diff --git a/.github/workflows/static.yaml b/.github/workflows/static.yaml index 23c90e2d8..60e9ac030 100644 --- a/.github/workflows/static.yaml +++ b/.github/workflows/static.yaml @@ -15,5 +15,5 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v3 with: - version: v1.51 - args: -E=gofmt,deadcode,unused,varcheck,ineffassign,revive,misspell,exportloopref,asciicheck,bodyclose,depguard,dogsled,durationcheck,errname,forbidigo -D=staticcheck --timeout=30m0s + version: v1.54 + args: -E=gofmt,unused,ineffassign,revive,misspell,exportloopref,asciicheck,bodyclose,depguard,dogsled,durationcheck,errname,forbidigo -D=staticcheck --timeout=30m0s diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 000000000..a7102ad33 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,12 @@ +linters-settings: + depguard: + rules: + main: + files: + - $all + - "!$test" + allow: + - $gostd + - k8s.io + - sigs.k8s.io + - github.com diff --git a/.trivyignore b/.trivyignore deleted file mode 100644 index b01025946..000000000 --- a/.trivyignore +++ /dev/null @@ -1,2 +0,0 @@ -CVE-2023-39325 -CVE-2023-44487 \ No newline at end of file diff --git a/README.md b/README.md index 19669a415..7393e9455 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ Disclaimer: Deploying this driver manually is not an officially supported Micros |driver version |Image | supported k8s version | |----------------|------------------------------------------------------|-----------------------| |master branch |mcr.microsoft.com/k8s/csi/blob-csi:latest | 1.21+ | -|v1.23.0 |mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.23.0 | 1.21+ | -|v1.22.2 |mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.22.2 | 1.21+ | -|v1.21.4 |mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.21.4 | 1.21+ | +|v1.23.2 |mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.23.2 | 1.21+ | +|v1.22.4 |mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.22.4 | 1.21+ | +|v1.21.6 |mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.21.6 | 1.21+ | ### Driver parameters Please refer to `blob.csi.azure.com` [driver parameters](./docs/driver-parameters.md) @@ -40,16 +40,16 @@ This option does not depend on cloud provider config file, supports cross subscr ### Install driver on a Kubernetes cluster > Note: this feature is only available in v1.19.5, v1.21.1 and later versions. > -> To install specific blobfuse v1 version, run following command directly after driver is running on the agent node: +> Execute following command to install a specific version of blobfuse v2 once driver is running on the agent node: > ```console -> kubectl patch daemonset csi-blob-node -n kube-system -p '{"spec":{"template":{"spec":{"initContainers":[{"env":[{"name":"INSTALL_BLOBFUSE","value":"true"},{"name":"BLOBFUSE_VERSION","value":"1.4.5"}],"name":"install-blobfuse-proxy"}]}}}}' +> kubectl patch daemonset csi-blob-node -n kube-system -p '{"spec":{"template":{"spec":{"initContainers":[{"env":[{"name":"INSTALL_BLOBFUSE2","value":"true"},{"name":"BLOBFUSE2_VERSION","value":"2.1.2"}],"name":"install-blobfuse-proxy"}]}}}}' > ``` > -> To install specific blobfuse v2 version, run following command directly after driver is running on the agent node: +> Execute following command to install a specific version of blobfuse v1 once driver is running on the agent node: > ```console -> kubectl patch daemonset csi-blob-node -n kube-system -p '{"spec":{"template":{"spec":{"initContainers":[{"env":[{"name":"INSTALL_BLOBFUSE2","value":"true"},{"name":"BLOBFUSE2_VERSION","value":"2.1.0"}],"name":"install-blobfuse-proxy"}]}}}}' +> kubectl patch daemonset csi-blob-node -n kube-system -p '{"spec":{"template":{"spec":{"initContainers":[{"env":[{"name":"INSTALL_BLOBFUSE","value":"true"},{"name":"BLOBFUSE_VERSION","value":"1.4.5"}],"name":"install-blobfuse-proxy"}]}}}}' > ``` -> + - install by [helm charts](./charts) - install by [kubectl](./docs/install-blob-csi-driver.md) - install open source CSI driver on following platforms: @@ -62,6 +62,7 @@ This option does not depend on cloud provider config file, supports cross subscr - [Basic usage](./deploy/example/e2e_usage.md) - [NFSv3](./deploy/example/nfs) - [fsGroupPolicy](./deploy/example/fsgroup) + - [Volume cloning](./deploy/example/cloning) - [Workload identity](./docs/workload-identity.md) ### Troubleshooting diff --git a/charts/README.md b/charts/README.md index 719149236..043b9b91b 100644 --- a/charts/README.md +++ b/charts/README.md @@ -5,7 +5,7 @@ ### Tips - configure with [blobfuse-proxy](../deploy/blobfuse-proxy) to make blobfuse mount still available after driver restart - > note: [blobfuse-proxy](../deploy/blobfuse-proxy) is only available on **debian** OS based agent node (not available on OpenShift) + > Note: [blobfuse-proxy](../deploy/blobfuse-proxy) is supported on CoreOS(OpenShift) from v1.23.2 - specify `node.enableBlobfuseProxy=true` together with [blobfuse-proxy](../deploy/blobfuse-proxy) - run controller on control plane node: `--set controller.runOnControlPlane=true` - set replica of controller as `1`: `--set controller.replicas=1` @@ -66,16 +66,16 @@ The following table lists the configurable parameters of the latest Azure Blob S | `image.blob.tag` | blob-csi-driver docker image tag | `latest` | | `image.blob.pullPolicy` | blob-csi-driver image pull policy | `IfNotPresent` | | `image.csiProvisioner.repository` | csi-provisioner docker image | `mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner` | -| `image.csiProvisioner.tag` | csi-provisioner docker image tag | `v3.6.1` | +| `image.csiProvisioner.tag` | csi-provisioner docker image tag | `v3.6.2` | | `image.csiProvisioner.pullPolicy` | csi-provisioner image pull policy | `IfNotPresent` | | `image.livenessProbe.repository` | liveness-probe docker image | `mcr.microsoft.com/oss/kubernetes-csi/livenessprobe` | | `image.livenessProbe.tag` | liveness-probe docker image tag | `v2.11.0` | | `image.livenessProbe.pullPolicy` | liveness-probe image pull policy | `IfNotPresent` | | `image.nodeDriverRegistrar.repository` | csi-node-driver-registrar docker image | `mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar` | -| `image.nodeDriverRegistrar.tag` | csi-node-driver-registrar docker image tag | `v2.9.0` | +| `image.nodeDriverRegistrar.tag` | csi-node-driver-registrar docker image tag | `v2.9.1` | | `image.nodeDriverRegistrar.pullPolicy` | csi-node-driver-registrar image pull policy | `IfNotPresent` | | `image.csiResizer.repository` | csi-resizer docker image | `mcr.microsoft.com/oss/kubernetes-csi/csi-resizer` | -| `image.csiResizer.tag` | csi-resizer docker image tag | `v1.9.1` | +| `image.csiResizer.tag` | csi-resizer docker image tag | `v1.9.2` | | `image.csiResizer.pullPolicy` | csi-resizer image pull policy | `IfNotPresent` | | `imagePullSecrets` | Specify docker-registry secret names as an array | [] (does not add image pull secrets to deployed pods) | | `cloud` | the cloud environment the driver is running on | `AzurePublicCloud` | diff --git a/charts/index.yaml b/charts/index.yaml index e4fbd59f0..8472f23f1 100644 --- a/charts/index.yaml +++ b/charts/index.yaml @@ -1,18 +1,54 @@ apiVersion: v1 entries: blob-csi-driver: + - apiVersion: v1 + appVersion: v1.23.2 + created: "2023-11-24T09:01:28.995261524Z" + description: Azure Blob Storage CSI driver + digest: 9452372c032a09eefed4b4064a547143e6f62b7628992db22784844eb35bee7d + name: blob-csi-driver + urls: + - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.23.2/blob-csi-driver-v1.23.2.tgz + version: v1.23.2 + - apiVersion: v1 + appVersion: v1.23.1 + created: "2023-11-24T09:01:28.994649337Z" + description: Azure Blob Storage CSI driver + digest: d0345309791c22d197c44e5d74b7acd62ce652b3a8756d08bf878f85adb0de7b + name: blob-csi-driver + urls: + - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.23.1/blob-csi-driver-v1.23.1.tgz + version: v1.23.1 - apiVersion: v1 appVersion: v1.23.0 - created: "2023-09-14T07:10:07.895401784Z" + created: "2023-11-24T09:01:28.994017634Z" description: Azure Blob Storage CSI driver digest: 57151e21e33660522f25694bd8ae985e5e17c7ffe09904ad2af4025e8bf1da72 name: blob-csi-driver urls: - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.23.0/blob-csi-driver-v1.23.0.tgz version: v1.23.0 + - apiVersion: v1 + appVersion: v1.22.4 + created: "2023-11-24T09:01:28.993398586Z" + description: Azure Blob Storage CSI driver + digest: 20a3f200282472f27ab45eccf74c87a205cc647aafd5ca481762b5cd3bc5249b + name: blob-csi-driver + urls: + - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.22.4/blob-csi-driver-v1.22.4.tgz + version: v1.22.4 + - apiVersion: v1 + appVersion: v1.22.3 + created: "2023-11-24T09:01:28.992740245Z" + description: Azure Blob Storage CSI driver + digest: d8dba916d9540447f2b7ba33e8f56dafe7459eeffb6a7323645f359b19b6a6eb + name: blob-csi-driver + urls: + - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.22.3/blob-csi-driver-v1.22.3.tgz + version: v1.22.3 - apiVersion: v1 appVersion: v1.22.2 - created: "2023-09-14T07:10:07.894776849Z" + created: "2023-11-24T09:01:28.991669251Z" description: Azure Blob Storage CSI driver digest: 259e66dc12db7310fe1c51e49c964398e0a6b7d511133916dd7d25f748f0b791 name: blob-csi-driver @@ -21,16 +57,34 @@ entries: version: v1.22.2 - apiVersion: v1 appVersion: v1.22.1 - created: "2023-09-14T07:10:07.894161608Z" + created: "2023-11-24T09:01:28.990518632Z" description: Azure Blob Storage CSI driver digest: 8329d477d55c82f97bb09fb172c5f39a1677bedc13c7410bd93b306194516438 name: blob-csi-driver urls: - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.22.1/blob-csi-driver-v1.22.1.tgz version: v1.22.1 + - apiVersion: v1 + appVersion: v1.21.6 + created: "2023-11-24T09:01:28.989918718Z" + description: Azure Blob Storage CSI driver + digest: d5ba1f92795ec45970eb6e5fc54aa13a5684f9936216c064f8a3843bf722bf54 + name: blob-csi-driver + urls: + - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.21.6/blob-csi-driver-v1.21.6.tgz + version: v1.21.6 + - apiVersion: v1 + appVersion: v1.21.5 + created: "2023-11-24T09:01:28.989326165Z" + description: Azure Blob Storage CSI driver + digest: b403e9d49abfe076ecd83d6dd50166347ee4305f33dc840019474b2876723b9b + name: blob-csi-driver + urls: + - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.21.5/blob-csi-driver-v1.21.5.tgz + version: v1.21.5 - apiVersion: v1 appVersion: v1.21.4 - created: "2023-09-14T07:10:07.893545411Z" + created: "2023-11-24T09:01:28.988732801Z" description: Azure Blob Storage CSI driver digest: e4fa13670caf6b0d3e9fefa55d100daa439cd7187dabd45318ab03c7d4b17710 name: blob-csi-driver @@ -39,16 +93,25 @@ entries: version: v1.21.4 - apiVersion: v1 appVersion: v1.20.3 - created: "2023-09-14T07:10:07.892937422Z" + created: "2023-11-24T09:01:28.98813592Z" description: Azure Blob Storage CSI driver digest: 8c2c20547b2e0e1b39d2f2efd04c1bd778f14af5feae2bda86d722dac3c02643 name: blob-csi-driver urls: - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.20.3/blob-csi-driver-v1.20.3.tgz version: v1.20.3 + - apiVersion: v1 + appVersion: v1.19.6 + created: "2023-11-24T09:01:28.986827359Z" + description: Azure Blob Storage CSI driver + digest: 0007ef225b5658d3989aa6fdc3a91a4b33696a438eee46ad9a675af615cbdf21 + name: blob-csi-driver + urls: + - https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts/v1.19.6/blob-csi-driver-v1.19.6.tgz + version: v1.19.6 - apiVersion: v1 appVersion: v1.19.5 - created: "2023-09-14T07:10:07.891871785Z" + created: "2023-11-24T09:01:28.986187133Z" description: Azure Blob Storage CSI driver digest: 183c3e5cd84b709f1455cc7c84ed5bd573e8a24149fd6442d38999835b0a1711 name: blob-csi-driver @@ -57,7 +120,7 @@ entries: version: v1.19.5 - apiVersion: v1 appVersion: v1.18.0 - created: "2023-09-14T07:10:07.891255613Z" + created: "2023-11-24T09:01:28.984655313Z" description: Azure Blob Storage CSI driver digest: 3eac15488da5be7d1e78431929f7cda35bceb1af3fe107ffbd84606e047c9204 name: blob-csi-driver @@ -66,7 +129,7 @@ entries: version: v1.18.0 - apiVersion: v1 appVersion: v1.17.0 - created: "2023-09-14T07:10:07.8902352Z" + created: "2023-11-24T09:01:28.983826321Z" description: Azure Blob Storage CSI driver digest: 22cfa17fc5e8d771ff8edd26729266a9a8ee55c0e150df85ef15698f7fe985e9 name: blob-csi-driver @@ -75,7 +138,7 @@ entries: version: v1.17.0 - apiVersion: v1 appVersion: v1.16.0 - created: "2023-09-14T07:10:07.889144209Z" + created: "2023-11-24T09:01:28.983050388Z" description: Azure Blob Storage CSI driver digest: bf6249c0e3e3d3d009d4c79ceb7fda9a56c0565b969de753628792ea3ea5ece8 name: blob-csi-driver @@ -84,7 +147,7 @@ entries: version: v1.16.0 - apiVersion: v1 appVersion: v1.15.0 - created: "2023-09-14T07:10:07.888518009Z" + created: "2023-11-24T09:01:28.982324298Z" description: Azure Blob Storage CSI driver digest: 8daa35cd4957695cb64b45da05a15b4020df5545a8ac44c4668dad4bba82c8a9 name: blob-csi-driver @@ -93,7 +156,7 @@ entries: version: v1.15.0 - apiVersion: v1 appVersion: v1.14.0 - created: "2023-09-14T07:10:07.887919949Z" + created: "2023-11-24T09:01:28.981585971Z" description: Azure Blob Storage CSI driver digest: 442bc579b231aab626b9e474e2c0ed3f101d47d61c99aa9a7f863af7ce268d9d name: blob-csi-driver @@ -102,7 +165,7 @@ entries: version: v1.14.0 - apiVersion: v1 appVersion: v1.13.0 - created: "2023-09-14T07:10:07.887324297Z" + created: "2023-11-24T09:01:28.980866908Z" description: Azure Blob Storage CSI driver digest: b577b0b771138109aa90eb09d56fc07273ca0b584a263ee8f789e35796279f31 name: blob-csi-driver @@ -111,7 +174,7 @@ entries: version: v1.13.0 - apiVersion: v1 appVersion: v1.12.0 - created: "2023-09-14T07:10:07.886741071Z" + created: "2023-11-24T09:01:28.980076348Z" description: Azure Blob Storage CSI driver digest: 124e87af2581b374b89a39940698620c23d3eae6dcee518d302461ffea93e9a8 name: blob-csi-driver @@ -120,7 +183,7 @@ entries: version: v1.12.0 - apiVersion: v1 appVersion: v1.11.0 - created: "2023-09-14T07:10:07.886122719Z" + created: "2023-11-24T09:01:28.979289047Z" description: Azure Blob Storage CSI driver digest: 07c4d76017491b3d0bdd70de90e814096938bf7916da0c149c3805294bd57560 name: blob-csi-driver @@ -129,7 +192,7 @@ entries: version: v1.11.0 - apiVersion: v1 appVersion: v1.10.0 - created: "2023-09-14T07:10:07.88549666Z" + created: "2023-11-24T09:01:28.978511783Z" description: Azure Blob Storage CSI driver digest: 79716efa958385adf57eb3570843e1b4512d8c801e8e070625e94264f3e917a9 name: blob-csi-driver @@ -138,7 +201,7 @@ entries: version: v1.10.0 - apiVersion: v1 appVersion: v1.9.0 - created: "2023-09-14T07:10:07.900772998Z" + created: "2023-11-24T09:01:29.002027136Z" description: Azure Blob Storage CSI driver digest: fca0b9215d3277346f68c643fb3ead75158971f0d1945ab01ec559196f3cf842 name: blob-csi-driver @@ -147,7 +210,7 @@ entries: version: v1.9.0 - apiVersion: v1 appVersion: v1.8.0 - created: "2023-09-14T07:10:07.900207312Z" + created: "2023-11-24T09:01:29.001031812Z" description: Azure Blob Storage CSI driver digest: 3b78e2ab4f33577c54d4f57276c824717d2ad2aa3741210e938fcaf927bc751f name: blob-csi-driver @@ -156,7 +219,7 @@ entries: version: v1.8.0 - apiVersion: v1 appVersion: v1.7.0 - created: "2023-09-14T07:10:07.89963445Z" + created: "2023-11-24T09:01:29.000277142Z" description: Azure Blob Storage CSI driver digest: 28da5b55c3d2689d6da85eb7da344385e9cb99bdb2af18c24fea93670abfe7ea name: blob-csi-driver @@ -165,7 +228,7 @@ entries: version: v1.7.0 - apiVersion: v1 appVersion: v1.6.0 - created: "2023-09-14T07:10:07.899045279Z" + created: "2023-11-24T09:01:28.999499839Z" description: Azure Blob Storage CSI driver digest: 6f24f2e6623f6f8862e47d4fbdf13b5f351ceec6bb9a4591ef7fc2fca9fc1eef name: blob-csi-driver @@ -174,7 +237,7 @@ entries: version: v1.6.0 - apiVersion: v1 appVersion: v1.5.0 - created: "2023-09-14T07:10:07.898388106Z" + created: "2023-11-24T09:01:28.997945662Z" description: Azure Blob Storage CSI driver digest: 95d14c9b70b319760d388ea47727c8c97e9287867a8852aeb67b7175b52fe8f5 name: blob-csi-driver @@ -183,7 +246,7 @@ entries: version: v1.5.0 - apiVersion: v1 appVersion: v1.4.1 - created: "2023-09-14T07:10:07.89687391Z" + created: "2023-11-24T09:01:28.997274031Z" description: Azure Blob Storage CSI driver digest: 5fcf69c449f065fa1d5722e5a7fed8a28000efa790907e9ff4b552c5fbd16d22 name: blob-csi-driver @@ -192,7 +255,7 @@ entries: version: v1.4.1 - apiVersion: v1 appVersion: v1.4.0 - created: "2023-09-14T07:10:07.896376484Z" + created: "2023-11-24T09:01:28.996582891Z" description: Azure Blob Storage CSI driver digest: b466543344a6411f6130ba87b093955d39ab8614c6b4ed8505a0a0c96073cb33 name: blob-csi-driver @@ -201,7 +264,7 @@ entries: version: v1.4.0 - apiVersion: v1 appVersion: v1.3.0 - created: "2023-09-14T07:10:07.89587395Z" + created: "2023-11-24T09:01:28.995930012Z" description: Azure Blob Storage CSI driver digest: 58d02cb70a3a966b349d62e880b7149fb06ac009474e35e580784fd3c98a5b07 name: blob-csi-driver @@ -210,7 +273,7 @@ entries: version: v1.3.0 - apiVersion: v1 appVersion: v1.2.0 - created: "2023-09-14T07:10:07.892325402Z" + created: "2023-11-24T09:01:28.987468867Z" description: Azure Blob Storage CSI driver digest: 27fb89f20b5fddc7329e6d7c2374857b22c1d61592e397a53f47121eea68c344 name: blob-csi-driver @@ -219,7 +282,7 @@ entries: version: v1.2.0 - apiVersion: v1 appVersion: v1.1.0 - created: "2023-09-14T07:10:07.884828709Z" + created: "2023-11-24T09:01:28.977742046Z" description: Azure Blob Storage CSI driver digest: a251a55243de207c69ef53f72abee45e93b72fa4fc43dc204b7f1cdfd459acdb name: blob-csi-driver @@ -228,7 +291,7 @@ entries: version: v1.1.0 - apiVersion: v1 appVersion: v1.0.0 - created: "2023-09-14T07:10:07.884368201Z" + created: "2023-11-24T09:01:28.9770962Z" description: Azure Blob Storage CSI driver digest: e83f037a165eafc83a978bd7e6bf6221b052ac34363aecb12e6a73607dc58b89 name: blob-csi-driver @@ -291,11 +354,11 @@ entries: version: v4.4.0 - apiVersion: v1 appVersion: latest - created: "2023-09-14T07:10:07.884046607Z" + created: "2023-12-01T09:01:28.975686234Z" description: Azure Blob Storage CSI driver - digest: fe19afaa31f86ee3902c3e85e98f2f42b205756959df68665c29e8b1845d1120 + digest: 830d14741c60e807ea9d36a9d64761fafb59bbda894cf7bd6198b08499c20069 name: blob-csi-driver urls: - https://raw.githubusercontent.com/avoltz/blob-csi-driver/staging/charts/latest/blob-csi-driver-v0.0.0.tgz version: v0.0.0 -generated: "2023-10-12T19:27:00.820283000Z" +generated: "2023-12-01T09:01:28.975686234Z" diff --git a/charts/latest/blob-csi-driver-v0.0.0.tgz b/charts/latest/blob-csi-driver-v0.0.0.tgz index aa9534e71..0490b66d7 100644 Binary files a/charts/latest/blob-csi-driver-v0.0.0.tgz and b/charts/latest/blob-csi-driver-v0.0.0.tgz differ diff --git a/charts/latest/blob-csi-driver/templates/csi-blob-node.yaml b/charts/latest/blob-csi-driver/templates/csi-blob-node.yaml index d032ce92d..82a3043e3 100644 --- a/charts/latest/blob-csi-driver/templates/csi-blob-node.yaml +++ b/charts/latest/blob-csi-driver/templates/csi-blob-node.yaml @@ -66,7 +66,6 @@ spec: tolerations: {{ toYaml . | indent 8 }} {{- end }} -{{- if .Values.node.enableBlobfuseProxy }} initContainers: - name: install-blobfuse-proxy {{- if hasPrefix "/" .Values.image.blob.repository }} @@ -90,6 +89,8 @@ spec: value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}" - name: BLOBFUSE2_VERSION value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}" + - name: INSTALL_BLOBFUSE_PROXY + value: "{{ .Values.node.enableBlobfuseProxy }}" - name: SET_MAX_OPEN_FILE_NUM value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}" - name: MAX_FILE_NUM @@ -99,9 +100,10 @@ spec: volumeMounts: - name: host-usr mountPath: /host/usr + - name: host-usr-local + mountPath: /host/usr/local - name: host-etc mountPath: /host/etc -{{- end }} containers: - name: liveness-probe imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} @@ -244,16 +246,24 @@ spec: mountPath: /etc/pki/ca-trust/extracted readOnly: true {{- end }} + {{- if .Values.node.enableAznfsMount }} + - mountPath: /opt/microsoft/aznfs/data + name: aznfs-data + - mountPath: /lib/modules + name: lib-modules + readOnly: true + {{- end }} resources: {{- toYaml .Values.node.resources.blob | nindent 12 }} volumes: -{{- if .Values.node.enableBlobfuseProxy }} - name: host-usr hostPath: path: /usr + - name: host-usr-local + hostPath: + path: /usr/local - name: host-etc hostPath: path: /etc -{{- end }} - hostPath: path: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }} type: DirectoryOrCreate @@ -286,6 +296,16 @@ spec: hostPath: path: /etc/pki/ca-trust/extracted {{- end }} + {{- if .Values.node.enableAznfsMount }} + - hostPath: + path: /opt/microsoft/aznfs/data + type: DirectoryOrCreate + name: aznfs-data + - name: lib-modules + hostPath: + path: /lib/modules + type: DirectoryOrCreate + {{- end }} {{- if .Values.securityContext }} securityContext: {{- toYaml .Values.securityContext | nindent 8 }} {{- end }} diff --git a/charts/latest/blob-csi-driver/values.yaml b/charts/latest/blob-csi-driver/values.yaml index 4fdb99d29..40304399c 100644 --- a/charts/latest/blob-csi-driver/values.yaml +++ b/charts/latest/blob-csi-driver/values.yaml @@ -6,7 +6,7 @@ image: pullPolicy: IfNotPresent csiProvisioner: repository: /oss/kubernetes-csi/csi-provisioner - tag: v3.5.0 + tag: v3.6.2 pullPolicy: IfNotPresent livenessProbe: repository: /oss/kubernetes-csi/livenessprobe @@ -14,11 +14,11 @@ image: pullPolicy: IfNotPresent nodeDriverRegistrar: repository: /oss/kubernetes-csi/csi-node-driver-registrar - tag: v2.8.0 + tag: v2.9.1 pullPolicy: IfNotPresent csiResizer: repository: /oss/kubernetes-csi/csi-resizer - tag: v1.8.0 + tag: v1.9.2 pullPolicy: IfNotPresent cloud: AzurePublicCloud @@ -114,12 +114,12 @@ node: livenessProbe: healthPort: 29633 logLevel: 5 - enableBlobfuseProxy: false + enableBlobfuseProxy: true blobfuseProxy: installBlobfuse: true blobfuseVersion: "1.4.5" installBlobfuse2: true - blobfuse2Version: "2.0.3" + blobfuse2Version: "2.1.2" setMaxOpenFileNum: true maxOpenFileNum: "9000000" disableUpdateDB: true diff --git a/charts/v1.19.6/blob-csi-driver-v1.19.6.tgz b/charts/v1.19.6/blob-csi-driver-v1.19.6.tgz new file mode 100644 index 000000000..24057f065 Binary files /dev/null and b/charts/v1.19.6/blob-csi-driver-v1.19.6.tgz differ diff --git a/charts/v1.19.6/blob-csi-driver/Chart.yaml b/charts/v1.19.6/blob-csi-driver/Chart.yaml new file mode 100644 index 000000000..0412ab2fc --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: v1.19.6 +description: Azure Blob Storage CSI driver +name: blob-csi-driver +version: v1.19.6 diff --git a/charts/v1.19.6/blob-csi-driver/templates/NOTES.txt b/charts/v1.19.6/blob-csi-driver/templates/NOTES.txt new file mode 100644 index 000000000..9ad135dd4 --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/templates/NOTES.txt @@ -0,0 +1,5 @@ +The Azure Blob Storage CSI driver is getting deployed to your cluster. + +To check Azure Blob Storage CSI driver pods status, please run: + + kubectl --namespace={{ .Release.Namespace }} get pods --selector="release={{ .Release.Name }}" --watch diff --git a/charts/v1.19.6/blob-csi-driver/templates/_helpers.tpl b/charts/v1.19.6/blob-csi-driver/templates/_helpers.tpl new file mode 100644 index 000000000..d99392f32 --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* Expand the name of the chart.*/}} +{{- define "blob.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "blob.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common selectors. +*/}} +{{- define "blob.selectorLabels" -}} +app.kubernetes.io/name: {{ template "blob.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Common labels. +*/}} +{{- define "blob.labels" -}} +{{- include "blob.selectorLabels" . }} +app.kubernetes.io/component: csi-driver +app.kubernetes.io/part-of: {{ template "blob.name" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +helm.sh/chart: {{ template "blob.chart" . }} +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels }} +{{- end }} +{{- end -}} + + +{{/* pull secrets for containers */}} +{{- define "blob.pullSecrets" -}} +{{- if .Values.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/v1.19.6/blob-csi-driver/templates/csi-blob-controller.yaml b/charts/v1.19.6/blob-csi-driver/templates/csi-blob-controller.yaml new file mode 100644 index 000000000..161e08b83 --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/templates/csi-blob-controller.yaml @@ -0,0 +1,209 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ .Values.controller.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.controller.replicas }} + selector: + matchLabels: + app: {{ .Values.controller.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: +{{- with .Values.controller.affinity }} + affinity: +{{ toYaml . | indent 8 }} +{{- end }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + hostNetwork: {{ .Values.controller.hostNetwork }} + serviceAccountName: {{ .Values.serviceAccount.controller }} + nodeSelector: + kubernetes.io/os: linux + {{- if .Values.controller.runOnMaster}} + node-role.kubernetes.io/master: "" + {{- end}} + {{- if .Values.controller.runOnControlPlane}} + node-role.kubernetes.io/control-plane: "" + {{- end}} +{{- with .Values.controller.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} +{{- with .Values.controller.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + containers: + - name: csi-provisioner +{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- else }} + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- end }} + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} + - name: liveness-probe +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.controller.livenessProbe.healthPort }} + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.controller.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}" + - "--drivername={{ .Values.driver.name }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--cloud-config-secret-name={{ .Values.controller.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.controller.cloudConfigSecretNamespace }}" + - "--allow-empty-cloud-config={{ .Values.controller.allowEmptyCloudConfig }}" + ports: + - containerPort: {{ .Values.controller.livenessProbe.healthPort }} + name: healthz + protocol: TCP + - containerPort: {{ .Values.controller.metricsPort }} + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.controller.resources.blob | nindent 12 }} + - name: csi-resizer +{{- if hasPrefix "/" .Values.image.csiResizer.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- else }} + image: "{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- end }} + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiResizer.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.csiResizer | nindent 12 }} + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.19.6/blob-csi-driver/templates/csi-blob-driver.yaml b/charts/v1.19.6/blob-csi-driver/templates/csi-blob-driver.yaml new file mode 100644 index 000000000..891826a62 --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/templates/csi-blob-driver.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: {{ .Values.driver.name }} + labels: + {{- include "blob.labels" . | nindent 4 }} +spec: + attachRequired: false + podInfoOnMount: true + {{- if .Values.feature.enableFSGroupPolicy}} + fsGroupPolicy: File + {{- end}} + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/charts/v1.19.6/blob-csi-driver/templates/csi-blob-node.yaml b/charts/v1.19.6/blob-csi-driver/templates/csi-blob-node.yaml new file mode 100644 index 000000000..d19b6128c --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/templates/csi-blob-node.yaml @@ -0,0 +1,280 @@ +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: {{ .Values.node.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: {{ .Values.node.maxUnavailable }} + type: RollingUpdate + selector: + matchLabels: + app: {{ .Values.node.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} +{{- if .Values.node.enableBlobfuseProxy }} + hostPID: true +{{- end }} + hostNetwork: true + dnsPolicy: Default + serviceAccountName: {{ .Values.serviceAccount.node }} + nodeSelector: + kubernetes.io/os: linux +{{- with .Values.node.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + {{- if .Values.node.affinity }} +{{- toYaml .Values.node.affinity | nindent 8 }} + {{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} +{{- with .Values.node.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} +{{- if .Values.node.enableBlobfuseProxy }} + initContainers: + - name: install-blobfuse-proxy +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE + value: "{{ .Values.node.blobfuseProxy.installBlobfuse }}" + - name: BLOBFUSE_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuseVersion }}" + - name: INSTALL_BLOBFUSE2 + value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}" + - name: BLOBFUSE2_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}" + - name: SET_MAX_OPEN_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}" + - name: MAX_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.maxOpenFileNum }}" + - name: DISABLE_UPDATEDB + value: "{{ .Values.node.blobfuseProxy.disableUpdateDB }}" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc +{{- end }} + containers: + - name: liveness-probe + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.node.livenessProbe.healthPort }} + - --v=2 + resources: {{- toYaml .Values.node.resources.livenessProbe | nindent 12 }} + - name: node-driver-registrar +{{- if hasPrefix "/" .Values.image.nodeDriverRegistrar.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- else }} + image: "{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- end }} + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }}/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: {{- toYaml .Values.node.resources.nodeDriverRegistrar | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.node.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--enable-blobfuse-proxy={{ .Values.node.enableBlobfuseProxy }}" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--metrics-address=0.0.0.0:{{ .Values.node.metricsPort }}" + - "--drivername={{ .Values.driver.name }}" + - "--cloud-config-secret-name={{ .Values.node.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.node.cloudConfigSecretNamespace }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--allow-empty-cloud-config={{ .Values.node.allowEmptyCloudConfig }}" + - "--enable-get-volume-stats={{ .Values.feature.enableGetVolumeStats }}" + - "--append-timestamp-cache-dir={{ .Values.node.appendTimeStampInCacheDir }}" + - "--mount-permissions={{ .Values.node.mountPermissions }}" + - "--allow-inline-volume-key-access-with-idenitity={{ .Values.node.allowInlineVolumeKeyAccessWithIdentity }}" + ports: + - containerPort: {{ .Values.node.livenessProbe.healthPort }} + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.node.resources.blob | nindent 12 }} + volumes: +{{- if .Values.node.enableBlobfuseProxy }} + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc +{{- end }} + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }} + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: {{ .Values.node.blobfuseCachePath }} + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.19.6/blob-csi-driver/templates/rbac-csi-blob-controller.yaml b/charts/v1.19.6/blob-csi-driver/templates/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..833dcc640 --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/templates/rbac-csi-blob-controller.yaml @@ -0,0 +1,115 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-provisioner-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-provisioner-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-provisioner-role + apiGroup: rbac.authorization.k8s.io + +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-resizer-role + apiGroup: rbac.authorization.k8s.io + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-controller-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.19.6/blob-csi-driver/templates/rbac-csi-blob-node.yaml b/charts/v1.19.6/blob-csi-driver/templates/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..c041cf8db --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/templates/rbac-csi-blob-node.yaml @@ -0,0 +1,29 @@ +{{- if .Values.rbac.create -}} +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-node-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.19.6/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml b/charts/v1.19.6/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml new file mode 100644 index 000000000..9c9fb477b --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml @@ -0,0 +1,9 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- end -}} diff --git a/charts/v1.19.6/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml b/charts/v1.19.6/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml new file mode 100644 index 000000000..e1dc20bd2 --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml @@ -0,0 +1,9 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- end -}} diff --git a/charts/v1.19.6/blob-csi-driver/values.yaml b/charts/v1.19.6/blob-csi-driver/values.yaml new file mode 100644 index 000000000..e334604da --- /dev/null +++ b/charts/v1.19.6/blob-csi-driver/values.yaml @@ -0,0 +1,168 @@ +image: + baseRepo: mcr.microsoft.com + blob: + repository: /oss/kubernetes-csi/blob-csi + tag: v1.19.6 + pullPolicy: IfNotPresent + csiProvisioner: + repository: /oss/kubernetes-csi/csi-provisioner + tag: v3.3.0 + pullPolicy: IfNotPresent + livenessProbe: + repository: /oss/kubernetes-csi/livenessprobe + tag: v2.8.0 + pullPolicy: IfNotPresent + nodeDriverRegistrar: + repository: /oss/kubernetes-csi/csi-node-driver-registrar + tag: v2.6.2 + pullPolicy: IfNotPresent + csiResizer: + repository: /oss/kubernetes-csi/csi-resizer + tag: v1.6.0 + pullPolicy: IfNotPresent + +cloud: AzurePublicCloud + +## Reference to one or more secrets to be used when pulling images +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# - name: myRegistryKeySecretName + +serviceAccount: + create: true # When true, service accounts will be created for you. Set to false if you want to use your own. + controller: csi-blob-controller-sa # Name of Service Account to be created or used + node: csi-blob-node-sa # Name of Service Account to be created or used + +rbac: + create: true + name: blob + +## Collection of annotations to add to all the pods +podAnnotations: {} +## Collection of labels to add to all the pods +podLabels: {} +# -- Custom labels to add into metadata +customLabels: {} + # k8s-app: blob-csi-driver + +## Leverage a PriorityClass to ensure your pods survive resource shortages +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +priorityClassName: system-cluster-critical +## Security context give the opportunity to run container as nonroot by setting a securityContext +## by example : +## securityContext: { runAsUser: 1001 } +securityContext: {} + +controller: + name: csi-blob-controller + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + hostNetwork: true # this setting could be disabled if controller does not depend on MSI setting + metricsPort: 29634 + livenessProbe: + healthPort: 29632 + replicas: 2 + runOnMaster: false + runOnControlPlane: false + logLevel: 5 + resources: + csiProvisioner: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + csiResizer: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + +node: + name: csi-blob-node + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + allowInlineVolumeKeyAccessWithIdentity: false + maxUnavailable: 1 + metricsPort: 29635 + livenessProbe: + healthPort: 29633 + logLevel: 5 + enableBlobfuseProxy: false + blobfuseProxy: + installBlobfuse: true + blobfuseVersion: "" + installBlobfuse2: true + blobfuse2Version: "" + setMaxOpenFileNum: true + maxOpenFileNum: "9000000" + disableUpdateDB: true + blobfuseCachePath: /mnt + appendTimeStampInCacheDir: false + mountPermissions: 0777 + resources: + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + nodeDriverRegistrar: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - operator: "Exists" + +feature: + enableFSGroupPolicy: false + enableGetVolumeStats: false + +driver: + name: blob.csi.azure.com + customUserAgent: "" + userAgentSuffix: "OSS-helm" + azureGoSDKLogLevel: "" # available values: ""(no logs), DEBUG, INFO, WARNING, ERROR + httpsProxy: "" + httpProxy: "" + +linux: + kubelet: /var/lib/kubelet + distro: debian diff --git a/charts/v1.21.5/blob-csi-driver-v1.21.5.tgz b/charts/v1.21.5/blob-csi-driver-v1.21.5.tgz new file mode 100644 index 000000000..5e7ca163b Binary files /dev/null and b/charts/v1.21.5/blob-csi-driver-v1.21.5.tgz differ diff --git a/charts/v1.21.5/blob-csi-driver/Chart.yaml b/charts/v1.21.5/blob-csi-driver/Chart.yaml new file mode 100644 index 000000000..fbc87b605 --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: v1.21.5 +description: Azure Blob Storage CSI driver +name: blob-csi-driver +version: v1.21.5 diff --git a/charts/v1.21.5/blob-csi-driver/templates/NOTES.txt b/charts/v1.21.5/blob-csi-driver/templates/NOTES.txt new file mode 100644 index 000000000..9ad135dd4 --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/templates/NOTES.txt @@ -0,0 +1,5 @@ +The Azure Blob Storage CSI driver is getting deployed to your cluster. + +To check Azure Blob Storage CSI driver pods status, please run: + + kubectl --namespace={{ .Release.Namespace }} get pods --selector="release={{ .Release.Name }}" --watch diff --git a/charts/v1.21.5/blob-csi-driver/templates/_helpers.tpl b/charts/v1.21.5/blob-csi-driver/templates/_helpers.tpl new file mode 100644 index 000000000..d99392f32 --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* Expand the name of the chart.*/}} +{{- define "blob.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "blob.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common selectors. +*/}} +{{- define "blob.selectorLabels" -}} +app.kubernetes.io/name: {{ template "blob.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Common labels. +*/}} +{{- define "blob.labels" -}} +{{- include "blob.selectorLabels" . }} +app.kubernetes.io/component: csi-driver +app.kubernetes.io/part-of: {{ template "blob.name" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +helm.sh/chart: {{ template "blob.chart" . }} +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels }} +{{- end }} +{{- end -}} + + +{{/* pull secrets for containers */}} +{{- define "blob.pullSecrets" -}} +{{- if .Values.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/v1.21.5/blob-csi-driver/templates/csi-blob-controller.yaml b/charts/v1.21.5/blob-csi-driver/templates/csi-blob-controller.yaml new file mode 100644 index 000000000..6b7bd2e23 --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/templates/csi-blob-controller.yaml @@ -0,0 +1,212 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ .Values.controller.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.controller.replicas }} + selector: + matchLabels: + app: {{ .Values.controller.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: +{{- with .Values.controller.affinity }} + affinity: +{{ toYaml . | indent 8 }} +{{- end }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + hostNetwork: {{ .Values.controller.hostNetwork }} + serviceAccountName: {{ .Values.serviceAccount.controller }} + nodeSelector: + kubernetes.io/os: linux + {{- if .Values.controller.runOnMaster}} + node-role.kubernetes.io/master: "" + {{- end}} + {{- if .Values.controller.runOnControlPlane}} + node-role.kubernetes.io/control-plane: "" + {{- end}} +{{- with .Values.controller.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.controller.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + containers: + - name: csi-provisioner +{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- else }} + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- end }} + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} + - name: liveness-probe +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.controller.livenessProbe.healthPort }} + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.controller.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}" + - "--drivername={{ .Values.driver.name }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--cloud-config-secret-name={{ .Values.controller.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.controller.cloudConfigSecretNamespace }}" + - "--allow-empty-cloud-config={{ .Values.controller.allowEmptyCloudConfig }}" + ports: + - containerPort: {{ .Values.controller.livenessProbe.healthPort }} + name: healthz + protocol: TCP + - containerPort: {{ .Values.controller.metricsPort }} + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.controller.resources.blob | nindent 12 }} + - name: csi-resizer +{{- if hasPrefix "/" .Values.image.csiResizer.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- else }} + image: "{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- end }} + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiResizer.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.csiResizer | nindent 12 }} + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.21.5/blob-csi-driver/templates/csi-blob-driver.yaml b/charts/v1.21.5/blob-csi-driver/templates/csi-blob-driver.yaml new file mode 100644 index 000000000..891826a62 --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/templates/csi-blob-driver.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: {{ .Values.driver.name }} + labels: + {{- include "blob.labels" . | nindent 4 }} +spec: + attachRequired: false + podInfoOnMount: true + {{- if .Values.feature.enableFSGroupPolicy}} + fsGroupPolicy: File + {{- end}} + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/charts/v1.21.5/blob-csi-driver/templates/csi-blob-node.yaml b/charts/v1.21.5/blob-csi-driver/templates/csi-blob-node.yaml new file mode 100644 index 000000000..882e056fa --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/templates/csi-blob-node.yaml @@ -0,0 +1,282 @@ +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: {{ .Values.node.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: {{ .Values.node.maxUnavailable }} + type: RollingUpdate + selector: + matchLabels: + app: {{ .Values.node.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} +{{- if .Values.node.enableBlobfuseProxy }} + hostPID: true +{{- end }} + hostNetwork: true + dnsPolicy: Default + serviceAccountName: {{ .Values.serviceAccount.node }} + nodeSelector: + kubernetes.io/os: linux +{{- with .Values.node.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + {{- if .Values.node.affinity }} +{{- toYaml .Values.node.affinity | nindent 8 }} + {{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.node.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} +{{- if .Values.node.enableBlobfuseProxy }} + initContainers: + - name: install-blobfuse-proxy +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE + value: "{{ .Values.node.blobfuseProxy.installBlobfuse }}" + - name: BLOBFUSE_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuseVersion }}" + - name: INSTALL_BLOBFUSE2 + value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}" + - name: BLOBFUSE2_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}" + - name: SET_MAX_OPEN_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}" + - name: MAX_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.maxOpenFileNum }}" + - name: DISABLE_UPDATEDB + value: "{{ .Values.node.blobfuseProxy.disableUpdateDB }}" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc +{{- end }} + containers: + - name: liveness-probe + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.node.livenessProbe.healthPort }} + - --v=2 + resources: {{- toYaml .Values.node.resources.livenessProbe | nindent 12 }} + - name: node-driver-registrar +{{- if hasPrefix "/" .Values.image.nodeDriverRegistrar.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- else }} + image: "{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- end }} + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }}/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: {{- toYaml .Values.node.resources.nodeDriverRegistrar | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.node.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--enable-blobfuse-proxy={{ .Values.node.enableBlobfuseProxy }}" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--drivername={{ .Values.driver.name }}" + - "--cloud-config-secret-name={{ .Values.node.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.node.cloudConfigSecretNamespace }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--allow-empty-cloud-config={{ .Values.node.allowEmptyCloudConfig }}" + - "--enable-get-volume-stats={{ .Values.feature.enableGetVolumeStats }}" + - "--append-timestamp-cache-dir={{ .Values.node.appendTimeStampInCacheDir }}" + - "--mount-permissions={{ .Values.node.mountPermissions }}" + - "--allow-inline-volume-key-access-with-idenitity={{ .Values.node.allowInlineVolumeKeyAccessWithIdentity }}" + ports: + - containerPort: {{ .Values.node.livenessProbe.healthPort }} + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.node.resources.blob | nindent 12 }} + volumes: +{{- if .Values.node.enableBlobfuseProxy }} + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc +{{- end }} + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }} + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: {{ .Values.node.blobfuseCachePath }} + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.21.5/blob-csi-driver/templates/rbac-csi-blob-controller.yaml b/charts/v1.21.5/blob-csi-driver/templates/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..833dcc640 --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/templates/rbac-csi-blob-controller.yaml @@ -0,0 +1,115 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-provisioner-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-provisioner-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-provisioner-role + apiGroup: rbac.authorization.k8s.io + +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-resizer-role + apiGroup: rbac.authorization.k8s.io + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-controller-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.21.5/blob-csi-driver/templates/rbac-csi-blob-node.yaml b/charts/v1.21.5/blob-csi-driver/templates/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..c041cf8db --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/templates/rbac-csi-blob-node.yaml @@ -0,0 +1,29 @@ +{{- if .Values.rbac.create -}} +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-node-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.21.5/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml b/charts/v1.21.5/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml new file mode 100644 index 000000000..9c9fb477b --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml @@ -0,0 +1,9 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- end -}} diff --git a/charts/v1.21.5/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml b/charts/v1.21.5/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml new file mode 100644 index 000000000..e1dc20bd2 --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml @@ -0,0 +1,9 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- end -}} diff --git a/charts/v1.21.5/blob-csi-driver/values.yaml b/charts/v1.21.5/blob-csi-driver/values.yaml new file mode 100644 index 000000000..87f9be109 --- /dev/null +++ b/charts/v1.21.5/blob-csi-driver/values.yaml @@ -0,0 +1,167 @@ +image: + baseRepo: mcr.microsoft.com + blob: + repository: /oss/kubernetes-csi/blob-csi + tag: v1.21.5 + pullPolicy: IfNotPresent + csiProvisioner: + repository: /oss/kubernetes-csi/csi-provisioner + tag: v3.3.0 + pullPolicy: IfNotPresent + livenessProbe: + repository: /oss/kubernetes-csi/livenessprobe + tag: v2.8.0 + pullPolicy: IfNotPresent + nodeDriverRegistrar: + repository: /oss/kubernetes-csi/csi-node-driver-registrar + tag: v2.6.2 + pullPolicy: IfNotPresent + csiResizer: + repository: /oss/kubernetes-csi/csi-resizer + tag: v1.6.0 + pullPolicy: IfNotPresent + +cloud: AzurePublicCloud + +## Reference to one or more secrets to be used when pulling images +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# - name: myRegistryKeySecretName + +serviceAccount: + create: true # When true, service accounts will be created for you. Set to false if you want to use your own. + controller: csi-blob-controller-sa # Name of Service Account to be created or used + node: csi-blob-node-sa # Name of Service Account to be created or used + +rbac: + create: true + name: blob + +## Collection of annotations to add to all the pods +podAnnotations: {} +## Collection of labels to add to all the pods +podLabels: {} +# -- Custom labels to add into metadata +customLabels: {} + # k8s-app: blob-csi-driver + +## Leverage a PriorityClass to ensure your pods survive resource shortages +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +priorityClassName: system-cluster-critical +## Security context give the opportunity to run container as nonroot by setting a securityContext +## by example : +## securityContext: { runAsUser: 1001 } +securityContext: {} + +controller: + name: csi-blob-controller + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + hostNetwork: true # this setting could be disabled if controller does not depend on MSI setting + metricsPort: 29634 + livenessProbe: + healthPort: 29632 + replicas: 2 + runOnMaster: false + runOnControlPlane: false + logLevel: 5 + resources: + csiProvisioner: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + csiResizer: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + +node: + name: csi-blob-node + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + allowInlineVolumeKeyAccessWithIdentity: false + maxUnavailable: 1 + livenessProbe: + healthPort: 29633 + logLevel: 5 + enableBlobfuseProxy: false + blobfuseProxy: + installBlobfuse: true + blobfuseVersion: "" + installBlobfuse2: true + blobfuse2Version: "" + setMaxOpenFileNum: true + maxOpenFileNum: "9000000" + disableUpdateDB: true + blobfuseCachePath: /mnt + appendTimeStampInCacheDir: false + mountPermissions: 0777 + resources: + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + nodeDriverRegistrar: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - operator: "Exists" + +feature: + enableFSGroupPolicy: false + enableGetVolumeStats: false + +driver: + name: blob.csi.azure.com + customUserAgent: "" + userAgentSuffix: "OSS-helm" + azureGoSDKLogLevel: "" # available values: ""(no logs), DEBUG, INFO, WARNING, ERROR + httpsProxy: "" + httpProxy: "" + +linux: + kubelet: /var/lib/kubelet + distro: debian diff --git a/charts/v1.21.6/blob-csi-driver-v1.21.6.tgz b/charts/v1.21.6/blob-csi-driver-v1.21.6.tgz new file mode 100644 index 000000000..24b26d00e Binary files /dev/null and b/charts/v1.21.6/blob-csi-driver-v1.21.6.tgz differ diff --git a/charts/v1.21.6/blob-csi-driver/Chart.yaml b/charts/v1.21.6/blob-csi-driver/Chart.yaml new file mode 100644 index 000000000..be6bc9b19 --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: v1.21.6 +description: Azure Blob Storage CSI driver +name: blob-csi-driver +version: v1.21.6 diff --git a/charts/v1.21.6/blob-csi-driver/templates/NOTES.txt b/charts/v1.21.6/blob-csi-driver/templates/NOTES.txt new file mode 100644 index 000000000..9ad135dd4 --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/templates/NOTES.txt @@ -0,0 +1,5 @@ +The Azure Blob Storage CSI driver is getting deployed to your cluster. + +To check Azure Blob Storage CSI driver pods status, please run: + + kubectl --namespace={{ .Release.Namespace }} get pods --selector="release={{ .Release.Name }}" --watch diff --git a/charts/v1.21.6/blob-csi-driver/templates/_helpers.tpl b/charts/v1.21.6/blob-csi-driver/templates/_helpers.tpl new file mode 100644 index 000000000..d99392f32 --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* Expand the name of the chart.*/}} +{{- define "blob.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "blob.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common selectors. +*/}} +{{- define "blob.selectorLabels" -}} +app.kubernetes.io/name: {{ template "blob.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Common labels. +*/}} +{{- define "blob.labels" -}} +{{- include "blob.selectorLabels" . }} +app.kubernetes.io/component: csi-driver +app.kubernetes.io/part-of: {{ template "blob.name" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +helm.sh/chart: {{ template "blob.chart" . }} +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels }} +{{- end }} +{{- end -}} + + +{{/* pull secrets for containers */}} +{{- define "blob.pullSecrets" -}} +{{- if .Values.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/v1.21.6/blob-csi-driver/templates/csi-blob-controller.yaml b/charts/v1.21.6/blob-csi-driver/templates/csi-blob-controller.yaml new file mode 100644 index 000000000..6b7bd2e23 --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/templates/csi-blob-controller.yaml @@ -0,0 +1,212 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ .Values.controller.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.controller.replicas }} + selector: + matchLabels: + app: {{ .Values.controller.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: +{{- with .Values.controller.affinity }} + affinity: +{{ toYaml . | indent 8 }} +{{- end }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + hostNetwork: {{ .Values.controller.hostNetwork }} + serviceAccountName: {{ .Values.serviceAccount.controller }} + nodeSelector: + kubernetes.io/os: linux + {{- if .Values.controller.runOnMaster}} + node-role.kubernetes.io/master: "" + {{- end}} + {{- if .Values.controller.runOnControlPlane}} + node-role.kubernetes.io/control-plane: "" + {{- end}} +{{- with .Values.controller.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.controller.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + containers: + - name: csi-provisioner +{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- else }} + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- end }} + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} + - name: liveness-probe +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.controller.livenessProbe.healthPort }} + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.controller.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}" + - "--drivername={{ .Values.driver.name }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--cloud-config-secret-name={{ .Values.controller.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.controller.cloudConfigSecretNamespace }}" + - "--allow-empty-cloud-config={{ .Values.controller.allowEmptyCloudConfig }}" + ports: + - containerPort: {{ .Values.controller.livenessProbe.healthPort }} + name: healthz + protocol: TCP + - containerPort: {{ .Values.controller.metricsPort }} + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.controller.resources.blob | nindent 12 }} + - name: csi-resizer +{{- if hasPrefix "/" .Values.image.csiResizer.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- else }} + image: "{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- end }} + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiResizer.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.csiResizer | nindent 12 }} + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.21.6/blob-csi-driver/templates/csi-blob-driver.yaml b/charts/v1.21.6/blob-csi-driver/templates/csi-blob-driver.yaml new file mode 100644 index 000000000..891826a62 --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/templates/csi-blob-driver.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: {{ .Values.driver.name }} + labels: + {{- include "blob.labels" . | nindent 4 }} +spec: + attachRequired: false + podInfoOnMount: true + {{- if .Values.feature.enableFSGroupPolicy}} + fsGroupPolicy: File + {{- end}} + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/charts/v1.21.6/blob-csi-driver/templates/csi-blob-node.yaml b/charts/v1.21.6/blob-csi-driver/templates/csi-blob-node.yaml new file mode 100644 index 000000000..882e056fa --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/templates/csi-blob-node.yaml @@ -0,0 +1,282 @@ +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: {{ .Values.node.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: {{ .Values.node.maxUnavailable }} + type: RollingUpdate + selector: + matchLabels: + app: {{ .Values.node.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} +{{- if .Values.node.enableBlobfuseProxy }} + hostPID: true +{{- end }} + hostNetwork: true + dnsPolicy: Default + serviceAccountName: {{ .Values.serviceAccount.node }} + nodeSelector: + kubernetes.io/os: linux +{{- with .Values.node.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + {{- if .Values.node.affinity }} +{{- toYaml .Values.node.affinity | nindent 8 }} + {{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.node.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} +{{- if .Values.node.enableBlobfuseProxy }} + initContainers: + - name: install-blobfuse-proxy +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE + value: "{{ .Values.node.blobfuseProxy.installBlobfuse }}" + - name: BLOBFUSE_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuseVersion }}" + - name: INSTALL_BLOBFUSE2 + value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}" + - name: BLOBFUSE2_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}" + - name: SET_MAX_OPEN_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}" + - name: MAX_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.maxOpenFileNum }}" + - name: DISABLE_UPDATEDB + value: "{{ .Values.node.blobfuseProxy.disableUpdateDB }}" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc +{{- end }} + containers: + - name: liveness-probe + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.node.livenessProbe.healthPort }} + - --v=2 + resources: {{- toYaml .Values.node.resources.livenessProbe | nindent 12 }} + - name: node-driver-registrar +{{- if hasPrefix "/" .Values.image.nodeDriverRegistrar.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- else }} + image: "{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- end }} + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }}/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: {{- toYaml .Values.node.resources.nodeDriverRegistrar | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.node.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--enable-blobfuse-proxy={{ .Values.node.enableBlobfuseProxy }}" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--drivername={{ .Values.driver.name }}" + - "--cloud-config-secret-name={{ .Values.node.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.node.cloudConfigSecretNamespace }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--allow-empty-cloud-config={{ .Values.node.allowEmptyCloudConfig }}" + - "--enable-get-volume-stats={{ .Values.feature.enableGetVolumeStats }}" + - "--append-timestamp-cache-dir={{ .Values.node.appendTimeStampInCacheDir }}" + - "--mount-permissions={{ .Values.node.mountPermissions }}" + - "--allow-inline-volume-key-access-with-idenitity={{ .Values.node.allowInlineVolumeKeyAccessWithIdentity }}" + ports: + - containerPort: {{ .Values.node.livenessProbe.healthPort }} + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.node.resources.blob | nindent 12 }} + volumes: +{{- if .Values.node.enableBlobfuseProxy }} + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc +{{- end }} + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }} + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: {{ .Values.node.blobfuseCachePath }} + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.21.6/blob-csi-driver/templates/rbac-csi-blob-controller.yaml b/charts/v1.21.6/blob-csi-driver/templates/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..833dcc640 --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/templates/rbac-csi-blob-controller.yaml @@ -0,0 +1,115 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-provisioner-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-provisioner-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-provisioner-role + apiGroup: rbac.authorization.k8s.io + +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-resizer-role + apiGroup: rbac.authorization.k8s.io + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-controller-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.21.6/blob-csi-driver/templates/rbac-csi-blob-node.yaml b/charts/v1.21.6/blob-csi-driver/templates/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..c041cf8db --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/templates/rbac-csi-blob-node.yaml @@ -0,0 +1,29 @@ +{{- if .Values.rbac.create -}} +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-node-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.21.6/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml b/charts/v1.21.6/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml new file mode 100644 index 000000000..9c9fb477b --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml @@ -0,0 +1,9 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- end -}} diff --git a/charts/v1.21.6/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml b/charts/v1.21.6/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml new file mode 100644 index 000000000..e1dc20bd2 --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml @@ -0,0 +1,9 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- end -}} diff --git a/charts/v1.21.6/blob-csi-driver/values.yaml b/charts/v1.21.6/blob-csi-driver/values.yaml new file mode 100644 index 000000000..32832638c --- /dev/null +++ b/charts/v1.21.6/blob-csi-driver/values.yaml @@ -0,0 +1,167 @@ +image: + baseRepo: mcr.microsoft.com + blob: + repository: /oss/kubernetes-csi/blob-csi + tag: v1.21.6 + pullPolicy: IfNotPresent + csiProvisioner: + repository: /oss/kubernetes-csi/csi-provisioner + tag: v3.3.0 + pullPolicy: IfNotPresent + livenessProbe: + repository: /oss/kubernetes-csi/livenessprobe + tag: v2.8.0 + pullPolicy: IfNotPresent + nodeDriverRegistrar: + repository: /oss/kubernetes-csi/csi-node-driver-registrar + tag: v2.6.2 + pullPolicy: IfNotPresent + csiResizer: + repository: /oss/kubernetes-csi/csi-resizer + tag: v1.6.0 + pullPolicy: IfNotPresent + +cloud: AzurePublicCloud + +## Reference to one or more secrets to be used when pulling images +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# - name: myRegistryKeySecretName + +serviceAccount: + create: true # When true, service accounts will be created for you. Set to false if you want to use your own. + controller: csi-blob-controller-sa # Name of Service Account to be created or used + node: csi-blob-node-sa # Name of Service Account to be created or used + +rbac: + create: true + name: blob + +## Collection of annotations to add to all the pods +podAnnotations: {} +## Collection of labels to add to all the pods +podLabels: {} +# -- Custom labels to add into metadata +customLabels: {} + # k8s-app: blob-csi-driver + +## Leverage a PriorityClass to ensure your pods survive resource shortages +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +priorityClassName: system-cluster-critical +## Security context give the opportunity to run container as nonroot by setting a securityContext +## by example : +## securityContext: { runAsUser: 1001 } +securityContext: {} + +controller: + name: csi-blob-controller + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + hostNetwork: true # this setting could be disabled if controller does not depend on MSI setting + metricsPort: 29634 + livenessProbe: + healthPort: 29632 + replicas: 2 + runOnMaster: false + runOnControlPlane: false + logLevel: 5 + resources: + csiProvisioner: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + csiResizer: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + +node: + name: csi-blob-node + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + allowInlineVolumeKeyAccessWithIdentity: false + maxUnavailable: 1 + livenessProbe: + healthPort: 29633 + logLevel: 5 + enableBlobfuseProxy: false + blobfuseProxy: + installBlobfuse: true + blobfuseVersion: "" + installBlobfuse2: true + blobfuse2Version: "" + setMaxOpenFileNum: true + maxOpenFileNum: "9000000" + disableUpdateDB: true + blobfuseCachePath: /mnt + appendTimeStampInCacheDir: false + mountPermissions: 0777 + resources: + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + nodeDriverRegistrar: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - operator: "Exists" + +feature: + enableFSGroupPolicy: false + enableGetVolumeStats: false + +driver: + name: blob.csi.azure.com + customUserAgent: "" + userAgentSuffix: "OSS-helm" + azureGoSDKLogLevel: "" # available values: ""(no logs), DEBUG, INFO, WARNING, ERROR + httpsProxy: "" + httpProxy: "" + +linux: + kubelet: /var/lib/kubelet + distro: debian diff --git a/charts/v1.22.3/blob-csi-driver-v1.22.3.tgz b/charts/v1.22.3/blob-csi-driver-v1.22.3.tgz new file mode 100644 index 000000000..ae6bd1e56 Binary files /dev/null and b/charts/v1.22.3/blob-csi-driver-v1.22.3.tgz differ diff --git a/charts/v1.22.3/blob-csi-driver/Chart.yaml b/charts/v1.22.3/blob-csi-driver/Chart.yaml new file mode 100644 index 000000000..bad614a6d --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: v1.22.3 +description: Azure Blob Storage CSI driver +name: blob-csi-driver +version: v1.22.3 diff --git a/charts/v1.22.3/blob-csi-driver/templates/NOTES.txt b/charts/v1.22.3/blob-csi-driver/templates/NOTES.txt new file mode 100644 index 000000000..9ad135dd4 --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/templates/NOTES.txt @@ -0,0 +1,5 @@ +The Azure Blob Storage CSI driver is getting deployed to your cluster. + +To check Azure Blob Storage CSI driver pods status, please run: + + kubectl --namespace={{ .Release.Namespace }} get pods --selector="release={{ .Release.Name }}" --watch diff --git a/charts/v1.22.3/blob-csi-driver/templates/_helpers.tpl b/charts/v1.22.3/blob-csi-driver/templates/_helpers.tpl new file mode 100644 index 000000000..d99392f32 --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* Expand the name of the chart.*/}} +{{- define "blob.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "blob.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common selectors. +*/}} +{{- define "blob.selectorLabels" -}} +app.kubernetes.io/name: {{ template "blob.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Common labels. +*/}} +{{- define "blob.labels" -}} +{{- include "blob.selectorLabels" . }} +app.kubernetes.io/component: csi-driver +app.kubernetes.io/part-of: {{ template "blob.name" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +helm.sh/chart: {{ template "blob.chart" . }} +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels }} +{{- end }} +{{- end -}} + + +{{/* pull secrets for containers */}} +{{- define "blob.pullSecrets" -}} +{{- if .Values.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/v1.22.3/blob-csi-driver/templates/csi-blob-controller.yaml b/charts/v1.22.3/blob-csi-driver/templates/csi-blob-controller.yaml new file mode 100644 index 000000000..6f1c552ae --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/templates/csi-blob-controller.yaml @@ -0,0 +1,215 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ .Values.controller.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.controller.replicas }} + selector: + matchLabels: + app: {{ .Values.controller.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + {{- end }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: +{{- with .Values.controller.affinity }} + affinity: +{{ toYaml . | indent 8 }} +{{- end }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + hostNetwork: {{ .Values.controller.hostNetwork }} + serviceAccountName: {{ .Values.serviceAccount.controller }} + nodeSelector: + kubernetes.io/os: linux + {{- if .Values.controller.runOnMaster}} + node-role.kubernetes.io/master: "" + {{- end}} + {{- if .Values.controller.runOnControlPlane}} + node-role.kubernetes.io/control-plane: "" + {{- end}} +{{- with .Values.controller.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.controller.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + containers: + - name: csi-provisioner +{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- else }} + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- end }} + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} + - name: liveness-probe +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.controller.livenessProbe.healthPort }} + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.controller.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}" + - "--drivername={{ .Values.driver.name }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--cloud-config-secret-name={{ .Values.controller.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.controller.cloudConfigSecretNamespace }}" + - "--allow-empty-cloud-config={{ .Values.controller.allowEmptyCloudConfig }}" + ports: + - containerPort: {{ .Values.controller.livenessProbe.healthPort }} + name: healthz + protocol: TCP + - containerPort: {{ .Values.controller.metricsPort }} + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.controller.resources.blob | nindent 12 }} + - name: csi-resizer +{{- if hasPrefix "/" .Values.image.csiResizer.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- else }} + image: "{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- end }} + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiResizer.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.csiResizer | nindent 12 }} + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.22.3/blob-csi-driver/templates/csi-blob-driver.yaml b/charts/v1.22.3/blob-csi-driver/templates/csi-blob-driver.yaml new file mode 100644 index 000000000..9a6aea64a --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/templates/csi-blob-driver.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: {{ .Values.driver.name }} + labels: + {{- include "blob.labels" . | nindent 4 }} +spec: + attachRequired: false + podInfoOnMount: true + fsGroupPolicy: {{ .Values.feature.fsGroupPolicy }} + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/charts/v1.22.3/blob-csi-driver/templates/csi-blob-node.yaml b/charts/v1.22.3/blob-csi-driver/templates/csi-blob-node.yaml new file mode 100644 index 000000000..f7b6a48f3 --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/templates/csi-blob-node.yaml @@ -0,0 +1,316 @@ +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: {{ .Values.node.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: {{ .Values.node.maxUnavailable }} + type: RollingUpdate + selector: + matchLabels: + app: {{ .Values.node.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + {{- end }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + {{- if or .Values.node.enableBlobfuseProxy .Values.node.enableAznfsMount }} + hostPID: true + {{- end }} + hostNetwork: true + dnsPolicy: Default + serviceAccountName: {{ .Values.serviceAccount.node }} + nodeSelector: + kubernetes.io/os: linux +{{- with .Values.node.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + {{- if .Values.node.affinity }} +{{- toYaml .Values.node.affinity | nindent 8 }} + {{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.node.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} +{{- if .Values.node.enableBlobfuseProxy }} + initContainers: + - name: install-blobfuse-proxy +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE + value: "{{ .Values.node.blobfuseProxy.installBlobfuse }}" + - name: BLOBFUSE_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuseVersion }}" + - name: INSTALL_BLOBFUSE2 + value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}" + - name: BLOBFUSE2_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}" + - name: SET_MAX_OPEN_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}" + - name: MAX_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.maxOpenFileNum }}" + - name: DISABLE_UPDATEDB + value: "{{ .Values.node.blobfuseProxy.disableUpdateDB }}" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc +{{- end }} + containers: + - name: liveness-probe + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.node.livenessProbe.healthPort }} + - --v=2 + resources: {{- toYaml .Values.node.resources.livenessProbe | nindent 12 }} + - name: node-driver-registrar +{{- if hasPrefix "/" .Values.image.nodeDriverRegistrar.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- else }} + image: "{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- end }} + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }}/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: {{- toYaml .Values.node.resources.nodeDriverRegistrar | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.node.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--enable-blobfuse-proxy={{ .Values.node.enableBlobfuseProxy }}" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--drivername={{ .Values.driver.name }}" + - "--cloud-config-secret-name={{ .Values.node.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.node.cloudConfigSecretNamespace }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--allow-empty-cloud-config={{ .Values.node.allowEmptyCloudConfig }}" + - "--enable-get-volume-stats={{ .Values.feature.enableGetVolumeStats }}" + - "--append-timestamp-cache-dir={{ .Values.node.appendTimeStampInCacheDir }}" + - "--mount-permissions={{ .Values.node.mountPermissions }}" + - "--allow-inline-volume-key-access-with-idenitity={{ .Values.node.allowInlineVolumeKeyAccessWithIdentity }}" + - "--enable-aznfs-mount={{ .Values.node.enableAznfsMount }}" + ports: + - containerPort: {{ .Values.node.livenessProbe.healthPort }} + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + {{- if .Values.node.enableAznfsMount }} + - mountPath: /opt/microsoft/aznfs/data + name: aznfs-data + {{- end }} + resources: {{- toYaml .Values.node.resources.blob | nindent 12 }} +{{- if .Values.node.enableAznfsMount }} + - name: aznfswatchdog +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + command: + - "aznfswatchdog" + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + resources: {{- toYaml .Values.node.resources.aznfswatchdog | nindent 12 }} + volumeMounts: + - mountPath: /opt/microsoft/aznfs/data + name: aznfs-data + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir +{{- end }} + volumes: +{{- if .Values.node.enableBlobfuseProxy }} + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc +{{- end }} + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }} + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: {{ .Values.node.blobfuseCachePath }} + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.node.enableAznfsMount }} + - hostPath: + path: /opt/microsoft/aznfs/data + type: DirectoryOrCreate + name: aznfs-data + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.22.3/blob-csi-driver/templates/rbac-csi-blob-controller.yaml b/charts/v1.22.3/blob-csi-driver/templates/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..833dcc640 --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/templates/rbac-csi-blob-controller.yaml @@ -0,0 +1,115 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-provisioner-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-provisioner-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-provisioner-role + apiGroup: rbac.authorization.k8s.io + +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-resizer-role + apiGroup: rbac.authorization.k8s.io + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-controller-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.22.3/blob-csi-driver/templates/rbac-csi-blob-node.yaml b/charts/v1.22.3/blob-csi-driver/templates/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..c041cf8db --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/templates/rbac-csi-blob-node.yaml @@ -0,0 +1,29 @@ +{{- if .Values.rbac.create -}} +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-node-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.22.3/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml b/charts/v1.22.3/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml new file mode 100644 index 000000000..7433bccf1 --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml @@ -0,0 +1,17 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + annotations: + azure.workload.identity/client-id: {{ .Values.workloadIdentity.clientID }} +{{- if .Values.workloadIdentity.tenantID }} + azure.workload.identity/tenant-id: {{ .Values.workloadIdentity.tenantID }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/v1.22.3/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml b/charts/v1.22.3/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml new file mode 100644 index 000000000..a25090e30 --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml @@ -0,0 +1,17 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + annotations: + azure.workload.identity/client-id: {{ .Values.workloadIdentity.clientID }} +{{- if .Values.workloadIdentity.tenantID }} + azure.workload.identity/tenant-id: {{ .Values.workloadIdentity.tenantID }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/v1.22.3/blob-csi-driver/values.yaml b/charts/v1.22.3/blob-csi-driver/values.yaml new file mode 100644 index 000000000..7d647fc3f --- /dev/null +++ b/charts/v1.22.3/blob-csi-driver/values.yaml @@ -0,0 +1,180 @@ +image: + baseRepo: mcr.microsoft.com + blob: + repository: /oss/kubernetes-csi/blob-csi + tag: v1.22.3 + pullPolicy: IfNotPresent + csiProvisioner: + repository: /oss/kubernetes-csi/csi-provisioner + tag: v3.5.0 + pullPolicy: IfNotPresent + livenessProbe: + repository: /oss/kubernetes-csi/livenessprobe + tag: v2.10.0 + pullPolicy: IfNotPresent + nodeDriverRegistrar: + repository: /oss/kubernetes-csi/csi-node-driver-registrar + tag: v2.8.0 + pullPolicy: IfNotPresent + csiResizer: + repository: /oss/kubernetes-csi/csi-resizer + tag: v1.8.0 + pullPolicy: IfNotPresent + +cloud: AzurePublicCloud + +## Reference to one or more secrets to be used when pulling images +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# - name: myRegistryKeySecretName + +serviceAccount: + create: true # When true, service accounts will be created for you. Set to false if you want to use your own. + controller: csi-blob-controller-sa # Name of Service Account to be created or used + node: csi-blob-node-sa # Name of Service Account to be created or used + +rbac: + create: true + name: blob + +## Collection of annotations to add to all the pods +podAnnotations: {} +## Collection of labels to add to all the pods +podLabels: {} +# -- Custom labels to add into metadata +customLabels: {} + # k8s-app: blob-csi-driver + +## Leverage a PriorityClass to ensure your pods survive resource shortages +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +priorityClassName: system-cluster-critical +## Security context give the opportunity to run container as nonroot by setting a securityContext +## by example : +## securityContext: { runAsUser: 1001 } +securityContext: {} + +controller: + name: csi-blob-controller + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + hostNetwork: true # this setting could be disabled if controller does not depend on MSI setting + metricsPort: 29634 + livenessProbe: + healthPort: 29632 + replicas: 2 + runOnMaster: false + runOnControlPlane: false + logLevel: 5 + resources: + csiProvisioner: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + csiResizer: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + +node: + name: csi-blob-node + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + allowInlineVolumeKeyAccessWithIdentity: false + maxUnavailable: 1 + livenessProbe: + healthPort: 29633 + logLevel: 5 + enableBlobfuseProxy: false + blobfuseProxy: + installBlobfuse: true + blobfuseVersion: "1.4.5" + installBlobfuse2: true + blobfuse2Version: "2.1.2" + setMaxOpenFileNum: true + maxOpenFileNum: "9000000" + disableUpdateDB: true + blobfuseCachePath: /mnt + appendTimeStampInCacheDir: false + mountPermissions: 0777 + resources: + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + nodeDriverRegistrar: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + aznfswatchdog: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - operator: "Exists" + enableAznfsMount: true + +feature: + fsGroupPolicy: ReadWriteOnceWithFSType + enableGetVolumeStats: false + +driver: + name: blob.csi.azure.com + customUserAgent: "" + userAgentSuffix: "OSS-helm" + azureGoSDKLogLevel: "" # available values: ""(no logs), DEBUG, INFO, WARNING, ERROR + httpsProxy: "" + httpProxy: "" + +linux: + kubelet: /var/lib/kubelet + distro: debian + +workloadIdentity: + clientID: "" + # [optional] If the AAD application or user-assigned managed identity is not in the same tenant as the cluster + # then set tenantID with the application or user-assigned managed identity tenant ID + tenantID: "" diff --git a/charts/v1.22.4/blob-csi-driver-v1.22.4.tgz b/charts/v1.22.4/blob-csi-driver-v1.22.4.tgz new file mode 100644 index 000000000..d09dbfdda Binary files /dev/null and b/charts/v1.22.4/blob-csi-driver-v1.22.4.tgz differ diff --git a/charts/v1.22.4/blob-csi-driver/Chart.yaml b/charts/v1.22.4/blob-csi-driver/Chart.yaml new file mode 100644 index 000000000..22be7479c --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: v1.22.4 +description: Azure Blob Storage CSI driver +name: blob-csi-driver +version: v1.22.4 diff --git a/charts/v1.22.4/blob-csi-driver/templates/NOTES.txt b/charts/v1.22.4/blob-csi-driver/templates/NOTES.txt new file mode 100644 index 000000000..9ad135dd4 --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/templates/NOTES.txt @@ -0,0 +1,5 @@ +The Azure Blob Storage CSI driver is getting deployed to your cluster. + +To check Azure Blob Storage CSI driver pods status, please run: + + kubectl --namespace={{ .Release.Namespace }} get pods --selector="release={{ .Release.Name }}" --watch diff --git a/charts/v1.22.4/blob-csi-driver/templates/_helpers.tpl b/charts/v1.22.4/blob-csi-driver/templates/_helpers.tpl new file mode 100644 index 000000000..d99392f32 --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* Expand the name of the chart.*/}} +{{- define "blob.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "blob.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common selectors. +*/}} +{{- define "blob.selectorLabels" -}} +app.kubernetes.io/name: {{ template "blob.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Common labels. +*/}} +{{- define "blob.labels" -}} +{{- include "blob.selectorLabels" . }} +app.kubernetes.io/component: csi-driver +app.kubernetes.io/part-of: {{ template "blob.name" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +helm.sh/chart: {{ template "blob.chart" . }} +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels }} +{{- end }} +{{- end -}} + + +{{/* pull secrets for containers */}} +{{- define "blob.pullSecrets" -}} +{{- if .Values.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/v1.22.4/blob-csi-driver/templates/csi-blob-controller.yaml b/charts/v1.22.4/blob-csi-driver/templates/csi-blob-controller.yaml new file mode 100644 index 000000000..6f1c552ae --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/templates/csi-blob-controller.yaml @@ -0,0 +1,215 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ .Values.controller.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.controller.replicas }} + selector: + matchLabels: + app: {{ .Values.controller.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + {{- end }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: +{{- with .Values.controller.affinity }} + affinity: +{{ toYaml . | indent 8 }} +{{- end }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + hostNetwork: {{ .Values.controller.hostNetwork }} + serviceAccountName: {{ .Values.serviceAccount.controller }} + nodeSelector: + kubernetes.io/os: linux + {{- if .Values.controller.runOnMaster}} + node-role.kubernetes.io/master: "" + {{- end}} + {{- if .Values.controller.runOnControlPlane}} + node-role.kubernetes.io/control-plane: "" + {{- end}} +{{- with .Values.controller.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.controller.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + containers: + - name: csi-provisioner +{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- else }} + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- end }} + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} + - name: liveness-probe +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.controller.livenessProbe.healthPort }} + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.controller.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}" + - "--drivername={{ .Values.driver.name }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--cloud-config-secret-name={{ .Values.controller.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.controller.cloudConfigSecretNamespace }}" + - "--allow-empty-cloud-config={{ .Values.controller.allowEmptyCloudConfig }}" + ports: + - containerPort: {{ .Values.controller.livenessProbe.healthPort }} + name: healthz + protocol: TCP + - containerPort: {{ .Values.controller.metricsPort }} + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.controller.resources.blob | nindent 12 }} + - name: csi-resizer +{{- if hasPrefix "/" .Values.image.csiResizer.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- else }} + image: "{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- end }} + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiResizer.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.csiResizer | nindent 12 }} + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.22.4/blob-csi-driver/templates/csi-blob-driver.yaml b/charts/v1.22.4/blob-csi-driver/templates/csi-blob-driver.yaml new file mode 100644 index 000000000..9a6aea64a --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/templates/csi-blob-driver.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: {{ .Values.driver.name }} + labels: + {{- include "blob.labels" . | nindent 4 }} +spec: + attachRequired: false + podInfoOnMount: true + fsGroupPolicy: {{ .Values.feature.fsGroupPolicy }} + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/charts/v1.22.4/blob-csi-driver/templates/csi-blob-node.yaml b/charts/v1.22.4/blob-csi-driver/templates/csi-blob-node.yaml new file mode 100644 index 000000000..f7b6a48f3 --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/templates/csi-blob-node.yaml @@ -0,0 +1,316 @@ +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: {{ .Values.node.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: {{ .Values.node.maxUnavailable }} + type: RollingUpdate + selector: + matchLabels: + app: {{ .Values.node.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + {{- end }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + {{- if or .Values.node.enableBlobfuseProxy .Values.node.enableAznfsMount }} + hostPID: true + {{- end }} + hostNetwork: true + dnsPolicy: Default + serviceAccountName: {{ .Values.serviceAccount.node }} + nodeSelector: + kubernetes.io/os: linux +{{- with .Values.node.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + {{- if .Values.node.affinity }} +{{- toYaml .Values.node.affinity | nindent 8 }} + {{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.node.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} +{{- if .Values.node.enableBlobfuseProxy }} + initContainers: + - name: install-blobfuse-proxy +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE + value: "{{ .Values.node.blobfuseProxy.installBlobfuse }}" + - name: BLOBFUSE_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuseVersion }}" + - name: INSTALL_BLOBFUSE2 + value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}" + - name: BLOBFUSE2_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}" + - name: SET_MAX_OPEN_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}" + - name: MAX_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.maxOpenFileNum }}" + - name: DISABLE_UPDATEDB + value: "{{ .Values.node.blobfuseProxy.disableUpdateDB }}" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc +{{- end }} + containers: + - name: liveness-probe + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.node.livenessProbe.healthPort }} + - --v=2 + resources: {{- toYaml .Values.node.resources.livenessProbe | nindent 12 }} + - name: node-driver-registrar +{{- if hasPrefix "/" .Values.image.nodeDriverRegistrar.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- else }} + image: "{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- end }} + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }}/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: {{- toYaml .Values.node.resources.nodeDriverRegistrar | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.node.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--enable-blobfuse-proxy={{ .Values.node.enableBlobfuseProxy }}" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--drivername={{ .Values.driver.name }}" + - "--cloud-config-secret-name={{ .Values.node.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.node.cloudConfigSecretNamespace }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--allow-empty-cloud-config={{ .Values.node.allowEmptyCloudConfig }}" + - "--enable-get-volume-stats={{ .Values.feature.enableGetVolumeStats }}" + - "--append-timestamp-cache-dir={{ .Values.node.appendTimeStampInCacheDir }}" + - "--mount-permissions={{ .Values.node.mountPermissions }}" + - "--allow-inline-volume-key-access-with-idenitity={{ .Values.node.allowInlineVolumeKeyAccessWithIdentity }}" + - "--enable-aznfs-mount={{ .Values.node.enableAznfsMount }}" + ports: + - containerPort: {{ .Values.node.livenessProbe.healthPort }} + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + {{- if .Values.node.enableAznfsMount }} + - mountPath: /opt/microsoft/aznfs/data + name: aznfs-data + {{- end }} + resources: {{- toYaml .Values.node.resources.blob | nindent 12 }} +{{- if .Values.node.enableAznfsMount }} + - name: aznfswatchdog +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + command: + - "aznfswatchdog" + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + resources: {{- toYaml .Values.node.resources.aznfswatchdog | nindent 12 }} + volumeMounts: + - mountPath: /opt/microsoft/aznfs/data + name: aznfs-data + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir +{{- end }} + volumes: +{{- if .Values.node.enableBlobfuseProxy }} + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc +{{- end }} + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }} + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: {{ .Values.node.blobfuseCachePath }} + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.node.enableAznfsMount }} + - hostPath: + path: /opt/microsoft/aznfs/data + type: DirectoryOrCreate + name: aznfs-data + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.22.4/blob-csi-driver/templates/rbac-csi-blob-controller.yaml b/charts/v1.22.4/blob-csi-driver/templates/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..833dcc640 --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/templates/rbac-csi-blob-controller.yaml @@ -0,0 +1,115 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-provisioner-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-provisioner-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-provisioner-role + apiGroup: rbac.authorization.k8s.io + +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-resizer-role + apiGroup: rbac.authorization.k8s.io + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-controller-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.22.4/blob-csi-driver/templates/rbac-csi-blob-node.yaml b/charts/v1.22.4/blob-csi-driver/templates/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..c041cf8db --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/templates/rbac-csi-blob-node.yaml @@ -0,0 +1,29 @@ +{{- if .Values.rbac.create -}} +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-node-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.22.4/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml b/charts/v1.22.4/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml new file mode 100644 index 000000000..7433bccf1 --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml @@ -0,0 +1,17 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + annotations: + azure.workload.identity/client-id: {{ .Values.workloadIdentity.clientID }} +{{- if .Values.workloadIdentity.tenantID }} + azure.workload.identity/tenant-id: {{ .Values.workloadIdentity.tenantID }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/v1.22.4/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml b/charts/v1.22.4/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml new file mode 100644 index 000000000..a25090e30 --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml @@ -0,0 +1,17 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + annotations: + azure.workload.identity/client-id: {{ .Values.workloadIdentity.clientID }} +{{- if .Values.workloadIdentity.tenantID }} + azure.workload.identity/tenant-id: {{ .Values.workloadIdentity.tenantID }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/v1.22.4/blob-csi-driver/values.yaml b/charts/v1.22.4/blob-csi-driver/values.yaml new file mode 100644 index 000000000..78912172c --- /dev/null +++ b/charts/v1.22.4/blob-csi-driver/values.yaml @@ -0,0 +1,180 @@ +image: + baseRepo: mcr.microsoft.com + blob: + repository: /oss/kubernetes-csi/blob-csi + tag: v1.22.4 + pullPolicy: IfNotPresent + csiProvisioner: + repository: /oss/kubernetes-csi/csi-provisioner + tag: v3.5.0 + pullPolicy: IfNotPresent + livenessProbe: + repository: /oss/kubernetes-csi/livenessprobe + tag: v2.10.0 + pullPolicy: IfNotPresent + nodeDriverRegistrar: + repository: /oss/kubernetes-csi/csi-node-driver-registrar + tag: v2.8.0 + pullPolicy: IfNotPresent + csiResizer: + repository: /oss/kubernetes-csi/csi-resizer + tag: v1.8.0 + pullPolicy: IfNotPresent + +cloud: AzurePublicCloud + +## Reference to one or more secrets to be used when pulling images +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# - name: myRegistryKeySecretName + +serviceAccount: + create: true # When true, service accounts will be created for you. Set to false if you want to use your own. + controller: csi-blob-controller-sa # Name of Service Account to be created or used + node: csi-blob-node-sa # Name of Service Account to be created or used + +rbac: + create: true + name: blob + +## Collection of annotations to add to all the pods +podAnnotations: {} +## Collection of labels to add to all the pods +podLabels: {} +# -- Custom labels to add into metadata +customLabels: {} + # k8s-app: blob-csi-driver + +## Leverage a PriorityClass to ensure your pods survive resource shortages +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +priorityClassName: system-cluster-critical +## Security context give the opportunity to run container as nonroot by setting a securityContext +## by example : +## securityContext: { runAsUser: 1001 } +securityContext: {} + +controller: + name: csi-blob-controller + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + hostNetwork: true # this setting could be disabled if controller does not depend on MSI setting + metricsPort: 29634 + livenessProbe: + healthPort: 29632 + replicas: 2 + runOnMaster: false + runOnControlPlane: false + logLevel: 5 + resources: + csiProvisioner: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + csiResizer: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + +node: + name: csi-blob-node + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + allowInlineVolumeKeyAccessWithIdentity: false + maxUnavailable: 1 + livenessProbe: + healthPort: 29633 + logLevel: 5 + enableBlobfuseProxy: false + blobfuseProxy: + installBlobfuse: true + blobfuseVersion: "1.4.5" + installBlobfuse2: true + blobfuse2Version: "2.0.5" + setMaxOpenFileNum: true + maxOpenFileNum: "9000000" + disableUpdateDB: true + blobfuseCachePath: /mnt + appendTimeStampInCacheDir: false + mountPermissions: 0777 + resources: + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + nodeDriverRegistrar: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + aznfswatchdog: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - operator: "Exists" + enableAznfsMount: true + +feature: + fsGroupPolicy: ReadWriteOnceWithFSType + enableGetVolumeStats: false + +driver: + name: blob.csi.azure.com + customUserAgent: "" + userAgentSuffix: "OSS-helm" + azureGoSDKLogLevel: "" # available values: ""(no logs), DEBUG, INFO, WARNING, ERROR + httpsProxy: "" + httpProxy: "" + +linux: + kubelet: /var/lib/kubelet + distro: debian + +workloadIdentity: + clientID: "" + # [optional] If the AAD application or user-assigned managed identity is not in the same tenant as the cluster + # then set tenantID with the application or user-assigned managed identity tenant ID + tenantID: "" diff --git a/charts/v1.23.1/blob-csi-driver-v1.23.1.tgz b/charts/v1.23.1/blob-csi-driver-v1.23.1.tgz new file mode 100644 index 000000000..55a74b9fa Binary files /dev/null and b/charts/v1.23.1/blob-csi-driver-v1.23.1.tgz differ diff --git a/charts/v1.23.1/blob-csi-driver/Chart.yaml b/charts/v1.23.1/blob-csi-driver/Chart.yaml new file mode 100644 index 000000000..64ad9f8f7 --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: v1.23.1 +description: Azure Blob Storage CSI driver +name: blob-csi-driver +version: v1.23.1 diff --git a/charts/v1.23.1/blob-csi-driver/templates/NOTES.txt b/charts/v1.23.1/blob-csi-driver/templates/NOTES.txt new file mode 100644 index 000000000..9ad135dd4 --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/templates/NOTES.txt @@ -0,0 +1,5 @@ +The Azure Blob Storage CSI driver is getting deployed to your cluster. + +To check Azure Blob Storage CSI driver pods status, please run: + + kubectl --namespace={{ .Release.Namespace }} get pods --selector="release={{ .Release.Name }}" --watch diff --git a/charts/v1.23.1/blob-csi-driver/templates/_helpers.tpl b/charts/v1.23.1/blob-csi-driver/templates/_helpers.tpl new file mode 100644 index 000000000..d99392f32 --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* Expand the name of the chart.*/}} +{{- define "blob.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "blob.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common selectors. +*/}} +{{- define "blob.selectorLabels" -}} +app.kubernetes.io/name: {{ template "blob.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Common labels. +*/}} +{{- define "blob.labels" -}} +{{- include "blob.selectorLabels" . }} +app.kubernetes.io/component: csi-driver +app.kubernetes.io/part-of: {{ template "blob.name" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +helm.sh/chart: {{ template "blob.chart" . }} +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels }} +{{- end }} +{{- end -}} + + +{{/* pull secrets for containers */}} +{{- define "blob.pullSecrets" -}} +{{- if .Values.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/v1.23.1/blob-csi-driver/templates/csi-blob-controller.yaml b/charts/v1.23.1/blob-csi-driver/templates/csi-blob-controller.yaml new file mode 100644 index 000000000..9ece72de3 --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/templates/csi-blob-controller.yaml @@ -0,0 +1,216 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ .Values.controller.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.controller.replicas }} + selector: + matchLabels: + app: {{ .Values.controller.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + {{- end }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: +{{- with .Values.controller.affinity }} + affinity: +{{ toYaml . | indent 8 }} +{{- end }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + hostNetwork: {{ .Values.controller.hostNetwork }} + serviceAccountName: {{ .Values.serviceAccount.controller }} + nodeSelector: + kubernetes.io/os: linux + {{- if .Values.controller.runOnMaster}} + node-role.kubernetes.io/master: "" + {{- end}} + {{- if .Values.controller.runOnControlPlane}} + node-role.kubernetes.io/control-plane: "" + {{- end}} +{{- with .Values.controller.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.controller.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + containers: + - name: csi-provisioner +{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- else }} + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- end }} + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - "--timeout=1200s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + - "--feature-gates=HonorPVReclaimPolicy=true" + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} + - name: liveness-probe +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.controller.livenessProbe.healthPort }} + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.controller.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}" + - "--drivername={{ .Values.driver.name }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--cloud-config-secret-name={{ .Values.controller.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.controller.cloudConfigSecretNamespace }}" + - "--allow-empty-cloud-config={{ .Values.controller.allowEmptyCloudConfig }}" + ports: + - containerPort: {{ .Values.controller.livenessProbe.healthPort }} + name: healthz + protocol: TCP + - containerPort: {{ .Values.controller.metricsPort }} + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.controller.resources.blob | nindent 12 }} + - name: csi-resizer +{{- if hasPrefix "/" .Values.image.csiResizer.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- else }} + image: "{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- end }} + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiResizer.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.csiResizer | nindent 12 }} + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.23.1/blob-csi-driver/templates/csi-blob-driver.yaml b/charts/v1.23.1/blob-csi-driver/templates/csi-blob-driver.yaml new file mode 100644 index 000000000..9a6aea64a --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/templates/csi-blob-driver.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: {{ .Values.driver.name }} + labels: + {{- include "blob.labels" . | nindent 4 }} +spec: + attachRequired: false + podInfoOnMount: true + fsGroupPolicy: {{ .Values.feature.fsGroupPolicy }} + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/charts/v1.23.1/blob-csi-driver/templates/csi-blob-node.yaml b/charts/v1.23.1/blob-csi-driver/templates/csi-blob-node.yaml new file mode 100644 index 000000000..f7b6a48f3 --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/templates/csi-blob-node.yaml @@ -0,0 +1,316 @@ +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: {{ .Values.node.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: {{ .Values.node.maxUnavailable }} + type: RollingUpdate + selector: + matchLabels: + app: {{ .Values.node.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + {{- end }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + {{- if or .Values.node.enableBlobfuseProxy .Values.node.enableAznfsMount }} + hostPID: true + {{- end }} + hostNetwork: true + dnsPolicy: Default + serviceAccountName: {{ .Values.serviceAccount.node }} + nodeSelector: + kubernetes.io/os: linux +{{- with .Values.node.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + {{- if .Values.node.affinity }} +{{- toYaml .Values.node.affinity | nindent 8 }} + {{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.node.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} +{{- if .Values.node.enableBlobfuseProxy }} + initContainers: + - name: install-blobfuse-proxy +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE + value: "{{ .Values.node.blobfuseProxy.installBlobfuse }}" + - name: BLOBFUSE_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuseVersion }}" + - name: INSTALL_BLOBFUSE2 + value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}" + - name: BLOBFUSE2_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}" + - name: SET_MAX_OPEN_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}" + - name: MAX_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.maxOpenFileNum }}" + - name: DISABLE_UPDATEDB + value: "{{ .Values.node.blobfuseProxy.disableUpdateDB }}" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc +{{- end }} + containers: + - name: liveness-probe + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.node.livenessProbe.healthPort }} + - --v=2 + resources: {{- toYaml .Values.node.resources.livenessProbe | nindent 12 }} + - name: node-driver-registrar +{{- if hasPrefix "/" .Values.image.nodeDriverRegistrar.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- else }} + image: "{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- end }} + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }}/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: {{- toYaml .Values.node.resources.nodeDriverRegistrar | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.node.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--enable-blobfuse-proxy={{ .Values.node.enableBlobfuseProxy }}" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--drivername={{ .Values.driver.name }}" + - "--cloud-config-secret-name={{ .Values.node.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.node.cloudConfigSecretNamespace }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--allow-empty-cloud-config={{ .Values.node.allowEmptyCloudConfig }}" + - "--enable-get-volume-stats={{ .Values.feature.enableGetVolumeStats }}" + - "--append-timestamp-cache-dir={{ .Values.node.appendTimeStampInCacheDir }}" + - "--mount-permissions={{ .Values.node.mountPermissions }}" + - "--allow-inline-volume-key-access-with-idenitity={{ .Values.node.allowInlineVolumeKeyAccessWithIdentity }}" + - "--enable-aznfs-mount={{ .Values.node.enableAznfsMount }}" + ports: + - containerPort: {{ .Values.node.livenessProbe.healthPort }} + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + {{- if .Values.node.enableAznfsMount }} + - mountPath: /opt/microsoft/aznfs/data + name: aznfs-data + {{- end }} + resources: {{- toYaml .Values.node.resources.blob | nindent 12 }} +{{- if .Values.node.enableAznfsMount }} + - name: aznfswatchdog +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + command: + - "aznfswatchdog" + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + resources: {{- toYaml .Values.node.resources.aznfswatchdog | nindent 12 }} + volumeMounts: + - mountPath: /opt/microsoft/aznfs/data + name: aznfs-data + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir +{{- end }} + volumes: +{{- if .Values.node.enableBlobfuseProxy }} + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc +{{- end }} + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }} + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: {{ .Values.node.blobfuseCachePath }} + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.node.enableAznfsMount }} + - hostPath: + path: /opt/microsoft/aznfs/data + type: DirectoryOrCreate + name: aznfs-data + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.23.1/blob-csi-driver/templates/rbac-csi-blob-controller.yaml b/charts/v1.23.1/blob-csi-driver/templates/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..833dcc640 --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/templates/rbac-csi-blob-controller.yaml @@ -0,0 +1,115 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-provisioner-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-provisioner-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-provisioner-role + apiGroup: rbac.authorization.k8s.io + +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-resizer-role + apiGroup: rbac.authorization.k8s.io + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-controller-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.23.1/blob-csi-driver/templates/rbac-csi-blob-node.yaml b/charts/v1.23.1/blob-csi-driver/templates/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..c041cf8db --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/templates/rbac-csi-blob-node.yaml @@ -0,0 +1,29 @@ +{{- if .Values.rbac.create -}} +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-node-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.23.1/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml b/charts/v1.23.1/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml new file mode 100644 index 000000000..7433bccf1 --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml @@ -0,0 +1,17 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + annotations: + azure.workload.identity/client-id: {{ .Values.workloadIdentity.clientID }} +{{- if .Values.workloadIdentity.tenantID }} + azure.workload.identity/tenant-id: {{ .Values.workloadIdentity.tenantID }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/v1.23.1/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml b/charts/v1.23.1/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml new file mode 100644 index 000000000..a25090e30 --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml @@ -0,0 +1,17 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + annotations: + azure.workload.identity/client-id: {{ .Values.workloadIdentity.clientID }} +{{- if .Values.workloadIdentity.tenantID }} + azure.workload.identity/tenant-id: {{ .Values.workloadIdentity.tenantID }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/v1.23.1/blob-csi-driver/values.yaml b/charts/v1.23.1/blob-csi-driver/values.yaml new file mode 100644 index 000000000..f7384ca89 --- /dev/null +++ b/charts/v1.23.1/blob-csi-driver/values.yaml @@ -0,0 +1,180 @@ +image: + baseRepo: mcr.microsoft.com + blob: + repository: /oss/kubernetes-csi/blob-csi + tag: v1.23.1 + pullPolicy: IfNotPresent + csiProvisioner: + repository: /oss/kubernetes-csi/csi-provisioner + tag: v3.5.0 + pullPolicy: IfNotPresent + livenessProbe: + repository: /oss/kubernetes-csi/livenessprobe + tag: v2.10.0 + pullPolicy: IfNotPresent + nodeDriverRegistrar: + repository: /oss/kubernetes-csi/csi-node-driver-registrar + tag: v2.8.0 + pullPolicy: IfNotPresent + csiResizer: + repository: /oss/kubernetes-csi/csi-resizer + tag: v1.8.0 + pullPolicy: IfNotPresent + +cloud: AzurePublicCloud + +## Reference to one or more secrets to be used when pulling images +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# - name: myRegistryKeySecretName + +serviceAccount: + create: true # When true, service accounts will be created for you. Set to false if you want to use your own. + controller: csi-blob-controller-sa # Name of Service Account to be created or used + node: csi-blob-node-sa # Name of Service Account to be created or used + +rbac: + create: true + name: blob + +## Collection of annotations to add to all the pods +podAnnotations: {} +## Collection of labels to add to all the pods +podLabels: {} +# -- Custom labels to add into metadata +customLabels: {} + # k8s-app: blob-csi-driver + +## Leverage a PriorityClass to ensure your pods survive resource shortages +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +priorityClassName: system-cluster-critical +## Security context give the opportunity to run container as nonroot by setting a securityContext +## by example : +## securityContext: { runAsUser: 1001 } +securityContext: {} + +controller: + name: csi-blob-controller + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + hostNetwork: true # this setting could be disabled if controller does not depend on MSI setting + metricsPort: 29634 + livenessProbe: + healthPort: 29632 + replicas: 2 + runOnMaster: false + runOnControlPlane: false + logLevel: 5 + resources: + csiProvisioner: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + csiResizer: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + +node: + name: csi-blob-node + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + allowInlineVolumeKeyAccessWithIdentity: false + maxUnavailable: 1 + livenessProbe: + healthPort: 29633 + logLevel: 5 + enableBlobfuseProxy: false + blobfuseProxy: + installBlobfuse: true + blobfuseVersion: "1.4.5" + installBlobfuse2: true + blobfuse2Version: "2.1.2" + setMaxOpenFileNum: true + maxOpenFileNum: "9000000" + disableUpdateDB: true + blobfuseCachePath: /mnt + appendTimeStampInCacheDir: false + mountPermissions: 0777 + resources: + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + nodeDriverRegistrar: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + aznfswatchdog: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - operator: "Exists" + enableAznfsMount: true + +feature: + fsGroupPolicy: ReadWriteOnceWithFSType + enableGetVolumeStats: false + +driver: + name: blob.csi.azure.com + customUserAgent: "" + userAgentSuffix: "OSS-helm" + azureGoSDKLogLevel: "" # available values: ""(no logs), DEBUG, INFO, WARNING, ERROR + httpsProxy: "" + httpProxy: "" + +linux: + kubelet: /var/lib/kubelet + distro: debian + +workloadIdentity: + clientID: "" + # [optional] If the AAD application or user-assigned managed identity is not in the same tenant as the cluster + # then set tenantID with the application or user-assigned managed identity tenant ID + tenantID: "" diff --git a/charts/v1.23.2/blob-csi-driver-v1.23.2.tgz b/charts/v1.23.2/blob-csi-driver-v1.23.2.tgz new file mode 100644 index 000000000..c4b0fb5e6 Binary files /dev/null and b/charts/v1.23.2/blob-csi-driver-v1.23.2.tgz differ diff --git a/charts/v1.23.2/blob-csi-driver/Chart.yaml b/charts/v1.23.2/blob-csi-driver/Chart.yaml new file mode 100644 index 000000000..c2b93985c --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: v1.23.2 +description: Azure Blob Storage CSI driver +name: blob-csi-driver +version: v1.23.2 diff --git a/charts/v1.23.2/blob-csi-driver/templates/NOTES.txt b/charts/v1.23.2/blob-csi-driver/templates/NOTES.txt new file mode 100644 index 000000000..9ad135dd4 --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/templates/NOTES.txt @@ -0,0 +1,5 @@ +The Azure Blob Storage CSI driver is getting deployed to your cluster. + +To check Azure Blob Storage CSI driver pods status, please run: + + kubectl --namespace={{ .Release.Namespace }} get pods --selector="release={{ .Release.Name }}" --watch diff --git a/charts/v1.23.2/blob-csi-driver/templates/_helpers.tpl b/charts/v1.23.2/blob-csi-driver/templates/_helpers.tpl new file mode 100644 index 000000000..d99392f32 --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* Expand the name of the chart.*/}} +{{- define "blob.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "blob.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common selectors. +*/}} +{{- define "blob.selectorLabels" -}} +app.kubernetes.io/name: {{ template "blob.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Common labels. +*/}} +{{- define "blob.labels" -}} +{{- include "blob.selectorLabels" . }} +app.kubernetes.io/component: csi-driver +app.kubernetes.io/part-of: {{ template "blob.name" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +helm.sh/chart: {{ template "blob.chart" . }} +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels }} +{{- end }} +{{- end -}} + + +{{/* pull secrets for containers */}} +{{- define "blob.pullSecrets" -}} +{{- if .Values.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/v1.23.2/blob-csi-driver/templates/csi-blob-controller.yaml b/charts/v1.23.2/blob-csi-driver/templates/csi-blob-controller.yaml new file mode 100644 index 000000000..9ece72de3 --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/templates/csi-blob-controller.yaml @@ -0,0 +1,216 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ .Values.controller.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.controller.replicas }} + selector: + matchLabels: + app: {{ .Values.controller.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.controller.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + {{- end }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: +{{- with .Values.controller.affinity }} + affinity: +{{ toYaml . | indent 8 }} +{{- end }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + hostNetwork: {{ .Values.controller.hostNetwork }} + serviceAccountName: {{ .Values.serviceAccount.controller }} + nodeSelector: + kubernetes.io/os: linux + {{- if .Values.controller.runOnMaster}} + node-role.kubernetes.io/master: "" + {{- end}} + {{- if .Values.controller.runOnControlPlane}} + node-role.kubernetes.io/control-plane: "" + {{- end}} +{{- with .Values.controller.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.controller.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + containers: + - name: csi-provisioner +{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- else }} + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" +{{- end }} + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - "--timeout=1200s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + - "--feature-gates=HonorPVReclaimPolicy=true" + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} + - name: liveness-probe +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.controller.livenessProbe.healthPort }} + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.controller.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}" + - "--drivername={{ .Values.driver.name }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--cloud-config-secret-name={{ .Values.controller.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.controller.cloudConfigSecretNamespace }}" + - "--allow-empty-cloud-config={{ .Values.controller.allowEmptyCloudConfig }}" + ports: + - containerPort: {{ .Values.controller.livenessProbe.healthPort }} + name: healthz + protocol: TCP + - containerPort: {{ .Values.controller.metricsPort }} + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + resources: {{- toYaml .Values.controller.resources.blob | nindent 12 }} + - name: csi-resizer +{{- if hasPrefix "/" .Values.image.csiResizer.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- else }} + image: "{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" +{{- end }} + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace={{ .Release.Namespace }}" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + imagePullPolicy: {{ .Values.image.csiResizer.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: {{- toYaml .Values.controller.resources.csiResizer | nindent 12 }} + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.23.2/blob-csi-driver/templates/csi-blob-driver.yaml b/charts/v1.23.2/blob-csi-driver/templates/csi-blob-driver.yaml new file mode 100644 index 000000000..9a6aea64a --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/templates/csi-blob-driver.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: {{ .Values.driver.name }} + labels: + {{- include "blob.labels" . | nindent 4 }} +spec: + attachRequired: false + podInfoOnMount: true + fsGroupPolicy: {{ .Values.feature.fsGroupPolicy }} + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/charts/v1.23.2/blob-csi-driver/templates/csi-blob-node.yaml b/charts/v1.23.2/blob-csi-driver/templates/csi-blob-node.yaml new file mode 100644 index 000000000..4874f89b6 --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/templates/csi-blob-node.yaml @@ -0,0 +1,319 @@ +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: {{ .Values.node.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 4 }} +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: {{ .Values.node.maxUnavailable }} + type: RollingUpdate + selector: + matchLabels: + app: {{ .Values.node.name }} + {{- include "blob.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: {{ .Values.node.name }} + {{- include "blob.labels" . | nindent 8 }} + {{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + {{- end }} + {{- if .Values.podLabels }} +{{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + {{- if or .Values.node.enableBlobfuseProxy .Values.node.enableAznfsMount }} + hostPID: true + {{- end }} + hostNetwork: true + dnsPolicy: Default + serviceAccountName: {{ .Values.serviceAccount.node }} + nodeSelector: + kubernetes.io/os: linux +{{- with .Values.node.nodeSelector }} +{{ toYaml . | indent 8 }} +{{- end }} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + {{- if .Values.node.affinity }} +{{- toYaml .Values.node.affinity | nindent 8 }} + {{- end }} + priorityClassName: {{ .Values.priorityClassName | quote }} + securityContext: + seccompProfile: + type: RuntimeDefault +{{- with .Values.node.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + initContainers: + - name: install-blobfuse-proxy +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE + value: "{{ .Values.node.blobfuseProxy.installBlobfuse }}" + - name: BLOBFUSE_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuseVersion }}" + - name: INSTALL_BLOBFUSE2 + value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}" + - name: BLOBFUSE2_VERSION + value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}" + - name: INSTALL_BLOBFUSE_PROXY + value: "{{ .Values.node.enableBlobfuseProxy }}" + - name: SET_MAX_OPEN_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}" + - name: MAX_FILE_NUM + value: "{{ .Values.node.blobfuseProxy.maxOpenFileNum }}" + - name: DISABLE_UPDATEDB + value: "{{ .Values.node.blobfuseProxy.disableUpdateDB }}" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-usr-local + mountPath: /host/usr/local + - name: host-etc + mountPath: /host/etc + containers: + - name: liveness-probe + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - mountPath: /csi + name: socket-dir +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- else }} + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" +{{- end }} + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port={{ .Values.node.livenessProbe.healthPort }} + - --v=2 + resources: {{- toYaml .Values.node.resources.livenessProbe | nindent 12 }} + - name: node-driver-registrar +{{- if hasPrefix "/" .Values.image.nodeDriverRegistrar.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- else }} + image: "{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" +{{- end }} + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }}/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: {{- toYaml .Values.node.resources.nodeDriverRegistrar | nindent 12 }} + - name: blob +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + args: + - "--v={{ .Values.node.logLevel }}" + - "--endpoint=$(CSI_ENDPOINT)" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--enable-blobfuse-proxy={{ .Values.node.enableBlobfuseProxy }}" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--drivername={{ .Values.driver.name }}" + - "--cloud-config-secret-name={{ .Values.node.cloudConfigSecretName }}" + - "--cloud-config-secret-namespace={{ .Values.node.cloudConfigSecretNamespace }}" + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" + - "--allow-empty-cloud-config={{ .Values.node.allowEmptyCloudConfig }}" + - "--enable-get-volume-stats={{ .Values.feature.enableGetVolumeStats }}" + - "--append-timestamp-cache-dir={{ .Values.node.appendTimeStampInCacheDir }}" + - "--mount-permissions={{ .Values.node.mountPermissions }}" + - "--allow-inline-volume-key-access-with-idenitity={{ .Values.node.allowInlineVolumeKeyAccessWithIdentity }}" + - "--enable-aznfs-mount={{ .Values.node.enableAznfsMount }}" + ports: + - containerPort: {{ .Values.node.livenessProbe.healthPort }} + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + {{- if ne .Values.driver.httpsProxy "" }} + - name: HTTPS_PROXY + value: {{ .Values.driver.httpsProxy }} + {{- end }} + {{- if ne .Values.driver.httpProxy "" }} + - name: HTTP_PROXY + value: {{ .Values.driver.httpProxy }} + {{- end }} + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: AZURE_GO_SDK_LOG_LEVEL + value: {{ .Values.driver.azureGoSDKLogLevel }} + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: AZURE_ENVIRONMENT_FILEPATH + value: /etc/kubernetes/azurestackcloud.json + {{- end }} + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + mountPath: /etc/ssl/certs + readOnly: true + - name: ssl-pki + mountPath: /etc/pki/ca-trust/extracted + readOnly: true + {{- end }} + {{- if .Values.node.enableAznfsMount }} + - mountPath: /opt/microsoft/aznfs/data + name: aznfs-data + {{- end }} + resources: {{- toYaml .Values.node.resources.blob | nindent 12 }} +{{- if .Values.node.enableAznfsMount }} + - name: aznfswatchdog +{{- if hasPrefix "/" .Values.image.blob.repository }} + image: "{{ .Values.image.baseRepo }}{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- else }} + image: "{{ .Values.image.blob.repository }}:{{ .Values.image.blob.tag }}" +{{- end }} + command: + - "aznfswatchdog" + imagePullPolicy: {{ .Values.image.blob.pullPolicy }} + securityContext: + privileged: true + resources: {{- toYaml .Values.node.resources.aznfswatchdog | nindent 12 }} + volumeMounts: + - mountPath: /opt/microsoft/aznfs/data + name: aznfs-data + - mountPath: {{ .Values.linux.kubelet }}/ + mountPropagation: Bidirectional + name: mountpoint-dir +{{- end }} + volumes: + - name: host-usr + hostPath: + path: /usr + - name: host-usr-local + hostPath: + path: /usr/local + - name: host-etc + hostPath: + path: /etc + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }} + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: {{ .Values.linux.kubelet }}/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: {{ .Values.node.blobfuseCachePath }} + name: blob-cache + {{- if eq .Values.cloud "AzureStackCloud" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + {{- end }} + {{- if eq .Values.linux.distro "fedora" }} + - name: ssl + hostPath: + path: /etc/ssl/certs + - name: ssl-pki + hostPath: + path: /etc/pki/ca-trust/extracted + {{- end }} + {{- if .Values.node.enableAznfsMount }} + - hostPath: + path: /opt/microsoft/aznfs/data + type: DirectoryOrCreate + name: aznfs-data + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} diff --git a/charts/v1.23.2/blob-csi-driver/templates/rbac-csi-blob-controller.yaml b/charts/v1.23.2/blob-csi-driver/templates/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..833dcc640 --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/templates/rbac-csi-blob-controller.yaml @@ -0,0 +1,115 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-provisioner-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-provisioner-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-provisioner-role + apiGroup: rbac.authorization.k8s.io + +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-external-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.rbac.name }}-csi-resizer-role + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }}-external-resizer-role + apiGroup: rbac.authorization.k8s.io + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-controller-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-controller-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.23.2/blob-csi-driver/templates/rbac-csi-blob-node.yaml b/charts/v1.23.2/blob-csi-driver/templates/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..c041cf8db --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/templates/rbac-csi-blob-node.yaml @@ -0,0 +1,29 @@ +{{- if .Values.rbac.create -}} +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-role + labels: + {{- include "blob.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-{{ .Values.rbac.name }}-node-secret-binding + labels: + {{- include "blob.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: csi-{{ .Values.rbac.name }}-node-secret-role + apiGroup: rbac.authorization.k8s.io +{{ end }} diff --git a/charts/v1.23.2/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml b/charts/v1.23.2/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml new file mode 100644 index 000000000..7433bccf1 --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/templates/serviceaccount-csi-blob-controller.yaml @@ -0,0 +1,17 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.controller }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + annotations: + azure.workload.identity/client-id: {{ .Values.workloadIdentity.clientID }} +{{- if .Values.workloadIdentity.tenantID }} + azure.workload.identity/tenant-id: {{ .Values.workloadIdentity.tenantID }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/v1.23.2/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml b/charts/v1.23.2/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml new file mode 100644 index 000000000..a25090e30 --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/templates/serviceaccount-csi-blob-node.yaml @@ -0,0 +1,17 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.node }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "blob.labels" . | nindent 4 }} +{{- if .Values.workloadIdentity.clientID }} + azure.workload.identity/use: "true" + annotations: + azure.workload.identity/client-id: {{ .Values.workloadIdentity.clientID }} +{{- if .Values.workloadIdentity.tenantID }} + azure.workload.identity/tenant-id: {{ .Values.workloadIdentity.tenantID }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/charts/v1.23.2/blob-csi-driver/values.yaml b/charts/v1.23.2/blob-csi-driver/values.yaml new file mode 100644 index 000000000..1e8c4c997 --- /dev/null +++ b/charts/v1.23.2/blob-csi-driver/values.yaml @@ -0,0 +1,180 @@ +image: + baseRepo: mcr.microsoft.com + blob: + repository: /oss/kubernetes-csi/blob-csi + tag: v1.23.2 + pullPolicy: IfNotPresent + csiProvisioner: + repository: /oss/kubernetes-csi/csi-provisioner + tag: v3.5.0 + pullPolicy: IfNotPresent + livenessProbe: + repository: /oss/kubernetes-csi/livenessprobe + tag: v2.10.0 + pullPolicy: IfNotPresent + nodeDriverRegistrar: + repository: /oss/kubernetes-csi/csi-node-driver-registrar + tag: v2.8.0 + pullPolicy: IfNotPresent + csiResizer: + repository: /oss/kubernetes-csi/csi-resizer + tag: v1.8.0 + pullPolicy: IfNotPresent + +cloud: AzurePublicCloud + +## Reference to one or more secrets to be used when pulling images +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# - name: myRegistryKeySecretName + +serviceAccount: + create: true # When true, service accounts will be created for you. Set to false if you want to use your own. + controller: csi-blob-controller-sa # Name of Service Account to be created or used + node: csi-blob-node-sa # Name of Service Account to be created or used + +rbac: + create: true + name: blob + +## Collection of annotations to add to all the pods +podAnnotations: {} +## Collection of labels to add to all the pods +podLabels: {} +# -- Custom labels to add into metadata +customLabels: {} + # k8s-app: blob-csi-driver + +## Leverage a PriorityClass to ensure your pods survive resource shortages +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +priorityClassName: system-cluster-critical +## Security context give the opportunity to run container as nonroot by setting a securityContext +## by example : +## securityContext: { runAsUser: 1001 } +securityContext: {} + +controller: + name: csi-blob-controller + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + hostNetwork: true # this setting could be disabled if controller does not depend on MSI setting + metricsPort: 29634 + livenessProbe: + healthPort: 29632 + replicas: 2 + runOnMaster: false + runOnControlPlane: false + logLevel: 5 + resources: + csiProvisioner: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + csiResizer: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + +node: + name: csi-blob-node + cloudConfigSecretName: azure-cloud-provider + cloudConfigSecretNamespace: kube-system + allowEmptyCloudConfig: true + allowInlineVolumeKeyAccessWithIdentity: false + maxUnavailable: 1 + livenessProbe: + healthPort: 29633 + logLevel: 5 + enableBlobfuseProxy: true + blobfuseProxy: + installBlobfuse: true + blobfuseVersion: "1.4.5" + installBlobfuse2: true + blobfuse2Version: "2.1.0" + setMaxOpenFileNum: true + maxOpenFileNum: "9000000" + disableUpdateDB: true + blobfuseCachePath: /mnt + appendTimeStampInCacheDir: false + mountPermissions: 0777 + resources: + livenessProbe: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + nodeDriverRegistrar: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + blob: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + aznfswatchdog: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + affinity: {} + nodeSelector: {} + tolerations: + - operator: "Exists" + enableAznfsMount: true + +feature: + fsGroupPolicy: ReadWriteOnceWithFSType + enableGetVolumeStats: false + +driver: + name: blob.csi.azure.com + customUserAgent: "" + userAgentSuffix: "OSS-helm" + azureGoSDKLogLevel: "" # available values: ""(no logs), DEBUG, INFO, WARNING, ERROR + httpsProxy: "" + httpProxy: "" + +linux: + kubelet: /var/lib/kubelet + distro: debian + +workloadIdentity: + clientID: "" + # [optional] If the AAD application or user-assigned managed identity is not in the same tenant as the cluster + # then set tenantID with the application or user-assigned managed identity tenant ID + tenantID: "" diff --git a/deploy/blobfuse-proxy/README.md b/deploy/blobfuse-proxy/README.md index 988b78975..0952af918 100644 --- a/deploy/blobfuse-proxy/README.md +++ b/deploy/blobfuse-proxy/README.md @@ -9,19 +9,19 @@ This guide shows how to install a blobfuse proxy on all agent nodes and the prox - helm install ```console helm repo add blob-csi-driver https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts -helm install blob-csi-driver blob-csi-driver/blob-csi-driver --namespace kube-system --version v1.22.0 --set node.enableBlobfuseProxy=true +helm install blob-csi-driver blob-csi-driver/blob-csi-driver --namespace kube-system --version v1.23.1 --set node.enableBlobfuseProxy=true ``` - kubectl install ```console -curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.22.0/deploy/install-driver.sh | bash -s v1.22.0 blobfuse-proxy -- +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.23.1/deploy/install-driver.sh | bash -s v1.23.1 blobfuse-proxy -- ``` ### Enable blobfuse proxy on existing Blob CSI driver - install blobfuse proxy daemonset -> following config only works on debian based agent node +> blobfuse proxy is supported on CoreOS(OpenShift) from v1.23.2 ```console -kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/v1.22.0/blobfuse-proxy.yaml +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/v1.23.1/blobfuse-proxy.yaml ``` - set `enable-blobfuse-proxy=true` in existing `csi-blob-node` daemonset manually (default is `false`) ```console diff --git a/deploy/csi-blob-controller.yaml b/deploy/csi-blob-controller.yaml index 55e005281..c1054ad57 100644 --- a/deploy/csi-blob-controller.yaml +++ b/deploy/csi-blob-controller.yaml @@ -35,7 +35,7 @@ spec: effect: "NoSchedule" containers: - name: csi-provisioner - image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v3.6.1 + image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v3.6.2 args: - "-v=2" - "--csi-address=$(ADDRESS)" @@ -117,7 +117,7 @@ spec: cpu: 10m memory: 20Mi - name: csi-resizer - image: mcr.microsoft.com/oss/kubernetes-csi/csi-resizer:v1.9.1 + image: mcr.microsoft.com/oss/kubernetes-csi/csi-resizer:v1.9.2 args: - "-csi-address=$(ADDRESS)" - "-v=2" diff --git a/deploy/csi-blob-node.yaml b/deploy/csi-blob-node.yaml index de9a03248..2f7ade765 100644 --- a/deploy/csi-blob-node.yaml +++ b/deploy/csi-blob-node.yaml @@ -58,7 +58,7 @@ spec: - name: INSTALL_BLOBFUSE2 value: "true" - name: BLOBFUSE2_VERSION - value: "2.1.0" + value: "2.1.2" - name: SET_MAX_OPEN_FILE_NUM value: "true" - name: MAX_FILE_NUM @@ -68,6 +68,8 @@ spec: volumeMounts: - name: host-usr mountPath: /host/usr + - name: host-usr-local + mountPath: /host/usr/local - name: host-etc mountPath: /host/etc containers: @@ -88,7 +90,7 @@ spec: cpu: 10m memory: 20Mi - name: node-driver-registrar - image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.9.0 + image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.9.1 args: - --csi-address=$(ADDRESS) - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) @@ -181,6 +183,9 @@ spec: - name: host-usr hostPath: path: /usr + - name: host-usr-local + hostPath: + path: /usr/local - name: host-etc hostPath: path: /etc diff --git a/deploy/example/cloning/README.md b/deploy/example/cloning/README.md new file mode 100644 index 000000000..c81e11482 --- /dev/null +++ b/deploy/example/cloning/README.md @@ -0,0 +1,66 @@ +# Volume Cloning Example +## Feature Status: Beta + +- supported from v1.23.2 + +## Create a Source PVC + +```console +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/storageclass-blobfuse2.yaml +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/pvc-blob-csi.yaml +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/nginx-pod-blob.yaml +``` + +### Check the Source PVC + +```console +$ kubectl exec nginx-blob -- ls /mnt/blob +outfile +``` + +## Create a PVC from an existing PVC +> Make sure application is not writing data to source blob container +```console +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/cloning/pvc-blob-cloning.yaml +``` +### Check the Creation Status + +```console +$ kubectl describe pvc pvc-blob-cloning +Name: pvc-blob-cloning +Namespace: default +StorageClass: blob-fuse +Status: Bound +Volume: pvc-6db5af93-3b32-4c24-a68e-b727d7801fd5 +Labels: +Annotations: kubectl.kubernetes.io/last-applied-configuration: + {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"name":"pvc-blob-cloning","namespace":"default"},"spec":{"a... + pv.kubernetes.io/bind-completed: yes + pv.kubernetes.io/bound-by-controller: yes + volume.beta.kubernetes.io/storage-provisioner: blob.csi.azure.com + volume.kubernetes.io/storage-provisioner: blob.csi.azure.com +Finalizers: [kubernetes.io/pvc-protection] +Capacity: 100Gi +Access Modes: RWX +VolumeMode: Filesystem +Mounted By: +Events: + Type Reason Age From Message + ---- ------ ---- ---- ------- + Normal Provisioning 16s blob.csi.azure.com_aks-nodepool1-34988195-vmss000002_8ecdf8ad-b636-4ca5-81ee-0f1a49337168 External provisioner is provisioning volume for claim "default/pvc-blob-cloning" + Normal ExternalProvisioning 14s (x3 over 16s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "blob.csi.azure.com" or manually created by system administrator + Normal ProvisioningSucceeded 8s blob.csi.azure.com_aks-nodepool1-34988195-vmss000002_8ecdf8ad-b636-4ca5-81ee-0f1a49337168 Successfully provisioned volume pvc-6db5af93-3b32-4c24-a68e-b727d7801fd5 +``` + +## Restore the PVC into a Pod + +```console +kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/deploy/example/cloning/nginx-pod-restored-cloning.yaml +``` + +### Check Sample Data + +```console +$ kubectl exec nginx-blob-restored-cloning -- ls /mnt/blob +outfile +``` diff --git a/deploy/example/cloning/nginx-pod-restored-cloning.yaml b/deploy/example/cloning/nginx-pod-restored-cloning.yaml new file mode 100644 index 000000000..77fe17dc4 --- /dev/null +++ b/deploy/example/cloning/nginx-pod-restored-cloning.yaml @@ -0,0 +1,21 @@ +--- +kind: Pod +apiVersion: v1 +metadata: + name: nginx-blob-restored-cloning +spec: + nodeSelector: + kubernetes.io/os: linux + containers: + - image: mcr.microsoft.com/oss/nginx/nginx:1.17.3-alpine + name: nginx-blob-restored-cloning + args: + - sleep + - "3600" + volumeMounts: + - name: blob-cloning + mountPath: "/mnt/blob" + volumes: + - name: blob-cloning + persistentVolumeClaim: + claimName: pvc-blob-cloning diff --git a/deploy/example/pvc-blob-csi-clone.yaml b/deploy/example/cloning/pvc-blob-csi-cloning.yaml similarity index 91% rename from deploy/example/pvc-blob-csi-clone.yaml rename to deploy/example/cloning/pvc-blob-csi-cloning.yaml index d24da9016..16d32b865 100644 --- a/deploy/example/pvc-blob-csi-clone.yaml +++ b/deploy/example/cloning/pvc-blob-csi-cloning.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: pvc-blob-clone + name: pvc-blob-cloning namespace: default spec: accessModes: diff --git a/deploy/example/e2e_usage.md b/deploy/example/e2e_usage.md index 2a670357e..2f60f4fe9 100644 --- a/deploy/example/e2e_usage.md +++ b/deploy/example/e2e_usage.md @@ -93,7 +93,6 @@ spec: persistentVolumeReclaimPolicy: Retain csi: driver: blob.csi.azure.com - readOnly: false # make sure volumeid is unique for every storage blob container in the cluster # the # character is reserved for internal use, the / character is not allowed volumeHandle: account-name_container-name diff --git a/deploy/example/nfs/README.md b/deploy/example/nfs/README.md index 47f476973..2ef0460a8 100644 --- a/deploy/example/nfs/README.md +++ b/deploy/example/nfs/README.md @@ -19,8 +19,11 @@ kind: StorageClass metadata: name: blob-nfs provisioner: blob.csi.azure.com +allowVolumeExpansion: true parameters: protocol: nfs +mountOptions: + - nconnect=4 ``` run following command to create a storage class: diff --git a/deploy/example/nginx-blobfuse-inline-volume.yaml b/deploy/example/nginx-blobfuse-inline-volume.yaml index 98b141c6f..8a0c82d19 100644 --- a/deploy/example/nginx-blobfuse-inline-volume.yaml +++ b/deploy/example/nginx-blobfuse-inline-volume.yaml @@ -16,6 +16,7 @@ spec: volumeMounts: - name: persistent-storage mountPath: "/mnt/blobfuse" + readOnly: false volumes: - name: persistent-storage csi: diff --git a/deploy/example/nginx-pod-blob.yaml b/deploy/example/nginx-pod-blob.yaml index dd04166d3..0dcbbd5da 100644 --- a/deploy/example/nginx-pod-blob.yaml +++ b/deploy/example/nginx-pod-blob.yaml @@ -16,6 +16,7 @@ spec: volumeMounts: - name: blob01 mountPath: "/mnt/blob" + readOnly: false volumes: - name: blob01 persistentVolumeClaim: diff --git a/deploy/example/pv-blobfuse-auth.yaml b/deploy/example/pv-blobfuse-auth.yaml index 1b132a612..29e4d42c3 100644 --- a/deploy/example/pv-blobfuse-auth.yaml +++ b/deploy/example/pv-blobfuse-auth.yaml @@ -17,7 +17,6 @@ spec: - --file-cache-timeout-in-seconds=120 csi: driver: blob.csi.azure.com - readOnly: false # make sure volumeid is unique for every storage blob container in the cluster # the # character is reserved for internal use, the / character is not allowed volumeHandle: account-name_container-name diff --git a/deploy/example/pv-blobfuse-csi-keyvault.yaml b/deploy/example/pv-blobfuse-csi-keyvault.yaml index 49dd56098..9a67b8053 100644 --- a/deploy/example/pv-blobfuse-csi-keyvault.yaml +++ b/deploy/example/pv-blobfuse-csi-keyvault.yaml @@ -14,7 +14,6 @@ spec: storageClassName: blob-fuse csi: driver: blob.csi.azure.com - readOnly: false # make sure volumeid is unique for every storage blob container in the cluster # the # character is reserved for internal use, the / character is not allowed volumeHandle: account-name_container-name diff --git a/deploy/example/pv-blobfuse-csi.yaml b/deploy/example/pv-blobfuse-csi.yaml index a83a9302f..66f377d3e 100644 --- a/deploy/example/pv-blobfuse-csi.yaml +++ b/deploy/example/pv-blobfuse-csi.yaml @@ -17,7 +17,6 @@ spec: - --file-cache-timeout-in-seconds=120 csi: driver: blob.csi.azure.com - readOnly: false # make sure volumeid is unique for every storage blob container in the cluster # the # character is reserved for internal use, the / character is not allowed volumeHandle: account-name_container-name diff --git a/deploy/example/pv-blobfuse-nfs.yaml b/deploy/example/pv-blobfuse-nfs.yaml index 796132f69..78edd0e14 100644 --- a/deploy/example/pv-blobfuse-nfs.yaml +++ b/deploy/example/pv-blobfuse-nfs.yaml @@ -12,9 +12,10 @@ spec: - ReadWriteMany persistentVolumeReclaimPolicy: Retain storageClassName: blob-nfs + mountOptions: + - nconnect=4 csi: driver: blob.csi.azure.com - readOnly: false # make sure volumeid is unique for every storage blob container in the cluster # the # character is reserved for internal use, the / character is not allowed volumeHandle: account-name_container-name diff --git a/deploy/example/statefulset-nfs.yaml b/deploy/example/statefulset-nfs.yaml index 4a76facb9..d9fa0caf3 100644 --- a/deploy/example/statefulset-nfs.yaml +++ b/deploy/example/statefulset-nfs.yaml @@ -25,6 +25,7 @@ spec: volumeMounts: - name: persistent-storage mountPath: /mnt/blob + readOnly: false updateStrategy: type: RollingUpdate selector: diff --git a/deploy/example/statefulset-nonroot-nfs.yaml b/deploy/example/statefulset-nonroot-nfs.yaml index 7c917cac7..77d34a732 100644 --- a/deploy/example/statefulset-nonroot-nfs.yaml +++ b/deploy/example/statefulset-nonroot-nfs.yaml @@ -29,6 +29,7 @@ spec: volumeMounts: - name: persistent-storage mountPath: /mnt/blob + readOnly: false updateStrategy: type: RollingUpdate selector: diff --git a/deploy/example/statefulset-nonroot.yaml b/deploy/example/statefulset-nonroot.yaml index 27453c14b..ac6c2399e 100644 --- a/deploy/example/statefulset-nonroot.yaml +++ b/deploy/example/statefulset-nonroot.yaml @@ -29,6 +29,7 @@ spec: volumeMounts: - name: persistent-storage mountPath: /mnt/blob + readOnly: false updateStrategy: type: RollingUpdate selector: diff --git a/deploy/example/statefulset.yaml b/deploy/example/statefulset.yaml index 0baf655f1..c7ae3ad7b 100644 --- a/deploy/example/statefulset.yaml +++ b/deploy/example/statefulset.yaml @@ -25,6 +25,7 @@ spec: volumeMounts: - name: persistent-storage mountPath: /mnt/blob + readOnly: false updateStrategy: type: RollingUpdate selector: diff --git a/deploy/example/storageclass-blob-nfs.yaml b/deploy/example/storageclass-blob-nfs.yaml index 71e998e21..5492327cf 100644 --- a/deploy/example/storageclass-blob-nfs.yaml +++ b/deploy/example/storageclass-blob-nfs.yaml @@ -8,3 +8,5 @@ parameters: protocol: nfs volumeBindingMode: Immediate allowVolumeExpansion: true +mountOptions: + - nconnect=4 diff --git a/deploy/example/storageclass-blobfuse.yaml b/deploy/example/storageclass-blobfuse.yaml index c710d822e..bfdb62654 100644 --- a/deploy/example/storageclass-blobfuse.yaml +++ b/deploy/example/storageclass-blobfuse.yaml @@ -5,7 +5,7 @@ metadata: name: blob-fuse provisioner: blob.csi.azure.com parameters: - skuName: Premium_LRS # available values: Standard_LRS, Premium_LRS, Standard_GRS, Standard_RAGRS + skuName: Premium_LRS # available values: Standard_LRS, Premium_LRS, Standard_GRS, Standard_RAGRS, Standard_ZRS, Premium_ZRS reclaimPolicy: Delete volumeBindingMode: Immediate allowVolumeExpansion: true diff --git a/deploy/example/storageclass-blobfuse2.yaml b/deploy/example/storageclass-blobfuse2.yaml index e6b6391f1..c968a68a1 100644 --- a/deploy/example/storageclass-blobfuse2.yaml +++ b/deploy/example/storageclass-blobfuse2.yaml @@ -5,7 +5,7 @@ metadata: name: blob-fuse provisioner: blob.csi.azure.com parameters: - skuName: Premium_LRS # available values: Standard_LRS, Premium_LRS, Standard_GRS, Standard_RAGRS + skuName: Premium_LRS # available values: Standard_LRS, Premium_LRS, Standard_GRS, Standard_RAGRS, Standard_ZRS, Premium_ZRS protocol: fuse2 reclaimPolicy: Delete volumeBindingMode: Immediate diff --git a/deploy/v1.19.6/csi-blob-controller.yaml b/deploy/v1.19.6/csi-blob-controller.yaml new file mode 100644 index 000000000..77ef41599 --- /dev/null +++ b/deploy/v1.19.6/csi-blob-controller.yaml @@ -0,0 +1,140 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: csi-blob-controller + namespace: kube-system +spec: + replicas: 2 + selector: + matchLabels: + app: csi-blob-controller + template: + metadata: + labels: + app: csi-blob-controller + spec: + hostNetwork: true + serviceAccountName: csi-blob-controller-sa + nodeSelector: + kubernetes.io/os: linux # add "kubernetes.io/role: master" to run controller on master node + priorityClassName: system-cluster-critical + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + containers: + - name: csi-provisioner + image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v3.3.0 + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace=kube-system" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + - name: liveness-probe + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.8.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29632 + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.19.6 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:29634" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29632 + name: healthz + protocol: TCP + - containerPort: 29634 + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + resources: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + - name: csi-resizer + image: mcr.microsoft.com/oss/kubernetes-csi/csi-resizer:v1.5.0 + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace=kube-system" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate diff --git a/deploy/v1.19.6/csi-blob-driver.yaml b/deploy/v1.19.6/csi-blob-driver.yaml new file mode 100644 index 000000000..7b216feab --- /dev/null +++ b/deploy/v1.19.6/csi-blob-driver.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: blob.csi.azure.com +spec: + attachRequired: false + podInfoOnMount: true + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/deploy/v1.19.6/csi-blob-node.yaml b/deploy/v1.19.6/csi-blob-node.yaml new file mode 100644 index 000000000..a2a3a1b8a --- /dev/null +++ b/deploy/v1.19.6/csi-blob-node.yaml @@ -0,0 +1,201 @@ +--- +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: csi-blob-node + namespace: kube-system +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + app: csi-blob-node + template: + metadata: + labels: + app: csi-blob-node + spec: + hostNetwork: true + hostPID: true + dnsPolicy: Default + serviceAccountName: csi-blob-node-sa + nodeSelector: + kubernetes.io/os: linux + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + priorityClassName: system-node-critical + tolerations: + - operator: "Exists" + initContainers: + - name: install-blobfuse-proxy + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.19.6 + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE_PROXY + value: "true" + - name: INSTALL_BLOBFUSE + value: "true" + - name: BLOBFUSE_VERSION + value: "" + - name: INSTALL_BLOBFUSE2 + value: "true" + - name: BLOBFUSE2_VERSION + value: "" + - name: SET_MAX_OPEN_FILE_NUM + value: "true" + - name: MAX_FILE_NUM + value: "9000000" + - name: DISABLE_UPDATEDB + value: "true" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc + containers: + - name: liveness-probe + volumeMounts: + - mountPath: /csi + name: socket-dir + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.8.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29633 + - --v=2 + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: node-driver-registrar + image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.6.2 + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: /var/lib/kubelet/plugins/blob.csi.azure.com/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.19.6 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--enable-blobfuse-proxy=false" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--metrics-address=0.0.0.0:29635" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29633 + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /var/lib/kubelet/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + resources: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc + - hostPath: + path: /var/lib/kubelet/plugins/blob.csi.azure.com + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: /var/lib/kubelet/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: /mnt + type: DirectoryOrCreate + name: blob-cache +--- diff --git a/deploy/v1.19.6/kustomization.yaml b/deploy/v1.19.6/kustomization.yaml new file mode 100644 index 000000000..8b7f5fcac --- /dev/null +++ b/deploy/v1.19.6/kustomization.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - csi-blob-controller.yaml + - csi-blob-driver.yaml + - csi-blob-node.yaml + - rbac-csi-blob-controller.yaml + - rbac-csi-blob-node.yaml + - blobfuse-proxy.yaml diff --git a/deploy/v1.19.6/rbac-csi-blob-controller.yaml b/deploy/v1.19.6/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..89c2f1f38 --- /dev/null +++ b/deploy/v1.19.6/rbac-csi-blob-controller.yaml @@ -0,0 +1,108 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-controller-sa + namespace: kube-system +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-provisioner-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-provisioner-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-provisioner-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-resizer-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-resizer-role +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-resizer-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-controller-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.19.6/rbac-csi-blob-node.yaml b/deploy/v1.19.6/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..ce06d862c --- /dev/null +++ b/deploy/v1.19.6/rbac-csi-blob-node.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-node-sa + namespace: kube-system + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-node-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-node-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.21.5/csi-blob-controller.yaml b/deploy/v1.21.5/csi-blob-controller.yaml new file mode 100644 index 000000000..536618a5c --- /dev/null +++ b/deploy/v1.21.5/csi-blob-controller.yaml @@ -0,0 +1,143 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: csi-blob-controller + namespace: kube-system +spec: + replicas: 2 + selector: + matchLabels: + app: csi-blob-controller + template: + metadata: + labels: + app: csi-blob-controller + spec: + hostNetwork: true + serviceAccountName: csi-blob-controller-sa + nodeSelector: + kubernetes.io/os: linux # add "kubernetes.io/role: master" to run controller on master node + priorityClassName: system-cluster-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + containers: + - name: csi-provisioner + image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v3.3.0 + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace=kube-system" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + - name: liveness-probe + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.8.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29632 + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.21.5 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:29634" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29632 + name: healthz + protocol: TCP + - containerPort: 29634 + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + resources: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + - name: csi-resizer + image: mcr.microsoft.com/oss/kubernetes-csi/csi-resizer:v1.5.0 + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace=kube-system" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate diff --git a/deploy/v1.21.5/csi-blob-driver.yaml b/deploy/v1.21.5/csi-blob-driver.yaml new file mode 100644 index 000000000..7b216feab --- /dev/null +++ b/deploy/v1.21.5/csi-blob-driver.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: blob.csi.azure.com +spec: + attachRequired: false + podInfoOnMount: true + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/deploy/v1.21.5/csi-blob-node.yaml b/deploy/v1.21.5/csi-blob-node.yaml new file mode 100644 index 000000000..f074ef063 --- /dev/null +++ b/deploy/v1.21.5/csi-blob-node.yaml @@ -0,0 +1,203 @@ +--- +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: csi-blob-node + namespace: kube-system +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + app: csi-blob-node + template: + metadata: + labels: + app: csi-blob-node + spec: + hostNetwork: true + hostPID: true + dnsPolicy: Default + serviceAccountName: csi-blob-node-sa + nodeSelector: + kubernetes.io/os: linux + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + priorityClassName: system-node-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - operator: "Exists" + initContainers: + - name: install-blobfuse-proxy + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.21.5 + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE_PROXY + value: "true" + - name: INSTALL_BLOBFUSE + value: "true" + - name: BLOBFUSE_VERSION + value: "" + - name: INSTALL_BLOBFUSE2 + value: "true" + - name: BLOBFUSE2_VERSION + value: "" + - name: SET_MAX_OPEN_FILE_NUM + value: "true" + - name: MAX_FILE_NUM + value: "9000000" + - name: DISABLE_UPDATEDB + value: "true" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc + containers: + - name: liveness-probe + volumeMounts: + - mountPath: /csi + name: socket-dir + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.8.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29633 + - --v=2 + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: node-driver-registrar + image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.6.2 + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: /var/lib/kubelet/plugins/blob.csi.azure.com/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.21.5 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--enable-blobfuse-proxy=false" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29633 + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /var/lib/kubelet/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + resources: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc + - hostPath: + path: /var/lib/kubelet/plugins/blob.csi.azure.com + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: /var/lib/kubelet/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: /mnt + type: DirectoryOrCreate + name: blob-cache +--- diff --git a/deploy/v1.21.5/kustomization.yaml b/deploy/v1.21.5/kustomization.yaml new file mode 100644 index 000000000..8b7f5fcac --- /dev/null +++ b/deploy/v1.21.5/kustomization.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - csi-blob-controller.yaml + - csi-blob-driver.yaml + - csi-blob-node.yaml + - rbac-csi-blob-controller.yaml + - rbac-csi-blob-node.yaml + - blobfuse-proxy.yaml diff --git a/deploy/v1.21.5/rbac-csi-blob-controller.yaml b/deploy/v1.21.5/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..89c2f1f38 --- /dev/null +++ b/deploy/v1.21.5/rbac-csi-blob-controller.yaml @@ -0,0 +1,108 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-controller-sa + namespace: kube-system +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-provisioner-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-provisioner-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-provisioner-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-resizer-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-resizer-role +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-resizer-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-controller-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.21.5/rbac-csi-blob-node.yaml b/deploy/v1.21.5/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..ce06d862c --- /dev/null +++ b/deploy/v1.21.5/rbac-csi-blob-node.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-node-sa + namespace: kube-system + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-node-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-node-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.21.6/csi-blob-controller.yaml b/deploy/v1.21.6/csi-blob-controller.yaml new file mode 100644 index 000000000..3dbbe1e1f --- /dev/null +++ b/deploy/v1.21.6/csi-blob-controller.yaml @@ -0,0 +1,143 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: csi-blob-controller + namespace: kube-system +spec: + replicas: 2 + selector: + matchLabels: + app: csi-blob-controller + template: + metadata: + labels: + app: csi-blob-controller + spec: + hostNetwork: true + serviceAccountName: csi-blob-controller-sa + nodeSelector: + kubernetes.io/os: linux # add "kubernetes.io/role: master" to run controller on master node + priorityClassName: system-cluster-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + containers: + - name: csi-provisioner + image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v3.3.0 + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace=kube-system" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + - name: liveness-probe + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.8.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29632 + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.21.6 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:29634" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29632 + name: healthz + protocol: TCP + - containerPort: 29634 + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + resources: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + - name: csi-resizer + image: mcr.microsoft.com/oss/kubernetes-csi/csi-resizer:v1.5.0 + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace=kube-system" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate diff --git a/deploy/v1.21.6/csi-blob-driver.yaml b/deploy/v1.21.6/csi-blob-driver.yaml new file mode 100644 index 000000000..7b216feab --- /dev/null +++ b/deploy/v1.21.6/csi-blob-driver.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: blob.csi.azure.com +spec: + attachRequired: false + podInfoOnMount: true + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/deploy/v1.21.6/csi-blob-node.yaml b/deploy/v1.21.6/csi-blob-node.yaml new file mode 100644 index 000000000..7da641761 --- /dev/null +++ b/deploy/v1.21.6/csi-blob-node.yaml @@ -0,0 +1,203 @@ +--- +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: csi-blob-node + namespace: kube-system +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + app: csi-blob-node + template: + metadata: + labels: + app: csi-blob-node + spec: + hostNetwork: true + hostPID: true + dnsPolicy: Default + serviceAccountName: csi-blob-node-sa + nodeSelector: + kubernetes.io/os: linux + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + priorityClassName: system-node-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - operator: "Exists" + initContainers: + - name: install-blobfuse-proxy + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.21.6 + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE_PROXY + value: "true" + - name: INSTALL_BLOBFUSE + value: "true" + - name: BLOBFUSE_VERSION + value: "" + - name: INSTALL_BLOBFUSE2 + value: "true" + - name: BLOBFUSE2_VERSION + value: "" + - name: SET_MAX_OPEN_FILE_NUM + value: "true" + - name: MAX_FILE_NUM + value: "9000000" + - name: DISABLE_UPDATEDB + value: "true" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc + containers: + - name: liveness-probe + volumeMounts: + - mountPath: /csi + name: socket-dir + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.8.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29633 + - --v=2 + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: node-driver-registrar + image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.6.2 + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: /var/lib/kubelet/plugins/blob.csi.azure.com/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.21.6 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--enable-blobfuse-proxy=false" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29633 + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /var/lib/kubelet/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + resources: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc + - hostPath: + path: /var/lib/kubelet/plugins/blob.csi.azure.com + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: /var/lib/kubelet/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: /mnt + type: DirectoryOrCreate + name: blob-cache +--- diff --git a/deploy/v1.21.6/kustomization.yaml b/deploy/v1.21.6/kustomization.yaml new file mode 100644 index 000000000..8b7f5fcac --- /dev/null +++ b/deploy/v1.21.6/kustomization.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - csi-blob-controller.yaml + - csi-blob-driver.yaml + - csi-blob-node.yaml + - rbac-csi-blob-controller.yaml + - rbac-csi-blob-node.yaml + - blobfuse-proxy.yaml diff --git a/deploy/v1.21.6/rbac-csi-blob-controller.yaml b/deploy/v1.21.6/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..89c2f1f38 --- /dev/null +++ b/deploy/v1.21.6/rbac-csi-blob-controller.yaml @@ -0,0 +1,108 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-controller-sa + namespace: kube-system +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-provisioner-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-provisioner-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-provisioner-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-resizer-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-resizer-role +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-resizer-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-controller-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.21.6/rbac-csi-blob-node.yaml b/deploy/v1.21.6/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..ce06d862c --- /dev/null +++ b/deploy/v1.21.6/rbac-csi-blob-node.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-node-sa + namespace: kube-system + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-node-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-node-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.22.3/csi-blob-controller.yaml b/deploy/v1.22.3/csi-blob-controller.yaml new file mode 100644 index 000000000..304763a3c --- /dev/null +++ b/deploy/v1.22.3/csi-blob-controller.yaml @@ -0,0 +1,143 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: csi-blob-controller + namespace: kube-system +spec: + replicas: 2 + selector: + matchLabels: + app: csi-blob-controller + template: + metadata: + labels: + app: csi-blob-controller + spec: + hostNetwork: true + serviceAccountName: csi-blob-controller-sa + nodeSelector: + kubernetes.io/os: linux # add "kubernetes.io/role: master" to run controller on master node + priorityClassName: system-cluster-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + containers: + - name: csi-provisioner + image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v3.5.0 + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace=kube-system" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + - name: liveness-probe + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.10.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29632 + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.22.3 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:29634" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29632 + name: healthz + protocol: TCP + - containerPort: 29634 + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + resources: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + - name: csi-resizer + image: mcr.microsoft.com/oss/kubernetes-csi/csi-resizer:v1.8.0 + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace=kube-system" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate diff --git a/deploy/v1.22.3/csi-blob-driver.yaml b/deploy/v1.22.3/csi-blob-driver.yaml new file mode 100644 index 000000000..d2de725d8 --- /dev/null +++ b/deploy/v1.22.3/csi-blob-driver.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: blob.csi.azure.com +spec: + attachRequired: false + podInfoOnMount: true + fsGroupPolicy: ReadWriteOnceWithFSType + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/deploy/v1.22.3/csi-blob-node.yaml b/deploy/v1.22.3/csi-blob-node.yaml new file mode 100644 index 000000000..6b4ffde05 --- /dev/null +++ b/deploy/v1.22.3/csi-blob-node.yaml @@ -0,0 +1,203 @@ +--- +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: csi-blob-node + namespace: kube-system +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + app: csi-blob-node + template: + metadata: + labels: + app: csi-blob-node + spec: + hostNetwork: true + hostPID: true + dnsPolicy: Default + serviceAccountName: csi-blob-node-sa + nodeSelector: + kubernetes.io/os: linux + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + priorityClassName: system-node-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - operator: "Exists" + initContainers: + - name: install-blobfuse-proxy + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.22.3 + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE_PROXY + value: "true" + - name: INSTALL_BLOBFUSE + value: "true" + - name: BLOBFUSE_VERSION + value: "1.4.5" + - name: INSTALL_BLOBFUSE2 + value: "true" + - name: BLOBFUSE2_VERSION + value: "2.1.2" + - name: SET_MAX_OPEN_FILE_NUM + value: "true" + - name: MAX_FILE_NUM + value: "9000000" + - name: DISABLE_UPDATEDB + value: "true" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc + containers: + - name: liveness-probe + volumeMounts: + - mountPath: /csi + name: socket-dir + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.10.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29633 + - --v=2 + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: node-driver-registrar + image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.8.0 + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: /var/lib/kubelet/plugins/blob.csi.azure.com/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.22.3 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--enable-blobfuse-proxy=false" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29633 + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /var/lib/kubelet/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + resources: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc + - hostPath: + path: /var/lib/kubelet/plugins/blob.csi.azure.com + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: /var/lib/kubelet/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: /mnt + type: DirectoryOrCreate + name: blob-cache +--- diff --git a/deploy/v1.22.3/kustomization.yaml b/deploy/v1.22.3/kustomization.yaml new file mode 100644 index 000000000..8b7f5fcac --- /dev/null +++ b/deploy/v1.22.3/kustomization.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - csi-blob-controller.yaml + - csi-blob-driver.yaml + - csi-blob-node.yaml + - rbac-csi-blob-controller.yaml + - rbac-csi-blob-node.yaml + - blobfuse-proxy.yaml diff --git a/deploy/v1.22.3/rbac-csi-blob-controller.yaml b/deploy/v1.22.3/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..89c2f1f38 --- /dev/null +++ b/deploy/v1.22.3/rbac-csi-blob-controller.yaml @@ -0,0 +1,108 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-controller-sa + namespace: kube-system +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-provisioner-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-provisioner-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-provisioner-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-resizer-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-resizer-role +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-resizer-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-controller-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.22.3/rbac-csi-blob-node.yaml b/deploy/v1.22.3/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..ce06d862c --- /dev/null +++ b/deploy/v1.22.3/rbac-csi-blob-node.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-node-sa + namespace: kube-system + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-node-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-node-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.22.4/csi-blob-controller.yaml b/deploy/v1.22.4/csi-blob-controller.yaml new file mode 100644 index 000000000..200cb2b7d --- /dev/null +++ b/deploy/v1.22.4/csi-blob-controller.yaml @@ -0,0 +1,143 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: csi-blob-controller + namespace: kube-system +spec: + replicas: 2 + selector: + matchLabels: + app: csi-blob-controller + template: + metadata: + labels: + app: csi-blob-controller + spec: + hostNetwork: true + serviceAccountName: csi-blob-controller-sa + nodeSelector: + kubernetes.io/os: linux # add "kubernetes.io/role: master" to run controller on master node + priorityClassName: system-cluster-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + containers: + - name: csi-provisioner + image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v3.5.0 + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace=kube-system" + - "--timeout=120s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + - name: liveness-probe + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.10.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29632 + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.22.4 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:29634" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29632 + name: healthz + protocol: TCP + - containerPort: 29634 + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + resources: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + - name: csi-resizer + image: mcr.microsoft.com/oss/kubernetes-csi/csi-resizer:v1.8.0 + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace=kube-system" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate diff --git a/deploy/v1.22.4/csi-blob-driver.yaml b/deploy/v1.22.4/csi-blob-driver.yaml new file mode 100644 index 000000000..d2de725d8 --- /dev/null +++ b/deploy/v1.22.4/csi-blob-driver.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: blob.csi.azure.com +spec: + attachRequired: false + podInfoOnMount: true + fsGroupPolicy: ReadWriteOnceWithFSType + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/deploy/v1.22.4/csi-blob-node.yaml b/deploy/v1.22.4/csi-blob-node.yaml new file mode 100644 index 000000000..778d40161 --- /dev/null +++ b/deploy/v1.22.4/csi-blob-node.yaml @@ -0,0 +1,203 @@ +--- +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: csi-blob-node + namespace: kube-system +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + app: csi-blob-node + template: + metadata: + labels: + app: csi-blob-node + spec: + hostNetwork: true + hostPID: true + dnsPolicy: Default + serviceAccountName: csi-blob-node-sa + nodeSelector: + kubernetes.io/os: linux + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + priorityClassName: system-node-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - operator: "Exists" + initContainers: + - name: install-blobfuse-proxy + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.22.4 + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE_PROXY + value: "true" + - name: INSTALL_BLOBFUSE + value: "true" + - name: BLOBFUSE_VERSION + value: "1.4.5" + - name: INSTALL_BLOBFUSE2 + value: "true" + - name: BLOBFUSE2_VERSION + value: "2.0.5" + - name: SET_MAX_OPEN_FILE_NUM + value: "true" + - name: MAX_FILE_NUM + value: "9000000" + - name: DISABLE_UPDATEDB + value: "true" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc + containers: + - name: liveness-probe + volumeMounts: + - mountPath: /csi + name: socket-dir + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.10.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29633 + - --v=2 + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: node-driver-registrar + image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.8.0 + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: /var/lib/kubelet/plugins/blob.csi.azure.com/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.22.4 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--enable-blobfuse-proxy=false" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29633 + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /var/lib/kubelet/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + resources: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc + - hostPath: + path: /var/lib/kubelet/plugins/blob.csi.azure.com + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: /var/lib/kubelet/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: /mnt + type: DirectoryOrCreate + name: blob-cache +--- diff --git a/deploy/v1.22.4/kustomization.yaml b/deploy/v1.22.4/kustomization.yaml new file mode 100644 index 000000000..8b7f5fcac --- /dev/null +++ b/deploy/v1.22.4/kustomization.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - csi-blob-controller.yaml + - csi-blob-driver.yaml + - csi-blob-node.yaml + - rbac-csi-blob-controller.yaml + - rbac-csi-blob-node.yaml + - blobfuse-proxy.yaml diff --git a/deploy/v1.22.4/rbac-csi-blob-controller.yaml b/deploy/v1.22.4/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..89c2f1f38 --- /dev/null +++ b/deploy/v1.22.4/rbac-csi-blob-controller.yaml @@ -0,0 +1,108 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-controller-sa + namespace: kube-system +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-provisioner-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-provisioner-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-provisioner-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-resizer-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-resizer-role +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-resizer-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-controller-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.22.4/rbac-csi-blob-node.yaml b/deploy/v1.22.4/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..ce06d862c --- /dev/null +++ b/deploy/v1.22.4/rbac-csi-blob-node.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-node-sa + namespace: kube-system + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-node-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-node-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.23.1/csi-blob-controller.yaml b/deploy/v1.23.1/csi-blob-controller.yaml new file mode 100644 index 000000000..617d27648 --- /dev/null +++ b/deploy/v1.23.1/csi-blob-controller.yaml @@ -0,0 +1,144 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: csi-blob-controller + namespace: kube-system +spec: + replicas: 2 + selector: + matchLabels: + app: csi-blob-controller + template: + metadata: + labels: + app: csi-blob-controller + spec: + hostNetwork: true + serviceAccountName: csi-blob-controller-sa + nodeSelector: + kubernetes.io/os: linux # add "kubernetes.io/role: master" to run controller on master node + priorityClassName: system-cluster-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + containers: + - name: csi-provisioner + image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v3.5.0 + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace=kube-system" + - "--timeout=1200s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + - "--feature-gates=HonorPVReclaimPolicy=true" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + - name: liveness-probe + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.10.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29632 + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.23.1 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:29634" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29632 + name: healthz + protocol: TCP + - containerPort: 29634 + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + resources: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + - name: csi-resizer + image: mcr.microsoft.com/oss/kubernetes-csi/csi-resizer:v1.8.0 + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace=kube-system" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate diff --git a/deploy/v1.23.1/csi-blob-driver.yaml b/deploy/v1.23.1/csi-blob-driver.yaml new file mode 100644 index 000000000..d2de725d8 --- /dev/null +++ b/deploy/v1.23.1/csi-blob-driver.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: blob.csi.azure.com +spec: + attachRequired: false + podInfoOnMount: true + fsGroupPolicy: ReadWriteOnceWithFSType + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/deploy/v1.23.1/csi-blob-node.yaml b/deploy/v1.23.1/csi-blob-node.yaml new file mode 100644 index 000000000..2b47557ce --- /dev/null +++ b/deploy/v1.23.1/csi-blob-node.yaml @@ -0,0 +1,203 @@ +--- +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: csi-blob-node + namespace: kube-system +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + app: csi-blob-node + template: + metadata: + labels: + app: csi-blob-node + spec: + hostNetwork: true + hostPID: true + dnsPolicy: Default + serviceAccountName: csi-blob-node-sa + nodeSelector: + kubernetes.io/os: linux + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + priorityClassName: system-node-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - operator: "Exists" + initContainers: + - name: install-blobfuse-proxy + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.23.1 + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE_PROXY + value: "true" + - name: INSTALL_BLOBFUSE + value: "true" + - name: BLOBFUSE_VERSION + value: "1.4.5" + - name: INSTALL_BLOBFUSE2 + value: "true" + - name: BLOBFUSE2_VERSION + value: "2.1.2" + - name: SET_MAX_OPEN_FILE_NUM + value: "true" + - name: MAX_FILE_NUM + value: "9000000" + - name: DISABLE_UPDATEDB + value: "true" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-etc + mountPath: /host/etc + containers: + - name: liveness-probe + volumeMounts: + - mountPath: /csi + name: socket-dir + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.10.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29633 + - --v=2 + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: node-driver-registrar + image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.8.0 + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: /var/lib/kubelet/plugins/blob.csi.azure.com/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.23.1 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--enable-blobfuse-proxy=false" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29633 + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /var/lib/kubelet/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + resources: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: host-usr + hostPath: + path: /usr + - name: host-etc + hostPath: + path: /etc + - hostPath: + path: /var/lib/kubelet/plugins/blob.csi.azure.com + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: /var/lib/kubelet/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: /mnt + type: DirectoryOrCreate + name: blob-cache +--- diff --git a/deploy/v1.23.1/kustomization.yaml b/deploy/v1.23.1/kustomization.yaml new file mode 100644 index 000000000..8b7f5fcac --- /dev/null +++ b/deploy/v1.23.1/kustomization.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - csi-blob-controller.yaml + - csi-blob-driver.yaml + - csi-blob-node.yaml + - rbac-csi-blob-controller.yaml + - rbac-csi-blob-node.yaml + - blobfuse-proxy.yaml diff --git a/deploy/v1.23.1/rbac-csi-blob-controller.yaml b/deploy/v1.23.1/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..89c2f1f38 --- /dev/null +++ b/deploy/v1.23.1/rbac-csi-blob-controller.yaml @@ -0,0 +1,108 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-controller-sa + namespace: kube-system +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-provisioner-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-provisioner-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-provisioner-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-resizer-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-resizer-role +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-resizer-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-controller-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.23.1/rbac-csi-blob-node.yaml b/deploy/v1.23.1/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..ce06d862c --- /dev/null +++ b/deploy/v1.23.1/rbac-csi-blob-node.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-node-sa + namespace: kube-system + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-node-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-node-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.23.2/csi-blob-controller.yaml b/deploy/v1.23.2/csi-blob-controller.yaml new file mode 100644 index 000000000..7d39cbc35 --- /dev/null +++ b/deploy/v1.23.2/csi-blob-controller.yaml @@ -0,0 +1,144 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: csi-blob-controller + namespace: kube-system +spec: + replicas: 2 + selector: + matchLabels: + app: csi-blob-controller + template: + metadata: + labels: + app: csi-blob-controller + spec: + hostNetwork: true + serviceAccountName: csi-blob-controller-sa + nodeSelector: + kubernetes.io/os: linux # add "kubernetes.io/role: master" to run controller on master node + priorityClassName: system-cluster-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/controlplane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + containers: + - name: csi-provisioner + image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v3.5.0 + args: + - "-v=2" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-namespace=kube-system" + - "--timeout=600s" + - "--extra-create-metadata=true" + - "--kube-api-qps=50" + - "--kube-api-burst=100" + - "--feature-gates=HonorPVReclaimPolicy=true" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + - name: liveness-probe + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.10.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29632 + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.23.2 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--metrics-address=0.0.0.0:29634" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29632 + name: healthz + protocol: TCP + - containerPort: 29634 + name: metrics + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + resources: + limits: + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + - name: csi-resizer + image: mcr.microsoft.com/oss/kubernetes-csi/csi-resizer:v1.8.0 + args: + - "-csi-address=$(ADDRESS)" + - "-v=2" + - "-leader-election" + - "--leader-election-namespace=kube-system" + - '-handle-volume-inuse-error=false' + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + memory: 500Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: socket-dir + emptyDir: {} + - name: azure-cred + hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate diff --git a/deploy/v1.23.2/csi-blob-driver.yaml b/deploy/v1.23.2/csi-blob-driver.yaml new file mode 100644 index 000000000..d2de725d8 --- /dev/null +++ b/deploy/v1.23.2/csi-blob-driver.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: blob.csi.azure.com +spec: + attachRequired: false + podInfoOnMount: true + fsGroupPolicy: ReadWriteOnceWithFSType + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/deploy/v1.23.2/csi-blob-node.yaml b/deploy/v1.23.2/csi-blob-node.yaml new file mode 100644 index 000000000..643790fb9 --- /dev/null +++ b/deploy/v1.23.2/csi-blob-node.yaml @@ -0,0 +1,208 @@ +--- +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: csi-blob-node + namespace: kube-system +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + app: csi-blob-node + template: + metadata: + labels: + app: csi-blob-node + spec: + hostNetwork: true + hostPID: true + dnsPolicy: Default + serviceAccountName: csi-blob-node-sa + nodeSelector: + kubernetes.io/os: linux + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + priorityClassName: system-node-critical + securityContext: + seccompProfile: + type: RuntimeDefault + tolerations: + - operator: "Exists" + initContainers: + - name: install-blobfuse-proxy + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.23.2 + imagePullPolicy: IfNotPresent + command: + - "/blobfuse-proxy/init.sh" + securityContext: + privileged: true + env: + - name: DEBIAN_FRONTEND + value: "noninteractive" + - name: INSTALL_BLOBFUSE_PROXY + value: "true" + - name: INSTALL_BLOBFUSE + value: "true" + - name: BLOBFUSE_VERSION + value: "1.4.5" + - name: INSTALL_BLOBFUSE2 + value: "true" + - name: BLOBFUSE2_VERSION + value: "2.1.0" + - name: SET_MAX_OPEN_FILE_NUM + value: "true" + - name: MAX_FILE_NUM + value: "9000000" + - name: DISABLE_UPDATEDB + value: "true" + volumeMounts: + - name: host-usr + mountPath: /host/usr + - name: host-usr-local + mountPath: /host/usr/local + - name: host-etc + mountPath: /host/etc + containers: + - name: liveness-probe + volumeMounts: + - mountPath: /csi + name: socket-dir + image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v2.10.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29633 + - --v=2 + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: node-driver-registrar + image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:v2.8.0 + args: + - --csi-address=$(ADDRESS) + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --v=2 + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) + - --mode=kubelet-registration-probe + initialDelaySeconds: 30 + timeoutSeconds: 15 + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: /var/lib/kubelet/plugins/blob.csi.azure.com/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + resources: + limits: + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi + - name: blob + image: mcr.microsoft.com/oss/kubernetes-csi/blob-csi:v1.23.2 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--enable-blobfuse-proxy=false" + - "--blobfuse-proxy-endpoint=$(BLOBFUSE_PROXY_ENDPOINT)" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--user-agent-suffix=OSS-kubectl" + ports: + - containerPort: 29633 + name: healthz + protocol: TCP + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 30 + env: + - name: AZURE_CREDENTIAL_FILE + valueFrom: + configMapKeyRef: + name: azure-cred-file + key: path + optional: true + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: BLOBFUSE_PROXY_ENDPOINT + value: unix:///csi/blobfuse-proxy.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /var/lib/kubelet/ + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /etc/kubernetes/ + name: azure-cred + - mountPath: /mnt + name: blob-cache + resources: + limits: + memory: 2100Mi + requests: + cpu: 10m + memory: 20Mi + volumes: + - name: host-usr + hostPath: + path: /usr + - name: host-usr-local + hostPath: + path: /usr/local + - name: host-etc + hostPath: + path: /etc + - hostPath: + path: /var/lib/kubelet/plugins/blob.csi.azure.com + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: /var/lib/kubelet/ + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /etc/kubernetes/ + type: DirectoryOrCreate + name: azure-cred + - hostPath: + path: /mnt + type: DirectoryOrCreate + name: blob-cache +--- diff --git a/deploy/v1.23.2/kustomization.yaml b/deploy/v1.23.2/kustomization.yaml new file mode 100644 index 000000000..8b7f5fcac --- /dev/null +++ b/deploy/v1.23.2/kustomization.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - csi-blob-controller.yaml + - csi-blob-driver.yaml + - csi-blob-node.yaml + - rbac-csi-blob-controller.yaml + - rbac-csi-blob-node.yaml + - blobfuse-proxy.yaml diff --git a/deploy/v1.23.2/rbac-csi-blob-controller.yaml b/deploy/v1.23.2/rbac-csi-blob-controller.yaml new file mode 100644 index 000000000..89c2f1f38 --- /dev/null +++ b/deploy/v1.23.2/rbac-csi-blob-controller.yaml @@ -0,0 +1,108 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-controller-sa + namespace: kube-system +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-provisioner-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-provisioner-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-provisioner-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-external-resizer-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["update", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: blob-csi-resizer-role +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: blob-external-resizer-role + apiGroup: rbac.authorization.k8s.io +--- + +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "create"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-controller-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-controller-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/v1.23.2/rbac-csi-blob-node.yaml b/deploy/v1.23.2/rbac-csi-blob-node.yaml new file mode 100644 index 000000000..ce06d862c --- /dev/null +++ b/deploy/v1.23.2/rbac-csi-blob-node.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-blob-node-sa + namespace: kube-system + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-role +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-blob-node-secret-binding +subjects: + - kind: ServiceAccount + name: csi-blob-node-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-blob-node-secret-role + apiGroup: rbac.authorization.k8s.io diff --git a/docs/csi-debug.md b/docs/csi-debug.md index bdb9bff50..d7aaa9ce4 100644 --- a/docs/csi-debug.md +++ b/docs/csi-debug.md @@ -81,7 +81,7 @@ change below deployment config, e.g. blobfuse2 -v ```
-blobfuse2 version 2.1.0
+blobfuse2 version 2.1.2
 
### check blobfuse mount on the agent node @@ -144,5 +144,39 @@ kubectl delete po node-debugger-node-name-xxxx +### Troubleshooting aznfs mount +> Supported from v1.22.2 +> About aznfs mount helper: https://github.com/Azure/AZNFS-mount/ + +
+Check mount point information + + +```console +kubectl debug node/node-name --image=nginx +findmnt -t nfs +``` + +The `SOURCE` of the mount point should have prefix with an ip address rather than domain name. e.g, **10.161.100.100**:/nfs02a796c105814dbebc4e/pvc-ca149059-6872-4d6f-a806-48402648110c. + +
+ + +
+Get client-side logs on Linux node + + +```console +kubectl debug node/node-name --image=nginx + +cat /opt/microsoft/aznfs/data/aznfs.log +``` + +If ip was migrated successfully, you should find logs like: +1. `IP for nfsxxxxx.blob.core.windows.net changed [1.2.3.4 -> 5.6.7.8].` +2. `Updating mountmap entry [nfsxxxxx.blob.core.windows.net 10.161.100.100 1.2.3.4 -> nfsxxxxx.blob.core.windows.net 10.161.100.100 5.6.7.8]` + +
+ ### Tips - [Troubleshoot Azure Blob storage mount issues on AKS](http://aka.ms/blobmounterror) diff --git a/docs/driver-parameters.md b/docs/driver-parameters.md index 9bcde90a3..f96040b87 100644 --- a/docs/driver-parameters.md +++ b/docs/driver-parameters.md @@ -19,7 +19,7 @@ Name | Meaning | Example | Mandatory | Default value --- | --- | --- | --- | --- -skuName | Azure storage account type (alias: `storageAccountType`) | `Standard_LRS`, `Premium_LRS`, `Standard_GRS`, `Standard_RAGRS` | No | `Standard_LRS` +skuName | Azure storage account type (alias: `storageAccountType`) | `Standard_LRS`, `Premium_LRS`, `Standard_GRS`, `Standard_RAGRS`, `Standard_ZRS`, `Premium_ZRS` | No | `Standard_LRS` location | Azure location | `eastus`, `westus`, etc. | No | if empty, driver will use the same location name as current k8s cluster resourceGroup | Azure resource group name | existing resource group name | No | if empty, driver will use the same resource group name as current k8s cluster storageAccount | specify Azure storage account name| STORAGE_ACCOUNT_NAME | No | If the driver is not provided with a specific storage account name, it will search for a suitable storage account that matches the account settings within the same resource group. If it cannot find a matching storage account, it will create a new one. However, if a storage account name is specified, the storage account must already exist. @@ -129,6 +129,7 @@ kubectl create secret generic azure-secret --from-literal azurestoragespnclients - with blobfuse-proxy deployment (default on AKS), user could set `--tmp-path=` mount option to specify a different cache directory - [Mount an azure blob storage with a dedicated user-assigned managed identity](https://github.com/qxsch/Azure-Aks/tree/master/aks-blobfuse-mi) - [Blobfuse Performance and caching](https://github.com/Azure/azure-storage-fuse/tree/blobfuse-1.4.5#performance-and-caching) + - `--disable-writeback-cache=true`: disallow libfuse to buffer write requests if you must strictly open files in O_WRONLY or O_APPEND mode - [Blobfuse CLI Flag Options v1 & v2](https://github.com/Azure/azure-storage-fuse/blob/main/MIGRATION.md#blobfuse-cli-flag-options) #### `containerName` parameter supports following pv/pvc metadata conversion diff --git a/docs/install-blob-csi-driver.md b/docs/install-blob-csi-driver.md index 668fea9f7..702b04b51 100644 --- a/docs/install-blob-csi-driver.md +++ b/docs/install-blob-csi-driver.md @@ -4,6 +4,6 @@ > - please use helm install method for more customization, e.g. Azure Stack, RedHat OpenShift support. > - [install CSI driver master version](./install-csi-driver-master.md) (only for testing purpose) - - [install v1.23.0 CSI driver](./install-csi-driver-v1.23.0.md) - - [install v1.22.2 CSI driver](./install-csi-driver-v1.22.2.md) - - [install v1.21.4 CSI driver](./install-csi-driver-v1.21.4.md) + - [install v1.23.2 CSI driver](./install-csi-driver-v1.23.2.md) + - [install v1.22.4 CSI driver](./install-csi-driver-v1.22.4.md) + - [install v1.21.6 CSI driver](./install-csi-driver-v1.21.6.md) diff --git a/docs/install-csi-driver-master.md b/docs/install-csi-driver-master.md index dff7e4b31..a1eafd21e 100644 --- a/docs/install-csi-driver-master.md +++ b/docs/install-csi-driver-master.md @@ -1,5 +1,5 @@ # Install Azure Blob Storage CSI driver master version on a kubernetes cluster -> `blobfuse-proxy` is only available for debian based agent nodes, remove `blobfuse-proxy` parameter in installation steps if it's not applicable. +> `blobfuse-proxy` is supported on CoreOS(OpenShift) from v1.23.2 > If you have already installed Helm, you can also use it to install this driver. Please check [Installation with Helm](../charts/README.md). diff --git a/docs/install-csi-driver-v1.19.6.md b/docs/install-csi-driver-v1.19.6.md new file mode 100644 index 000000000..bdc5fdf87 --- /dev/null +++ b/docs/install-csi-driver-v1.19.6.md @@ -0,0 +1,47 @@ +# Install Azure Blob Storage CSI driver v1.19.6 version on a kubernetes cluster +> `blobfuse-proxy` is only available for debian based agent nodes, remove `blobfuse-proxy` parameter in installation steps if it's not applicable. +> +If you have already installed Helm, you can also use it to install this driver. Please check [Installation with Helm](../charts/README.md). + +## Install with kubectl + - Option#1. remote install +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.19.6/deploy/install-driver.sh | bash -s v1.19.6 blobfuse-proxy -- +``` + + - Option#2. local install +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +./deploy/install-driver.sh v1.19.6 local,blobfuse-proxy +``` + +- check pods status: +```console +kubectl -n kube-system get pod -o wide -l app=csi-blob-controller +kubectl -n kube-system get pod -o wide -l app=csi-blob-node +``` + +example output: + +```console +NAME READY STATUS RESTARTS AGE IP NODE +csi-blob-controller-56bfddd689-dh5tk 4/4 Running 0 35s 10.240.0.19 k8s-agentpool-22533604-0 +csi-blob-controller-56bfddd689-8pgr4 4/4 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-cvgbs 3/3 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-dr4s4 3/3 Running 0 35s 10.240.0.4 k8s-agentpool-22533604-0 +``` + +### clean up Blob CSI driver +- Option#1. remote uninstall +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.19.6/deploy/uninstall-driver.sh | bash -s v1.19.6 -- +``` + + - Option#2. local uninstall +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +git checkout v1.19.6 +./deploy/uninstall-driver.sh v1.19.6 local +``` diff --git a/docs/install-csi-driver-v1.21.5.md b/docs/install-csi-driver-v1.21.5.md new file mode 100644 index 000000000..0cc1b9efd --- /dev/null +++ b/docs/install-csi-driver-v1.21.5.md @@ -0,0 +1,47 @@ +# Install Azure Blob Storage CSI driver v1.21.5 version on a kubernetes cluster +> `blobfuse-proxy` is only available for debian based agent nodes, remove `blobfuse-proxy` parameter in installation steps if it's not applicable. +> +If you have already installed Helm, you can also use it to install this driver. Please check [Installation with Helm](../charts/README.md). + +## Install with kubectl + - Option#1. remote install +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.21.5/deploy/install-driver.sh | bash -s v1.21.5 blobfuse-proxy -- +``` + + - Option#2. local install +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +./deploy/install-driver.sh v1.21.5 local,blobfuse-proxy +``` + +- check pods status: +```console +kubectl -n kube-system get pod -o wide -l app=csi-blob-controller +kubectl -n kube-system get pod -o wide -l app=csi-blob-node +``` + +example output: + +```console +NAME READY STATUS RESTARTS AGE IP NODE +csi-blob-controller-56bfddd689-dh5tk 4/4 Running 0 35s 10.240.0.19 k8s-agentpool-22533604-0 +csi-blob-controller-56bfddd689-8pgr4 4/4 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-cvgbs 3/3 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-dr4s4 3/3 Running 0 35s 10.240.0.4 k8s-agentpool-22533604-0 +``` + +### clean up Blob CSI driver +- Option#1. remote uninstall +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.21.5/deploy/uninstall-driver.sh | bash -s v1.21.5 -- +``` + + - Option#2. local uninstall +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +git checkout v1.21.5 +./deploy/uninstall-driver.sh v1.21.5 local +``` diff --git a/docs/install-csi-driver-v1.21.6.md b/docs/install-csi-driver-v1.21.6.md new file mode 100644 index 000000000..c1639e3a8 --- /dev/null +++ b/docs/install-csi-driver-v1.21.6.md @@ -0,0 +1,47 @@ +# Install Azure Blob Storage CSI driver v1.21.6 version on a kubernetes cluster +> `blobfuse-proxy` is only available for debian based agent nodes, remove `blobfuse-proxy` parameter in installation steps if it's not applicable. +> +If you have already installed Helm, you can also use it to install this driver. Please check [Installation with Helm](../charts/README.md). + +## Install with kubectl + - Option#1. remote install +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.21.6/deploy/install-driver.sh | bash -s v1.21.6 blobfuse-proxy -- +``` + + - Option#2. local install +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +./deploy/install-driver.sh v1.21.6 local,blobfuse-proxy +``` + +- check pods status: +```console +kubectl -n kube-system get pod -o wide -l app=csi-blob-controller +kubectl -n kube-system get pod -o wide -l app=csi-blob-node +``` + +example output: + +```console +NAME READY STATUS RESTARTS AGE IP NODE +csi-blob-controller-56bfddd689-dh5tk 4/4 Running 0 35s 10.240.0.19 k8s-agentpool-22533604-0 +csi-blob-controller-56bfddd689-8pgr4 4/4 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-cvgbs 3/3 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-dr4s4 3/3 Running 0 35s 10.240.0.4 k8s-agentpool-22533604-0 +``` + +### clean up Blob CSI driver +- Option#1. remote uninstall +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.21.6/deploy/uninstall-driver.sh | bash -s v1.21.6 -- +``` + + - Option#2. local uninstall +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +git checkout v1.21.6 +./deploy/uninstall-driver.sh v1.21.6 local +``` diff --git a/docs/install-csi-driver-v1.22.3.md b/docs/install-csi-driver-v1.22.3.md new file mode 100644 index 000000000..2e2951087 --- /dev/null +++ b/docs/install-csi-driver-v1.22.3.md @@ -0,0 +1,47 @@ +# Install Azure Blob Storage CSI driver v1.22.3 version on a kubernetes cluster +> `blobfuse-proxy` is only available for debian based agent nodes, remove `blobfuse-proxy` parameter in installation steps if it's not applicable. +> +If you have already installed Helm, you can also use it to install this driver. Please check [Installation with Helm](../charts/README.md). + +## Install with kubectl + - Option#1. remote install +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.22.3/deploy/install-driver.sh | bash -s v1.22.3 blobfuse-proxy -- +``` + + - Option#2. local install +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +./deploy/install-driver.sh v1.22.3 local,blobfuse-proxy +``` + +- check pods status: +```console +kubectl -n kube-system get pod -o wide -l app=csi-blob-controller +kubectl -n kube-system get pod -o wide -l app=csi-blob-node +``` + +example output: + +```console +NAME READY STATUS RESTARTS AGE IP NODE +csi-blob-controller-56bfddd689-dh5tk 4/4 Running 0 35s 10.240.0.19 k8s-agentpool-22533604-0 +csi-blob-controller-56bfddd689-8pgr4 4/4 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-cvgbs 3/3 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-dr4s4 3/3 Running 0 35s 10.240.0.4 k8s-agentpool-22533604-0 +``` + +### clean up Blob CSI driver +- Option#1. remote uninstall +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.22.3/deploy/uninstall-driver.sh | bash -s v1.22.3 -- +``` + + - Option#2. local uninstall +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +git checkout v1.22.3 +./deploy/uninstall-driver.sh v1.22.3 local +``` diff --git a/docs/install-csi-driver-v1.22.4.md b/docs/install-csi-driver-v1.22.4.md new file mode 100644 index 000000000..ca251ffa9 --- /dev/null +++ b/docs/install-csi-driver-v1.22.4.md @@ -0,0 +1,47 @@ +# Install Azure Blob Storage CSI driver v1.22.4 version on a kubernetes cluster +> `blobfuse-proxy` is only available for debian based agent nodes, remove `blobfuse-proxy` parameter in installation steps if it's not applicable. +> +If you have already installed Helm, you can also use it to install this driver. Please check [Installation with Helm](../charts/README.md). + +## Install with kubectl + - Option#1. remote install +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.22.4/deploy/install-driver.sh | bash -s v1.22.4 blobfuse-proxy -- +``` + + - Option#2. local install +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +./deploy/install-driver.sh v1.22.4 local,blobfuse-proxy +``` + +- check pods status: +```console +kubectl -n kube-system get pod -o wide -l app=csi-blob-controller +kubectl -n kube-system get pod -o wide -l app=csi-blob-node +``` + +example output: + +```console +NAME READY STATUS RESTARTS AGE IP NODE +csi-blob-controller-56bfddd689-dh5tk 4/4 Running 0 35s 10.240.0.19 k8s-agentpool-22533604-0 +csi-blob-controller-56bfddd689-8pgr4 4/4 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-cvgbs 3/3 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-dr4s4 3/3 Running 0 35s 10.240.0.4 k8s-agentpool-22533604-0 +``` + +### clean up Blob CSI driver +- Option#1. remote uninstall +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.22.4/deploy/uninstall-driver.sh | bash -s v1.22.4 -- +``` + + - Option#2. local uninstall +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +git checkout v1.22.4 +./deploy/uninstall-driver.sh v1.22.4 local +``` diff --git a/docs/install-csi-driver-v1.23.1.md b/docs/install-csi-driver-v1.23.1.md new file mode 100644 index 000000000..052a28ce1 --- /dev/null +++ b/docs/install-csi-driver-v1.23.1.md @@ -0,0 +1,47 @@ +# Install Azure Blob Storage CSI driver v1.23.1 version on a kubernetes cluster +> `blobfuse-proxy` is only available for debian based agent nodes, remove `blobfuse-proxy` parameter in installation steps if it's not applicable. +> +If you have already installed Helm, you can also use it to install this driver. Please check [Installation with Helm](../charts/README.md). + +## Install with kubectl + - Option#1. remote install +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.23.1/deploy/install-driver.sh | bash -s v1.23.1 blobfuse-proxy -- +``` + + - Option#2. local install +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +./deploy/install-driver.sh v1.23.1 local,blobfuse-proxy +``` + +- check pods status: +```console +kubectl -n kube-system get pod -o wide -l app=csi-blob-controller +kubectl -n kube-system get pod -o wide -l app=csi-blob-node +``` + +example output: + +```console +NAME READY STATUS RESTARTS AGE IP NODE +csi-blob-controller-56bfddd689-dh5tk 4/4 Running 0 35s 10.240.0.19 k8s-agentpool-22533604-0 +csi-blob-controller-56bfddd689-8pgr4 4/4 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-cvgbs 3/3 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-dr4s4 3/3 Running 0 35s 10.240.0.4 k8s-agentpool-22533604-0 +``` + +### clean up Blob CSI driver +- Option#1. remote uninstall +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.23.1/deploy/uninstall-driver.sh | bash -s v1.23.1 -- +``` + + - Option#2. local uninstall +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +git checkout v1.23.1 +./deploy/uninstall-driver.sh v1.23.1 local +``` diff --git a/docs/install-csi-driver-v1.23.2.md b/docs/install-csi-driver-v1.23.2.md new file mode 100644 index 000000000..72a8c736e --- /dev/null +++ b/docs/install-csi-driver-v1.23.2.md @@ -0,0 +1,47 @@ +# Install Azure Blob Storage CSI driver v1.23.2 version on a kubernetes cluster +> `blobfuse-proxy` is supported on CoreOS(OpenShift) from v1.23.2 +> +If you have already installed Helm, you can also use it to install this driver. Please check [Installation with Helm](../charts/README.md). + +## Install with kubectl + - Option#1. remote install +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.23.2/deploy/install-driver.sh | bash -s v1.23.2 blobfuse-proxy -- +``` + + - Option#2. local install +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +./deploy/install-driver.sh v1.23.2 local,blobfuse-proxy +``` + +- check pods status: +```console +kubectl -n kube-system get pod -o wide -l app=csi-blob-controller +kubectl -n kube-system get pod -o wide -l app=csi-blob-node +``` + +example output: + +```console +NAME READY STATUS RESTARTS AGE IP NODE +csi-blob-controller-56bfddd689-dh5tk 4/4 Running 0 35s 10.240.0.19 k8s-agentpool-22533604-0 +csi-blob-controller-56bfddd689-8pgr4 4/4 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-cvgbs 3/3 Running 0 35s 10.240.0.35 k8s-agentpool-22533604-1 +csi-blob-node-dr4s4 3/3 Running 0 35s 10.240.0.4 k8s-agentpool-22533604-0 +``` + +### clean up Blob CSI driver +- Option#1. remote uninstall +```console +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/v1.23.2/deploy/uninstall-driver.sh | bash -s v1.23.2 -- +``` + + - Option#2. local uninstall +```console +git clone https://github.com/kubernetes-sigs/blob-csi-driver.git +cd blob-csi-driver +git checkout v1.23.2 +./deploy/uninstall-driver.sh v1.23.2 local +``` diff --git a/go.mod b/go.mod index bf554ed55..27968de14 100644 --- a/go.mod +++ b/go.mod @@ -1,61 +1,63 @@ module sigs.k8s.io/blob-csi-driver -go 1.20 +go 1.21 require ( github.com/Azure/azure-sdk-for-go v68.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.6.1 github.com/Azure/go-autorest/autorest v0.11.29 github.com/Azure/go-autorest/autorest/adal v0.9.23 - github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect github.com/container-storage-interface/spec v1.8.0 - github.com/gofrs/uuid v4.4.0+incompatible // indirect + github.com/go-ini/ini v1.67.0 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 - github.com/imdario/mergo v0.3.9 // indirect - github.com/kubernetes-csi/csi-lib-utils v0.13.0 - github.com/onsi/gomega v1.27.10 + github.com/kubernetes-csi/csi-lib-utils v0.16.0 + github.com/onsi/ginkgo/v2 v2.13.2 + github.com/onsi/gomega v1.30.0 github.com/pborman/uuid v1.2.1 github.com/pelletier/go-toml v1.9.5 - github.com/stretchr/testify v1.8.4 - golang.org/x/net v0.17.0 - google.golang.org/grpc v1.58.3 - google.golang.org/protobuf v1.31.0 - k8s.io/api v0.28.1 - k8s.io/apimachinery v0.28.1 - k8s.io/client-go v0.28.1 - k8s.io/component-base v0.28.1 - k8s.io/klog/v2 v2.100.1 - k8s.io/kubernetes v1.28.2 - k8s.io/mount-utils v0.28.1 - k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 - sigs.k8s.io/cloud-provider-azure v1.27.1-0.20230907063607-e9994a5f9c7a - sigs.k8s.io/yaml v1.3.0 -) - -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.2.0 - github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.6.1 - github.com/go-ini/ini v1.67.0 - github.com/jongio/azidext/go/azidext v0.5.0 - github.com/onsi/ginkgo/v2 v2.13.0 github.com/pkg/errors v0.9.1 github.com/satori/go.uuid v1.2.0 - golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 - k8s.io/apiserver v0.28.1 - k8s.io/pod-security-admission v0.28.1 + github.com/stretchr/testify v1.8.4 + golang.org/x/net v0.18.0 + google.golang.org/grpc v1.59.0 + google.golang.org/protobuf v1.31.0 + k8s.io/api v0.28.4 + k8s.io/apimachinery v0.28.4 + k8s.io/apiserver v0.28.4 + k8s.io/client-go v0.28.4 + k8s.io/component-base v0.28.4 + k8s.io/klog/v2 v2.110.1 + k8s.io/kubernetes v1.28.4 + k8s.io/mount-utils v0.28.4 + k8s.io/pod-security-admission v0.28.4 + k8s.io/utils v0.0.0-20230505201702-9f6742963106 + sigs.k8s.io/cloud-provider-azure v1.27.1-0.20231128114432-f80321a29d3a + sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.0-20231128114432-f80321a29d3a + sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.0-20231128114432-f80321a29d3a + sigs.k8s.io/yaml v1.4.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.6.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect github.com/Azure/go-autorest/autorest/mocks v0.4.2 // indirect + github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect github.com/Azure/go-autorest/autorest/validation v0.3.1 // 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 v1.0.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect @@ -67,27 +69,30 @@ require ( github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect - github.com/emicklei/go-restful/v3 v3.9.0 // indirect - github.com/evanphx/json-patch v5.6.0+incompatible // indirect - github.com/felixge/httpsnoop v1.0.3 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/emicklei/go-restful/v3 v3.10.2 // indirect + github.com/evanphx/json-patch v5.7.0+incompatible // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-openapi/swag v0.22.4 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect + github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/golang-jwt/jwt/v5 v5.0.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/cel-go v0.16.1 // indirect github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/google/pprof v0.0.0-20230602010524-ada837c32108 // indirect + github.com/google/uuid v1.4.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/imdario/mergo v0.3.9 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -107,84 +112,82 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - github.com/spf13/cobra v1.7.0 // indirect + github.com/spf13/cobra v1.8.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stoewer/go-strcase v1.2.0 // indirect go.etcd.io/etcd/api/v3 v3.5.9 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect go.etcd.io/etcd/client/v3 v3.5.9 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1 // indirect - go.opentelemetry.io/otel v1.10.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect - go.opentelemetry.io/otel/metric v0.31.0 // indirect - go.opentelemetry.io/otel/sdk v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect - go.opentelemetry.io/proto/otlp v0.19.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect + go.opentelemetry.io/otel v1.20.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/sdk v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.19.0 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.12.0 // indirect + golang.org/x/crypto v0.16.0 // indirect + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/oauth2 v0.11.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect + golang.org/x/tools v0.14.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.0.0 // indirect - k8s.io/cloud-provider v0.28.1 // indirect - k8s.io/component-helpers v0.28.1 // indirect - k8s.io/controller-manager v0.28.1 // indirect - k8s.io/kms v0.28.1 // indirect + k8s.io/cloud-provider v0.28.4 // indirect + k8s.io/component-helpers v0.28.4 // indirect + k8s.io/controller-manager v0.28.4 // indirect + k8s.io/kms v0.28.4 // indirect k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect k8s.io/kubectl v0.0.0 // indirect - k8s.io/kubelet v0.28.1 // indirect + k8s.io/kubelet v0.28.4 // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) replace ( - github.com/niemeyer/pretty => github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e - go.etcd.io/etcd => go.etcd.io/etcd v0.0.0-20200410171415-59f5fb25a533 - k8s.io/api => k8s.io/api v0.28.1 - k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.28.1 - k8s.io/apimachinery => k8s.io/apimachinery v0.28.1 - k8s.io/apiserver => k8s.io/apiserver v0.28.1 - k8s.io/cli-runtime => k8s.io/cli-runtime v0.28.1 - k8s.io/client-go => k8s.io/client-go v0.28.1 - k8s.io/cloud-provider => k8s.io/cloud-provider v0.28.1 - k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.28.1 - k8s.io/code-generator => k8s.io/code-generator v0.28.1 - k8s.io/component-base => k8s.io/component-base v0.28.1 - k8s.io/component-helpers => k8s.io/component-helpers v0.28.1 - k8s.io/controller-manager => k8s.io/controller-manager v0.28.1 - k8s.io/cri-api => k8s.io/cri-api v0.28.1 - k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.28.1 - k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.1 - k8s.io/endpointslice => k8s.io/endpointslice v0.28.1 - k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.28.1 - k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.28.1 - k8s.io/kube-proxy => k8s.io/kube-proxy v0.28.1 - k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.1 - k8s.io/kubectl => k8s.io/kubectl v0.28.1 - k8s.io/kubelet => k8s.io/kubelet v0.28.1 - k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.1 - k8s.io/metrics => k8s.io/metrics v0.28.1 - k8s.io/mount-utils => k8s.io/mount-utils v0.28.1 - k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.28.1 - k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.28.1 - k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.28.1 - k8s.io/sample-controller => k8s.io/sample-controller v0.28.1 + k8s.io/api => k8s.io/api v0.28.4 + k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.28.4 + k8s.io/apimachinery => k8s.io/apimachinery v0.28.4 + k8s.io/apiserver => k8s.io/apiserver v0.28.4 + k8s.io/cli-runtime => k8s.io/cli-runtime v0.28.4 + k8s.io/client-go => k8s.io/client-go v0.28.4 + k8s.io/cloud-provider => k8s.io/cloud-provider v0.28.4 + k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.28.4 + k8s.io/code-generator => k8s.io/code-generator v0.28.4 + k8s.io/component-base => k8s.io/component-base v0.28.4 + k8s.io/component-helpers => k8s.io/component-helpers v0.28.4 + k8s.io/controller-manager => k8s.io/controller-manager v0.28.4 + k8s.io/cri-api => k8s.io/cri-api v0.28.4 + k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.28.4 + k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.4 + k8s.io/endpointslice => k8s.io/endpointslice v0.28.4 + k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.28.4 + k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.28.4 + k8s.io/kube-proxy => k8s.io/kube-proxy v0.28.4 + k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.4 + k8s.io/kubectl => k8s.io/kubectl v0.28.4 + k8s.io/kubelet => k8s.io/kubelet v0.28.4 + k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.4 + k8s.io/metrics => k8s.io/metrics v0.28.4 + k8s.io/mount-utils => k8s.io/mount-utils v0.28.4 + k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.28.4 + k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.28.4 + k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.28.4 + k8s.io/sample-controller => k8s.io/sample-controller v0.28.4 ) diff --git a/go.sum b/go.sum index 69feca44f..2f2dc83d4 100644 --- a/go.sum +++ b/go.sum @@ -1,51 +1,38 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.110.4 h1:1JYyxKMN9hd5dR2MYTPWkGUgcoxVVhg0LKNKEo0qvmk= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.21.0 h1:JNBsyXVoOoNJtTQcnEY5uYpZIbeCTYIeDe0Xh1bySMk= +cloud.google.com/go v0.110.9 h1:e7ITSqGFFk4rbz/JFIqZh3G4VEHguhAL4BQcFlWtU68= +cloud.google.com/go/compute v1.23.2 h1:nWEMDhgbBkBJjfpVySqU4jgWdc22PLR0o4vEexZHers= +cloud.google.com/go/compute v1.23.2/go.mod h1:JJ0atRC0J/oWYiiVBmsSsrRnh92DhZPG4hFDcR04Rns= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.3.0 h1:qgs/VAMSR+9qFhwTw4OwF2NbVuw+2m83pVZJjqkKQMw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.3.0/go.mod h1:uYt4CfhkJA9o0FN7jfE5minm/i4nUE4MjGUJkzB6Zs8= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.2.0 h1:DWlwvVV5r/Wy1561nZ3wrpI1/vDIBRY/Wd1HWaRBZWA= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.2.0/go.mod h1:E7ltexgRDmeJ0fJWv0D/HLwY2xbDdN+uv+X2uZtOx3w= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.6.0 h1:AAIdAyPkFff6XTct2lQCxOWN/+LnA41S7kIkzKaMbyE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.6.0/go.mod h1:noQIdW75SiQFB3mSFJBr4iRRH83S9skaFiBv4C0uEs0= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.2.0 h1:8d4U82r7ItT1Es91x3eUcAQweih36KWvUha8AZ9X0Rs= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.2.0/go.mod h1:/1bkGperHinQbAHMWivoec/Ucu6//iXo6jn5mhmqCVU= -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/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.4.0 h1:HlZMUZW8S4P9oob1nCHxCCKrytxyLc+24nUJGssoEto= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.4.0/go.mod h1:StGsLbuJh06Bd8IBfnAlIFV3fLb+gkczONWf15hpX2E= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.2.0 h1:iGj7n4SmssnseLryJRs/0lb4Db129ioYOCPSPC+vEsw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.2.0/go.mod h1:qeBrdANBgW4QsU1bF5/9qjrPRwFIt+AnOMxyH5Bwkhk= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.2.0 h1:9Eih8XcEeQnFD0ntMlUDleKMzfeCeUfa+VbnDCI4AZs= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.2.0/go.mod h1:wGPyTi+aURdqPAGMZDQqnNs9IrShADF8w2WZb6bKeq0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0 h1:AifHbc4mg0x9zW52WOpKbsHaDKuRhlI7TVl47thgQ70= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0/go.mod h1:T5RfihdXtBDxt1Ch2wobif3TvzTdumDy29kahv6AV9A= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.6.1 h1:YvQv9Mz6T8oR5ypQOL6erY0Z5t71ak1uHV4QFokCOZk= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.6.1/go.mod h1:c6WvOhtmjNUWbLfOG1qxM/q0SPvQNSVJvolm+C52dIU= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= @@ -68,17 +55,14 @@ github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+Z github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= @@ -89,73 +73,53 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/container-storage-interface/spec v1.8.0 h1:D0vhF3PLIZwlwZEf2eNbpujGCNwspwTYf2idJRJx4xI= github.com/container-storage-interface/spec v1.8.0/go.mod h1:ROLik+GhPslwwWRNFF1KasPzroNARibH2rfz1rkg4H0= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= -github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/emicklei/go-restful/v3 v3.10.2 h1:hIovbnmBTLjHXkqEBUz3HGpXZdM7ZrE9fJIZIqlJLqE= +github.com/emicklei/go-restful/v3 v3.10.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= -github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= -github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI= +github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= +github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -166,118 +130,69 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/cel-go v0.16.1 h1:3hZfSNiAU3KOiNtxuFXVp5WFy4hf/Ly3Sa4/7F8SXNo= github.com/google/cel-go v0.16.1/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/pprof v0.0.0-20230602010524-ada837c32108 h1:y+JfwMOPwQwIrnh3TUPwwtOAhONoppkHiSa4sQBoK2k= +github.com/google/pprof v0.0.0-20230602010524-ada837c32108/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= -github.com/jongio/azidext/go/azidext v0.5.0 h1:uPInXD4NZ3J0k79FPwIA0YXknFn+WcqZqSgs3/jPgvQ= -github.com/jongio/azidext/go/azidext v0.5.0/go.mod h1:TVRX/hJhzbsCKaOIzicH6a8IvOH0hpjWk/JwZZgtXeU= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kubernetes-csi/csi-lib-utils v0.13.0 h1:QrTdZVZbHlaSUBN9ReayBPnnF1N0edFIpUKBwVIBW3w= -github.com/kubernetes-csi/csi-lib-utils v0.13.0/go.mod h1:JS9eDIZmSjx4F9o0bLTVK/qfhIIOifdjEfVXzxWapfE= +github.com/kubernetes-csi/csi-lib-utils v0.16.0 h1:LXCvkhXHtFOkl7LoDqFdho/MuebccZqWxLwhKiRGiBg= +github.com/kubernetes-csi/csi-lib-utils v0.16.0/go.mod h1:fp1Oik+45tP2o4X9SD/SBWXLTQYT9wtLxGasBE3+vBI= 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/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -295,10 +210,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= -github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= -github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= +github.com/onsi/ginkgo/v2 v2.13.2 h1:Bi2gGVkfn6gQcjNjZJVO8Gf0FHzMPf2phUei9tejVMs= +github.com/onsi/ginkgo/v2 v2.13.2/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM= +github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= +github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/selinux v1.10.0 h1:rAiKF8hTcgLI3w0DHm6i0ylVVcOrlgR1kK99DRLDhyU= @@ -316,24 +231,23 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU= @@ -353,186 +267,101 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= +go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd/api/v3 v3.5.9 h1:4wSsluwyTbGGmyjJktOf3wFQoTBIURXHnq9n/G/JQHs= go.etcd.io/etcd/api/v3 v3.5.9/go.mod h1:uyAal843mC8uUVSLWz6eHa/d971iDGnCRpmKd2Z+X8k= go.etcd.io/etcd/client/pkg/v3 v3.5.9 h1:oidDC4+YEuSIQbsR94rY9gur91UPL6DnxDCIYd2IGsE= go.etcd.io/etcd/client/pkg/v3 v3.5.9/go.mod h1:y+CzeSmkMpWN2Jyu1npecjB9BBnABxGM4pN8cGuJeL4= go.etcd.io/etcd/client/v2 v2.305.9 h1:YZ2OLi0OvR0H75AcgSUajjd5uqKDKocQUqROTG11jIo= +go.etcd.io/etcd/client/v2 v2.305.9/go.mod h1:0NBdNx9wbxtEQLwAQtrDHwx58m02vXpDcgSYI2seohQ= go.etcd.io/etcd/client/v3 v3.5.9 h1:r5xghnU7CwbUxD/fbUtRyJGaYNfDun8sp/gTr1hew6E= go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA= go.etcd.io/etcd/pkg/v3 v3.5.9 h1:6R2jg/aWd/zB9+9JxmijDKStGJAPFsX3e6BeJkMi6eQ= +go.etcd.io/etcd/pkg/v3 v3.5.9/go.mod h1:BZl0SAShQFk0IpLWR78T/+pyt8AruMHhTNNX73hkNVY= go.etcd.io/etcd/raft/v3 v3.5.9 h1:ZZ1GIHoUlHsn0QVqiRysAm3/81Xx7+i2d7nSdWxlOiI= +go.etcd.io/etcd/raft/v3 v3.5.9/go.mod h1:WnFkqzFdZua4LVlVXQEGhmooLeyS7mqzS4Pf4BCVqXg= go.etcd.io/etcd/server/v3 v3.5.9 h1:vomEmmxeztLtS5OEH7d0hBAg4cjVIu9wXuNzUZx2ZA0= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0 h1:xFSRQBbXF6VvYRf2lqMJXxoB72XI1K/azav8TekHHSw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0/go.mod h1:h8TWwRAhQpOd0aM5nYsRD8+flnkj+526GEIVlarH7eY= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1 h1:sxoY9kG1s1WpSYNyzm24rlwH4lnRYFXUVVBmKMBfRgw= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1/go.mod h1:9NiG9I2aHTKkcxqCILhjtyNA1QEiCjdBACv4IvrFQ+c= -go.opentelemetry.io/otel v1.10.0 h1:Y7DTJMR6zs1xkS/upamJYk0SxxN4C9AqRd77jmZnyY4= -go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 h1:TaB+1rQhddO1sF71MpZOZAuSPW1klK2M8XxfrBMfK7Y= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 h1:pDDYmo0QadUPal5fwXoY1pmMpFcdyhXOmL5drCrI3vU= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0/go.mod h1:Krqnjl22jUJ0HgMzw5eveuCvFDXY4nSYb4F8t5gdrag= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 h1:KtiUEhQmj/Pa874bVYKGNVdq8NPKiacPbaRRtgXi+t4= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0/go.mod h1:OfUCyyIiDvNXHWpcWgbF+MWvqPZiNa3YDEnivcnYsV0= -go.opentelemetry.io/otel/metric v0.31.0 h1:6SiklT+gfWAwWUR0meEMxQBtihpiEs4c+vL9spDTqUs= -go.opentelemetry.io/otel/metric v0.31.0/go.mod h1:ohmwj9KTSIeBnDBm/ZwH2PSZxZzoOaG2xZeekTRzL5A= -go.opentelemetry.io/otel/sdk v1.10.0 h1:jZ6K7sVn04kk/3DNUdJ4mqRlGDiXAVuIG+MMENpTNdY= -go.opentelemetry.io/otel/sdk v1.10.0/go.mod h1:vO06iKzD5baltJz1zarxMCNHFpUlUiOy4s65ECtn6kE= -go.opentelemetry.io/otel/trace v1.10.0 h1:npQMbR8o7mum8uF95yFbOEJffhs1sbCOfDh8zAJiH5E= -go.opentelemetry.io/otel/trace v1.10.0/go.mod h1:Sij3YYczqAdz+EhmGhE6TpTxUO5/F/AzrK+kxfGqySM= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.etcd.io/etcd/server/v3 v3.5.9/go.mod h1:GgI1fQClQCFIzuVjlvdbMxNbnISt90gdfYyqiAIt65g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 h1:1eHu3/pUSWaOgltNK3WJFaywKsTIr/PwvHyDmi0lQA0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0/go.mod h1:HyABWq60Uy1kjJSa2BVOxUVao8Cdick5AWSKPutqy6U= +go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= +go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= +go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= +go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= +go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= +go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= +go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= +go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.19.0 h1:mZQZefskPPCMIBCSEH0v2/iUqqLrYtaeqwD6FUGUnFE= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o= -golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= +golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -542,187 +371,63 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= -golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 h1:I6WNifs6pF9tNdSob2W24JtyxIYjzFB9qDlpUC76q+U= +google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405/go.mod h1:3WDQMjmJk36UQhjQ89emUzb1mdaHcPeeAh4SCBKznB4= +google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b h1:CIC2YMXmIhYw6evmhPxBKJ4fmLbOFtXQN/GV3XOZR8k= +google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:IBQ646DjkDkvUIsVq/cc03FUFQ9wbZu7yE396YcL870= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/dnaeon/go-vcr.v3 v3.1.2 h1:F1smfXBqQqwpVifDfUBQG6zzaGjzT+EnVZakrOdr5wA= +gopkg.in/dnaeon/go-vcr.v3 v3.1.2/go.mod h1:2IMOnnlx9I6u9x+YBsM3tAMx6AlOxnJ0pWxQAzZ79Ag= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= @@ -730,60 +435,55 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.28.1 h1:i+0O8k2NPBCPYaMB+uCkseEbawEt/eFaiRqUx8aB108= -k8s.io/api v0.28.1/go.mod h1:uBYwID+66wiL28Kn2tBjBYQdEU0Xk0z5qF8bIBqk/Dg= -k8s.io/apiextensions-apiserver v0.28.1 h1:l2ThkBRjrWpw4f24uq0Da2HaEgqJZ7pcgiEUTKSmQZw= -k8s.io/apiextensions-apiserver v0.28.1/go.mod h1:sVvrI+P4vxh2YBBcm8n2ThjNyzU4BQGilCQ/JAY5kGs= -k8s.io/apimachinery v0.28.1 h1:EJD40og3GizBSV3mkIoXQBsws32okPOy+MkRyzh6nPY= -k8s.io/apimachinery v0.28.1/go.mod h1:X0xh/chESs2hP9koe+SdIAcXWcQ+RM5hy0ZynB+yEvw= -k8s.io/apiserver v0.28.1 h1:dw2/NKauDZCnOUAzIo2hFhtBRUo6gQK832NV8kuDbGM= -k8s.io/apiserver v0.28.1/go.mod h1:d8aizlSRB6yRgJ6PKfDkdwCy2DXt/d1FDR6iJN9kY1w= -k8s.io/client-go v0.28.1 h1:pRhMzB8HyLfVwpngWKE8hDcXRqifh1ga2Z/PU9SXVK8= -k8s.io/client-go v0.28.1/go.mod h1:pEZA3FqOsVkCc07pFVzK076R+P/eXqsgx5zuuRWukNE= -k8s.io/cloud-provider v0.28.1 h1:bR7lIRYBHqxfsOkUsY2hJ7V7vmStxb0wjJJdrID8+7I= -k8s.io/cloud-provider v0.28.1/go.mod h1:7jxsc3c15go606KLXnUq8Cy4nX1R1dxFRgn/czIJp/Q= -k8s.io/component-base v0.28.1 h1:LA4AujMlK2mr0tZbQDZkjWbdhTV5bRyEyAFe0TJxlWg= -k8s.io/component-base v0.28.1/go.mod h1:jI11OyhbX21Qtbav7JkhehyBsIRfnO8oEgoAR12ArIU= -k8s.io/component-helpers v0.28.1 h1:ts/vykhyUmPLhUl/hdLdf+a4BWA0giQ3f25HAIhl+RI= -k8s.io/component-helpers v0.28.1/go.mod h1:rHFPj33uXNbgppg+ilmjJ4oR73prZQNRRmg+utVOAb0= -k8s.io/controller-manager v0.28.1 h1:+md/3DAsdLVoMe3AewhyTxljnPLE/gyshTDZ8sX4Rf0= -k8s.io/controller-manager v0.28.1/go.mod h1:yZ8aOBpMYOBTAI/Jd0qpaUzZUlQigmtRcdYg2VgWKiU= -k8s.io/csi-translation-lib v0.28.1 h1:6EdpqKbwgJEcLxRzcGR1GnbyJrcTcUMhHTYfMwFT3LA= -k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= -k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/kms v0.28.1 h1:QLNTIc0k7Yebkt9yobj9Y9qBoRCMB4dq+pFCxVXVBnY= -k8s.io/kms v0.28.1/go.mod h1:I2TwA8oerDRInHWWBOqSUzv1EJDC1+55FQKYkxaPxh0= +k8s.io/api v0.28.4 h1:8ZBrLjwosLl/NYgv1P7EQLqoO8MGQApnbgH8tu3BMzY= +k8s.io/api v0.28.4/go.mod h1:axWTGrY88s/5YE+JSt4uUi6NMM+gur1en2REMR7IRj0= +k8s.io/apiextensions-apiserver v0.28.4 h1:AZpKY/7wQ8n+ZYDtNHbAJBb+N4AXXJvyZx6ww6yAJvU= +k8s.io/apiextensions-apiserver v0.28.4/go.mod h1:pgQIZ1U8eJSMQcENew/0ShUTlePcSGFq6dxSxf2mwPM= +k8s.io/apimachinery v0.28.4 h1:zOSJe1mc+GxuMnFzD4Z/U1wst50X28ZNsn5bhgIIao8= +k8s.io/apimachinery v0.28.4/go.mod h1:wI37ncBvfAoswfq626yPTe6Bz1c22L7uaJ8dho83mgg= +k8s.io/apiserver v0.28.4 h1:BJXlaQbAU/RXYX2lRz+E1oPe3G3TKlozMMCZWu5GMgg= +k8s.io/apiserver v0.28.4/go.mod h1:Idq71oXugKZoVGUUL2wgBCTHbUR+FYTWa4rq9j4n23w= +k8s.io/client-go v0.28.4 h1:Np5ocjlZcTrkyRJ3+T3PkXDpe4UpatQxj85+xjaD2wY= +k8s.io/client-go v0.28.4/go.mod h1:0VDZFpgoZfelyP5Wqu0/r/TRYcLYuJ2U1KEeoaPa1N4= +k8s.io/cloud-provider v0.28.4 h1:7obmeuJJ5CYTO9HANDqemf/d2v95U+F0t8aeH4jNOsQ= +k8s.io/cloud-provider v0.28.4/go.mod h1:xbhmGZ7wRHgXFP3SNsvdmFRO87KJIvirDYQA5ydMgGA= +k8s.io/component-base v0.28.4 h1:c/iQLWPdUgI90O+T9TeECg8o7N3YJTiuz2sKxILYcYo= +k8s.io/component-base v0.28.4/go.mod h1:m9hR0uvqXDybiGL2nf/3Lf0MerAfQXzkfWhUY58JUbU= +k8s.io/component-helpers v0.28.4 h1:+X9VXT5+jUsRdC26JyMZ8Fjfln7mSjgumafocE509C4= +k8s.io/component-helpers v0.28.4/go.mod h1:8LzMalOQ0K10tkBJWBWq8h0HTI9HDPx4WT3QvTFn9Ro= +k8s.io/controller-manager v0.28.4 h1:8uJmo1pD6fWYk4mC/JfZQU6zPvuCgEHf3pd5G39ldDU= +k8s.io/controller-manager v0.28.4/go.mod h1:pnO+UK2mcWNu1MxucqI8xHPD/8UBm04IUmp2u/3vbnM= +k8s.io/csi-translation-lib v0.28.4 h1:4TrU2zefZGU5HQCyPZvcPxkS6IowqZ/jBs2Qi/dPUpc= +k8s.io/csi-translation-lib v0.28.4/go.mod h1:oxwDdx0hyVqViINOUF7TGrVt51eqsOkQ0BTI+A9QcQs= +k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= +k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/kms v0.28.4 h1:PMgY/3CQTWP9eIKmNQiTgjLIZ0ns6O+voagzD2/4mSg= +k8s.io/kms v0.28.4/go.mod h1:HL4/lR/bhjAJPbqycKtfhWiKh1Sp21cpHOL8P4oo87w= k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ= k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM= -k8s.io/kubectl v0.28.1 h1:jAq4yKEqQL+fwkWcEsUWxhJ7uIRcOYQraJxx4SyAMTY= -k8s.io/kubectl v0.28.1/go.mod h1:a0nk/lMMeKBulp0lMTJAKbkjZg1ykqfLfz/d6dnv1ak= -k8s.io/kubelet v0.28.1 h1:QRfx+jrzNgkLnMSw/nxGkAN7cjHPO446MDbjPITxLkk= -k8s.io/kubelet v0.28.1/go.mod h1:xYBbbJ0e2Rtb/hv+QFie448lFF81J990ImIptce2AHk= -k8s.io/kubernetes v1.28.2 h1:GhcnYeNTukeaC0dD5BC+UWBvzQsFEpWj7XBVMQptfYc= -k8s.io/kubernetes v1.28.2/go.mod h1:FmB1Mlp9ua0ezuwQCTGs/y6wj/fVisN2sVxhzjj0WDk= -k8s.io/mount-utils v0.28.1 h1:oyPtn8ZVxniBfwSlQaBF4fr7QVNYzUuk+gkuxEJgil0= -k8s.io/mount-utils v0.28.1/go.mod h1:AyP8LmZSLgpGdFQr+vzHTerlPiGvXUdP99n98Er47jw= -k8s.io/pod-security-admission v0.28.1 h1:d3jvo/+C6yDR1wnlX9ot1WvLyJ5R4uachJyxhdn9cW8= -k8s.io/pod-security-admission v0.28.1/go.mod h1:Qm1rSy3l96m6QXGNU/8u+cmdpNdmAeA3OYDinrXhi6U= -k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= -k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +k8s.io/kubectl v0.28.4 h1:gWpUXW/T7aFne+rchYeHkyB8eVDl5UZce8G4X//kjUQ= +k8s.io/kubectl v0.28.4/go.mod h1:CKOccVx3l+3MmDbkXtIUtibq93nN2hkDR99XDCn7c/c= +k8s.io/kubelet v0.28.4 h1:Ypxy1jaFlSXFXbg/yVtFOU2ZxErBVRJfLu8+t4s7Dtw= +k8s.io/kubelet v0.28.4/go.mod h1:w1wPI12liY/aeC70nqKYcNNkr6/nbyvdMB7P7wmww2o= +k8s.io/kubernetes v1.28.4 h1:aRNxs5jb8FVTtlnxeA4FSDBVKuFwA8Gw40/U2zReBYA= +k8s.io/kubernetes v1.28.4/go.mod h1:BTzDCKYAlu6LL9ITbfjwgwIrJ30hlTgbv0eXDoA/WoA= +k8s.io/mount-utils v0.28.4 h1:5GOZLm2dXi2fr+MKY8hS6kdV5reXrZBiK7848O5MVD0= +k8s.io/mount-utils v0.28.4/go.mod h1:ceMAZ+Nzlk8zOwN205YXXGJRGmf1o0/XIwsKnG44p0I= +k8s.io/pod-security-admission v0.28.4 h1:b9d6zfKNjkawrO2gF7rBr5XoSZqPfE6UjKLNjgXYrr0= +k8s.io/pod-security-admission v0.28.4/go.mod h1:MVYrZx0Q6ewsZ05Ml2+Ox03HQMAVjO60oombQNmJ44E= +k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU= +k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 h1:trsWhjU5jZrx6UvFu4WzQDrN7Pga4a7Qg+zcfcj64PA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2/go.mod h1:+qG7ISXqCDVVcyO8hLn12AKVYYUjM7ftlqsqmrhMZE0= -sigs.k8s.io/cloud-provider-azure v1.27.1-0.20230907063607-e9994a5f9c7a h1:7/WSpSvXdr/mwDoEMjz0tqlyaACPT9dL/+c1FnbhV6U= -sigs.k8s.io/cloud-provider-azure v1.27.1-0.20230907063607-e9994a5f9c7a/go.mod h1:T86YMaSDRFlMqX5Kmb+KqeASg4Px75GQfcs0sD0yqAw= +sigs.k8s.io/cloud-provider-azure v1.27.1-0.20231128114432-f80321a29d3a h1:e332VvGZflcYOgaFSi6uCCq+17518Mwe6HXG3mN8A4M= +sigs.k8s.io/cloud-provider-azure v1.27.1-0.20231128114432-f80321a29d3a/go.mod h1:M36MFsCkzXOA4MYSGwemzBRDfjb29LT/rmOSs2qnUxc= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.0-20231128114432-f80321a29d3a h1:k3ruyFIAxcCi0XvrdIXt6Xvbw/iiSoBh58tF1NZQ3Sk= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.0-20231128114432-f80321a29d3a/go.mod h1:8F3Frjd9iJjzk9h2dmqG5DrgJ8+Ge48UvO075A8KNFc= +sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.0-20231128114432-f80321a29d3a h1:o2EKmtfsv4U5r1g4hqlUva4+ZptO4YzopHCppVj7mho= +sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.0-20231128114432-f80321a29d3a/go.mod h1:JY+50qlRnEpQGhcw8fem/o9E/Q8OvmWSJPov+SpxTXM= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/hack/verify-yamllint.sh b/hack/verify-yamllint.sh index be491a816..6bdb1ffaa 100755 --- a/hack/verify-yamllint.sh +++ b/hack/verify-yamllint.sh @@ -29,7 +29,7 @@ if [[ "${deployDirNum}" != "${helmDirNum}" ]]; then exit 1 fi -for path in "deploy/*.yaml" "deploy/example/*.yaml" "deploy/example/metrics/*.yaml" +for path in "deploy/*.yaml" "deploy/example/*.yaml" "deploy/example/metrics/*.yaml" "deploy/example/cloning/*.yaml" do echo "checking yamllint under path: $path ..." yamllint -f parsable $path | grep -v "line too long" > $LOG diff --git a/pkg/blob/azure.go b/pkg/blob/azure.go index 9e53c7cb1..5a9a03c2f 100644 --- a/pkg/blob/azure.go +++ b/pkg/blob/azure.go @@ -22,20 +22,17 @@ import ( "os" "strings" - "golang.org/x/net/context" - kv "github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network" "github.com/Azure/azure-sdk-for-go/storage" - "github.com/Azure/go-autorest/autorest" - + "golang.org/x/net/context" clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" "k8s.io/klog/v2" "k8s.io/utils/pointer" - + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader" azure "sigs.k8s.io/cloud-provider-azure/pkg/provider" providerconfig "sigs.k8s.io/cloud-provider-azure/pkg/provider/config" ) @@ -52,20 +49,14 @@ func IsAzureStackCloud(cloud *azure.Cloud) bool { } // getCloudProvider get Azure Cloud Provider -func getCloudProvider(kubeconfig, nodeID, secretName, secretNamespace, userAgent string, allowEmptyCloudConfig bool, kubeAPIQPS float64, kubeAPIBurst int) (*azure.Cloud, error) { +func GetCloudProvider(ctx context.Context, kubeconfig, nodeID, secretName, secretNamespace, userAgent string, allowEmptyCloudConfig bool, kubeAPIQPS float64, kubeAPIBurst int) (*azure.Cloud, error) { var ( config *azure.Config kubeClient *clientset.Clientset fromSecret bool ) - az := &azure.Cloud{ - InitSecretConfig: azure.InitSecretConfig{ - SecretName: secretName, - SecretNamespace: secretNamespace, - CloudConfigKey: "cloud-config", - }, - } + az := &azure.Cloud{} az.Environment.StorageEndpointSuffix = storage.DefaultBaseURL kubeCfg, err := getKubeConfig(kubeconfig) @@ -85,9 +76,16 @@ func getCloudProvider(kubeconfig, nodeID, secretName, secretNamespace, userAgent } if kubeClient != nil { - klog.V(2).Infof("reading cloud config from secret %s/%s", az.SecretNamespace, az.SecretName) az.KubeClient = kubeClient - config, err = az.GetConfigFromSecret() + klog.V(2).Infof("reading cloud config from secret %s/%s", secretNamespace, secretName) + config, err := configloader.Load[azure.Config](ctx, &configloader.K8sSecretLoaderConfig{ + K8sSecretConfig: configloader.K8sSecretConfig{ + SecretName: secretName, + SecretNamespace: secretNamespace, + CloudConfigKey: "cloud-config", + }, + KubeClient: kubeClient, + }, nil) if err == nil && config != nil { fromSecret = true @@ -103,12 +101,12 @@ func getCloudProvider(kubeconfig, nodeID, secretName, secretNamespace, userAgent } } if err != nil { - klog.V(2).Infof("InitializeCloudFromSecret: failed to get cloud config from secret %s/%s: %v", az.SecretNamespace, az.SecretName, err) + klog.V(2).Infof("InitializeCloudFromSecret: failed to get cloud config from secret %s/%s: %v", secretNamespace, secretName, err) } } if config == nil { - klog.V(2).Infof("could not read cloud config from secret %s/%s", az.SecretNamespace, az.SecretName) + klog.V(2).Infof("could not read cloud config from secret %s/%s", secretNamespace, secretName) credFile, ok := os.LookupEnv(DefaultAzureCredentialFileEnv) if ok && strings.TrimSpace(credFile) != "" { klog.V(2).Infof("%s env var set as %v", DefaultAzureCredentialFileEnv, credFile) @@ -117,15 +115,11 @@ func getCloudProvider(kubeconfig, nodeID, secretName, secretNamespace, userAgent klog.V(2).Infof("use default %s env var: %v", DefaultAzureCredentialFileEnv, credFile) } - credFileConfig, err := os.Open(credFile) + config, err = configloader.Load[azure.Config](ctx, nil, &configloader.FileLoaderConfig{ + FilePath: credFile, + }) if err != nil { klog.Warningf("load azure config from file(%s) failed with %v", credFile, err) - } else { - defer credFileConfig.Close() - klog.V(2).Infof("read cloud config from file: %s successfully", credFile) - if config, err = azure.ParseConfig(credFileConfig); err != nil { - klog.Warningf("parse config file(%s) failed with error: %v", credFile, err) - } } } @@ -263,6 +257,7 @@ func (d *Driver) updateSubnetServiceEndpoints(ctx context.Context, vnetResourceG serviceEndpoints = append(serviceEndpoints, storageServiceEndpoint) subnet.SubnetPropertiesFormat.ServiceEndpoints = &serviceEndpoints + klog.V(2).Infof("begin to update the subnet %s under vnet %s rg %s", subnetName, vnetName, vnetResourceGroup) if err := d.cloud.SubnetsClient.CreateOrUpdate(ctx, vnetResourceGroup, vnetName, subnetName, subnet); err != nil { return fmt.Errorf("failed to update the subnet %s under vnet %s: %v", subnetName, vnetName, err) } diff --git a/pkg/blob/azure_test.go b/pkg/blob/azure_test.go index 86b0e36b6..ce093fad6 100644 --- a/pkg/blob/azure_test.go +++ b/pkg/blob/azure_test.go @@ -168,7 +168,7 @@ users: } os.Setenv(DefaultAzureCredentialFileEnv, fakeCredFile) } - cloud, err := getCloudProvider(test.kubeconfig, test.nodeID, "", "", test.userAgent, test.allowEmptyCloudConfig, 25.0, 50) + cloud, err := GetCloudProvider(context.Background(), test.kubeconfig, test.nodeID, "", "", test.userAgent, test.allowEmptyCloudConfig, 25.0, 50) if !reflect.DeepEqual(err, test.expectedErr) && test.expectedErr != nil && !strings.Contains(err.Error(), test.expectedErr.Error()) { t.Errorf("desc: %s,\n input: %q, GetCloudProvider err: %v, expectedErr: %v", test.desc, test.kubeconfig, err, test.expectedErr) } diff --git a/pkg/blob/blob.go b/pkg/blob/blob.go index 0d3dd27a5..24b62602d 100644 --- a/pkg/blob/blob.go +++ b/pkg/blob/blob.go @@ -156,10 +156,6 @@ var ( type DriverOptions struct { NodeID string DriverName string - CloudConfigSecretName string - CloudConfigSecretNamespace string - CustomUserAgent string - UserAgentSuffix string BlobfuseProxyEndpoint string EdgeCacheConfigEndpoint string EdgeCacheMountEndpoint string @@ -168,14 +164,11 @@ type DriverOptions struct { BlobfuseProxyConnTimout int EdgeCacheConnTimeout int EnableBlobMockMount bool - AllowEmptyCloudConfig bool AllowInlineVolumeKeyAccessWithIdentity bool EnableGetVolumeStats bool AppendTimeStampInCacheDir bool AppendMountErrorHelpLink bool MountPermissions uint64 - KubeAPIQPS float64 - KubeAPIBurst int EnableAznfsMount bool VolStatsCacheExpireInMinutes int SasTokenExpirationMinutes int @@ -185,17 +178,12 @@ type DriverOptions struct { type Driver struct { csicommon.CSIDriver - cloud *azure.Cloud - cloudConfigSecretName string - cloudConfigSecretNamespace string - customUserAgent string - userAgentSuffix string - blobfuseProxyEndpoint string + cloud *azure.Cloud + blobfuseProxyEndpoint string // enableBlobMockMount is only for testing, DO NOT set as true in non-testing scenario enableBlobMockMount bool enableBlobfuseProxy bool enableEdgeCacheFinalizer bool - allowEmptyCloudConfig bool enableGetVolumeStats bool allowInlineVolumeKeyAccessWithIdentity bool appendTimeStampInCacheDir bool @@ -203,8 +191,6 @@ type Driver struct { blobfuseProxyConnTimout int mountPermissions uint64 edgeCacheManager *edgecache.Manager - kubeAPIQPS float64 - kubeAPIBurst int enableAznfsMount bool mounter *mount.SafeFormatAndMount volLockMap *util.LockMap @@ -229,15 +215,11 @@ type Driver struct { // NewDriver Creates a NewCSIDriver object. Assumes vendor version is equal to driver version & // does not support optional driver plugin info manifest field. Refer to CSI spec for more details. -func NewDriver(options *DriverOptions) *Driver { +func NewDriver(options *DriverOptions, cloud *azure.Cloud) *Driver { d := Driver{ volLockMap: util.NewLockMap(), subnetLockMap: util.NewLockMap(), volumeLocks: newVolumeLocks(), - cloudConfigSecretName: options.CloudConfigSecretName, - cloudConfigSecretNamespace: options.CloudConfigSecretNamespace, - customUserAgent: options.CustomUserAgent, - userAgentSuffix: options.UserAgentSuffix, blobfuseProxyEndpoint: options.BlobfuseProxyEndpoint, edgeCacheManager: edgecache.NewManager(options.EdgeCacheConnTimeout, options.EdgeCacheMountEndpoint), enableBlobfuseProxy: options.EnableBlobfuseProxy, @@ -245,12 +227,9 @@ func NewDriver(options *DriverOptions) *Driver { allowInlineVolumeKeyAccessWithIdentity: options.AllowInlineVolumeKeyAccessWithIdentity, blobfuseProxyConnTimout: options.BlobfuseProxyConnTimout, enableBlobMockMount: options.EnableBlobMockMount, - allowEmptyCloudConfig: options.AllowEmptyCloudConfig, enableGetVolumeStats: options.EnableGetVolumeStats, appendMountErrorHelpLink: options.AppendMountErrorHelpLink, mountPermissions: options.MountPermissions, - kubeAPIQPS: options.KubeAPIQPS, - kubeAPIBurst: options.KubeAPIBurst, enableAznfsMount: options.EnableAznfsMount, sasTokenExpirationMinutes: options.SasTokenExpirationMinutes, azcopy: &util.Azcopy{}, @@ -274,26 +253,7 @@ func NewDriver(options *DriverOptions) *Driver { if d.volStatsCache, err = azcache.NewTimedCache(time.Duration(options.VolStatsCacheExpireInMinutes)*time.Minute, getter, false); err != nil { klog.Fatalf("%v", err) } - return &d -} - -// Run driver initialization -func (d *Driver) Run(endpoint, kubeconfig string, testBool bool) { - versionMeta, err := GetVersionYAML(d.Name) - if err != nil { - klog.Fatalf("%v", err) - } - klog.Infof("\nDRIVER INFORMATION:\n-------------------\n%s\n\nStreaming logs below:", versionMeta) - - userAgent := GetUserAgent(d.Name, d.customUserAgent, d.userAgentSuffix) - klog.V(2).Infof("driver userAgent: %s", userAgent) - d.cloud, err = getCloudProvider(kubeconfig, d.NodeID, d.cloudConfigSecretName, d.cloudConfigSecretNamespace, userAgent, d.allowEmptyCloudConfig, d.kubeAPIQPS, d.kubeAPIBurst) - if err != nil { - csicommon.SendKubeEvent(v1.EventTypeWarning, csicommon.FailedToInitializeDriver, csicommon.CSIEventSourceStr, fmt.Sprintf("failed to get Azure Cloud Provider, error: %v", err)) - klog.Fatalf("failed to get Azure Cloud Provider, error: %v", err) - } - klog.V(2).Infof("cloud: %s, location: %s, rg: %s, VnetName: %s, VnetResourceGroup: %s, SubnetName: %s", d.cloud.Cloud, d.cloud.Location, d.cloud.ResourceGroup, d.cloud.VnetName, d.cloud.VnetResourceGroup, d.cloud.SubnetName) - + d.cloud = cloud d.mounter = &mount.SafeFormatAndMount{ Interface: mount.New(""), Exec: utilexec.New(), @@ -328,6 +288,17 @@ func (d *Driver) Run(endpoint, kubeconfig string, testBool bool) { } d.AddNodeServiceCapabilities(nodeCap) + return &d +} + +// Run driver initialization +func (d *Driver) Run(endpoint string, testBool bool) { + versionMeta, err := GetVersionYAML(d.Name) + if err != nil { + klog.Fatalf("%v", err) + } + klog.Infof("\nDRIVER INFORMATION:\n-------------------\n%s\n\nStreaming logs below:", versionMeta) + s := csicommon.NewNonBlockingGRPCServer() // Driver d act as IdentityServer, ControllerServer and NodeServer s.Start(endpoint, d, d, d, testBool) @@ -740,6 +711,12 @@ func isSupportedContainerNamePrefix(prefix string) bool { return true } +// isNFSProtocol checks if the protocol is NFS or AZNFS +func isNFSProtocol(protocol string) bool { + protocol = strings.ToLower(protocol) + return protocol == NFS || protocol == AZNFS +} + // get storage account from secrets map func getStorageAccount(secrets map[string]string) (string, string, error) { if secrets == nil { diff --git a/pkg/blob/blob_test.go b/pkg/blob/blob_test.go index ea1f2a653..07262202f 100644 --- a/pkg/blob/blob_test.go +++ b/pkg/blob/blob_test.go @@ -57,11 +57,10 @@ func NewFakeDriver() *Driver { BlobfuseProxyConnTimout: 5, EnableBlobMockMount: false, } - driver := NewDriver(&driverOptions) + driver := NewDriver(&driverOptions, &azure.Cloud{}) driver.Name = fakeDriverName driver.Version = vendorVersion driver.subnetLockMap = util.NewLockMap() - driver.cloud = &azure.Cloud{} return driver } @@ -74,7 +73,7 @@ func TestNewFakeDriver(t *testing.T) { BlobfuseProxyConnTimout: 5, EnableBlobMockMount: false, } - d := NewDriver(&driverOptions) + d := NewDriver(&driverOptions, &azure.Cloud{}) assert.NotNil(t, d) } @@ -87,7 +86,7 @@ func TestNewDriver(t *testing.T) { BlobfuseProxyConnTimout: 5, EnableBlobMockMount: false, } - driver := NewDriver(&driverOptions) + driver := NewDriver(&driverOptions, &azure.Cloud{}) fakedriver := NewFakeDriver() fakedriver.Name = DefaultDriverName fakedriver.Version = driverVersion @@ -135,7 +134,7 @@ func TestRun(t *testing.T) { os.Setenv(DefaultAzureCredentialFileEnv, fakeCredFile) d := NewFakeDriver() - d.Run("tcp://127.0.0.1:0", "", true) + d.Run("tcp://127.0.0.1:0", true) }, }, { @@ -162,7 +161,7 @@ func TestRun(t *testing.T) { d := NewFakeDriver() d.cloud = &azure.Cloud{} d.NodeID = "" - d.Run("tcp://127.0.0.1:0", "", true) + d.Run("tcp://127.0.0.1:0", true) }, }, } @@ -1662,3 +1661,46 @@ func TestIsSupportedAccessTier(t *testing.T) { } } } + +func TestIsNFSProtocol(t *testing.T) { + tests := []struct { + protocol string + expectedResult bool + }{ + { + protocol: "", + expectedResult: false, + }, + { + protocol: "NFS", + expectedResult: true, + }, + { + protocol: "nfs", + expectedResult: true, + }, + { + protocol: "Nfs", + expectedResult: true, + }, + { + protocol: "NFSv3", + expectedResult: false, + }, + { + protocol: "aznfs", + expectedResult: true, + }, + { + protocol: "azNfs", + expectedResult: true, + }, + } + + for _, test := range tests { + result := isNFSProtocol(test.protocol) + if result != test.expectedResult { + t.Errorf("isNFSVolume(%s) returned with %v, not equal to %v", test.protocol, result, test.expectedResult) + } + } +} diff --git a/pkg/blob/controllerserver.go b/pkg/blob/controllerserver.go index 78a8cc5e9..11bbccca8 100644 --- a/pkg/blob/controllerserver.go +++ b/pkg/blob/controllerserver.go @@ -211,7 +211,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) } if pointer.BoolDeref(enableBlobVersioning, false) { - if protocol == NFS || pointer.BoolDeref(isHnsEnabled, false) { + if isNFSProtocol(protocol) || pointer.BoolDeref(isHnsEnabled, false) { return nil, status.Errorf(codes.InvalidArgument, "enableBlobVersioning is not supported for NFS protocol or HNS enabled account") } } @@ -221,7 +221,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) } if subsID != "" && subsID != d.cloud.SubscriptionID { - if protocol == NFS { + if isNFSProtocol(protocol) { return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("NFS protocol is not supported in cross subscription(%s)", subsID)) } if !storeAccountKey { @@ -267,7 +267,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) createPrivateEndpoint = pointer.BoolPtr(true) } accountKind := string(storage.KindStorageV2) - if protocol == NFS { + if isNFSProtocol(protocol) { isHnsEnabled = pointer.Bool(true) enableNfsV3 = pointer.Bool(true) // NFS protocol does not need account key @@ -386,7 +386,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) } } - if pointer.BoolDeref(createPrivateEndpoint, false) && protocol == NFS { + if pointer.BoolDeref(createPrivateEndpoint, false) && isNFSProtocol(protocol) { // As for blobfuse/blobfuse2, serverName, i.e.,AZURE_STORAGE_BLOB_ENDPOINT env variable can't include // "privatelink", issue: https://github.com/Azure/azure-storage-fuse/issues/1014 // @@ -594,11 +594,11 @@ func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.Valida }, nil } -func (d *Driver) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) { +func (d *Driver) ControllerPublishVolume(_ context.Context, _ *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) { return nil, status.Error(codes.Unimplemented, "ControllerPublishVolume is not yet implemented") } -func (d *Driver) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) { +func (d *Driver) ControllerUnpublishVolume(_ context.Context, _ *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) { return nil, status.Error(codes.Unimplemented, "ControllerUnpublishVolume is not yet implemented") } @@ -608,39 +608,39 @@ func (d *Driver) ControllerGetVolume(context.Context, *csi.ControllerGetVolumeRe } // GetCapacity returns the capacity of the total available storage pool -func (d *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) { +func (d *Driver) GetCapacity(_ context.Context, _ *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) { return nil, status.Error(codes.Unimplemented, "GetCapacity is not yet implemented") } // ListVolumes return all available volumes -func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) { +func (d *Driver) ListVolumes(_ context.Context, _ *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) { return nil, status.Error(codes.Unimplemented, "ListVolumes is not yet implemented") } // CreateSnapshot create snapshot -func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) { +func (d *Driver) CreateSnapshot(_ context.Context, _ *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) { return nil, status.Error(codes.Unimplemented, "CreateSnapshot is not yet implemented") } // DeleteSnapshot delete snapshot -func (d *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) { +func (d *Driver) DeleteSnapshot(_ context.Context, _ *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) { return nil, status.Error(codes.Unimplemented, "DeleteSnapshot is not yet implemented") } // ListSnapshots list snapshots -func (d *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) { +func (d *Driver) ListSnapshots(_ context.Context, _ *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) { return nil, status.Error(codes.Unimplemented, "ListSnapshots is not yet implemented") } // ControllerGetCapabilities returns the capabilities of the Controller plugin -func (d *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) { +func (d *Driver) ControllerGetCapabilities(_ context.Context, _ *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) { return &csi.ControllerGetCapabilitiesResponse{ Capabilities: d.Cap, }, nil } // ControllerExpandVolume controller expand volume -func (d *Driver) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) { +func (d *Driver) ControllerExpandVolume(_ context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) { if len(req.GetVolumeId()) == 0 { return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request") } @@ -728,7 +728,7 @@ func (d *Driver) DeleteBlobContainer(ctx context.Context, subsID, resourceGroupN } // CopyBlobContainer copies a blob container in the same storage account -func (d *Driver) copyBlobContainer(ctx context.Context, req *csi.CreateVolumeRequest, accountKey, dstContainerName, storageEndpointSuffix string) error { +func (d *Driver) copyBlobContainer(_ context.Context, req *csi.CreateVolumeRequest, accountKey, dstContainerName, storageEndpointSuffix string) error { var sourceVolumeID string if req.GetVolumeContentSource() != nil && req.GetVolumeContentSource().GetVolume() != nil { sourceVolumeID = req.GetVolumeContentSource().GetVolume().GetVolumeId() diff --git a/pkg/blob/controllerserver_test.go b/pkg/blob/controllerserver_test.go index 92fd5944f..8b9fb5bc1 100644 --- a/pkg/blob/controllerserver_test.go +++ b/pkg/blob/controllerserver_test.go @@ -59,7 +59,7 @@ type mockBlobClient struct { conProp *storage.ContainerProperties } -func (c *mockBlobClient) CreateContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string, parameters storage.BlobContainer) *retry.Error { +func (c *mockBlobClient) CreateContainer(_ context.Context, _, _, _, _ string, _ storage.BlobContainer) *retry.Error { switch *c.errorType { case DATAPLANE: return retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError)) @@ -70,7 +70,7 @@ func (c *mockBlobClient) CreateContainer(ctx context.Context, subsID, resourceGr } return nil } -func (c *mockBlobClient) DeleteContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string) *retry.Error { +func (c *mockBlobClient) DeleteContainer(_ context.Context, _, _, _, _ string) *retry.Error { switch *c.errorType { case DATAPLANE: return retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError)) @@ -81,7 +81,7 @@ func (c *mockBlobClient) DeleteContainer(ctx context.Context, subsID, resourceGr } return nil } -func (c *mockBlobClient) GetContainer(ctx context.Context, subsID, resourceGroupName, accountName, containerName string) (storage.BlobContainer, *retry.Error) { +func (c *mockBlobClient) GetContainer(_ context.Context, _, _, _, _ string) (storage.BlobContainer, *retry.Error) { switch *c.errorType { case DATAPLANE: return storage.BlobContainer{ContainerProperties: c.conProp}, retry.GetError(&http.Response{}, fmt.Errorf(containerBeingDeletedDataplaneAPIError)) @@ -93,11 +93,11 @@ func (c *mockBlobClient) GetContainer(ctx context.Context, subsID, resourceGroup return storage.BlobContainer{ContainerProperties: c.conProp}, nil } -func (c *mockBlobClient) GetServiceProperties(ctx context.Context, subsID, resourceGroupName, accountName string) (storage.BlobServiceProperties, error) { +func (c *mockBlobClient) GetServiceProperties(_ context.Context, _, _, _ string) (storage.BlobServiceProperties, error) { return storage.BlobServiceProperties{}, nil } -func (c *mockBlobClient) SetServiceProperties(ctx context.Context, subsID, resourceGroupName, accountName string, parameters storage.BlobServiceProperties) (storage.BlobServiceProperties, error) { +func (c *mockBlobClient) SetServiceProperties(_ context.Context, _, _, _ string, _ storage.BlobServiceProperties) (storage.BlobServiceProperties, error) { return storage.BlobServiceProperties{}, nil } @@ -106,7 +106,7 @@ func newMockBlobClient(errorType *errType, custom *string, conProp *storage.Cont } // creates and returns mock storage account client -func NewMockSAClient(ctx context.Context, ctrl *gomock.Controller, subsID, rg, accName string, keyList *[]storage.AccountKey) *mockstorageaccountclient.MockInterface { +func NewMockSAClient(_ context.Context, ctrl *gomock.Controller, _, _, _ string, keyList *[]storage.AccountKey) *mockstorageaccountclient.MockInterface { cl := mockstorageaccountclient.NewMockInterface(ctrl) cl.EXPECT(). @@ -163,18 +163,6 @@ func TestCreateVolume(t *testing.T) { name string testFunc func(t *testing.T) }{ - { - name: "invalid create volume req", - testFunc: func(t *testing.T) { - d := NewFakeDriver() - req := &csi.CreateVolumeRequest{} - _, err := d.CreateVolume(context.Background(), req) - expectedErr := status.Error(codes.InvalidArgument, "CREATE_DELETE_VOLUME") - if !reflect.DeepEqual(err, expectedErr) { - t.Errorf("actualErr: (%v), expectedErr: (%v)", err, expectedErr) - } - }, - }, { name: "volume Name missing", testFunc: func(t *testing.T) { @@ -752,6 +740,7 @@ func TestCreateVolume(t *testing.T) { } }, }, + //nolint:dupl { name: "create volume from copy volumesnapshot is not supported", testFunc: func(t *testing.T) { @@ -807,6 +796,7 @@ func TestCreateVolume(t *testing.T) { } }, }, + //nolint:dupl { name: "create volume from copy volume not found", testFunc: func(t *testing.T) { @@ -893,20 +883,6 @@ func TestDeleteVolume(t *testing.T) { } }, }, - { - name: "invalid delete volume req", - testFunc: func(t *testing.T) { - d := NewFakeDriver() - req := &csi.DeleteVolumeRequest{ - VolumeId: "unit-test", - } - _, err := d.DeleteVolume(context.Background(), req) - expectedErr := status.Errorf(codes.Internal, "invalid delete volume req: volume_id:\"unit-test\" ") - if !reflect.DeepEqual(err, expectedErr) { - t.Errorf("actualErr: (%v), expectedErr: (%v)", err, expectedErr) - } - }, - }, { name: "invalid volume Id", testFunc: func(t *testing.T) { @@ -1298,21 +1274,6 @@ func TestControllerExpandVolume(t *testing.T) { } }, }, - { - name: "invalid expand volume req", - testFunc: func(t *testing.T) { - d := NewFakeDriver() - req := &csi.ControllerExpandVolumeRequest{ - VolumeId: "unit-test", - CapacityRange: &csi.CapacityRange{}, - } - _, err := d.ControllerExpandVolume(context.Background(), req) - expectedErr := status.Errorf(codes.Internal, "invalid expand volume req: volume_id:\"unit-test\" capacity_range:<> ") - if !reflect.DeepEqual(err, expectedErr) { - t.Errorf("actualErr: (%v), expectedErr: (%v)", err, expectedErr) - } - }, - }, { name: "Volume Size exceeds Max Container Size", testFunc: func(t *testing.T) { diff --git a/pkg/blob/fake_mount.go b/pkg/blob/fake_mount.go index cafdb2370..d530e5fc8 100644 --- a/pkg/blob/fake_mount.go +++ b/pkg/blob/fake_mount.go @@ -28,7 +28,7 @@ type fakeMounter struct { } // Mount overrides mount.FakeMounter.Mount. -func (f *fakeMounter) Mount(source string, target string, fstype string, options []string) error { +func (f *fakeMounter) Mount(source string, target string, _ string, _ []string) error { if strings.Contains(source, "error_mount") { return fmt.Errorf("fake Mount: source error") } else if strings.Contains(target, "error_mount") { @@ -39,7 +39,7 @@ func (f *fakeMounter) Mount(source string, target string, fstype string, options } // MountSensitive overrides mount.FakeMounter.MountSensitive. -func (f *fakeMounter) MountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error { +func (f *fakeMounter) MountSensitive(source string, target string, _ string, _ []string, _ []string) error { if strings.Contains(source, "ut-container") { return fmt.Errorf("fake MountSensitive: source error") } else if strings.Contains(target, "error_mount_sens") { diff --git a/pkg/blob/identityserver.go b/pkg/blob/identityserver.go index e14969ef8..bdbbac866 100644 --- a/pkg/blob/identityserver.go +++ b/pkg/blob/identityserver.go @@ -27,7 +27,7 @@ import ( ) // GetPluginInfo return the version and name of the plugin -func (f *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) { +func (f *Driver) GetPluginInfo(_ context.Context, _ *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) { if f.Name == "" { return nil, status.Error(codes.Unavailable, "Driver name not configured") } @@ -46,12 +46,12 @@ func (f *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoReques // This method does not need to return anything. // Currently the spec does not dictate what you should return either. // Hence, return an empty response -func (f *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error) { +func (f *Driver) Probe(_ context.Context, _ *csi.ProbeRequest) (*csi.ProbeResponse, error) { return &csi.ProbeResponse{Ready: &wrappers.BoolValue{Value: true}}, nil } // GetPluginCapabilities returns the capabilities of the plugin -func (f *Driver) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) { +func (f *Driver) GetPluginCapabilities(_ context.Context, _ *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) { return &csi.GetPluginCapabilitiesResponse{ Capabilities: []*csi.PluginCapability{ { diff --git a/pkg/blob/nodeserver.go b/pkg/blob/nodeserver.go index ddd8ce441..72fee4307 100644 --- a/pkg/blob/nodeserver.go +++ b/pkg/blob/nodeserver.go @@ -219,7 +219,7 @@ func (d *Driver) mountBlobfuseInsideDriver(args string, protocol string, authEnv } // NodeUnpublishVolume unmount the volume from the target path -func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { +func (d *Driver) NodeUnpublishVolume(_ context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { volumeID := req.GetVolumeId() if len(volumeID) == 0 { return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request") @@ -397,7 +397,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe return &csi.NodeStageVolumeResponse{}, nil } - if protocol == NFS { + if isNFSProtocol(protocol) { klog.V(2).Infof("target %v\nprotocol %v\n\nvolumeId %v\ncontext %v\nmountflags %v\nserverAddress %v", targetPath, protocol, volumeID, attrib, mountFlags, serverAddress) @@ -513,7 +513,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe } // NodeUnstageVolume unmount the volume from the staging path -func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) { +func (d *Driver) NodeUnstageVolume(_ context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) { volumeID := req.GetVolumeId() if len(volumeID) == 0 { return nil, status.Error(codes.InvalidArgument, "Volume ID not provided") @@ -569,26 +569,26 @@ func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolu } // NodeGetCapabilities return the capabilities of the Node plugin -func (d *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) { +func (d *Driver) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) { return &csi.NodeGetCapabilitiesResponse{ Capabilities: d.NSCap, }, nil } // NodeGetInfo return info of the node on which this plugin is running -func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) { +func (d *Driver) NodeGetInfo(_ context.Context, _ *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) { return &csi.NodeGetInfoResponse{ NodeId: d.NodeID, }, nil } // NodeExpandVolume node expand volume -func (d *Driver) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { +func (d *Driver) NodeExpandVolume(_ context.Context, _ *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { return nil, status.Error(codes.Unimplemented, "NodeExpandVolume is not yet implemented") } // NodeGetVolumeStats get volume stats -func (d *Driver) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) { +func (d *Driver) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) { if len(req.VolumeId) == 0 { return nil, status.Error(codes.InvalidArgument, "NodeGetVolumeStats volume ID was empty") } diff --git a/pkg/blobfuse-proxy/init.sh b/pkg/blobfuse-proxy/init.sh index 380f2beca..4628f5ae4 100755 --- a/pkg/blobfuse-proxy/init.sh +++ b/pkg/blobfuse-proxy/init.sh @@ -25,110 +25,32 @@ READ_AHEAD_KB=${READ_AHEAD_KB:-15380} HOST_CMD="nsenter --mount=/proc/1/ns/mnt" DISTRIBUTION=$($HOST_CMD cat /etc/os-release | grep ^ID= | cut -d'=' -f2 | tr -d '"') -echo "Linux distribution: $DISTRIBUTION" ARCH=$($HOST_CMD uname -m) -echo "Linux Arch is $(uname -m)" - -if [ "${DISTRIBUTION}" = "ubuntu" ] && { [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]; } -then - release=$($HOST_CMD lsb_release -rs) - echo "Ubuntu release: $release" - - if [ "$(expr "$release" \< "22.04")" -eq 1 ] - then - cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb - else - cp /blobfuse-proxy/packages-microsoft-prod-22.04.deb /host/etc/packages-microsoft-prod.deb - fi - - # when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue. - # refer to https://stackoverflow.com/questions/45349571/how-to-install-deb-with-dpkg-non-interactively - yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update - - pkg_list="" - if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ "$(expr "$release" \< "22.04")" -eq 1 ] - then - pkg_list="${pkg_list} fuse" - # install blobfuse with latest version or specific version - if [ -z "${BLOBFUSE_VERSION}" ]; then - echo "install blobfuse with latest version" - pkg_list="${pkg_list} blobfuse" - else - pkg_list="${pkg_list} blobfuse=${BLOBFUSE_VERSION}" - fi - fi - - if [ "${INSTALL_BLOBFUSE2}" = "true" ] - then - if [ "$(expr "$release" \< "22.04")" -eq 1 ]; then - echo "install fuse for blobfuse2" - pkg_list="${pkg_list} fuse" - else - echo "install fuse3 for blobfuse2, current release is $release" - pkg_list="${pkg_list} fuse3" - fi - - # install blobfuse2 with latest version or specific version - if [ -z "${BLOBFUSE2_VERSION}" ]; then - echo "install blobfuse2 with latest version" - pkg_list="${pkg_list} blobfuse2" - else - pkg_list="${pkg_list} blobfuse2=${BLOBFUSE2_VERSION}" - fi - fi - echo "begin to install ${pkg_list}" - $HOST_CMD apt-get install -y $pkg_list - $HOST_CMD rm -f /etc/packages-microsoft-prod.deb -fi - -updateBlobfuseProxy="true" -if [ -f "/host/usr/bin/blobfuse-proxy" ];then - old=$(sha256sum /host/usr/bin/blobfuse-proxy | awk '{print $1}') - new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}') - if [ "$old" = "$new" ];then - updateBlobfuseProxy="false" - echo "no need to update blobfuse-proxy" - fi -fi - -if [ "$updateBlobfuseProxy" = "true" ];then - echo "copy blobfuse-proxy...." - rm -rf /host/var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock - rm -rf /host/usr/bin/blobfuse-proxy - cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy - chmod 755 /host/usr/bin/blobfuse-proxy -fi - -updateService="true" -if [ -f "/host/usr/lib/systemd/system/blobfuse-proxy.service" ];then - old=$(sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk '{print $1}') - new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}') - if [ "$old" = "$new" ];then - updateService="false" - echo "no need to update blobfuse-proxy.service" - fi -fi - -if [ "$updateService" = "true" ];then - echo "copy blobfuse-proxy.service...." - mkdir -p /host/usr/lib/systemd/system - cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service -fi - -if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then - if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then - echo "start blobfuse-proxy...." - $HOST_CMD systemctl daemon-reload - $HOST_CMD systemctl enable blobfuse-proxy.service - $HOST_CMD systemctl restart blobfuse-proxy.service - fi -fi - +echo "Linux distribution: $DISTRIBUTION, Arch: $ARCH" + +# install blobfuse-proxy and blobfuse/blofuse2 if needed +case "${DISTRIBUTION}" in + "ubuntu") + . ./blobfuse-proxy/install-proxy-ubuntu.sh + ;; + "rhcos") + . ./blobfuse-proxy/install-proxy-rhcos.sh + ;; + "mariner") + . ./blobfuse-proxy/install-proxy-mariner.sh + ;; + *) + echo "Unsupported distribution: ${DISTRIBUTION}" + ;; +esac + +# set max open file num if [ "${SET_MAX_OPEN_FILE_NUM}" = "true" ] then $HOST_CMD sysctl -w fs.file-max="${MAX_FILE_NUM}" fi +# disable updatedb updateDBConfigPath="/host/etc/updatedb.conf" if [ "${DISABLE_UPDATEDB}" = "true" ] && [ -f ${updateDBConfigPath} ] then @@ -140,6 +62,7 @@ then cat ${updateDBConfigPath} fi +# set read ahead size if [ "${SET_READ_AHEAD_SIZE}" = "true" ] then echo "set read ahead size to ${READ_AHEAD_KB}KB" diff --git a/pkg/blobfuse-proxy/install-proxy-mariner.sh b/pkg/blobfuse-proxy/install-proxy-mariner.sh new file mode 100644 index 000000000..4f7382708 --- /dev/null +++ b/pkg/blobfuse-proxy/install-proxy-mariner.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +# Copyright 2019 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -xe + +# install blobfuse/blobfuse2 +echo "skip install blobfuse/blobfuse2 for mariner...." + +# install blobfuse-proxy +updateBlobfuseProxy="true" +if [ -f "/host/usr/bin/blobfuse-proxy" ];then + old=$(sha256sum /host/usr/bin/blobfuse-proxy | awk '{print $1}') + new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}') + if [ "$old" = "$new" ];then + updateBlobfuseProxy="false" + echo "no need to update blobfuse-proxy" + fi +fi +if [ "$updateBlobfuseProxy" = "true" ];then + echo "copy blobfuse-proxy...." + rm -rf /host/var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock + rm -rf /host/usr/bin/blobfuse-proxy + cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy + chmod 755 /host/usr/bin/blobfuse-proxy +fi + +updateService="true" +if [ -f "/host/usr/lib/systemd/system/blobfuse-proxy.service" ];then + old=$(sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk '{print $1}') + new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}') + if [ "$old" = "$new" ];then + updateService="false" + echo "no need to update blobfuse-proxy.service" + fi +fi +if [ "$updateService" = "true" ];then + echo "copy blobfuse-proxy.service...." + mkdir -p /host/usr/lib/systemd/system + cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service +fi + +if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then + if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then + echo "start blobfuse-proxy...." + $HOST_CMD systemctl daemon-reload + $HOST_CMD systemctl enable blobfuse-proxy.service + $HOST_CMD systemctl restart blobfuse-proxy.service + fi +fi diff --git a/pkg/blobfuse-proxy/install-proxy-rhcos.sh b/pkg/blobfuse-proxy/install-proxy-rhcos.sh new file mode 100644 index 000000000..91f51f8bc --- /dev/null +++ b/pkg/blobfuse-proxy/install-proxy-rhcos.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# Copyright 2019 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -xe + +# in coreos, we could just copy the blobfuse2 binary to /usr/local/bin/blobfuse2 +if [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ] +then + echo "copy blobfuse2...." + cp /usr/bin/blobfuse2 /host/usr/local/bin/blobfuse2 +fi + +# install blobfuse-proxy +updateBlobfuseProxy="true" +if [ -f "/host/usr/local/bin/blobfuse-proxy" ];then + old=$(sha256sum /host/usr/local/bin/blobfuse-proxy | awk '{print $1}') + new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}') + if [ "$old" = "$new" ];then + updateBlobfuseProxy="false" + echo "no need to update blobfuse-proxy" + fi +fi +if [ "$updateBlobfuseProxy" = "true" ];then + echo "copy blobfuse-proxy...." + rm -rf /host/var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock + rm -rf /host/usr/local/bin/blobfuse-proxy + cp /blobfuse-proxy/blobfuse-proxy /host/usr/local/bin/blobfuse-proxy + chmod 755 /host/usr/local/bin/blobfuse-proxy +fi + +updateService="true" +echo "change from /usr/bin/blobfuse-proxy to /usr/local/bin/blobfuse-proxy in blobfuse-proxy.service" +sed -i 's/\/usr\/bin\/blobfuse-proxy/\/usr\/local\/bin\/blobfuse-proxy/g' /blobfuse-proxy/blobfuse-proxy.service +if [ -f "/host/etc/systemd/system/blobfuse-proxy.service" ];then + old=$(sha256sum /host/etc/systemd/system/blobfuse-proxy.service | awk '{print $1}') + new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}') + if [ "$old" = "$new" ];then + updateService="false" + echo "no need to update blobfuse-proxy.service" + fi +fi +if [ "$updateService" = "true" ];then + echo "copy blobfuse-proxy.service...." + mkdir -p /host/etc/systemd/system/ + cp /blobfuse-proxy/blobfuse-proxy.service /host/etc/systemd/system/blobfuse-proxy.service +fi + +if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then + if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then + echo "start blobfuse-proxy...." + $HOST_CMD systemctl daemon-reload + $HOST_CMD systemctl enable blobfuse-proxy.service + $HOST_CMD systemctl restart blobfuse-proxy.service + fi +fi diff --git a/pkg/blobfuse-proxy/install-proxy-ubuntu.sh b/pkg/blobfuse-proxy/install-proxy-ubuntu.sh new file mode 100644 index 000000000..911be8356 --- /dev/null +++ b/pkg/blobfuse-proxy/install-proxy-ubuntu.sh @@ -0,0 +1,117 @@ +#!/bin/sh + +# Copyright 2019 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -xe + +# install blobfuse/blobfuse2 +if [ "${ARCH}" = "aarch64" ] +then + echo "skip install blobfuse/blobfuse2 for arm64...." +elif [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ] +then + echo "start to install blobfuse/blobfuse2...." + + release=$($HOST_CMD lsb_release -rs) + echo "Ubuntu release: $release" + + if [ "$(expr "$release" \< "22.04")" -eq 1 ] + then + cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb + else + cp /blobfuse-proxy/packages-microsoft-prod-22.04.deb /host/etc/packages-microsoft-prod.deb + fi + # when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue. + # refer to https://stackoverflow.com/questions/45349571/how-to-install-deb-with-dpkg-non-interactively + yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update + + pkg_list="" + # blobfuse + if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ "$(expr "$release" \< "22.04")" -eq 1 ] + then + pkg_list="${pkg_list} fuse" + if [ -z "${BLOBFUSE_VERSION}" ]; then + echo "install blobfuse with latest version" + pkg_list="${pkg_list} blobfuse" + else + pkg_list="${pkg_list} blobfuse=${BLOBFUSE_VERSION}" + fi + fi + + # blobfuse2 + if [ "${INSTALL_BLOBFUSE2}" = "true" ] + then + if [ "$(expr "$release" \< "22.04")" -eq 1 ]; then + echo "install fuse for blobfuse2" + pkg_list="${pkg_list} fuse" + else + echo "install fuse3 for blobfuse2, current release is $release" + pkg_list="${pkg_list} fuse3" + fi + + if [ -z "${BLOBFUSE2_VERSION}" ]; then + echo "install blobfuse2 with latest version" + pkg_list="${pkg_list} blobfuse2" + else + pkg_list="${pkg_list} blobfuse2=${BLOBFUSE2_VERSION}" + fi + fi + + echo "begin to install ${pkg_list}" + $HOST_CMD apt-get install -y $pkg_list + $HOST_CMD rm -f /etc/packages-microsoft-prod.deb +fi + +# install blobfuse-proxy +updateBlobfuseProxy="true" +if [ -f "/host/usr/bin/blobfuse-proxy" ];then + old=$(sha256sum /host/usr/bin/blobfuse-proxy | awk '{print $1}') + new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}') + if [ "$old" = "$new" ];then + updateBlobfuseProxy="false" + echo "no need to update blobfuse-proxy" + fi +fi +if [ "$updateBlobfuseProxy" = "true" ];then + echo "copy blobfuse-proxy...." + rm -rf /host/var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock + rm -rf /host/usr/bin/blobfuse-proxy + cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy + chmod 755 /host/usr/bin/blobfuse-proxy +fi + +updateService="true" +if [ -f "/host/usr/lib/systemd/system/blobfuse-proxy.service" ];then + old=$(sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk '{print $1}') + new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}') + if [ "$old" = "$new" ];then + updateService="false" + echo "no need to update blobfuse-proxy.service" + fi +fi +if [ "$updateService" = "true" ];then + echo "copy blobfuse-proxy.service...." + mkdir -p /host/usr/lib/systemd/system + cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service +fi + +if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then + if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then + echo "start blobfuse-proxy...." + $HOST_CMD systemctl daemon-reload + $HOST_CMD systemctl enable blobfuse-proxy.service + $HOST_CMD systemctl restart blobfuse-proxy.service + fi +fi diff --git a/pkg/blobfuse-proxy/main.go b/pkg/blobfuse-proxy/main.go index 50ca18960..10990990d 100644 --- a/pkg/blobfuse-proxy/main.go +++ b/pkg/blobfuse-proxy/main.go @@ -54,8 +54,8 @@ func main() { mountServer := server.NewMountServiceServer() - klog.V(2).Info("Listening for connections on address: %v\n", listener.Addr()) + klog.V(2).Infof("Listening for connections on address: %v\n", listener.Addr()) if err = server.RunGRPCServer(mountServer, false, listener); err != nil { - klog.Fatalf("Error running grpc server. Error: %v", listener.Addr(), err) + klog.Fatalf("Error running grpc server %v. Error: %v", listener.Addr(), err) } } diff --git a/pkg/blobfuse-proxy/server/server.go b/pkg/blobfuse-proxy/server/server.go index 19c89c6f0..df2add7d7 100644 --- a/pkg/blobfuse-proxy/server/server.go +++ b/pkg/blobfuse-proxy/server/server.go @@ -55,7 +55,7 @@ func NewMountServiceServer() *MountServer { } // MountAzureBlob mounts an azure blob container to given location -func (server *MountServer) MountAzureBlob(ctx context.Context, +func (server *MountServer) MountAzureBlob(_ context.Context, req *mount_azure_blob.MountAzureBlobRequest, ) (resp *mount_azure_blob.MountAzureBlobResponse, err error) { mutex.Lock() @@ -115,14 +115,24 @@ func RunGRPCServer( } func getBlobfuseVersion() BlobfuseVersion { - osinfo, err := util.GetOSInfo("/etc/lsb-release") + osinfo, err := util.GetOSInfo("/etc/os-release") if err != nil { klog.Warningf("failed to get OS info: %v, default using blobfuse v1", err) return BlobfuseV1 } - if osinfo.Distro == "Ubuntu" && osinfo.Version >= "22.04" { - klog.V(2).Info("proxy default using blobfuse V2 for mounting") + if strings.EqualFold(osinfo.Distro, "mariner") && osinfo.Version >= "2.0" { + klog.V(2).Info("proxy default using blobfuse V2 for mounting on Mariner 2.0+") + return BlobfuseV2 + } + + if strings.EqualFold(osinfo.Distro, "rhcos") { + klog.V(2).Info("proxy default using blobfuse V2 for mounting on RHCOS") + return BlobfuseV2 + } + + if strings.EqualFold(osinfo.Distro, "ubuntu") && osinfo.Version >= "22.04" { + klog.V(2).Info("proxy default using blobfuse V2 for mounting on Ubuntu 22.04+") return BlobfuseV2 } diff --git a/pkg/blobplugin/Dockerfile b/pkg/blobplugin/Dockerfile index 9f572f968..8153961fa 100644 --- a/pkg/blobplugin/Dockerfile +++ b/pkg/blobplugin/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 +FROM registry.k8s.io/build-image/debian-base:bookworm-v1.0.0 ARG ARCH=amd64 ARG binary=./_output/${ARCH}/blobplugin @@ -21,19 +21,44 @@ COPY ${binary} /blobplugin RUN mkdir /blobfuse-proxy/ COPY ./pkg/blobfuse-proxy/init.sh /blobfuse-proxy/ +COPY ./pkg/blobfuse-proxy/install-proxy-ubuntu.sh /blobfuse-proxy/ +COPY ./pkg/blobfuse-proxy/install-proxy-rhcos.sh /blobfuse-proxy/ +COPY ./pkg/blobfuse-proxy/install-proxy-mariner.sh /blobfuse-proxy/ COPY ./pkg/blobfuse-proxy/blobfuse-proxy.service /blobfuse-proxy/ COPY ./_output/${ARCH}/blobfuse-proxy /blobfuse-proxy/ RUN chmod +x /blobfuse-proxy/init.sh && \ + chmod +x /blobfuse-proxy/install-proxy-ubuntu.sh && \ + chmod +x /blobfuse-proxy/install-proxy-rhcos.sh && \ + chmod +x /blobfuse-proxy/install-proxy-mariner.sh && \ chmod +x /blobfuse-proxy/blobfuse-proxy.service && \ chmod +x /blobfuse-proxy/blobfuse-proxy -# Currently no CBL-Mariner image with fix for "curl"/"zlib" CVE-2023-38545/CVE-2023-38546/CVE-2023-45853. -# So, temporarily do update here. Remove "curl"/"zlib" when image is updated. -RUN tdnf updateinfo && \ - tdnf install -y util-linux e2fsprogs nfs-utils quota-rpc rpcbind blobfuse2 fuse3 libcap-ng libcap ca-certificates curl zlib && \ - tdnf clean all +# packages that are only needed by aznfs: procps conntrack iptables bind9-host iproute2 bash netcat sysvinit-utils. +RUN apt update && apt upgrade -y && apt-mark unhold libcap2 && clean-install ca-certificates uuid-dev util-linux mount udev wget e2fsprogs nfs-common netbase procps conntrack iptables bind9-host iproute2 bash netcat-traditional sysvinit-utils kmod +# install aznfs +RUN if [ "$ARCH" = "amd64" ] ; then \ + wget -O aznfs.tar.gz https://github.com/Azure/AZNFS-mount/releases/download/1.0.8/aznfs-1.0.8-1.x86_64.tar.gz; \ +else \ + wget -O aznfs.tar.gz https://github.com/Azure/AZNFS-mount/releases/download/1.0.8/aznfs-1.0.8-1.arm64.tar.gz;fi +RUN tar xvzf aznfs.tar.gz -C / --keep-directory-symlink && rm aznfs.tar.gz + +# install azcopy +ARG azcopyURL=https://azcopyvnext.azureedge.net/releases/release-10.21.2-20231106/azcopy_linux_amd64_10.21.2.tar.gz +RUN if [ "$ARCH" == "arm64" ] ; then \ + azcopyURL=https://azcopyvnext.azureedge.net/releases/release-10.21.2-20231106/azcopy_linux_arm64_10.21.2.tar.gz; fi +RUN wget -O azcopy.tar.gz ${azcopyURL} && \ + tar xvzf azcopy.tar.gz -C . && rm azcopy.tar.gz && \ + mv ./azcopy_linux_$ARCH_*/azcopy /usr/local/bin/azcopy && \ + rm -rf ./azcopy_linux_$ARCH_* +RUN chmod +x /usr/local/bin/azcopy + +RUN if [ "$ARCH" = "amd64" ] ; then \ + clean-install libcurl4-gnutls-dev && \ + wget -O /blobfuse-proxy/packages-microsoft-prod-22.04.deb https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb && \ + wget -O /blobfuse-proxy/packages-microsoft-prod-18.04.deb https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \ + dpkg -i /blobfuse-proxy/packages-microsoft-prod-18.04.deb && apt update && apt install blobfuse blobfuse2 fuse -y && apt remove wget -y; fi LABEL maintainers="andyzhangx" LABEL description="Azure Blob Storage CSI driver" diff --git a/pkg/blobplugin/main.go b/pkg/blobplugin/main.go index 4402192ff..889450c24 100644 --- a/pkg/blobplugin/main.go +++ b/pkg/blobplugin/main.go @@ -84,8 +84,6 @@ func handle() { driverOptions := blob.DriverOptions{ NodeID: *nodeID, DriverName: *driverName, - CloudConfigSecretName: *cloudConfigSecretName, - CloudConfigSecretNamespace: *cloudConfigSecretNamespace, BlobfuseProxyEndpoint: *blobfuseProxyEndpoint, EdgeCacheConfigEndpoint: *edgeCacheConfigEndpoint, EdgeCacheMountEndpoint: *edgeCacheMountEndpoint, @@ -94,25 +92,30 @@ func handle() { BlobfuseProxyConnTimout: *blobfuseProxyConnTimout, EnableBlobMockMount: *enableBlobMockMount, EnableEdgeCacheFinalizer: true, - CustomUserAgent: *customUserAgent, - UserAgentSuffix: *userAgentSuffix, - AllowEmptyCloudConfig: *allowEmptyCloudConfig, EnableGetVolumeStats: *enableGetVolumeStats, AppendTimeStampInCacheDir: *appendTimeStampInCacheDir, MountPermissions: *mountPermissions, AllowInlineVolumeKeyAccessWithIdentity: *allowInlineVolumeKeyAccessWithIdentity, AppendMountErrorHelpLink: *appendMountErrorHelpLink, - KubeAPIQPS: *kubeAPIQPS, - KubeAPIBurst: *kubeAPIBurst, EnableAznfsMount: *enableAznfsMount, VolStatsCacheExpireInMinutes: *volStatsCacheExpireInMinutes, SasTokenExpirationMinutes: *sasTokenExpirationMinutes, } - driver := blob.NewDriver(&driverOptions) + + userAgent := blob.GetUserAgent(driverOptions.DriverName, *customUserAgent, *userAgentSuffix) + klog.V(2).Infof("driver userAgent: %s", userAgent) + + cloud, err := blob.GetCloudProvider(context.Background(), *kubeconfig, driverOptions.NodeID, *cloudConfigSecretName, *cloudConfigSecretNamespace, userAgent, *allowEmptyCloudConfig, *kubeAPIQPS, *kubeAPIBurst) + if err != nil { + klog.Fatalf("failed to get Azure Cloud Provider, error: %v", err) + } + klog.V(2).Infof("cloud: %s, location: %s, rg: %s, VnetName: %s, VnetResourceGroup: %s, SubnetName: %s", cloud.Cloud, cloud.Location, cloud.ResourceGroup, cloud.VnetName, cloud.VnetResourceGroup, cloud.SubnetName) + + driver := blob.NewDriver(&driverOptions, cloud) if driver == nil { klog.Fatalln("Failed to initialize Azure Blob Storage CSI driver") } - driver.Run(*endpoint, *kubeconfig, false) + driver.Run(*endpoint, false) } func exportMetrics() { @@ -127,7 +130,7 @@ func exportMetrics() { serve(context.Background(), l, serveMetrics) } -func serve(ctx context.Context, l net.Listener, serveFunc func(net.Listener) error) { +func serve(_ context.Context, l net.Listener, serveFunc func(net.Listener) error) { path := l.Addr().String() klog.V(2).Infof("set up prometheus server on %v", path) go func() { diff --git a/pkg/csi-common/driver_test.go b/pkg/csi-common/driver_test.go index 170c91dd8..aadee7090 100644 --- a/pkg/csi-common/driver_test.go +++ b/pkg/csi-common/driver_test.go @@ -63,7 +63,7 @@ func TestNewFakeDriver(t *testing.T) { assert.Nil(t, d) } -func TestAddControllerServiceCapabilities(t *testing.T) { +func TestAddControllerServiceCapabilities(_ *testing.T) { d := NewFakeDriver() var cl []csi.ControllerServiceCapability_RPC_Type cl = append(cl, csi.ControllerServiceCapability_RPC_UNKNOWN) diff --git a/pkg/csi-common/server_test.go b/pkg/csi-common/server_test.go index aa1b2d044..18e07712c 100644 --- a/pkg/csi-common/server_test.go +++ b/pkg/csi-common/server_test.go @@ -30,7 +30,7 @@ func TestNewNonBlockingGRPCServer(t *testing.T) { assert.NotNil(t, s) } -func TestStart(t *testing.T) { +func TestStart(_ *testing.T) { s := NewNonBlockingGRPCServer() // sleep a while to avoid race condition in unit test time.Sleep(time.Millisecond * 500) @@ -38,7 +38,7 @@ func TestStart(t *testing.T) { time.Sleep(time.Millisecond * 500) } -func TestServe(t *testing.T) { +func TestServe(_ *testing.T) { s := nonBlockingGRPCServer{} s.server = grpc.NewServer() s.wg = sync.WaitGroup{} @@ -47,20 +47,20 @@ func TestServe(t *testing.T) { s.serve("tcp://127.0.0.1:0", nil, nil, nil, true) } -func TestWait(t *testing.T) { +func TestWait(_ *testing.T) { s := nonBlockingGRPCServer{} s.server = grpc.NewServer() s.wg = sync.WaitGroup{} s.Wait() } -func TestStop(t *testing.T) { +func TestStop(_ *testing.T) { s := nonBlockingGRPCServer{} s.server = grpc.NewServer() s.Stop() } -func TestForceStop(t *testing.T) { +func TestForceStop(_ *testing.T) { s := nonBlockingGRPCServer{} s.server = grpc.NewServer() s.ForceStop() diff --git a/pkg/util/util.go b/pkg/util/util.go index 70ed8cab2..f9feaefae 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -210,8 +210,8 @@ type OsInfo struct { } const ( - keyDistribID = "DISTRIB_ID" - keyDistribRelease = "DISTRIB_RELEASE" + keyID = "ID" + keyVersionID = "VERSION_ID" ) func GetOSInfo(f interface{}) (*OsInfo, error) { @@ -221,8 +221,8 @@ func GetOSInfo(f interface{}) (*OsInfo, error) { } oi := &OsInfo{} - oi.Distro = cfg.Section("").Key(keyDistribID).String() - oi.Version = cfg.Section("").Key(keyDistribRelease).String() + oi.Distro = cfg.Section("").Key(keyID).String() + oi.Version = cfg.Section("").Key(keyVersionID).String() klog.V(2).Infof("get OS info: %v", oi) return oi, nil @@ -272,7 +272,7 @@ func (ac *Azcopy) GetAzcopyJob(dstBlobContainer string) (AzcopyJobState, string, klog.Warningf("failed to get azcopy job with error: %v, jobState: %v", err, AzcopyJobError) return AzcopyJobError, "", fmt.Errorf("couldn't list jobs in azcopy %v", err) } - jobid, jobState, err := parseAzcopyJobList(out, dstBlobContainer) + jobid, jobState, err := parseAzcopyJobList(out) if err != nil || jobState == AzcopyJobError { klog.Warningf("failed to get azcopy job with error: %v, jobState: %v", err, jobState) return AzcopyJobError, "", fmt.Errorf("couldn't parse azcopy job list in azcopy %v", err) @@ -299,8 +299,8 @@ func (ac *Azcopy) GetAzcopyJob(dstBlobContainer string) (AzcopyJobState, string, return jobState, percent, nil } -// parseAzcopyJobList parse command azcopy jobs list, get jobid and state from joblist containing dstBlobContainer -func parseAzcopyJobList(joblist string, dstBlobContainer string) (string, AzcopyJobState, error) { +// parseAzcopyJobList parse command azcopy jobs list, get jobid and state from joblist +func parseAzcopyJobList(joblist string) (string, AzcopyJobState, error) { jobid := "" jobSegments := strings.Split(joblist, "JobId: ") if len(jobSegments) < 2 { diff --git a/pkg/util/util_test.go b/pkg/util/util_test.go index c3b1ec021..0cd19aade 100644 --- a/pkg/util/util_test.go +++ b/pkg/util/util_test.go @@ -77,7 +77,7 @@ func TestConcurrentLockEntry(t *testing.T) { testLockMap.UnlockEntry("entry1") } -func (lm *LockMap) lockAndCallback(t *testing.T, entry string, callbackChan chan<- interface{}) { +func (lm *LockMap) lockAndCallback(_ *testing.T, entry string, callbackChan chan<- interface{}) { lm.LockEntry(entry) callbackChan <- true } @@ -358,10 +358,10 @@ func TestGetOSInfo(t *testing.T) { { name: "parse os info correctly", args: args{ - f: []byte("DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=22.04"), + f: []byte("ID=ubuntu\nVERSION_ID=\"22.04\""), }, want: &OsInfo{ - Distro: "Ubuntu", + Distro: "ubuntu", Version: "22.04", }, wantErr: false, @@ -572,8 +572,7 @@ func TestParseAzcopyJobList(t *testing.T) { } for _, test := range tests { - dstBlobContainer := "dstBlobContainer" - jobid, jobState, err := parseAzcopyJobList(test.str, dstBlobContainer) + jobid, jobState, err := parseAzcopyJobList(test.str) if jobid != test.expectedJobid || jobState != test.expectedJobState || !reflect.DeepEqual(err, test.expectedErr) { t.Errorf("test[%s]: unexpected jobid: %v, jobState: %v, err: %v, expected jobid: %v, jobState: %v, err: %v", test.desc, jobid, jobState, err, test.expectedJobid, test.expectedJobState, test.expectedErr) } diff --git a/test/e2e/driver/blob_csi_driver.go b/test/e2e/driver/blob_csi_driver.go index aace41a39..c7e989f41 100644 --- a/test/e2e/driver/blob_csi_driver.go +++ b/test/e2e/driver/blob_csi_driver.go @@ -39,7 +39,7 @@ func InitBlobCSIDriver() PVTestDriver { } } -func (d *blobCSIDriver) GetProvisionStorageClass(parameters map[string]string, mountOptions []string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, bindingMode *storagev1.VolumeBindingMode, allowedTopologyValues []string, namespace string) *storagev1.StorageClass { +func (d *blobCSIDriver) GetProvisionStorageClass(parameters map[string]string, mountOptions []string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, bindingMode *storagev1.VolumeBindingMode, _ []string, namespace string) *storagev1.StorageClass { provisioner := d.driverName generateName := fmt.Sprintf("%s-%s-sc-", namespace, provisioner) return getStorageClass(generateName, provisioner, parameters, mountOptions, reclaimPolicy, bindingMode, nil) diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 1335bcfe2..9b51476de 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -142,6 +142,7 @@ var _ = ginkgo.SynchronizedBeforeSuite(func(ctx ginkgo.SpecContext) []byte { // spin up a blob driver locally to make use of the azure client and controller service kubeconfig := os.Getenv(kubeconfigEnvVar) _, useBlobfuseProxy := os.LookupEnv("ENABLE_BLOBFUSE_PROXY") + os.Setenv("AZURE_CREDENTIAL_FILE", credentials.TempAzureCredentialFilePath) driverOptions := blob.DriverOptions{ NodeID: os.Getenv("nodeid"), DriverName: blob.DefaultDriverName, @@ -150,10 +151,11 @@ var _ = ginkgo.SynchronizedBeforeSuite(func(ctx ginkgo.SpecContext) []byte { BlobfuseProxyConnTimout: 5, EnableBlobMockMount: false, } - blobDriver = blob.NewDriver(&driverOptions) + cloud, err := blob.GetCloudProvider(context.Background(), kubeconfig, driverOptions.NodeID, "", "", "", false, 0, 0) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + blobDriver = blob.NewDriver(&driverOptions, cloud) go func() { - os.Setenv("AZURE_CREDENTIAL_FILE", credentials.TempAzureCredentialFilePath) - blobDriver.Run(fmt.Sprintf("unix:///tmp/csi-%s.sock", uuid.NewUUID().String()), kubeconfig, false) + blobDriver.Run(fmt.Sprintf("unix:///tmp/csi-%s.sock", uuid.NewUUID().String()), false) }() }) diff --git a/test/e2e/testsuites/dynamically_provisioned_inline_volume.go b/test/e2e/testsuites/dynamically_provisioned_inline_volume.go index b30d29157..4f8db2135 100644 --- a/test/e2e/testsuites/dynamically_provisioned_inline_volume.go +++ b/test/e2e/testsuites/dynamically_provisioned_inline_volume.go @@ -41,7 +41,7 @@ func (t *DynamicallyProvisionedInlineVolumeTest) Run(ctx context.Context, client for _, pod := range t.Pods { var tpod *TestPod var cleanup []func(context.Context) - tpod, cleanup = pod.SetupWithCSIInlineVolumes(client, namespace, t.CSIDriver, t.SecretName, t.ContainerName, t.ReadOnly) + tpod, cleanup = pod.SetupWithCSIInlineVolumes(client, namespace, t.SecretName, t.ContainerName, t.ReadOnly) // defer must be called here for resources not get removed before using them for i := range cleanup { diff --git a/test/e2e/testsuites/specs.go b/test/e2e/testsuites/specs.go index e785decc6..fe997b802 100644 --- a/test/e2e/testsuites/specs.go +++ b/test/e2e/testsuites/specs.go @@ -91,7 +91,7 @@ type DataSource struct { Name string } -func (pod *PodDetails) SetupWithCSIInlineVolumes(client clientset.Interface, namespace *v1.Namespace, csiDriver driver.DynamicPVTestDriver, secretName, shareName string, readOnly bool) (*TestPod, []func(context.Context)) { +func (pod *PodDetails) SetupWithCSIInlineVolumes(client clientset.Interface, namespace *v1.Namespace, secretName, shareName string, readOnly bool) (*TestPod, []func(context.Context)) { tpod := NewTestPod(client, namespace, pod.Cmd) cleanupFuncs := make([]func(ctx context.Context), 0) for n, v := range pod.Volumes { diff --git a/test/utils/azure/azure_helper.go b/test/utils/azure/azure_helper.go index 8574ed07e..81ac7a990 100644 --- a/test/utils/azure/azure_helper.go +++ b/test/utils/azure/azure_helper.go @@ -19,49 +19,69 @@ package azure import ( "context" "fmt" - "log" "os" - "strings" "time" - "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/azidentity" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/jongio/azidext/go/azidext" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + resources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient" ) type Client struct { - environment azure.Environment subscriptionID string - groupsClient resources.GroupsClient - accountsClient storage.AccountsClient + groupsClient resourcegroupclient.Interface + accountsClient accountclient.Interface } func GetClient(cloud, subscriptionID, clientID, tenantID, clientSecret string) (*Client, error) { - env, err := azure.EnvironmentFromName(cloud) + armConfig := &azclient.ARMClientConfig{ + Cloud: cloud, + } + cloudConfig, err := azclient.GetAzureCloudConfig(armConfig) if err != nil { return nil, err } - - options := azidentity.ClientSecretCredentialOptions{ - ClientOptions: azcore.ClientOptions{ - Cloud: getCloudConfig(env), + credProvider, err := azclient.NewAuthProvider(azclient.AzureAuthConfig{ + TenantID: tenantID, + AADClientID: clientID, + AADClientSecret: clientSecret, + }, &arm.ClientOptions{ + AuxiliaryTenants: []string{tenantID}, + ClientOptions: policy.ClientOptions{ + Cloud: *cloudConfig, }, + }) + if err != nil { + return nil, err } - cred, err := azidentity.NewClientSecretCredential(tenantID, clientID, clientSecret, &options) + cred, err := credProvider.GetAzIdentity() + if err != nil { + return nil, err + } + factory, err := azclient.NewClientFactory(&azclient.ClientFactoryConfig{ + SubscriptionID: subscriptionID, + }, armConfig, cred) if err != nil { return nil, err } - return getClient(env, subscriptionID, tenantID, cred, env.TokenAudience), nil + return &Client{ + subscriptionID: subscriptionID, + groupsClient: factory.GetResourceGroupClient(), + accountsClient: factory.GetAccountClient(), + }, nil } -func (az *Client) EnsureResourceGroup(ctx context.Context, name, location string, managedBy *string) (resourceGroup *resources.Group, err error) { +func (az *Client) EnsureResourceGroup(ctx context.Context, name, location string, managedBy *string) (resourceGroup *resources.ResourceGroup, err error) { var tags map[string]*string group, err := az.groupsClient.Get(ctx, name) + if err != nil { + group = &resources.ResourceGroup{} + } if err == nil && group.Tags != nil { tags = group.Tags } else { @@ -71,92 +91,38 @@ func (az *Client) EnsureResourceGroup(ctx context.Context, name, location string managedBy = group.ManagedBy } // Tags for correlating resource groups with prow jobs on testgrid - tags["buildID"] = stringPointer(os.Getenv("BUILD_ID")) - tags["jobName"] = stringPointer(os.Getenv("JOB_NAME")) - tags["creationTimestamp"] = stringPointer(time.Now().UTC().Format(time.RFC3339)) + tags["buildID"] = to.Ptr(os.Getenv("BUILD_ID")) + tags["jobName"] = to.Ptr(os.Getenv("JOB_NAME")) + tags["creationTimestamp"] = to.Ptr(time.Now().UTC().Format(time.RFC3339)) - response, err := az.groupsClient.CreateOrUpdate(ctx, name, resources.Group{ + response, err := az.groupsClient.CreateOrUpdate(ctx, name, resources.ResourceGroup{ Name: &name, Location: &location, ManagedBy: managedBy, Tags: tags, }) if err != nil { - return &response, err + return response, err } - return &response, nil + return response, nil } func (az *Client) DeleteResourceGroup(ctx context.Context, groupName string) error { _, err := az.groupsClient.Get(ctx, groupName) if err == nil { - future, err := az.groupsClient.Delete(ctx, groupName) + err := az.groupsClient.Delete(ctx, groupName) if err != nil { return fmt.Errorf("cannot delete resource group %v: %w", groupName, err) } - err = future.WaitForCompletionRef(ctx, az.groupsClient.Client) - if err != nil { - // Skip the teardown errors because of https://github.com/Azure/go-autorest/issues/357 - // TODO(feiskyer): fix the issue by upgrading go-autorest version >= v11.3.2. - log.Printf("Warning: failed to delete resource group %q with error %v", groupName, err) - } } return nil } func (az *Client) GetAccountNumByResourceGroup(ctx context.Context, groupName string) (count int, err error) { - result, err := az.accountsClient.ListByResourceGroup(ctx, groupName) + result, err := az.accountsClient.List(ctx, groupName) if err != nil { return -1, err } - return len(result.Values()), nil -} - -func getCloudConfig(env azure.Environment) cloud.Configuration { - switch env.Name { - case azure.USGovernmentCloud.Name: - return cloud.AzureGovernment - case azure.ChinaCloud.Name: - return cloud.AzureChina - case azure.PublicCloud.Name: - return cloud.AzurePublic - default: - return cloud.Configuration{ - ActiveDirectoryAuthorityHost: env.ActiveDirectoryEndpoint, - Services: map[cloud.ServiceName]cloud.ServiceConfiguration{ - cloud.ResourceManager: { - Audience: env.TokenAudience, - Endpoint: env.ResourceManagerEndpoint, - }, - }, - } - } -} - -func getClient(env azure.Environment, subscriptionID, tenantID string, cred *azidentity.ClientSecretCredential, scope string) *Client { - c := &Client{ - environment: env, - subscriptionID: subscriptionID, - groupsClient: resources.NewGroupsClientWithBaseURI(env.ResourceManagerEndpoint, subscriptionID), - accountsClient: storage.NewAccountsClient(subscriptionID), - } - - if !strings.HasSuffix(scope, "/.default") { - scope += "/.default" - } - // Use an adapter so azidentity in the Azure SDK can be used as Authorizer - // when calling the Azure Management Packages, which we currently use. Once - // the Azure SDK clients (found in /sdk) move to stable, we can update our - // clients and they will be able to use the creds directly without the - // authorizer. - authorizer := azidext.NewTokenCredentialAdapter(cred, []string{scope}) - c.groupsClient.Authorizer = authorizer - c.accountsClient.Authorizer = authorizer - - return c -} - -func stringPointer(s string) *string { - return &s + return len(result), nil } 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 index c4da5d78f..aa30abf37 100644 --- 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 @@ -1,11 +1,164 @@ # Release History +## 1.9.0 (2023-11-06) + +### Breaking Changes +> These changes affect only code written against previous beta versions of `v1.7.0` and `v1.8.0` +* The function `NewTokenCredential` has been removed from the `fake` package. Use a literal `&fake.TokenCredential{}` instead. +* The field `TracingNamespace` in `runtime.PipelineOptions` has been replaced by `TracingOptions`. + +### Bugs Fixed + +* Fixed an issue that could cause some allowed HTTP header values to not show up in logs. +* Include error text instead of error type in traces when the transport returns an error. +* Fixed an issue that could cause an HTTP/2 request to hang when the TCP connection becomes unresponsive. +* Block key and SAS authentication for non TLS protected endpoints. +* Passing a `nil` credential value will no longer cause a panic. Instead, the authentication is skipped. +* Calling `Error` on a zero-value `azcore.ResponseError` will no longer panic. +* Fixed an issue in `fake.PagerResponder[T]` that would cause a trailing error to be omitted when iterating over pages. +* Context values created by `azcore` will no longer flow across disjoint HTTP requests. + +### Other Changes + +* Skip generating trace info for no-op tracers. +* The `clientName` paramater in client constructors has been renamed to `moduleName`. + +## 1.9.0-beta.1 (2023-10-05) + +### Other Changes + +* The beta features for tracing and fakes have been reinstated. + +## 1.8.0 (2023-10-05) + +### Features Added + +* This includes the following features from `v1.8.0-beta.N` releases. + * Claims and CAE for authentication. + * New `messaging` package. + * Various helpers in the `runtime` package. + * Deprecation of `runtime.With*` funcs and their replacements in the `policy` package. +* Added types `KeyCredential` and `SASCredential` to the `azcore` package. + * Includes their respective constructor functions. +* Added types `KeyCredentialPolicy` and `SASCredentialPolicy` to the `azcore/runtime` package. + * Includes their respective constructor functions and options types. + +### Breaking Changes +> These changes affect only code written against beta versions of `v1.8.0` +* The beta features for tracing and fakes have been omitted for this release. + +### Bugs Fixed + +* Fixed an issue that could cause some ARM RPs to not be automatically registered. +* Block bearer token authentication for non TLS protected endpoints. + +### Other Changes + +* Updated dependencies. + +## 1.8.0-beta.3 (2023-09-07) + +### Features Added + +* Added function `FetcherForNextLink` and `FetcherForNextLinkOptions` to the `runtime` package to centralize creation of `Pager[T].Fetcher` from a next link URL. + +### Bugs Fixed + +* Suppress creating spans for nested SDK API calls. The HTTP span will be a child of the outer API span. + +### Other Changes + +* The following functions in the `runtime` package are now exposed from the `policy` package, and the `runtime` versions have been deprecated. + * `WithCaptureResponse` + * `WithHTTPHeader` + * `WithRetryOptions` + +## 1.7.2 (2023-09-06) + +### Bugs Fixed + +* Fix default HTTP transport to work in WASM modules. + +## 1.8.0-beta.2 (2023-08-14) + +### Features Added + +* Added function `SanitizePagerPollerPath` to the `server` package to centralize sanitization and formalize the contract. +* Added `TokenRequestOptions.EnableCAE` to indicate whether to request a CAE token. + +### Breaking Changes + +> This change affects only code written against beta version `v1.8.0-beta.1`. +* `messaging.CloudEvent` deserializes JSON objects as `[]byte`, instead of `json.RawMessage`. See the documentation for CloudEvent.Data for more information. + +> This change affects only code written against beta versions `v1.7.0-beta.2` and `v1.8.0-beta.1`. +* Removed parameter from method `Span.End()` and its type `tracing.SpanEndOptions`. This API GA'ed in `v1.2.0` so we cannot change it. + +### Bugs Fixed + +* Propagate any query parameters when constructing a fake poller and/or injecting next links. + +## 1.7.1 (2023-08-14) + +## Bugs Fixed + +* Enable TLS renegotiation in the default transport policy. + +## 1.8.0-beta.1 (2023-07-12) + +### Features Added + +- `messaging/CloudEvent` allows you to serialize/deserialize CloudEvents, as described in the CloudEvents 1.0 specification: [link](https://github.com/cloudevents/spec) + +### Other Changes + +* The beta features for CAE, tracing, and fakes have been reinstated. + +## 1.7.0 (2023-07-12) + +### Features Added +* Added method `WithClientName()` to type `azcore.Client` to support shallow cloning of a client with a new name used for tracing. + +### Breaking Changes +> These changes affect only code written against beta versions v1.7.0-beta.1 or v1.7.0-beta.2 +* The beta features for CAE, tracing, and fakes have been omitted for this release. + +## 1.7.0-beta.2 (2023-06-06) + +### Breaking Changes +> These changes affect only code written against beta version v1.7.0-beta.1 +* Method `SpanFromContext()` on type `tracing.Tracer` had the `bool` return value removed. + * This includes the field `SpanFromContext` in supporting type `tracing.TracerOptions`. +* Method `AddError()` has been removed from type `tracing.Span`. +* Method `Span.End()` now requires an argument of type `*tracing.SpanEndOptions`. + ## 1.6.1 (2023-06-06) +### Bugs Fixed +* Fixed an issue in `azcore.NewClient()` and `arm.NewClient()` that could cause an incorrect module name to be used in telemetry. + +### Other Changes +* This version contains all bug fixes from `v1.7.0-beta.1` + +## 1.7.0-beta.1 (2023-05-24) + +### Features Added +* Restored CAE support for ARM clients. +* Added supporting features to enable distributed tracing. + * Added func `runtime.StartSpan()` for use by SDKs to start spans. + * Added method `WithContext()` to `runtime.Request` to support shallow cloning with a new context. + * Added field `TracingNamespace` to `runtime.PipelineOptions`. + * Added field `Tracer` to `runtime.NewPollerOptions` and `runtime.NewPollerFromResumeTokenOptions` types. + * Added field `SpanFromContext` to `tracing.TracerOptions`. + * Added methods `Enabled()`, `SetAttributes()`, and `SpanFromContext()` to `tracing.Tracer`. + * Added supporting pipeline policies to include HTTP spans when creating clients. +* Added package `fake` to support generated fakes packages in SDKs. + * The package contains public surface area exposed by fake servers and supporting APIs intended only for use by the fake server implementations. + * Added an internal fake poller implementation. + ### Bugs Fixed * Retry policy always clones the underlying `*http.Request` before invoking the next policy. * Added some non-standard error codes to the list of error codes for unregistered resource providers. -* Fixed an issue in `azcore.NewClient()` and `arm.NewClient()` that could cause an incorrect module name to be used in telemetry. ## 1.6.0 (2023-05-04) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client.go index aa34575f6..c373cc43f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client.go @@ -28,17 +28,11 @@ type Client struct { // NewClient creates a new Client instance with the provided values. // This client is intended to be used with Azure Resource Manager endpoints. -// - clientName - the fully qualified name of the client ("module/package.Client"); this is used by the telemetry policy and tracing provider. -// if module and package are the same value, the "module/" prefix can be omitted. -// - moduleVersion - the version of the containing module; used by the telemetry policy +// - moduleName - the fully qualified name of the module where the client is defined; used by the telemetry policy and tracing provider. +// - moduleVersion - the semantic version of the module; used by the telemetry policy and tracing provider. // - cred - the TokenCredential used to authenticate the request // - options - optional client configurations; pass nil to accept the default values -func NewClient(clientName, moduleVersion string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) { - mod, client, err := shared.ExtractModuleName(clientName) - if err != nil { - return nil, err - } - +func NewClient(moduleName, moduleVersion string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) { if options == nil { options = &ClientOptions{} } @@ -53,12 +47,12 @@ func NewClient(clientName, moduleVersion string, cred azcore.TokenCredential, op if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } - pl, err := armruntime.NewPipeline(mod, moduleVersion, cred, runtime.PipelineOptions{}, options) + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, cred, runtime.PipelineOptions{}, options) if err != nil { return nil, err } - tr := options.TracingProvider.NewTracer(client, moduleVersion) + tr := options.TracingProvider.NewTracer(moduleName, moduleVersion) return &Client{ep: ep, pl: pl, tr: tr}, nil } 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 index 266c74b17..302c19cd4 100644 --- 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 @@ -13,6 +13,7 @@ import ( "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/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" azpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" azruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) @@ -34,7 +35,7 @@ func NewPipeline(module, version string, cred azcore.TokenCredential, plOpts azr }) perRetry := make([]azpolicy.Policy, len(plOpts.PerRetry), len(plOpts.PerRetry)+1) copy(perRetry, plOpts.PerRetry) - plOpts.PerRetry = append(perRetry, authPolicy) + plOpts.PerRetry = append(perRetry, authPolicy, exported.PolicyFunc(httpTraceNamespacePolicy)) if !options.DisableRPRegistration { regRPOpts := armpolicy.RegistrationOptions{ClientOptions: options.ClientOptions} regPolicy, err := NewRPRegistrationPolicy(cred, ®RPOpts) 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 index 07f15991e..54b3bb78d 100644 --- 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 @@ -5,6 +5,7 @@ package runtime import ( "context" + "encoding/base64" "fmt" "net/http" "strings" @@ -27,12 +28,12 @@ type acquiringResourceState struct { 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) { +// acquireAuxToken acquires a token from an auxiliary tenant. Only one thread/goroutine at a time ever calls this function. +func acquireAuxToken(state acquiringResourceState) (newResource azcore.AccessToken, newExpiration time.Time, err error) { tk, err := state.p.cred.GetToken(state.ctx, azpolicy.TokenRequestOptions{ - Scopes: state.p.scopes, - TenantID: state.tenant, + EnableCAE: true, + Scopes: state.p.scopes, + TenantID: state.tenant, }) if err != nil { return azcore.AccessToken{}, time.Time{}, err @@ -58,20 +59,37 @@ func NewBearerTokenPolicy(cred azcore.TokenCredential, opts *armpolicy.BearerTok p := &BearerTokenPolicy{cred: cred} p.auxResources = make(map[string]*temporal.Resource[azcore.AccessToken, acquiringResourceState], len(opts.AuxiliaryTenants)) for _, t := range opts.AuxiliaryTenants { - p.auxResources[t] = temporal.NewResource(acquire) + p.auxResources[t] = temporal.NewResource(acquireAuxToken) } p.scopes = make([]string, len(opts.Scopes)) copy(p.scopes, opts.Scopes) p.btp = azruntime.NewBearerTokenPolicy(cred, opts.Scopes, &azpolicy.BearerTokenOptions{ - AuthorizationHandler: azpolicy.AuthorizationHandler{OnRequest: p.onRequest}, + AuthorizationHandler: azpolicy.AuthorizationHandler{ + OnChallenge: p.onChallenge, + OnRequest: p.onRequest, + }, }) return p } +func (b *BearerTokenPolicy) onChallenge(req *azpolicy.Request, res *http.Response, authNZ func(azpolicy.TokenRequestOptions) error) error { + challenge := res.Header.Get(shared.HeaderWWWAuthenticate) + claims, err := parseChallenge(challenge) + if err != nil { + // the challenge contains claims we can't parse + return err + } else if claims != "" { + // request a new token having the specified claims, send the request again + return authNZ(azpolicy.TokenRequestOptions{Claims: claims, EnableCAE: true, Scopes: b.scopes}) + } + // auth challenge didn't include claims, so this is a simple authorization failure + return azruntime.NewResponseError(res) +} + // onRequest authorizes requests with one or more bearer tokens func (b *BearerTokenPolicy) onRequest(req *azpolicy.Request, authNZ func(azpolicy.TokenRequestOptions) error) error { // authorize the request with a token for the primary tenant - err := authNZ(azpolicy.TokenRequestOptions{Scopes: b.scopes}) + err := authNZ(azpolicy.TokenRequestOptions{EnableCAE: true, Scopes: b.scopes}) if err != nil || len(b.auxResources) == 0 { return err } @@ -97,3 +115,31 @@ func (b *BearerTokenPolicy) onRequest(req *azpolicy.Request, authNZ func(azpolic func (b *BearerTokenPolicy) Do(req *azpolicy.Request) (*http.Response, error) { return b.btp.Do(req) } + +// parseChallenge parses claims from an authentication challenge issued by ARM so a client can request a token +// that will satisfy conditional access policies. It returns a non-nil error when the given value contains +// claims it can't parse. If the value contains no claims, it returns an empty string and a nil error. +func parseChallenge(wwwAuthenticate string) (string, error) { + claims := "" + var err error + for _, param := range strings.Split(wwwAuthenticate, ",") { + if _, after, found := strings.Cut(param, "claims="); found { + if claims != "" { + // The header contains multiple challenges, at least two of which specify claims. The specs allow this + // but it's unclear what a client should do in this case and there's as yet no concrete example of it. + err = fmt.Errorf("found multiple claims challenges in %q", wwwAuthenticate) + break + } + // trim stuff that would get an error from RawURLEncoding; claims may or may not be padded + claims = strings.Trim(after, `\"=`) + // we don't return this error because it's something unhelpful like "illegal base64 data at input byte 42" + if b, decErr := base64.RawURLEncoding.DecodeString(claims); decErr == nil { + claims = string(b) + } else { + err = fmt.Errorf("failed to parse claims from %q", wwwAuthenticate) + break + } + } + } + return claims, err +} 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 index c3f5eeafe..83e15949a 100644 --- 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 @@ -126,12 +126,13 @@ func (r *rpRegistrationPolicy) Do(req *azpolicy.Request) (*http.Response, error) u: r.endpoint, subID: subID, } - if _, err = rpOps.Register(req.Raw().Context(), rp); err != nil { + if _, err = rpOps.Register(&shared.ContextWithDeniedValues{Context: 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) + pollCtx, pollCancel := context.WithTimeout(&shared.ContextWithDeniedValues{Context: req.Raw().Context()}, r.options.PollingDuration) var lastRegState string for { // get the current registration state @@ -176,6 +177,7 @@ var unregisteredRPCodes = []string{ "MissingSubscriptionRegistration", "MissingRegistrationForResourceProvider", "Subscription Not Registered", + "SubscriptionNotRegistered", } func isUnregisteredRPCode(errorCode string) bool { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_trace_namespace.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_trace_namespace.go new file mode 100644 index 000000000..6cea18424 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_trace_namespace.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 runtime + +import ( + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/internal/resource" + "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/azcore/tracing" +) + +// httpTraceNamespacePolicy is a policy that adds the az.namespace attribute to the current Span +func httpTraceNamespacePolicy(req *policy.Request) (resp *http.Response, err error) { + rawTracer := req.Raw().Context().Value(shared.CtxWithTracingTracer{}) + if tracer, ok := rawTracer.(tracing.Tracer); ok && tracer.Enabled() { + rt, err := resource.ParseResourceType(req.Raw().URL.Path) + if err == nil { + // add the namespace attribute to the current span + span := tracer.SpanFromContext(req.Raw().Context()) + span.SetAttributes(tracing.Attribute{Key: shared.TracingNamespaceAttrName, Value: rt.Namespace}) + } + } + return req.Next() +} 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 index 27231ad92..8eef8633a 100644 --- 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 @@ -22,6 +22,24 @@ type AccessToken = exported.AccessToken // TokenCredential represents a credential capable of providing an OAuth token. type TokenCredential = exported.TokenCredential +// KeyCredential contains an authentication key used to authenticate to an Azure service. +type KeyCredential = exported.KeyCredential + +// NewKeyCredential creates a new instance of [KeyCredential] with the specified values. +// - key is the authentication key +func NewKeyCredential(key string) *KeyCredential { + return exported.NewKeyCredential(key) +} + +// SASCredential contains a shared access signature used to authenticate to an Azure service. +type SASCredential = exported.SASCredential + +// NewSASCredential creates a new instance of [SASCredential] with the specified values. +// - sas is the shared access signature +func NewSASCredential(sas string) *SASCredential { + return exported.NewSASCredential(sas) +} + // holds sentinel values used to send nulls var nullables map[reflect.Type]interface{} = map[reflect.Type]interface{}{} @@ -66,27 +84,28 @@ func IsNullValue[T any](v T) bool { return false } -// ClientOptions contains configuration settings for a client's pipeline. +// ClientOptions contains optional settings for a client's pipeline. +// Instances can be shared across calls to SDK client constructors when uniform configuration is desired. +// Zero-value fields will have their specified default values applied during use. type ClientOptions = policy.ClientOptions // Client is a basic HTTP client. It consists of a pipeline and tracing provider. type Client struct { pl runtime.Pipeline tr tracing.Tracer + + // cached on the client to support shallow copying with new values + tp tracing.Provider + modVer string + namespace string } // NewClient creates a new Client instance with the provided values. -// - clientName - the fully qualified name of the client ("module/package.Client"); this is used by the telemetry policy and tracing provider. -// if module and package are the same value, the "module/" prefix can be omitted. -// - moduleVersion - the semantic version of the containing module; used by the telemetry policy +// - moduleName - the fully qualified name of the module where the client is defined; used by the telemetry policy and tracing provider. +// - moduleVersion - the semantic version of the module; used by the telemetry policy and tracing provider. // - plOpts - pipeline configuration options; can be the zero-value // - options - optional client configurations; pass nil to accept the default values -func NewClient(clientName, moduleVersion string, plOpts runtime.PipelineOptions, options *ClientOptions) (*Client, error) { - mod, client, err := shared.ExtractModuleName(clientName) - if err != nil { - return nil, err - } - +func NewClient(moduleName, moduleVersion string, plOpts runtime.PipelineOptions, options *ClientOptions) (*Client, error) { if options == nil { options = &ClientOptions{} } @@ -97,10 +116,20 @@ func NewClient(clientName, moduleVersion string, plOpts runtime.PipelineOptions, } } - pl := runtime.NewPipeline(mod, moduleVersion, plOpts, options) + pl := runtime.NewPipeline(moduleName, moduleVersion, plOpts, options) + + tr := options.TracingProvider.NewTracer(moduleName, moduleVersion) + if tr.Enabled() && plOpts.Tracing.Namespace != "" { + tr.SetAttributes(tracing.Attribute{Key: shared.TracingNamespaceAttrName, Value: plOpts.Tracing.Namespace}) + } - tr := options.TracingProvider.NewTracer(client, moduleVersion) - return &Client{pl: pl, tr: tr}, nil + return &Client{ + pl: pl, + tr: tr, + tp: options.TracingProvider, + modVer: moduleVersion, + namespace: plOpts.Tracing.Namespace, + }, nil } // Pipeline returns the pipeline for this client. @@ -112,3 +141,14 @@ func (c *Client) Pipeline() runtime.Pipeline { func (c *Client) Tracer() tracing.Tracer { return c.tr } + +// WithClientName returns a shallow copy of the Client with its tracing client name changed to clientName. +// Note that the values for module name and version will be preserved from the source Client. +// - clientName - the fully qualified name of the client ("package.Client"); this is used by the tracing provider when creating spans +func (c *Client) WithClientName(clientName string) *Client { + tr := c.tp.NewTracer(clientName, c.modVer) + if tr.Enabled() && c.namespace != "" { + tr.SetAttributes(tracing.Attribute{Key: shared.TracingNamespaceAttrName, Value: c.namespace}) + } + return &Client{pl: c.pl, tr: tr, tp: c.tp, modVer: c.modVer, namespace: c.namespace} +} 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 index 28c64678c..654a5f404 100644 --- 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 @@ -253,5 +253,12 @@ When resuming a poller, no IO is performed, and zero-value arguments can be used 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. + +# Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. */ package azcore 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 index a1236b362..f2b296b6d 100644 --- 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 @@ -8,8 +8,11 @@ package exported import ( "context" + "encoding/base64" + "fmt" "io" "net/http" + "sync/atomic" "time" ) @@ -51,6 +54,17 @@ type AccessToken struct { // TokenRequestOptions contain specific parameter that may be used by credentials types when attempting to get a token. // Exported as policy.TokenRequestOptions. type TokenRequestOptions struct { + // Claims are any additional claims required for the token to satisfy a conditional access policy, such as a + // service may return in a claims challenge following an authorization failure. If a service returned the + // claims value base64 encoded, it must be decoded before setting this field. + Claims string + + // EnableCAE indicates whether to enable Continuous Access Evaluation (CAE) for the requested token. When true, + // azidentity credentials request CAE tokens for resource APIs supporting CAE. Clients are responsible for + // handling CAE challenges. If a client that doesn't handle CAE challenges receives a CAE token, it may end up + // in a loop retrying an API call with a token that has been revoked due to CAE. + EnableCAE bool + // Scopes contains the list of permission scopes required for the token. Scopes []string @@ -65,3 +79,97 @@ type TokenCredential interface { // GetToken requests an access token for the specified set of scopes. GetToken(ctx context.Context, options TokenRequestOptions) (AccessToken, error) } + +// DecodeByteArray will base-64 decode the provided string into v. +// Exported as runtime.DecodeByteArray() +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) + } +} + +// KeyCredential contains an authentication key used to authenticate to an Azure service. +// Exported as azcore.KeyCredential. +type KeyCredential struct { + cred *keyCredential +} + +// NewKeyCredential creates a new instance of [KeyCredential] with the specified values. +// - key is the authentication key +func NewKeyCredential(key string) *KeyCredential { + return &KeyCredential{cred: newKeyCredential(key)} +} + +// Update replaces the existing key with the specified value. +func (k *KeyCredential) Update(key string) { + k.cred.Update(key) +} + +// SASCredential contains a shared access signature used to authenticate to an Azure service. +// Exported as azcore.SASCredential. +type SASCredential struct { + cred *keyCredential +} + +// NewSASCredential creates a new instance of [SASCredential] with the specified values. +// - sas is the shared access signature +func NewSASCredential(sas string) *SASCredential { + return &SASCredential{cred: newKeyCredential(sas)} +} + +// Update replaces the existing shared access signature with the specified value. +func (k *SASCredential) Update(sas string) { + k.cred.Update(sas) +} + +// KeyCredentialGet returns the key for cred. +func KeyCredentialGet(cred *KeyCredential) string { + return cred.cred.Get() +} + +// SASCredentialGet returns the shared access sig for cred. +func SASCredentialGet(cred *SASCredential) string { + return cred.cred.Get() +} + +type keyCredential struct { + key atomic.Value // string +} + +func newKeyCredential(key string) *keyCredential { + keyCred := keyCredential{} + keyCred.key.Store(key) + return &keyCred +} + +func (k *keyCredential) Get() string { + return k.key.Load().(string) +} + +func (k *keyCredential) Update(key string) { + k.key.Store(key) +} 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 index c44efd6ef..e45f831ed 100644 --- 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 @@ -8,10 +8,7 @@ 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 @@ -75,23 +72,6 @@ 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 index fa99d1b7e..659f2a7d2 100644 --- 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 @@ -8,6 +8,7 @@ package exported import ( "context" + "encoding/base64" "errors" "fmt" "io" @@ -18,6 +19,28 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" ) +// Base64Encoding is usesd to specify which base-64 encoder/decoder to use when +// encoding/decoding a slice of bytes to/from a string. +// Exported as runtime.Base64Encoding +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 +) + +// EncodeByteArray will base-64 encode the byte slice v. +// Exported as runtime.EncodeByteArray() +func EncodeByteArray(v []byte, format Base64Encoding) string { + if format == Base64URLFormat { + return base64.RawURLEncoding.EncodeToString(v) + } + return base64.StdEncoding.EncodeToString(v) +} + // 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. @@ -170,6 +193,14 @@ func (req *Request) Clone(ctx context.Context) *Request { return &r2 } +// WithContext returns a shallow copy of the request with its context changed to ctx. +func (req *Request) WithContext(ctx context.Context) *Request { + r2 := new(Request) + *r2 = *req + r2.req = r2.req.WithContext(ctx) + return r2 +} + // not exported but dependent on Request // PolicyFunc is a type that implements the Policy interface. 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 index 7df2f88c1..f24355288 100644 --- 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 @@ -13,6 +13,7 @@ import ( "net/http" "regexp" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" "github.com/Azure/azure-sdk-for-go/sdk/internal/exported" ) @@ -25,7 +26,7 @@ func NewResponseError(resp *http.Response) error { } // prefer the error code in the response header - if ec := resp.Header.Get("x-ms-error-code"); ec != "" { + if ec := resp.Header.Get(shared.HeaderXMSErrorCode); ec != "" { respErr.ErrorCode = ec return respErr } @@ -112,33 +113,45 @@ type ResponseError struct { // 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 { + const separator = "--------------------------------------------------------------------------------" // 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.RawResponse != nil { + if e.RawResponse.Request != nil { + 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) + } else { + fmt.Fprintln(msg, "Request information not available") + } + fmt.Fprintln(msg, separator) + fmt.Fprintf(msg, "RESPONSE %d: %s\n", e.RawResponse.StatusCode, e.RawResponse.Status) + } else { + fmt.Fprintln(msg, "Missing RawResponse") + fmt.Fprintln(msg, separator) + } if e.ErrorCode != "" { fmt.Fprintf(msg, "ERROR CODE: %s\n", e.ErrorCode) } else { fmt.Fprintln(msg, "ERROR CODE UNAVAILABLE") } - fmt.Fprintln(msg, "--------------------------------------------------------------------------------") - body, err := exported.Payload(e.RawResponse, nil) - 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)) + if e.RawResponse != nil { + fmt.Fprintln(msg, separator) + body, err := exported.Payload(e.RawResponse, nil) + 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") } - // 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, "--------------------------------------------------------------------------------") + fmt.Fprintln(msg, separator) return msg.String() } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/fake/fake.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/fake/fake.go new file mode 100644 index 000000000..259834718 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/fake/fake.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 fake + +import ( + "context" + "errors" + "fmt" + "net/http" + "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/pollers" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/internal/poller" +) + +// Applicable returns true if the LRO is a fake. +func Applicable(resp *http.Response) bool { + return resp.Header.Get(shared.HeaderFakePollerStatus) != "" +} + +// CanResume returns true if the token can rehydrate this poller type. +func CanResume(token map[string]interface{}) bool { + _, ok := token["fakeURL"] + return ok +} + +// Poller is an LRO poller that uses the Core-Fake-Poller pattern. +type Poller[T any] struct { + pl exported.Pipeline + + resp *http.Response + + // The API name from CtxAPINameKey + APIName string `json:"apiName"` + + // The URL from Core-Fake-Poller header. + FakeURL string `json:"fakeURL"` + + // The LRO's current state. + FakeStatus string `json:"status"` +} + +// lroStatusURLSuffix is the URL path suffix for a faked LRO. +const lroStatusURLSuffix = "/get/fake/status" + +// 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 Core-Fake-Poller poller.") + return &Poller[T]{pl: pl}, nil + } + + log.Write(log.EventLRO, "Using Core-Fake-Poller poller.") + fakeStatus := resp.Header.Get(shared.HeaderFakePollerStatus) + if fakeStatus == "" { + return nil, errors.New("response is missing Fake-Poller-Status header") + } + + ctxVal := resp.Request.Context().Value(shared.CtxAPINameKey{}) + if ctxVal == nil { + return nil, errors.New("missing value for CtxAPINameKey") + } + + apiName, ok := ctxVal.(string) + if !ok { + return nil, fmt.Errorf("expected string for CtxAPINameKey, the type was %T", ctxVal) + } + + qp := "" + if resp.Request.URL.RawQuery != "" { + qp = "?" + resp.Request.URL.RawQuery + } + + p := &Poller[T]{ + pl: pl, + resp: resp, + APIName: apiName, + // NOTE: any changes to this path format MUST be reflected in SanitizePollerPath() + FakeURL: fmt.Sprintf("%s://%s%s%s%s", resp.Request.URL.Scheme, resp.Request.URL.Host, resp.Request.URL.Path, lroStatusURLSuffix, qp), + FakeStatus: fakeStatus, + } + return p, nil +} + +// Done returns true if the LRO is in a terminal state. +func (p *Poller[T]) Done() bool { + return poller.IsTerminalState(p.FakeStatus) +} + +// Poll retrieves the current state of the LRO. +func (p *Poller[T]) Poll(ctx context.Context) (*http.Response, error) { + ctx = context.WithValue(ctx, shared.CtxAPINameKey{}, p.APIName) + err := pollers.PollHelper(ctx, p.FakeURL, p.pl, func(resp *http.Response) (string, error) { + if !poller.StatusCodeValid(resp) { + p.resp = resp + return "", exported.NewResponseError(resp) + } + fakeStatus := resp.Header.Get(shared.HeaderFakePollerStatus) + if fakeStatus == "" { + return "", errors.New("response is missing Fake-Poller-Status header") + } + p.resp = resp + p.FakeStatus = fakeStatus + return p.FakeStatus, 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 poller.Failed(p.FakeStatus) { + return exported.NewResponseError(p.resp) + } + + return pollers.ResultHelper(p.resp, poller.Failed(p.FakeStatus), out) +} + +// SanitizePollerPath removes any fake-appended suffix from a URL's path. +func SanitizePollerPath(path string) string { + return strings.TrimSuffix(path, lroStatusURLSuffix) +} 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 index 269a831ed..272f06155 100644 --- 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 @@ -7,8 +7,9 @@ package shared const ( - ContentTypeAppJSON = "application/json" - ContentTypeAppXML = "application/xml" + ContentTypeAppJSON = "application/json" + ContentTypeAppXML = "application/xml" + ContentTypeTextPlain = "text/plain" ) const ( @@ -17,20 +18,25 @@ const ( HeaderAzureAsync = "Azure-AsyncOperation" HeaderContentLength = "Content-Length" HeaderContentType = "Content-Type" + HeaderFakePollerStatus = "Fake-Poller-Status" HeaderLocation = "Location" HeaderOperationLocation = "Operation-Location" HeaderRetryAfter = "Retry-After" HeaderUserAgent = "User-Agent" HeaderWWWAuthenticate = "WWW-Authenticate" HeaderXMSClientRequestID = "x-ms-client-request-id" + HeaderXMSRequestID = "x-ms-request-id" + HeaderXMSErrorCode = "x-ms-error-code" ) const BearerTokenPrefix = "Bearer " +const TracingNamespaceAttrName = "az.namespace" + 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.6.1" + Version = "v1.9.0" ) 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 index db0aaa7cb..16bc105f4 100644 --- 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 @@ -16,14 +16,23 @@ import ( "time" ) +// NOTE: when adding a new context key type, it likely needs to be +// added to the deny-list of key types in ContextWithDeniedValues + // 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{} +// CtxWithCaptureResponse is used as a context key for retrieving the raw response. +type CtxWithCaptureResponse struct{} + +// CtxWithTracingTracer is used as a context key for adding/retrieving tracing.Tracer. +type CtxWithTracingTracer struct{} + +// CtxAPINameKey is used as a context key for adding/retrieving the API name. +type CtxAPINameKey struct{} // Delay waits for the duration to elapse or the context to be cancelled. func Delay(ctx context.Context, delay time.Duration) error { @@ -78,26 +87,21 @@ func ValidateModVer(moduleVersion string) error { return nil } -// ExtractModuleName returns "module", "package.Client" from "module/package.Client" or -// "package", "package.Client" from "package.Client" when there's no "module/" prefix. -// If clientName is malformed, an error is returned. -func ExtractModuleName(clientName string) (string, string, error) { - // uses unnamed capturing for "module", "package.Client", and "package" - regex, err := regexp.Compile(`^(?:([a-z0-9]+)/)?(([a-z0-9]+)\.(?:[A-Za-z0-9]+))$`) - if err != nil { - return "", "", err - } - - matches := regex.FindStringSubmatch(clientName) - if len(matches) < 4 { - return "", "", fmt.Errorf("malformed clientName %s", clientName) - } +// ContextWithDeniedValues wraps an existing [context.Context], denying access to certain context values. +// Pipeline policies that create new requests to be sent down their own pipeline MUST wrap the caller's +// context with an instance of this type. This is to prevent context values from flowing across disjoint +// requests which can have unintended side-effects. +type ContextWithDeniedValues struct { + context.Context +} - // the first match is the entire string, the second is "module", the third is - // "package.Client" and the fourth is "package". - // if there was no "module/" prefix, the second match will be the empty string - if matches[1] != "" { - return matches[1], matches[2], nil +// Value implements part of the [context.Context] interface. +// It acts as a deny-list for certain context keys. +func (c *ContextWithDeniedValues) Value(key any) any { + switch key.(type) { + case CtxAPINameKey, CtxWithCaptureResponse, CtxWithHTTPHeaderKey, CtxWithRetryOptionsKey, CtxWithTracingTracer: + return nil + default: + return c.Context.Value(key) } - return matches[3], matches[2], nil } 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 index b20004783..d934f1dc5 100644 --- 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 @@ -7,11 +7,13 @@ package policy import ( + "context" "net/http" "time" "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/shared" "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" ) @@ -27,9 +29,11 @@ type Transporter = exported.Transporter type Request = exported.Request // ClientOptions contains optional settings for a client's pipeline. -// All zero-value fields will be initialized with default values. +// Instances can be shared across calls to SDK client constructors when uniform configuration is desired. +// Zero-value fields will have their specified default values applied during use. type ClientOptions struct { - // APIVersion overrides the default version requested of the service. Set with caution as this package version has not been tested with arbitrary service versions. + // APIVersion overrides the default version requested of the service. + // Set with caution as this package version has not been tested with arbitrary service versions. APIVersion string // Cloud specifies a cloud for the client. The default is Azure Public Cloud. @@ -162,3 +166,22 @@ type AuthorizationHandler struct { // the policy will return any 401 response to the client. OnChallenge func(*Request, *http.Response, func(TokenRequestOptions) error) error } + +// 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.CtxWithCaptureResponse{}, resp) +} + +// 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) +} + +// 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 RetryOptions) context.Context { + return context.WithValue(parent, shared.CtxWithRetryOptionsKey{}, options) +} 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 index 5507665d6..cffe692d7 100644 --- 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 @@ -10,6 +10,12 @@ import ( "context" "encoding/json" "errors" + "fmt" + "net/http" + "reflect" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" ) // PagingHandler contains the required data for constructing a Pager. @@ -20,12 +26,16 @@ type PagingHandler[T any] struct { // Fetcher fetches the first and subsequent pages. Fetcher func(context.Context, *T) (T, error) + + // Tracer contains the Tracer from the client that's creating the Pager. + Tracer tracing.Tracer } // Pager provides operations for iterating over paged responses. type Pager[T any] struct { current *T handler PagingHandler[T] + tracer tracing.Tracer firstPage bool } @@ -34,6 +44,7 @@ type Pager[T any] struct { func NewPager[T any](handler PagingHandler[T]) *Pager[T] { return &Pager[T]{ handler: handler, + tracer: handler.Tracer, firstPage: true, } } @@ -48,8 +59,6 @@ func (p *Pager[T]) More() bool { // 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 @@ -58,12 +67,16 @@ func (p *Pager[T]) NextPage(ctx context.Context) (T, error) { } 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) } + + var err error + ctx, endSpan := StartSpan(ctx, fmt.Sprintf("%s.NextPage", shortenTypeName(reflect.TypeOf(*p).Name())), p.tracer, nil) + defer func() { endSpan(err) }() + + resp, err := p.handler.Fetcher(ctx, p.current) if err != nil { return *new(T), err } @@ -75,3 +88,41 @@ func (p *Pager[T]) NextPage(ctx context.Context) (T, error) { func (p *Pager[T]) UnmarshalJSON(data []byte) error { return json.Unmarshal(data, &p.current) } + +// FetcherForNextLinkOptions contains the optional values for [FetcherForNextLink]. +type FetcherForNextLinkOptions struct { + // NextReq is the func to be called when requesting subsequent pages. + // Used for paged operations that have a custom next link operation. + NextReq func(context.Context, string) (*policy.Request, error) +} + +// FetcherForNextLink is a helper containing boilerplate code to simplify creating a PagingHandler[T].Fetcher from a next link URL. +// - ctx is the [context.Context] controlling the lifetime of the HTTP operation +// - pl is the [Pipeline] used to dispatch the HTTP request +// - nextLink is the URL used to fetch the next page. the empty string indicates the first page is to be requested +// - firstReq is the func to be called when creating the request for the first page +// - options contains any optional parameters, pass nil to accept the default values +func FetcherForNextLink(ctx context.Context, pl Pipeline, nextLink string, firstReq func(context.Context) (*policy.Request, error), options *FetcherForNextLinkOptions) (*http.Response, error) { + var req *policy.Request + var err error + if nextLink == "" { + req, err = firstReq(ctx) + } else if nextLink, err = EncodeQueryParams(nextLink); err == nil { + if options != nil && options.NextReq != nil { + req, err = options.NextReq(ctx, nextLink) + } else { + req, err = NewRequest(ctx, http.MethodGet, nextLink) + } + } + if err != nil { + return nil, err + } + resp, err := pl.Do(req) + if err != nil { + return nil, err + } + if !HasStatusCode(resp, http.StatusOK) { + return nil, NewResponseError(resp) + } + return resp, nil +} 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 index 9d9288f53..6b1f5c083 100644 --- 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 @@ -13,9 +13,35 @@ import ( // PipelineOptions contains Pipeline options for SDK developers type PipelineOptions struct { - AllowedHeaders, AllowedQueryParameters []string - APIVersion APIVersionOptions - PerCall, PerRetry []policy.Policy + // 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 + + // AllowedQueryParameters is the slice of query parameters to log with their values intact. + // All query parameters not in the slice will have their values REDACTED. + AllowedQueryParameters []string + + // APIVersion overrides the default version requested of the service. + // Set with caution as this package version has not been tested with arbitrary service versions. + APIVersion APIVersionOptions + + // PerCall contains custom policies to inject into the pipeline. + // Each policy is executed once per request. + PerCall []policy.Policy + + // PerRetry contains custom policies to inject into the pipeline. + // Each policy is executed once per request, and for each retry of that request. + PerRetry []policy.Policy + + // Tracing contains options used to configure distributed tracing. + Tracing TracingOptions +} + +// TracingOptions contains tracing options for SDK developers. +type TracingOptions struct { + // Namespace contains the value to use for the az.namespace span attribute. + Namespace string } // Pipeline represents a primitive for sending HTTP requests and receiving responses. @@ -56,8 +82,10 @@ func NewPipeline(module, version string, plOpts PipelineOptions, options *policy policies = append(policies, NewRetryPolicy(&cp.Retry)) policies = append(policies, plOpts.PerRetry...) policies = append(policies, cp.PerRetryPolicies...) + policies = append(policies, exported.PolicyFunc(httpHeaderPolicy)) + policies = append(policies, newHTTPTracePolicy(cp.Logging.AllowedQueryParams)) policies = append(policies, NewLogPolicy(&cp.Logging)) - policies = append(policies, exported.PolicyFunc(httpHeaderPolicy), exported.PolicyFunc(bodyDownloadPolicy)) + policies = append(policies, exported.PolicyFunc(bodyDownloadPolicy)) transport := cp.Transport if transport == nil { transport = defaultHTTPClient 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 index b61e4c121..f0f280355 100644 --- 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 @@ -6,6 +6,7 @@ package runtime import ( "errors" "net/http" + "strings" "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" @@ -34,7 +35,7 @@ type acquiringResourceState struct { // acquire acquires or updates the resource; only one // thread/goroutine at a time ever calls this function func acquire(state acquiringResourceState) (newResource exported.AccessToken, newExpiration time.Time, err error) { - tk, err := state.p.cred.GetToken(state.req.Raw().Context(), state.tro) + tk, err := state.p.cred.GetToken(&shared.ContextWithDeniedValues{Context: state.req.Raw().Context()}, state.tro) if err != nil { return exported.AccessToken{}, time.Time{}, err } @@ -72,6 +73,17 @@ func (b *BearerTokenPolicy) authenticateAndAuthorize(req *policy.Request) func(p // Do authorizes a request with a bearer token func (b *BearerTokenPolicy) Do(req *policy.Request) (*http.Response, error) { + // skip adding the authorization header if no TokenCredential was provided. + // this prevents a panic that might be hard to diagnose and allows testing + // against http endpoints that don't require authentication. + if b.cred == nil { + return req.Next() + } + + if err := checkHTTPSForAuth(req); err != nil { + return nil, err + } + var err error if b.authzHandler.OnRequest != nil { err = b.authzHandler.OnRequest(req, b.authenticateAndAuthorize(req)) @@ -79,7 +91,7 @@ func (b *BearerTokenPolicy) Do(req *policy.Request) (*http.Response, error) { err = b.authenticateAndAuthorize(req)(policy.TokenRequestOptions{Scopes: b.scopes}) } if err != nil { - return nil, ensureNonRetriable(err) + return nil, errorinfo.NonRetriableError(err) } res, err := req.Next() @@ -95,22 +107,15 @@ func (b *BearerTokenPolicy) Do(req *policy.Request) (*http.Response, error) { } } } - return res, ensureNonRetriable(err) -} - -func ensureNonRetriable(err error) error { - var nre errorinfo.NonRetriable - if err != nil && !errors.As(err, &nre) { - err = btpError{err} + if err != nil { + err = errorinfo.NonRetriableError(err) } - return err + return res, err } -// btpError is a wrapper that ensures RetryPolicy doesn't retry requests BearerTokenPolicy couldn't authorize -type btpError struct { - error +func checkHTTPSForAuth(req *policy.Request) error { + if strings.ToLower(req.Raw().URL.Scheme) != "https" { + return errorinfo.NonRetriableError(errors.New("authenticated requests are not permitted for non TLS protected (https) endpoints")) + } + return nil } - -func (btpError) NonRetriable() {} - -var _ errorinfo.NonRetriable = (*btpError)(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 index 770e0a2b6..c230af0af 100644 --- 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 @@ -34,6 +34,7 @@ func httpHeaderPolicy(req *policy.Request) (*http.Response, error) { // 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. +// Deprecated: use [policy.WithHTTPHeader] instead. func WithHTTPHeader(parent context.Context, header http.Header) context.Context { - return context.WithValue(parent, shared.CtxWithHTTPHeaderKey{}, header) + return policy.WithHTTPHeader(parent, header) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go new file mode 100644 index 000000000..3df1c1218 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go @@ -0,0 +1,143 @@ +//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" + + "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" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" +) + +const ( + attrHTTPMethod = "http.method" + attrHTTPURL = "http.url" + attrHTTPUserAgent = "http.user_agent" + attrHTTPStatusCode = "http.status_code" + + attrAZClientReqID = "az.client_request_id" + attrAZServiceReqID = "az.service_request_id" + + attrNetPeerName = "net.peer.name" +) + +// newHTTPTracePolicy creates a new instance of the httpTracePolicy. +// - allowedQueryParams contains the user-specified query parameters that don't need to be redacted from the trace +func newHTTPTracePolicy(allowedQueryParams []string) exported.Policy { + return &httpTracePolicy{allowedQP: getAllowedQueryParams(allowedQueryParams)} +} + +// httpTracePolicy is a policy that creates a trace for the HTTP request and its response +type httpTracePolicy struct { + allowedQP map[string]struct{} +} + +// Do implements the pipeline.Policy interfaces for the httpTracePolicy type. +func (h *httpTracePolicy) Do(req *policy.Request) (resp *http.Response, err error) { + rawTracer := req.Raw().Context().Value(shared.CtxWithTracingTracer{}) + if tracer, ok := rawTracer.(tracing.Tracer); ok && tracer.Enabled() { + attributes := []tracing.Attribute{ + {Key: attrHTTPMethod, Value: req.Raw().Method}, + {Key: attrHTTPURL, Value: getSanitizedURL(*req.Raw().URL, h.allowedQP)}, + {Key: attrNetPeerName, Value: req.Raw().URL.Host}, + } + + if ua := req.Raw().Header.Get(shared.HeaderUserAgent); ua != "" { + attributes = append(attributes, tracing.Attribute{Key: attrHTTPUserAgent, Value: ua}) + } + if reqID := req.Raw().Header.Get(shared.HeaderXMSClientRequestID); reqID != "" { + attributes = append(attributes, tracing.Attribute{Key: attrAZClientReqID, Value: reqID}) + } + + ctx := req.Raw().Context() + ctx, span := tracer.Start(ctx, "HTTP "+req.Raw().Method, &tracing.SpanOptions{ + Kind: tracing.SpanKindClient, + Attributes: attributes, + }) + + defer func() { + if resp != nil { + span.SetAttributes(tracing.Attribute{Key: attrHTTPStatusCode, Value: resp.StatusCode}) + if resp.StatusCode > 399 { + span.SetStatus(tracing.SpanStatusError, resp.Status) + } + if reqID := resp.Header.Get(shared.HeaderXMSRequestID); reqID != "" { + span.SetAttributes(tracing.Attribute{Key: attrAZServiceReqID, Value: reqID}) + } + } else if err != nil { + var urlErr *url.Error + if errors.As(err, &urlErr) { + // calling *url.Error.Error() will include the unsanitized URL + // which we don't want. in addition, we already have the HTTP verb + // and sanitized URL in the trace so we aren't losing any info + err = urlErr.Err + } + span.SetStatus(tracing.SpanStatusError, err.Error()) + } + span.End() + }() + + req = req.WithContext(ctx) + } + resp, err = req.Next() + return +} + +// StartSpanOptions contains the optional values for StartSpan. +type StartSpanOptions struct { + // for future expansion +} + +// StartSpan starts a new tracing span. +// You must call the returned func to terminate the span. Pass the applicable error +// if the span will exit with an error condition. +// - ctx is the parent context of the newly created context +// - name is the name of the span. this is typically the fully qualified name of an API ("Client.Method") +// - tracer is the client's Tracer for creating spans +// - options contains optional values. pass nil to accept any default values +func StartSpan(ctx context.Context, name string, tracer tracing.Tracer, options *StartSpanOptions) (context.Context, func(error)) { + if !tracer.Enabled() { + return ctx, func(err error) {} + } + + // we MUST propagate the active tracer before returning so that the trace policy can access it + ctx = context.WithValue(ctx, shared.CtxWithTracingTracer{}, tracer) + + const newSpanKind = tracing.SpanKindInternal + if activeSpan := ctx.Value(ctxActiveSpan{}); activeSpan != nil { + // per the design guidelines, if a SDK method Foo() calls SDK method Bar(), + // then the span for Bar() must be suppressed. however, if Bar() makes a REST + // call, then Bar's HTTP span must be a child of Foo's span. + // however, there is an exception to this rule. if the SDK method Foo() is a + // messaging producer/consumer, and it takes a callback that's a SDK method + // Bar(), then the span for Bar() must _not_ be suppressed. + if kind := activeSpan.(tracing.SpanKind); kind == tracing.SpanKindClient || kind == tracing.SpanKindInternal { + return ctx, func(err error) {} + } + } + ctx, span := tracer.Start(ctx, name, &tracing.SpanOptions{ + Kind: newSpanKind, + }) + ctx = context.WithValue(ctx, ctxActiveSpan{}, newSpanKind) + return ctx, func(err error) { + if err != nil { + errType := strings.Replace(fmt.Sprintf("%T", err), "*exported.", "*azcore.", 1) + span.SetStatus(tracing.SpanStatusError, fmt.Sprintf("%s:\n%s", errType, err.Error())) + } + span.End() + } +} + +// ctxActiveSpan is used as a context key for indicating a SDK client span is in progress. +type ctxActiveSpan struct{} 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 index 4714baa30..bb00f6c2f 100644 --- 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 @@ -20,7 +20,7 @@ func includeResponsePolicy(req *policy.Request) (*http.Response, error) { if resp == nil { return resp, err } - if httpOutRaw := req.Raw().Context().Value(shared.CtxIncludeResponseKey{}); httpOutRaw != nil { + if httpOutRaw := req.Raw().Context().Value(shared.CtxWithCaptureResponse{}); httpOutRaw != nil { httpOut := httpOutRaw.(**http.Response) *httpOut = resp } @@ -29,6 +29,7 @@ func includeResponsePolicy(req *policy.Request) (*http.Response, error) { // WithCaptureResponse applies the HTTP response retrieval annotation to the parent context. // The resp parameter will contain the HTTP response after the request has completed. +// Deprecated: use [policy.WithCaptureResponse] instead. func WithCaptureResponse(parent context.Context, resp **http.Response) context.Context { - return context.WithValue(parent, shared.CtxIncludeResponseKey{}, resp) + return policy.WithCaptureResponse(parent, resp) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_key_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_key_credential.go new file mode 100644 index 000000000..6f577fa7a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_key_credential.go @@ -0,0 +1,57 @@ +// 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" +) + +// KeyCredentialPolicy authorizes requests with a [azcore.KeyCredential]. +type KeyCredentialPolicy struct { + cred *exported.KeyCredential + header string + prefix string +} + +// KeyCredentialPolicyOptions contains the optional values configuring [KeyCredentialPolicy]. +type KeyCredentialPolicyOptions struct { + // Prefix is used if the key requires a prefix before it's inserted into the HTTP request. + Prefix string +} + +// NewKeyCredentialPolicy creates a new instance of [KeyCredentialPolicy]. +// - cred is the [azcore.KeyCredential] used to authenticate with the service +// - header is the name of the HTTP request header in which the key is placed +// - options contains optional configuration, pass nil to accept the default values +func NewKeyCredentialPolicy(cred *exported.KeyCredential, header string, options *KeyCredentialPolicyOptions) *KeyCredentialPolicy { + if options == nil { + options = &KeyCredentialPolicyOptions{} + } + return &KeyCredentialPolicy{ + cred: cred, + header: header, + prefix: options.Prefix, + } +} + +// Do implementes the Do method on the [policy.Polilcy] interface. +func (k *KeyCredentialPolicy) Do(req *policy.Request) (*http.Response, error) { + // skip adding the authorization header if no KeyCredential was provided. + // this prevents a panic that might be hard to diagnose and allows testing + // against http endpoints that don't require authentication. + if k.cred != nil { + if err := checkHTTPSForAuth(req); err != nil { + return nil, err + } + val := exported.KeyCredentialGet(k.cred) + if k.prefix != "" { + val = k.prefix + val + } + req.Raw().Header.Add(k.header, val) + } + return req.Next() +} 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 index 8514f57d5..f048d7fb5 100644 --- 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 @@ -191,7 +191,8 @@ func (p *logPolicy) writeHeader(b *bytes.Buffer, header http.Header) { } sort.Strings(keys) for _, k := range keys { - value := header.Get(k) + // don't use Get() as it will canonicalize k which might cause a mismatch + value := header[k][0] // redact all header values not in the allow-list if _, ok := p.allowedHeaders[strings.ToLower(k)]; !ok { value = redactedValue 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 index e0c5929f3..04d7bb4ec 100644 --- 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 @@ -59,15 +59,7 @@ func setDefaults(o *policy.RetryOptions) { } 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 + delay := time.Duration((1< -1 { + mod = mod[i+1:] + } b.WriteString(formatTelemetry(mod, ver)) b.WriteRune(' ') b.WriteString(platformInfo) 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 index 3d029a3d1..c373f6896 100644 --- 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 @@ -13,6 +13,8 @@ import ( "flag" "fmt" "net/http" + "reflect" + "strings" "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" @@ -20,9 +22,11 @@ import ( "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/fake" "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/tracing" "github.com/Azure/azure-sdk-for-go/sdk/internal/poller" ) @@ -54,6 +58,9 @@ type NewPollerOptions[T any] struct { // Handler[T] contains a custom polling implementation. Handler PollingHandler[T] + + // Tracer contains the Tracer from the client that's creating the Poller. + Tracer tracing.Tracer } // NewPoller creates a Poller based on the provided initial response. @@ -70,6 +77,7 @@ func NewPoller[T any](resp *http.Response, pl exported.Pipeline, options *NewPol op: options.Handler, resp: resp, result: result, + tracer: options.Tracer, }, nil } @@ -83,7 +91,9 @@ func NewPoller[T any](resp *http.Response, pl exported.Pipeline, options *NewPol // determine the polling method var opr PollingHandler[T] var err error - if async.Applicable(resp) { + if fake.Applicable(resp) { + opr, err = fake.New[T](pl, resp) + } else 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) { @@ -110,6 +120,7 @@ func NewPoller[T any](resp *http.Response, pl exported.Pipeline, options *NewPol op: opr, resp: resp, result: result, + tracer: options.Tracer, }, nil } @@ -121,6 +132,9 @@ type NewPollerFromResumeTokenOptions[T any] struct { // Handler[T] contains a custom polling implementation. Handler PollingHandler[T] + + // Tracer contains the Tracer from the client that's creating the Poller. + Tracer tracing.Tracer } // NewPollerFromResumeToken creates a Poller from a resume token string. @@ -147,7 +161,9 @@ func NewPollerFromResumeToken[T any](token string, pl exported.Pipeline, options opr := options.Handler // now rehydrate the poller based on the encoded poller type - if opr != nil { + if fake.CanResume(asJSON) { + opr, _ = fake.New[T](pl, nil) + } else if opr != nil { log.Writef(log.EventLRO, "Resuming custom poller %T.", opr) } else if async.CanResume(asJSON) { opr, _ = async.New[T](pl, nil, "") @@ -166,6 +182,7 @@ func NewPollerFromResumeToken[T any](token string, pl exported.Pipeline, options return &Poller[T]{ op: opr, result: result, + tracer: options.Tracer, }, nil } @@ -188,6 +205,7 @@ type Poller[T any] struct { resp *http.Response err error result *T + tracer tracing.Tracer done bool } @@ -203,7 +221,7 @@ type PollUntilDoneOptions struct { // 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) { +func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOptions) (res T, err error) { if options == nil { options = &PollUntilDoneOptions{} } @@ -212,9 +230,13 @@ func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOpt cp.Frequency = 30 * time.Second } + ctx, endSpan := StartSpan(ctx, fmt.Sprintf("%s.PollUntilDone", shortenTypeName(reflect.TypeOf(*p).Name())), p.tracer, nil) + defer func() { endSpan(err) }() + // 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") + err = errors.New("polling frequency minimum is one second") + return } start := time.Now() @@ -226,22 +248,24 @@ func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOpt // 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 { + if err = shared.Delay(ctx, retryAfter); err != nil { logPollUntilDoneExit(err) - return *new(T), err + return } } } // begin polling the endpoint until a terminal state is reached for { - resp, err := p.Poll(ctx) + var resp *http.Response + resp, err = p.Poll(ctx) if err != nil { logPollUntilDoneExit(err) - return *new(T), err + return } if p.Done() { logPollUntilDoneExit("succeeded") - return p.Result(ctx) + res, err = p.Result(ctx) + return } d := cp.Frequency if retryAfter := shared.RetryAfter(resp); retryAfter > 0 { @@ -252,7 +276,7 @@ func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOpt } if err = shared.Delay(ctx, d); err != nil { logPollUntilDoneExit(err) - return *new(T), err + return } } } @@ -261,17 +285,22 @@ func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOpt // 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) { +func (p *Poller[T]) Poll(ctx context.Context) (resp *http.Response, err error) { if p.Done() { // the LRO has reached a terminal state, don't poll again - return p.resp, nil + resp = p.resp + return } - resp, err := p.op.Poll(ctx) + + ctx, endSpan := StartSpan(ctx, fmt.Sprintf("%s.Poll", shortenTypeName(reflect.TypeOf(*p).Name())), p.tracer, nil) + defer func() { endSpan(err) }() + + resp, err = p.op.Poll(ctx) if err != nil { - return nil, err + return } p.resp = resp - return p.resp, nil + return } // Done returns true if the LRO has reached a terminal state. @@ -284,31 +313,40 @@ func (p *Poller[T]) Done() bool { // 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) { +func (p *Poller[T]) Result(ctx context.Context) (res T, err error) { if !p.Done() { - return *new(T), errors.New("poller is in a non-terminal state") + err = errors.New("poller is in a non-terminal state") + return } if p.done { // the result has already been retrieved, return the cached value if p.err != nil { - return *new(T), p.err + err = p.err + return } - return *p.result, nil + res = *p.result + return } - err := p.op.Result(ctx, p.result) + + ctx, endSpan := StartSpan(ctx, fmt.Sprintf("%s.Result", shortenTypeName(reflect.TypeOf(*p).Name())), p.tracer, nil) + defer func() { endSpan(err) }() + + 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 + return } p.done = true if p.err != nil { - return *new(T), p.err + err = p.err + return } - return *p.result, nil + res = *p.result + return } // ResumeToken returns a value representing the poller that can be used to resume @@ -325,3 +363,22 @@ func (p *Poller[T]) ResumeToken() (string, error) { } return tk, err } + +// extracts the type name from the string returned from reflect.Value.Name() +func shortenTypeName(s string) string { + // the value is formatted as follows + // Poller[module/Package.Type].Method + // we want to shorten the generic type parameter string to Type + // anything we don't recognize will be left as-is + begin := strings.Index(s, "[") + end := strings.Index(s, "]") + if begin == -1 || end == -1 { + return s + } + + typeName := s[begin+1 : end] + if i := strings.LastIndex(typeName, "."); i > -1 { + typeName = typeName[i+1:] + } + return s[:begin+1] + typeName + s[end:] +} 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 index 98e007184..e97223da2 100644 --- 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 @@ -9,17 +9,14 @@ package runtime import ( "bytes" "context" - "encoding/base64" "encoding/json" "encoding/xml" "fmt" "io" "mime/multipart" - "os" + "net/url" "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" @@ -28,14 +25,14 @@ import ( // 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 +type Base64Encoding = exported.Base64Encoding const ( // Base64StdFormat uses base64.StdEncoding for encoding and decoding payloads. - Base64StdFormat Base64Encoding = 0 + Base64StdFormat Base64Encoding = exported.Base64StdFormat // Base64URLFormat uses base64.RawURLEncoding for encoding and decoding payloads. - Base64URLFormat Base64Encoding = 1 + Base64URLFormat Base64Encoding = exported.Base64URLFormat ) // NewRequest creates a new policy.Request with the specified input. @@ -44,6 +41,19 @@ func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*polic return exported.NewRequest(ctx, httpMethod, endpoint) } +// EncodeQueryParams will parse and encode any query parameters in the specified URL. +func EncodeQueryParams(u string) (string, error) { + before, after, found := strings.Cut(u, "?") + if !found { + return u, nil + } + qp, err := url.ParseQuery(after) + if err != nil { + return "", err + } + return before + "?" + qp.Encode(), nil +} + // JoinPaths concatenates multiple URL path segments into one path, // inserting path separation characters as required. JoinPaths will preserve // query parameters in the root path @@ -79,10 +89,7 @@ func JoinPaths(root string, paths ...string) string { // 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) + return exported.EncodeByteArray(v, format) } // MarshalAsByteArray will base-64 encode the byte slice v, then calls SetBody. @@ -95,9 +102,6 @@ func MarshalAsByteArray(req *policy.Request, v []byte, format Base64Encoding) er // MarshalAsJSON calls json.Marshal() to get the JSON encoding of v then calls SetBody. func MarshalAsJSON(req *policy.Request, v interface{}) error { - if omit := os.Getenv("AZURE_SDK_GO_OMIT_READONLY"); omit == "true" { - v = cloneWithoutReadOnlyFields(v) - } b, err := json.Marshal(v) if err != nil { return fmt.Errorf("error marshalling type %T: %s", v, err) @@ -169,80 +173,5 @@ 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 -} +// CtxAPINameKey is used as a context key for adding/retrieving the API name. +type CtxAPINameKey = shared.CtxAPINameKey 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 index d1f58e9e2..003c875b1 100644 --- 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 @@ -8,13 +8,13 @@ package runtime import ( "bytes" - "encoding/base64" "encoding/json" "encoding/xml" "fmt" "io" "net/http" + azexported "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" "github.com/Azure/azure-sdk-for-go/sdk/internal/exported" ) @@ -105,31 +105,5 @@ func removeBOM(resp *http.Response) error { // 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) - } + return azexported.DecodeByteArray(s, v, format) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_dialer_other.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_dialer_other.go new file mode 100644 index 000000000..1c75d771f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_dialer_other.go @@ -0,0 +1,15 @@ +//go:build !wasm + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "net" +) + +func defaultTransportDialContext(dialer *net.Dialer) func(context.Context, string, string) (net.Conn, error) { + return dialer.DialContext +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_dialer_wasm.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_dialer_wasm.go new file mode 100644 index 000000000..3dc9eeecd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_dialer_wasm.go @@ -0,0 +1,15 @@ +//go:build (js && wasm) || wasip1 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "net" +) + +func defaultTransportDialContext(dialer *net.Dialer) func(context.Context, string, string) (net.Conn, error) { + return nil +} 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 index 869bed511..2124c1d48 100644 --- 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 @@ -11,6 +11,8 @@ import ( "net" "net/http" "time" + + "golang.org/x/net/http2" ) var defaultHTTPClient *http.Client @@ -18,19 +20,28 @@ var defaultHTTPClient *http.Client func init() { defaultTransport := &http.Transport{ Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ + DialContext: defaultTransportDialContext(&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, - }).DialContext, + }), ForceAttemptHTTP2: true, MaxIdleConns: 100, + MaxIdleConnsPerHost: 10, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, TLSClientConfig: &tls.Config{ - MinVersion: tls.VersionTLS12, + MinVersion: tls.VersionTLS12, + Renegotiation: tls.RenegotiateFreelyAsClient, }, } + // TODO: evaluate removing this once https://github.com/golang/go/issues/59690 has been fixed + if http2Transport, err := http2.ConfigureTransports(defaultTransport); err == nil { + // if the connection has been idle for 10 seconds, send a ping frame for a health check + http2Transport.ReadIdleTimeout = 10 * time.Second + // if there's no response to the ping within the timeout, the connection will be closed + http2Transport.PingTimeout = 5 * time.Second + } defaultHTTPClient = &http.Client{ Transport: defaultTransport, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing/tracing.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing/tracing.go index 75f757ced..1ade7c560 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing/tracing.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing/tracing.go @@ -31,12 +31,12 @@ type Provider struct { newTracerFn func(name, version string) Tracer } -// NewTracer creates a new Tracer for the specified name and version. -// - name - the name of the tracer object, typically the fully qualified name of the service client -// - version - the version of the module in which the service client resides -func (p Provider) NewTracer(name, version string) (tracer Tracer) { +// NewTracer creates a new Tracer for the specified module name and version. +// - module - the fully qualified name of the module +// - version - the version of the module +func (p Provider) NewTracer(module, version string) (tracer Tracer) { if p.newTracerFn != nil { - tracer = p.newTracerFn(name, version) + tracer = p.newTracerFn(module, version) } return } @@ -45,21 +45,28 @@ func (p Provider) NewTracer(name, version string) (tracer Tracer) { // TracerOptions contains the optional values when creating a Tracer. type TracerOptions struct { - // for future expansion + // SpanFromContext contains the implementation for the Tracer.SpanFromContext method. + SpanFromContext func(context.Context) Span } // NewTracer creates a Tracer with the specified values. // - newSpanFn is the underlying implementation for creating Span instances // - options contains optional values; pass nil to accept the default value func NewTracer(newSpanFn func(ctx context.Context, spanName string, options *SpanOptions) (context.Context, Span), options *TracerOptions) Tracer { + if options == nil { + options = &TracerOptions{} + } return Tracer{ - newSpanFn: newSpanFn, + newSpanFn: newSpanFn, + spanFromContextFn: options.SpanFromContext, } } // Tracer is the factory that creates Span instances. type Tracer struct { - newSpanFn func(ctx context.Context, spanName string, options *SpanOptions) (context.Context, Span) + attrs []Attribute + newSpanFn func(ctx context.Context, spanName string, options *SpanOptions) (context.Context, Span) + spanFromContextFn func(ctx context.Context) Span } // Start creates a new span and a context.Context that contains it. @@ -68,11 +75,37 @@ type Tracer struct { // - options contains optional values for the span, pass nil to accept any defaults func (t Tracer) Start(ctx context.Context, spanName string, options *SpanOptions) (context.Context, Span) { if t.newSpanFn != nil { - return t.newSpanFn(ctx, spanName, options) + opts := SpanOptions{} + if options != nil { + opts = *options + } + opts.Attributes = append(opts.Attributes, t.attrs...) + return t.newSpanFn(ctx, spanName, &opts) } return ctx, Span{} } +// SetAttributes sets attrs to be applied to each Span. If a key from attrs +// already exists for an attribute of the Span it will be overwritten with +// the value contained in attrs. +func (t *Tracer) SetAttributes(attrs ...Attribute) { + t.attrs = append(t.attrs, attrs...) +} + +// Enabled returns true if this Tracer is capable of creating Spans. +func (t Tracer) Enabled() bool { + return t.newSpanFn != nil +} + +// SpanFromContext returns the Span associated with the current context. +// If the provided context has no Span, false is returned. +func (t Tracer) SpanFromContext(ctx context.Context) Span { + if t.spanFromContextFn != nil { + return t.spanFromContextFn(ctx) + } + return Span{} +} + // SpanOptions contains optional settings for creating a span. type SpanOptions struct { // Kind indicates the kind of Span. @@ -97,9 +130,6 @@ type SpanImpl struct { // AddEvent contains the implementation for the Span.AddEvent method. AddEvent func(string, ...Attribute) - // AddError contains the implementation for the Span.AddError method. - AddError func(err error) - // SetStatus contains the implementation for the Span.SetStatus method. SetStatus func(SpanStatus, string) } @@ -140,13 +170,6 @@ func (s Span) AddEvent(name string, attrs ...Attribute) { } } -// AddError adds the specified error event to the span. -func (s Span) AddError(err error) { - if s.impl.AddError != nil { - s.impl.AddError(err) - } -} - // SetStatus sets the status on the span along with a description. func (s Span) SetStatus(code SpanStatus, desc string) { if s.impl.SetStatus != nil { 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 index cc8034cf7..7ea119ab3 100644 --- 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 @@ -1,5 +1,53 @@ # Release History +## 1.4.0 (2023-10-10) + +### Bugs Fixed +* `ManagedIdentityCredential` will now retry when IMDS responds 410 or 503 + +## 1.4.0-beta.5 (2023-09-12) + +### Features Added +* Service principal credentials can request CAE tokens + +### Breaking Changes +> These changes affect only code written against a beta version such as v1.4.0-beta.4 +* Whether `GetToken` requests a CAE token is now determined by `TokenRequestOptions.EnableCAE`. Azure + SDK clients which support CAE will set this option automatically. Credentials no longer request CAE + tokens by default or observe the environment variable "AZURE_IDENTITY_DISABLE_CP1". + +### Bugs Fixed +* Credential chains such as `DefaultAzureCredential` now try their next credential, if any, when + managed identity authentication fails in a Docker Desktop container + ([#21417](https://github.com/Azure/azure-sdk-for-go/issues/21417)) + +## 1.4.0-beta.4 (2023-08-16) + +### Other Changes +* Upgraded dependencies + +## 1.3.1 (2023-08-16) + +### Other Changes +* Upgraded dependencies + +## 1.4.0-beta.3 (2023-08-08) + +### Bugs Fixed +* One invocation of `AzureCLICredential.GetToken()` and `OnBehalfOfCredential.GetToken()` + can no longer make two authentication attempts + +## 1.4.0-beta.2 (2023-07-14) + +### Other Changes +* `DefaultAzureCredentialOptions.TenantID` applies to workload identity authentication +* Upgraded dependencies + +## 1.4.0-beta.1 (2023-06-06) + +### Other Changes +* Re-enabled CAE support as in v1.3.0-beta.3 + ## 1.3.0 (2023-05-09) ### Breaking Changes 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 index 7b7515eba..fef099813 100644 --- 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 @@ -76,12 +76,14 @@ azlog.SetListener(func(event azlog.Event, s string) { 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-managedidentitycredential-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.
    | +|"managed identity timed out"|`DefaultAzureCredential` sets a short timeout on its first managed identity authentication attempt to prevent very long timeouts during local development when no managed identity is available. That timeout causes this error in production when an application requests a token before the hosting environment is ready to provide one.|Use [ManagedIdentityCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#ManagedIdentityCredential) directly, at least in production. It doesn't set a timeout on its authentication attempts.| ## Troubleshoot EnvironmentCredential authentication issues 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 index 739ff49c1..10b742ce1 100644 --- 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 @@ -10,12 +10,12 @@ import ( "bytes" "context" "errors" + "fmt" "io" "net/http" "net/url" "os" "regexp" - "strings" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" @@ -41,65 +41,18 @@ const ( 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" ) var ( // capability CP1 indicates the client application is capable of handling CAE claims challenges - cp1 = []string{"CP1"} - // CP1 is disabled until CAE support is added back - disableCP1 = true + cp1 = []string{"CP1"} + errInvalidTenantID = errors.New("invalid tenantID. You can locate your tenantID by following the instructions listed here: https://learn.microsoft.com/partner-center/find-ids-and-domain-names") ) -var getConfidentialClient = func(clientID, tenantID string, cred confidential.Credential, co *azcore.ClientOptions, additionalOpts ...confidential.Option) (confidentialClient, error) { - if !validTenantID(tenantID) { - return confidential.Client{}, errors.New(tenantIDValidationErr) - } - authorityHost, err := setAuthorityHost(co.Cloud) - if err != nil { - return confidential.Client{}, err - } - authority := runtime.JoinPaths(authorityHost, tenantID) - o := []confidential.Option{ - confidential.WithAzureRegion(os.Getenv(azureRegionalAuthorityName)), - confidential.WithHTTPClient(newPipelineAdapter(co)), - } - if !disableCP1 { - o = append(o, confidential.WithClientCapabilities(cp1)) - } - o = append(o, additionalOpts...) - if strings.ToLower(tenantID) == "adfs" { - o = append(o, confidential.WithInstanceDiscovery(false)) - } - return confidential.New(authority, clientID, cred, o...) -} - -var getPublicClient = func(clientID, tenantID string, co *azcore.ClientOptions, additionalOpts ...public.Option) (public.Client, error) { - if !validTenantID(tenantID) { - return public.Client{}, errors.New(tenantIDValidationErr) - } - authorityHost, err := setAuthorityHost(co.Cloud) - if err != nil { - return public.Client{}, err - } - o := []public.Option{ - public.WithAuthority(runtime.JoinPaths(authorityHost, tenantID)), - public.WithHTTPClient(newPipelineAdapter(co)), - } - if !disableCP1 { - o = append(o, public.WithClientCapabilities(cp1)) - } - o = append(o, additionalOpts...) - if strings.ToLower(tenantID) == "adfs" { - o = append(o, public.WithInstanceDiscovery(false)) - } - return public.New(clientID, o...) -} - // 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 +// 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 == "" { @@ -121,6 +74,41 @@ func setAuthorityHost(cc cloud.Configuration) (string, error) { return host, nil } +// resolveAdditionalTenants returns a copy of tenants, simplified when tenants contains a wildcard +func resolveAdditionalTenants(tenants []string) []string { + if len(tenants) == 0 { + return nil + } + for _, t := range tenants { + // a wildcard makes all other values redundant + if t == "*" { + return []string{"*"} + } + } + cp := make([]string, len(tenants)) + copy(cp, tenants) + return cp +} + +// resolveTenant returns the correct tenant for a token request +func resolveTenant(defaultTenant, specified, credName string, additionalTenants []string) (string, error) { + if specified == "" || specified == defaultTenant { + return defaultTenant, nil + } + if defaultTenant == "adfs" { + return "", errors.New("ADFS doesn't support tenants") + } + if !validTenantID(specified) { + return "", errInvalidTenantID + } + for _, t := range additionalTenants { + if t == "*" || t == specified { + return specified, nil + } + } + return "", fmt.Errorf(`%s isn't configured to acquire tokens for tenant %q. To enable acquiring tokens for this tenant add it to the AdditionallyAllowedTenants on the credential options, or add "*" to allow acquiring tokens for any tenant`, credName, specified) +} + // 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) @@ -173,7 +161,7 @@ func (p pipelineAdapter) Do(r *http.Request) (*http.Response, error) { } // enables fakes for test scenarios -type confidentialClient interface { +type msalConfidentialClient interface { AcquireTokenSilent(ctx context.Context, scopes []string, options ...confidential.AcquireSilentOption) (confidential.AuthResult, error) AcquireTokenByAuthCode(ctx context.Context, code string, redirectURI string, scopes []string, options ...confidential.AcquireByAuthCodeOption) (confidential.AuthResult, error) AcquireTokenByCredential(ctx context.Context, scopes []string, options ...confidential.AcquireByCredentialOption) (confidential.AuthResult, error) @@ -181,7 +169,7 @@ type confidentialClient interface { } // enables fakes for test scenarios -type publicClient interface { +type msalPublicClient interface { AcquireTokenSilent(ctx context.Context, scopes []string, options ...public.AcquireSilentOption) (public.AuthResult, error) AcquireTokenByUsernamePassword(ctx context.Context, scopes []string, username string, password string, options ...public.AcquireByUsernamePasswordOption) (public.AuthResult, error) AcquireTokenByDeviceCode(ctx context.Context, scopes []string, options ...public.AcquireByDeviceCodeOption) (public.DeviceCode, 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 index 33ff13c09..55a0d6543 100644 --- 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 @@ -17,10 +17,12 @@ import ( "regexp" "runtime" "strings" + "sync" "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" ) const ( @@ -47,14 +49,14 @@ type AzureCLICredentialOptions struct { // init returns an instance of AzureCLICredentialOptions initialized with default values. func (o *AzureCLICredentialOptions) init() { if o.tokenProvider == nil { - o.tokenProvider = defaultTokenProvider() + o.tokenProvider = defaultTokenProvider } } // AzureCLICredential authenticates as the identity logged in to the Azure CLI. type AzureCLICredential struct { - s *syncer - tokenProvider azureCLITokenProvider + mu *sync.Mutex + opts AzureCLICredentialOptions } // NewAzureCLICredential constructs an AzureCLICredential. Pass nil to accept default options. @@ -64,9 +66,8 @@ func NewAzureCLICredential(options *AzureCLICredentialOptions) (*AzureCLICredent cp = *options } cp.init() - c := AzureCLICredential{tokenProvider: cp.tokenProvider} - c.s = newSyncer(credNameAzureCLI, cp.TenantID, cp.AdditionallyAllowedTenants, c.requestToken, c.requestToken) - return &c, nil + cp.AdditionallyAllowedTenants = resolveAdditionalTenants(cp.AdditionallyAllowedTenants) + return &AzureCLICredential{mu: &sync.Mutex{}, opts: cp}, nil } // GetToken requests a token from the Azure CLI. This credential doesn't cache tokens, so every call invokes the CLI. @@ -75,13 +76,15 @@ func (c *AzureCLICredential) GetToken(ctx context.Context, opts policy.TokenRequ 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 + tenant, err := resolveTenant(c.opts.TenantID, opts.TenantID, credNameAzureCLI, c.opts.AdditionallyAllowedTenants) + if err != nil { + return azcore.AccessToken{}, err + } + // pass the CLI an AAD v1 resource because we don't know which CLI version is installed and older ones don't support v2 scopes opts.Scopes = []string{strings.TrimSuffix(opts.Scopes[0], defaultSuffix)} - return c.s.GetToken(ctx, opts) -} - -func (c *AzureCLICredential) requestToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - b, err := c.tokenProvider(ctx, opts.Scopes[0], opts.TenantID) + c.mu.Lock() + defer c.mu.Unlock() + b, err := c.opts.tokenProvider(ctx, opts.Scopes[0], tenant) if err != nil { return azcore.AccessToken{}, err } @@ -89,61 +92,61 @@ func (c *AzureCLICredential) requestToken(ctx context.Context, opts policy.Token if err != nil { return azcore.AccessToken{}, err } + msg := fmt.Sprintf("%s.GetToken() acquired a token for scope %q", credNameAzureCLI, strings.Join(opts.Scopes, ", ")) + log.Write(EventAuthentication, msg) return at, nil } -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) - } +var defaultTokenProvider azureCLITokenProvider = 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) + } - // set a default timeout for this authentication iff the application hasn't done so already - var cancel context.CancelFunc - if _, hasDeadline := ctx.Deadline(); !hasDeadline { - ctx, cancel = context.WithTimeout(ctx, timeoutCLIRequest) - defer cancel() - } + // set a default timeout for this authentication iff the application hasn't done so already + var cancel context.CancelFunc + if _, hasDeadline := ctx.Deadline(); !hasDeadline { + ctx, cancel = context.WithTimeout(ctx, timeoutCLIRequest) + defer cancel() + } - commandLine := "az account get-access-token -o json --resource " + resource - if tenantID != "" { - commandLine += " --tenant " + tenantID + 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") } - 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 = 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" } - 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) + if msg == "" { + msg = err.Error() } - - return output, nil + return nil, newCredentialUnavailableError(credNameAzureCLI, msg) } + + return output, nil } func (c *AzureCLICredential) createAccessToken(tk []byte) (azcore.AccessToken, error) { 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 index 3b443e8ee..9002ea0b0 100644 --- 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 @@ -26,22 +26,9 @@ stages: 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 + CloudConfig: + Public: + SubscriptionConfigurations: + - $(sub-config-azure-cloud-test-resources) + # Contains alternate tenant, AAD app and cert info for testing + - $(sub-config-identity-test-resources) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_assertion_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_assertion_credential.go index d9d22996c..303d5fc09 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_assertion_credential.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_assertion_credential.go @@ -24,8 +24,7 @@ const credNameAssertion = "ClientAssertionCredential" // // [Azure AD documentation]: https://docs.microsoft.com/azure/active-directory/develop/active-directory-certificate-credentials#assertion-format type ClientAssertionCredential struct { - client confidentialClient - s *syncer + client *confidentialClient } // ClientAssertionCredentialOptions contains optional parameters for ClientAssertionCredential. @@ -56,28 +55,21 @@ func NewClientAssertionCredential(tenantID, clientID string, getAssertion func(c return getAssertion(ctx) }, ) - c, err := getConfidentialClient(clientID, tenantID, cred, &options.ClientOptions, confidential.WithInstanceDiscovery(!options.DisableInstanceDiscovery)) + msalOpts := confidentialClientOptions{ + AdditionallyAllowedTenants: options.AdditionallyAllowedTenants, + ClientOptions: options.ClientOptions, + DisableInstanceDiscovery: options.DisableInstanceDiscovery, + } + c, err := newConfidentialClient(tenantID, clientID, credNameAssertion, cred, msalOpts) if err != nil { return nil, err } - cac := ClientAssertionCredential{client: c} - cac.s = newSyncer(credNameAssertion, tenantID, options.AdditionallyAllowedTenants, cac.requestToken, cac.silentAuth) - return &cac, nil + return &ClientAssertionCredential{client: c}, nil } // GetToken requests an access token from Azure Active Directory. This method is called automatically by Azure SDK clients. func (c *ClientAssertionCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - return c.s.GetToken(ctx, opts) -} - -func (c *ClientAssertionCredential) silentAuth(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes, confidential.WithTenantID(opts.TenantID)) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err -} - -func (c *ClientAssertionCredential) requestToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenByCredential(ctx, opts.Scopes, confidential.WithTenantID(opts.TenantID)) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + return c.client.GetToken(ctx, opts) } var _ azcore.TokenCredential = (*ClientAssertionCredential)(nil) 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 index 804eba899..d3300e305 100644 --- 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 @@ -42,8 +42,7 @@ type ClientCertificateCredentialOptions struct { // ClientCertificateCredential authenticates a service principal with a certificate. type ClientCertificateCredential struct { - client confidentialClient - s *syncer + client *confidentialClient } // NewClientCertificateCredential constructs a ClientCertificateCredential. Pass nil for options to accept defaults. @@ -58,33 +57,22 @@ func NewClientCertificateCredential(tenantID string, clientID string, certs []*x if err != nil { return nil, err } - var o []confidential.Option - if options.SendCertificateChain { - o = append(o, confidential.WithX5C()) + msalOpts := confidentialClientOptions{ + AdditionallyAllowedTenants: options.AdditionallyAllowedTenants, + ClientOptions: options.ClientOptions, + DisableInstanceDiscovery: options.DisableInstanceDiscovery, + SendX5C: options.SendCertificateChain, } - o = append(o, confidential.WithInstanceDiscovery(!options.DisableInstanceDiscovery)) - c, err := getConfidentialClient(clientID, tenantID, cred, &options.ClientOptions, o...) + c, err := newConfidentialClient(tenantID, clientID, credNameCert, cred, msalOpts) if err != nil { return nil, err } - cc := ClientCertificateCredential{client: c} - cc.s = newSyncer(credNameCert, tenantID, options.AdditionallyAllowedTenants, cc.requestToken, cc.silentAuth) - return &cc, nil + 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) { - return c.s.GetToken(ctx, opts) -} - -func (c *ClientCertificateCredential) silentAuth(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes, confidential.WithTenantID(opts.TenantID)) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err -} - -func (c *ClientCertificateCredential) requestToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenByCredential(ctx, opts.Scopes, confidential.WithTenantID(opts.TenantID)) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + return c.client.GetToken(ctx, opts) } // ParseCertificates loads certificates and a private key, in PEM or PKCS12 format, for use with NewClientCertificateCredential. 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 index dda21f6b8..d2ff7582b 100644 --- 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 @@ -33,8 +33,7 @@ type ClientSecretCredentialOptions struct { // ClientSecretCredential authenticates an application with a client secret. type ClientSecretCredential struct { - client confidentialClient - s *syncer + client *confidentialClient } // NewClientSecretCredential constructs a ClientSecretCredential. Pass nil for options to accept defaults. @@ -46,30 +45,21 @@ func NewClientSecretCredential(tenantID string, clientID string, clientSecret st if err != nil { return nil, err } - c, err := getConfidentialClient( - clientID, tenantID, cred, &options.ClientOptions, confidential.WithInstanceDiscovery(!options.DisableInstanceDiscovery), - ) + msalOpts := confidentialClientOptions{ + AdditionallyAllowedTenants: options.AdditionallyAllowedTenants, + ClientOptions: options.ClientOptions, + DisableInstanceDiscovery: options.DisableInstanceDiscovery, + } + c, err := newConfidentialClient(tenantID, clientID, credNameSecret, cred, msalOpts) if err != nil { return nil, err } - csc := ClientSecretCredential{client: c} - csc.s = newSyncer(credNameSecret, tenantID, options.AdditionallyAllowedTenants, csc.requestToken, csc.silentAuth) - return &csc, nil + return &ClientSecretCredential{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) { - return c.s.GetToken(ctx, opts) -} - -func (c *ClientSecretCredential) silentAuth(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes, confidential.WithTenantID(opts.TenantID)) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err -} - -func (c *ClientSecretCredential) requestToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenByCredential(ctx, opts.Scopes, confidential.WithTenantID(opts.TenantID)) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + return c.client.GetToken(ctx, opts) } var _ azcore.TokenCredential = (*ClientSecretCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/confidential_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/confidential_client.go new file mode 100644 index 000000000..4853a9a00 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/confidential_client.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 azidentity + +import ( + "context" + "errors" + "fmt" + "os" + "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/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential" +) + +type confidentialClientOptions struct { + azcore.ClientOptions + + AdditionallyAllowedTenants []string + // Assertion for on-behalf-of authentication + Assertion string + DisableInstanceDiscovery, SendX5C bool +} + +// confidentialClient wraps the MSAL confidential client +type confidentialClient struct { + cae, noCAE msalConfidentialClient + caeMu, noCAEMu, clientMu *sync.Mutex + clientID, tenantID string + cred confidential.Credential + host string + name string + opts confidentialClientOptions + region string +} + +func newConfidentialClient(tenantID, clientID, name string, cred confidential.Credential, opts confidentialClientOptions) (*confidentialClient, error) { + if !validTenantID(tenantID) { + return nil, errInvalidTenantID + } + host, err := setAuthorityHost(opts.Cloud) + if err != nil { + return nil, err + } + opts.AdditionallyAllowedTenants = resolveAdditionalTenants(opts.AdditionallyAllowedTenants) + return &confidentialClient{ + caeMu: &sync.Mutex{}, + clientID: clientID, + clientMu: &sync.Mutex{}, + cred: cred, + host: host, + name: name, + noCAEMu: &sync.Mutex{}, + opts: opts, + region: os.Getenv(azureRegionalAuthorityName), + tenantID: tenantID, + }, nil +} + +// GetToken requests an access token from MSAL, checking the cache first. +func (c *confidentialClient) GetToken(ctx context.Context, tro policy.TokenRequestOptions) (azcore.AccessToken, error) { + if len(tro.Scopes) < 1 { + return azcore.AccessToken{}, fmt.Errorf("%s.GetToken() requires at least one scope", c.name) + } + // we don't resolve the tenant for managed identities because they acquire tokens only from their home tenants + if c.name != credNameManagedIdentity { + tenant, err := c.resolveTenant(tro.TenantID) + if err != nil { + return azcore.AccessToken{}, err + } + tro.TenantID = tenant + } + client, mu, err := c.client(ctx, tro) + if err != nil { + return azcore.AccessToken{}, err + } + mu.Lock() + defer mu.Unlock() + var ar confidential.AuthResult + if c.opts.Assertion != "" { + ar, err = client.AcquireTokenOnBehalfOf(ctx, c.opts.Assertion, tro.Scopes, confidential.WithClaims(tro.Claims), confidential.WithTenantID(tro.TenantID)) + } else { + ar, err = client.AcquireTokenSilent(ctx, tro.Scopes, confidential.WithClaims(tro.Claims), confidential.WithTenantID(tro.TenantID)) + if err != nil { + ar, err = client.AcquireTokenByCredential(ctx, tro.Scopes, confidential.WithClaims(tro.Claims), confidential.WithTenantID(tro.TenantID)) + } + } + if err != nil { + // We could get a credentialUnavailableError from managed identity authentication because in that case the error comes from our code. + // We return it directly because it affects the behavior of credential chains. Otherwise, we return AuthenticationFailedError. + var unavailableErr *credentialUnavailableError + if !errors.As(err, &unavailableErr) { + res := getResponseFromError(err) + err = newAuthenticationFailedError(c.name, err.Error(), res, err) + } + } else { + msg := fmt.Sprintf("%s.GetToken() acquired a token for scope %q", c.name, strings.Join(ar.GrantedScopes, ", ")) + log.Write(EventAuthentication, msg) + } + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err +} + +func (c *confidentialClient) client(ctx context.Context, tro policy.TokenRequestOptions) (msalConfidentialClient, *sync.Mutex, error) { + c.clientMu.Lock() + defer c.clientMu.Unlock() + if tro.EnableCAE { + if c.cae == nil { + client, err := c.newMSALClient(true) + if err != nil { + return nil, nil, err + } + c.cae = client + } + return c.cae, c.caeMu, nil + } + if c.noCAE == nil { + client, err := c.newMSALClient(false) + if err != nil { + return nil, nil, err + } + c.noCAE = client + } + return c.noCAE, c.noCAEMu, nil +} + +func (c *confidentialClient) newMSALClient(enableCAE bool) (msalConfidentialClient, error) { + authority := runtime.JoinPaths(c.host, c.tenantID) + o := []confidential.Option{ + confidential.WithAzureRegion(c.region), + confidential.WithHTTPClient(newPipelineAdapter(&c.opts.ClientOptions)), + } + if enableCAE { + o = append(o, confidential.WithClientCapabilities(cp1)) + } + if c.opts.SendX5C { + o = append(o, confidential.WithX5C()) + } + if c.opts.DisableInstanceDiscovery || strings.ToLower(c.tenantID) == "adfs" { + o = append(o, confidential.WithInstanceDiscovery(false)) + } + return confidential.New(authority, c.clientID, c.cred, o...) +} + +// resolveTenant returns the correct tenant for a token request given the client's +// configuration, or an error when that configuration doesn't allow the specified tenant +func (c *confidentialClient) resolveTenant(specified string) (string, error) { + return resolveTenant(c.tenantID, specified, c.name, c.opts.AdditionallyAllowedTenants) +} 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 index 1e3efdc97..7647c60b1 100644 --- 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 @@ -21,6 +21,8 @@ import ( // DefaultAzureCredentialOptions contains optional parameters for DefaultAzureCredential. // These options may not apply to all credentials in the chain. type DefaultAzureCredentialOptions struct { + // ClientOptions has additional options for credentials that use an Azure SDK HTTP pipeline. These options don't apply + // to credential types that authenticate via external tools such as the Azure CLI. azcore.ClientOptions // AdditionallyAllowedTenants specifies additional tenants for which the credential may acquire tokens. Add @@ -32,8 +34,7 @@ type DefaultAzureCredentialOptions struct { // from https://login.microsoft.com before authenticating. Setting this to true will skip this request, making // the application responsible for ensuring the configured authority is valid and trustworthy. DisableInstanceDiscovery bool - // 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 sets the default tenant for authentication via the Azure CLI and workload identity. TenantID string } @@ -83,11 +84,11 @@ func NewDefaultAzureCredential(options *DefaultAzureCredentialOptions) (*Default creds = append(creds, &defaultCredentialErrorReporter{credType: "EnvironmentCredential", err: err}) } - // workload identity requires values for AZURE_AUTHORITY_HOST, AZURE_CLIENT_ID, AZURE_FEDERATED_TOKEN_FILE, AZURE_TENANT_ID wic, err := NewWorkloadIdentityCredential(&WorkloadIdentityCredentialOptions{ AdditionallyAllowedTenants: additionalTenants, ClientOptions: options.ClientOptions, DisableInstanceDiscovery: options.DisableInstanceDiscovery, + TenantID: options.TenantID, }) if err == nil { creds = append(creds, wic) @@ -95,6 +96,7 @@ func NewDefaultAzureCredential(options *DefaultAzureCredentialOptions) (*Default errorMessages = append(errorMessages, credNameWorkloadIdentity+": "+err.Error()) creds = append(creds, &defaultCredentialErrorReporter{credType: credNameWorkloadIdentity, err: err}) } + o := &ManagedIdentityCredentialOptions{ClientOptions: options.ClientOptions} if ID, ok := os.LookupEnv(azureClientID); ok { o.ID = ClientID(ID) @@ -115,9 +117,8 @@ func NewDefaultAzureCredential(options *DefaultAzureCredentialOptions) (*Default creds = append(creds, &defaultCredentialErrorReporter{credType: credNameAzureCLI, err: err}) } - err = defaultAzureCredentialConstructorErrorHandler(len(creds), errorMessages) - if err != nil { - return nil, err + if len(errorMessages) > 0 { + log.Writef(EventAuthentication, "NewDefaultAzureCredential failed to initialize some credentials:\n\t%s", strings.Join(errorMessages, "\n\t")) } chain, err := NewChainedTokenCredential(creds, nil) @@ -135,20 +136,6 @@ func (c *DefaultAzureCredential) GetToken(ctx context.Context, opts policy.Token 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 @@ -185,7 +172,7 @@ func (w *timeoutWrapper) GetToken(ctx context.Context, opts policy.TokenRequestO defer cancel() tk, err = w.mic.GetToken(c, opts) if isAuthFailedDueToContext(err) { - err = newCredentialUnavailableError(credNameManagedIdentity, "managed identity timed out") + err = newCredentialUnavailableError(credNameManagedIdentity, "managed identity timed out. See https://aka.ms/azsdk/go/identity/troubleshoot#dac for more information") } else { // some managed identity implementation is available, so don't apply the timeout to future calls w.timeout = 0 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 index 108e83c43..d245c269a 100644 --- 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 @@ -12,7 +12,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" ) const credNameDeviceCode = "DeviceCodeCredential" @@ -74,10 +73,7 @@ type DeviceCodeMessage struct { // If a web browser is available, InteractiveBrowserCredential is more convenient because it // automatically opens a browser to the login page. type DeviceCodeCredential struct { - account public.Account - client publicClient - s *syncer - prompt func(context.Context, DeviceCodeMessage) error + client *publicClient } // NewDeviceCodeCredential creates a DeviceCodeCredential. Pass nil to accept default options. @@ -87,50 +83,24 @@ func NewDeviceCodeCredential(options *DeviceCodeCredentialOptions) (*DeviceCodeC cp = *options } cp.init() - c, err := getPublicClient( - cp.ClientID, cp.TenantID, &cp.ClientOptions, public.WithInstanceDiscovery(!cp.DisableInstanceDiscovery), - ) + msalOpts := publicClientOptions{ + AdditionallyAllowedTenants: cp.AdditionallyAllowedTenants, + ClientOptions: cp.ClientOptions, + DeviceCodePrompt: cp.UserPrompt, + DisableInstanceDiscovery: cp.DisableInstanceDiscovery, + } + c, err := newPublicClient(cp.TenantID, cp.ClientID, credNameDeviceCode, msalOpts) if err != nil { return nil, err } - cred := DeviceCodeCredential{client: c, prompt: cp.UserPrompt} - cred.s = newSyncer(credNameDeviceCode, cp.TenantID, cp.AdditionallyAllowedTenants, cred.requestToken, cred.silentAuth) - return &cred, nil + c.name = credNameDeviceCode + return &DeviceCodeCredential{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) { - return c.s.GetToken(ctx, opts) -} - -func (c *DeviceCodeCredential) requestToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - dc, err := c.client.AcquireTokenByDeviceCode(ctx, opts.Scopes, public.WithTenantID(opts.TenantID)) - if err != nil { - return azcore.AccessToken{}, err - } - err = c.prompt(ctx, DeviceCodeMessage{ - Message: dc.Result.Message, - UserCode: dc.Result.UserCode, - VerificationURL: dc.Result.VerificationURL, - }) - if err != nil { - return azcore.AccessToken{}, err - } - ar, err := dc.AuthenticationResult(ctx) - if err != nil { - return azcore.AccessToken{}, err - } - c.account = ar.Account - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err -} - -func (c *DeviceCodeCredential) silentAuth(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes, - public.WithSilentAccount(c.account), - public.WithTenantID(opts.TenantID), - ) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + return c.client.GetToken(ctx, opts) } var _ azcore.TokenCredential = (*DeviceCodeCredential)(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 index 86d8976a4..e1a21e003 100644 --- 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 @@ -11,9 +11,9 @@ import ( "encoding/json" "errors" "fmt" - "io" "net/http" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo" msal "github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors" ) @@ -57,17 +57,16 @@ func (e *AuthenticationFailedError) Error() string { 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 { + body, err := runtime.Payload(e.RawResponse) + switch { + case err != nil: fmt.Fprintf(msg, "Error reading response body: %v", err) - } else if len(body) > 0 { - e.RawResponse.Body = io.NopCloser(bytes.NewReader(body)) + case 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)) } - } else { + default: fmt.Fprint(msg, "Response contained no body") } fmt.Fprintln(msg, "\n--------------------------------------------------------------------------------") 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 index 4868d22c3..08f3efbf3 100644 --- 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 @@ -11,7 +11,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" ) const credNameBrowser = "InteractiveBrowserCredential" @@ -56,10 +55,7 @@ func (o *InteractiveBrowserCredentialOptions) init() { // InteractiveBrowserCredential opens a browser to interactively authenticate a user. type InteractiveBrowserCredential struct { - account public.Account - client publicClient - options InteractiveBrowserCredentialOptions - s *syncer + client *publicClient } // NewInteractiveBrowserCredential constructs a new InteractiveBrowserCredential. Pass nil to accept default options. @@ -69,38 +65,22 @@ func NewInteractiveBrowserCredential(options *InteractiveBrowserCredentialOption cp = *options } cp.init() - c, err := getPublicClient(cp.ClientID, cp.TenantID, &cp.ClientOptions, public.WithInstanceDiscovery(!cp.DisableInstanceDiscovery)) + msalOpts := publicClientOptions{ + ClientOptions: cp.ClientOptions, + DisableInstanceDiscovery: cp.DisableInstanceDiscovery, + LoginHint: cp.LoginHint, + RedirectURL: cp.RedirectURL, + } + c, err := newPublicClient(cp.TenantID, cp.ClientID, credNameBrowser, msalOpts) if err != nil { return nil, err } - ibc := InteractiveBrowserCredential{client: c, options: cp} - ibc.s = newSyncer(credNameBrowser, cp.TenantID, cp.AdditionallyAllowedTenants, ibc.requestToken, ibc.silentAuth) - return &ibc, nil + return &InteractiveBrowserCredential{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) { - return c.s.GetToken(ctx, opts) -} - -func (c *InteractiveBrowserCredential) requestToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenInteractive(ctx, opts.Scopes, - public.WithLoginHint(c.options.LoginHint), - public.WithRedirectURI(c.options.RedirectURL), - public.WithTenantID(opts.TenantID), - ) - if err == nil { - c.account = ar.Account - } - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err -} - -func (c *InteractiveBrowserCredential) silentAuth(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes, - public.WithSilentAccount(c.account), - public.WithTenantID(opts.TenantID), - ) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + return c.client.GetToken(ctx, opts) } var _ azcore.TokenCredential = (*InteractiveBrowserCredential)(nil) 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 index d7b4a32a5..fdc3c1f67 100644 --- 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 @@ -84,13 +84,15 @@ func setIMDSRetryOptionDefaults(o *policy.RetryOptions) { } 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 + // IMDS docs recommend retrying 404, 410, 429 and 5xx + // https://learn.microsoft.com/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#error-handling http.StatusNotFound, // 404 + http.StatusGone, // 410 http.StatusTooManyRequests, // 429 http.StatusInternalServerError, // 500 http.StatusNotImplemented, // 501 http.StatusBadGateway, // 502 + http.StatusServiceUnavailable, // 503 http.StatusGatewayTimeout, // 504 http.StatusHTTPVersionNotSupported, // 505 http.StatusVariantAlsoNegotiates, // 506 @@ -175,11 +177,25 @@ func (c *managedIdentityClient) authenticate(ctx context.Context, id ManagedIDKi 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, nil) + if c.msiType == msiTypeIMDS { + switch resp.StatusCode { + case http.StatusBadRequest: + if id != nil { + return azcore.AccessToken{}, newAuthenticationFailedError(credNameManagedIdentity, "the requested identity isn't assigned to this resource", resp, nil) + } + msg := "failed to authenticate a system assigned identity" + if body, err := runtime.Payload(resp); err == nil && len(body) > 0 { + msg += fmt.Sprintf(". The endpoint responded with %s", body) + } + return azcore.AccessToken{}, newCredentialUnavailableError(credNameManagedIdentity, msg) + case http.StatusForbidden: + // Docker Desktop runs a proxy that responds 403 to IMDS token requests. If we get that response, + // we return credentialUnavailableError so credential chains continue to their next credential + body, err := runtime.Payload(resp) + if err == nil && strings.Contains(string(body), "A socket operation was attempted to an unreachable network") { + return azcore.AccessToken{}, newCredentialUnavailableError(credNameManagedIdentity, fmt.Sprintf("unexpected response %q", string(body))) + } } - return azcore.AccessToken{}, newCredentialUnavailableError(credNameManagedIdentity, "no default identity is assigned to this resource") } return azcore.AccessToken{}, newAuthenticationFailedError(credNameManagedIdentity, "authentication failed", resp, 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 index c6710ae52..35c5e6725 100644 --- 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 @@ -8,7 +8,6 @@ package azidentity import ( "context" - "errors" "fmt" "strings" @@ -71,9 +70,8 @@ type ManagedIdentityCredentialOptions struct { // 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 { - client confidentialClient + client *confidentialClient mic *managedIdentityClient - s *syncer } // NewManagedIdentityCredential creates a ManagedIdentityCredential. Pass nil to accept default options. @@ -93,35 +91,23 @@ func NewManagedIdentityCredential(options *ManagedIdentityCredentialOptions) (*M if options.ID != nil { clientID = options.ID.String() } - // similarly, it's okay to give MSAL an incorrect authority URL because that URL won't be used - c, err := confidential.New("https://login.microsoftonline.com/common", clientID, cred) + // similarly, it's okay to give MSAL an incorrect tenant because MSAL won't use the value + c, err := newConfidentialClient("common", clientID, credNameManagedIdentity, cred, confidentialClientOptions{}) if err != nil { return nil, err } - m := ManagedIdentityCredential{client: c, mic: mic} - m.s = newSyncer(credNameManagedIdentity, "", nil, m.requestToken, m.silentAuth) - return &m, nil + return &ManagedIdentityCredential{client: c, mic: mic}, 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") + err := fmt.Errorf("%s.GetToken() requires exactly one scope", credNameManagedIdentity) return azcore.AccessToken{}, err } // managed identity endpoints require an AADv1 resource (i.e. token audience), not a v2 scope, so we remove "/.default" here opts.Scopes = []string{strings.TrimSuffix(opts.Scopes[0], defaultSuffix)} - return c.s.GetToken(ctx, opts) -} - -func (c *ManagedIdentityCredential) requestToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenByCredential(ctx, opts.Scopes) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err -} - -func (c *ManagedIdentityCredential) silentAuth(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + return c.client.GetToken(ctx, opts) } var _ azcore.TokenCredential = (*ManagedIdentityCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/on_behalf_of_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/on_behalf_of_credential.go index 3e173f47d..2b360b681 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/on_behalf_of_credential.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/on_behalf_of_credential.go @@ -25,9 +25,7 @@ const credNameOBO = "OnBehalfOfCredential" // // [Azure Active Directory documentation]: https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow type OnBehalfOfCredential struct { - assertion string - client confidentialClient - s *syncer + client *confidentialClient } // OnBehalfOfCredentialOptions contains optional parameters for OnBehalfOfCredential @@ -72,28 +70,23 @@ func newOnBehalfOfCredential(tenantID, clientID, userAssertion string, cred conf if options == nil { options = &OnBehalfOfCredentialOptions{} } - opts := []confidential.Option{} - if options.SendCertificateChain { - opts = append(opts, confidential.WithX5C()) + opts := confidentialClientOptions{ + AdditionallyAllowedTenants: options.AdditionallyAllowedTenants, + Assertion: userAssertion, + ClientOptions: options.ClientOptions, + DisableInstanceDiscovery: options.DisableInstanceDiscovery, + SendX5C: options.SendCertificateChain, } - opts = append(opts, confidential.WithInstanceDiscovery(!options.DisableInstanceDiscovery)) - c, err := getConfidentialClient(clientID, tenantID, cred, &options.ClientOptions, opts...) + c, err := newConfidentialClient(tenantID, clientID, credNameOBO, cred, opts) if err != nil { return nil, err } - obo := OnBehalfOfCredential{assertion: userAssertion, client: c} - obo.s = newSyncer(credNameOBO, tenantID, options.AdditionallyAllowedTenants, obo.requestToken, obo.requestToken) - return &obo, nil + return &OnBehalfOfCredential{c}, nil } // GetToken requests an access token from Azure Active Directory. This method is called automatically by Azure SDK clients. func (o *OnBehalfOfCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - return o.s.GetToken(ctx, opts) -} - -func (o *OnBehalfOfCredential) requestToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := o.client.AcquireTokenOnBehalfOf(ctx, o.assertion, opts.Scopes, confidential.WithTenantID(opts.TenantID)) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + return o.client.GetToken(ctx, opts) } var _ azcore.TokenCredential = (*OnBehalfOfCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/public_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/public_client.go new file mode 100644 index 000000000..6512d3e25 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/public_client.go @@ -0,0 +1,178 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "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/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" +) + +type publicClientOptions struct { + azcore.ClientOptions + + AdditionallyAllowedTenants []string + DeviceCodePrompt func(context.Context, DeviceCodeMessage) error + DisableInstanceDiscovery bool + LoginHint, RedirectURL string + Username, Password string +} + +// publicClient wraps the MSAL public client +type publicClient struct { + account public.Account + cae, noCAE msalPublicClient + caeMu, noCAEMu, clientMu *sync.Mutex + clientID, tenantID string + host string + name string + opts publicClientOptions +} + +func newPublicClient(tenantID, clientID, name string, o publicClientOptions) (*publicClient, error) { + if !validTenantID(tenantID) { + return nil, errInvalidTenantID + } + host, err := setAuthorityHost(o.Cloud) + if err != nil { + return nil, err + } + o.AdditionallyAllowedTenants = resolveAdditionalTenants(o.AdditionallyAllowedTenants) + return &publicClient{ + caeMu: &sync.Mutex{}, + clientID: clientID, + clientMu: &sync.Mutex{}, + host: host, + name: name, + noCAEMu: &sync.Mutex{}, + opts: o, + tenantID: tenantID, + }, nil +} + +// GetToken requests an access token from MSAL, checking the cache first. +func (p *publicClient) GetToken(ctx context.Context, tro policy.TokenRequestOptions) (azcore.AccessToken, error) { + if len(tro.Scopes) < 1 { + return azcore.AccessToken{}, fmt.Errorf("%s.GetToken() requires at least one scope", p.name) + } + tenant, err := p.resolveTenant(tro.TenantID) + if err != nil { + return azcore.AccessToken{}, err + } + client, mu, err := p.client(tro) + if err != nil { + return azcore.AccessToken{}, err + } + mu.Lock() + defer mu.Unlock() + ar, err := client.AcquireTokenSilent(ctx, tro.Scopes, public.WithSilentAccount(p.account), public.WithClaims(tro.Claims), public.WithTenantID(tenant)) + if err == nil { + return p.token(ar, err) + } + at, err := p.reqToken(ctx, client, tro) + if err == nil { + msg := fmt.Sprintf("%s.GetToken() acquired a token for scope %q", p.name, strings.Join(ar.GrantedScopes, ", ")) + log.Write(EventAuthentication, msg) + } + return at, err +} + +// reqToken requests a token from the MSAL public client. It's separate from GetToken() to enable Authenticate() to bypass the cache. +func (p *publicClient) reqToken(ctx context.Context, c msalPublicClient, tro policy.TokenRequestOptions) (azcore.AccessToken, error) { + tenant, err := p.resolveTenant(tro.TenantID) + if err != nil { + return azcore.AccessToken{}, err + } + var ar public.AuthResult + switch p.name { + case credNameBrowser: + ar, err = c.AcquireTokenInteractive(ctx, tro.Scopes, + public.WithClaims(tro.Claims), + public.WithLoginHint(p.opts.LoginHint), + public.WithRedirectURI(p.opts.RedirectURL), + public.WithTenantID(tenant), + ) + case credNameDeviceCode: + dc, e := c.AcquireTokenByDeviceCode(ctx, tro.Scopes, public.WithClaims(tro.Claims), public.WithTenantID(tenant)) + if e != nil { + return azcore.AccessToken{}, e + } + err = p.opts.DeviceCodePrompt(ctx, DeviceCodeMessage{ + Message: dc.Result.Message, + UserCode: dc.Result.UserCode, + VerificationURL: dc.Result.VerificationURL, + }) + if err == nil { + ar, err = dc.AuthenticationResult(ctx) + } + case credNameUserPassword: + ar, err = c.AcquireTokenByUsernamePassword(ctx, tro.Scopes, p.opts.Username, p.opts.Password, public.WithClaims(tro.Claims), public.WithTenantID(tenant)) + default: + return azcore.AccessToken{}, fmt.Errorf("unknown credential %q", p.name) + } + return p.token(ar, err) +} + +func (p *publicClient) client(tro policy.TokenRequestOptions) (msalPublicClient, *sync.Mutex, error) { + p.clientMu.Lock() + defer p.clientMu.Unlock() + if tro.EnableCAE { + if p.cae == nil { + client, err := p.newMSALClient(true) + if err != nil { + return nil, nil, err + } + p.cae = client + } + return p.cae, p.caeMu, nil + } + if p.noCAE == nil { + client, err := p.newMSALClient(false) + if err != nil { + return nil, nil, err + } + p.noCAE = client + } + return p.noCAE, p.noCAEMu, nil +} + +func (p *publicClient) newMSALClient(enableCAE bool) (msalPublicClient, error) { + o := []public.Option{ + public.WithAuthority(runtime.JoinPaths(p.host, p.tenantID)), + public.WithHTTPClient(newPipelineAdapter(&p.opts.ClientOptions)), + } + if enableCAE { + o = append(o, public.WithClientCapabilities(cp1)) + } + if p.opts.DisableInstanceDiscovery || strings.ToLower(p.tenantID) == "adfs" { + o = append(o, public.WithInstanceDiscovery(false)) + } + return public.New(p.clientID, o...) +} + +func (p *publicClient) token(ar public.AuthResult, err error) (azcore.AccessToken, error) { + if err == nil { + p.account = ar.Account + } else { + res := getResponseFromError(err) + err = newAuthenticationFailedError(p.name, err.Error(), res, err) + } + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err +} + +// resolveTenant returns the correct tenant for a token request given the client's +// configuration, or an error when that configuration doesn't allow the specified tenant +func (p *publicClient) resolveTenant(specified string) (string, error) { + return resolveTenant(p.tenantID, specified, p.name, p.opts.AdditionallyAllowedTenants) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/syncer.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/syncer.go deleted file mode 100644 index ae3855599..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/syncer.go +++ /dev/null @@ -1,130 +0,0 @@ -//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" -) - -type authFn func(context.Context, policy.TokenRequestOptions) (azcore.AccessToken, error) - -// syncer synchronizes authentication calls so that goroutines can share a credential instance -type syncer struct { - addlTenants []string - authing bool - cond *sync.Cond - reqToken, silent authFn - name, tenant string -} - -func newSyncer(name, tenant string, additionalTenants []string, reqToken, silentAuth authFn) *syncer { - return &syncer{ - addlTenants: resolveAdditionalTenants(additionalTenants), - cond: &sync.Cond{L: &sync.Mutex{}}, - name: name, - reqToken: reqToken, - silent: silentAuth, - tenant: tenant, - } -} - -// GetToken ensures that only one goroutine authenticates at a time -func (s *syncer) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - var at azcore.AccessToken - var err error - if len(opts.Scopes) == 0 { - return at, errors.New(s.name + ".GetToken() requires at least one scope") - } - // we don't resolve the tenant for managed identities because they can acquire tokens only from their home tenants - if s.name != credNameManagedIdentity { - tenant, err := s.resolveTenant(opts.TenantID) - if err != nil { - return at, err - } - opts.TenantID = tenant - } - auth := false - s.cond.L.Lock() - defer s.cond.L.Unlock() - for { - at, err = s.silent(ctx, opts) - if err == nil { - // got a token - break - } - if !s.authing { - // this goroutine will request a token - s.authing, auth = true, true - break - } - // another goroutine is acquiring a token; wait for it to finish, then try silent auth again - s.cond.Wait() - } - if auth { - s.authing = false - at, err = s.reqToken(ctx, opts) - s.cond.Broadcast() - } - if err != nil { - // Return credentialUnavailableError directly because that type affects the behavior of credential chains. - // Otherwise, return AuthenticationFailedError. - var unavailableErr *credentialUnavailableError - if !errors.As(err, &unavailableErr) { - res := getResponseFromError(err) - err = newAuthenticationFailedError(s.name, err.Error(), res, err) - } - } else if log.Should(EventAuthentication) { - scope := strings.Join(opts.Scopes, ", ") - msg := fmt.Sprintf(`%s.GetToken() acquired a token for scope "%s"\n`, s.name, scope) - log.Write(EventAuthentication, msg) - } - return at, err -} - -// resolveTenant returns the correct tenant for a token request given the credential's -// configuration, or an error when the specified tenant isn't allowed by that configuration -func (s *syncer) resolveTenant(requested string) (string, error) { - if requested == "" || requested == s.tenant { - return s.tenant, nil - } - if s.tenant == "adfs" { - return "", errors.New("ADFS doesn't support tenants") - } - if !validTenantID(requested) { - return "", errors.New(tenantIDValidationErr) - } - for _, t := range s.addlTenants { - if t == "*" || t == requested { - return requested, nil - } - } - return "", fmt.Errorf(`%s isn't configured to acquire tokens for tenant %q. To enable acquiring tokens for this tenant add it to the AdditionallyAllowedTenants on the credential options, or add "*" to allow acquiring tokens for any tenant`, s.name, requested) -} - -// resolveAdditionalTenants returns a copy of tenants, simplified when tenants contains a wildcard -func resolveAdditionalTenants(tenants []string) []string { - if len(tenants) == 0 { - return nil - } - for _, t := range tenants { - // a wildcard makes all other values redundant - if t == "*" { - return []string{"*"} - } - } - cp := make([]string, len(tenants)) - copy(cp, tenants) - return cp -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/test-resources-pre.ps1 b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/test-resources-pre.ps1 new file mode 100644 index 000000000..fe0183add --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/test-resources-pre.ps1 @@ -0,0 +1,36 @@ +[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] +param ( + # Captures any arguments from eng/New-TestResources.ps1 not declared here (no parameter errors). + [Parameter(ValueFromRemainingArguments = $true)] + $RemainingArguments +) + +if (!$CI) { + # TODO: Remove this once auto-cloud config downloads are supported locally + Write-Host "Skipping cert setup in local testing mode" + return +} + +if ($EnvironmentVariables -eq $null -or $EnvironmentVariables.Count -eq 0) { + throw "EnvironmentVariables must be set in the calling script New-TestResources.ps1" +} + +$tmp = $env:TEMP ? $env:TEMP : [System.IO.Path]::GetTempPath() +$pfxPath = Join-Path $tmp "test.pfx" +$pemPath = Join-Path $tmp "test.pem" +$sniPath = Join-Path $tmp "testsni.pfx" + +Write-Host "Creating identity test files: $pfxPath $pemPath $sniPath" + +[System.Convert]::FromBase64String($EnvironmentVariables['PFX_CONTENTS']) | Set-Content -Path $pfxPath -AsByteStream +Set-Content -Path $pemPath -Value $EnvironmentVariables['PEM_CONTENTS'] +[System.Convert]::FromBase64String($EnvironmentVariables['SNI_CONTENTS']) | Set-Content -Path $sniPath -AsByteStream + +# Set for pipeline +Write-Host "##vso[task.setvariable variable=IDENTITY_SP_CERT_PFX;]$pfxPath" +Write-Host "##vso[task.setvariable variable=IDENTITY_SP_CERT_PEM;]$pemPath" +Write-Host "##vso[task.setvariable variable=IDENTITY_SP_CERT_SNI;]$sniPath" +# Set for local +$env:IDENTITY_SP_CERT_PFX = $pfxPath +$env:IDENTITY_SP_CERT_PEM = $pemPath +$env:IDENTITY_SP_CERT_SNI = $sniPath diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/test-resources.bicep b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/test-resources.bicep new file mode 100644 index 000000000..b3490d3b5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/test-resources.bicep @@ -0,0 +1 @@ +param baseName string 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 index 8e652e33f..f787ec0ce 100644 --- 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 @@ -11,7 +11,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" ) const credNameUserPassword = "UsernamePasswordCredential" @@ -36,10 +35,7 @@ type UsernamePasswordCredentialOptions struct { // 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 { - account public.Account - client publicClient - password, username string - s *syncer + client *publicClient } // NewUsernamePasswordCredential creates a UsernamePasswordCredential. clientID is the ID of the application the user @@ -48,34 +44,23 @@ func NewUsernamePasswordCredential(tenantID string, clientID string, username st if options == nil { options = &UsernamePasswordCredentialOptions{} } - c, err := getPublicClient(clientID, tenantID, &options.ClientOptions, public.WithInstanceDiscovery(!options.DisableInstanceDiscovery)) + opts := publicClientOptions{ + AdditionallyAllowedTenants: options.AdditionallyAllowedTenants, + ClientOptions: options.ClientOptions, + DisableInstanceDiscovery: options.DisableInstanceDiscovery, + Password: password, + Username: username, + } + c, err := newPublicClient(tenantID, clientID, credNameUserPassword, opts) if err != nil { return nil, err } - upc := UsernamePasswordCredential{client: c, password: password, username: username} - upc.s = newSyncer(credNameUserPassword, tenantID, options.AdditionallyAllowedTenants, upc.requestToken, upc.silentAuth) - return &upc, nil + return &UsernamePasswordCredential{client: c}, err } // 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) { - return c.s.GetToken(ctx, opts) -} - -func (c *UsernamePasswordCredential) requestToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenByUsernamePassword(ctx, opts.Scopes, c.username, c.password, public.WithTenantID(opts.TenantID)) - if err == nil { - c.account = ar.Account - } - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err -} - -func (c *UsernamePasswordCredential) silentAuth(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { - ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes, - public.WithSilentAccount(c.account), - public.WithTenantID(opts.TenantID), - ) - return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + return c.client.GetToken(ctx, opts) } 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 index 1a526b2e8..65e74e31e 100644 --- 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 @@ -11,5 +11,5 @@ const ( component = "azidentity" // Version is the semantic version (see http://semver.org) of this module. - version = "v1.3.0" + version = "v1.4.0" ) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/workload_identity.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/workload_identity.go index 7bfb34367..7e016324d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/workload_identity.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/workload_identity.go @@ -47,7 +47,7 @@ type WorkloadIdentityCredentialOptions struct { DisableInstanceDiscovery bool // TenantID of the service principal. Defaults to the value of the environment variable AZURE_TENANT_ID. TenantID string - // TokenFilePath is the path a file containing the workload identity token. Defaults to the value of the + // TokenFilePath is the path of a file containing a Kubernetes service account token. Defaults to the value of the // environment variable AZURE_FEDERATED_TOKEN_FILE. TokenFilePath string } @@ -88,7 +88,7 @@ func NewWorkloadIdentityCredential(options *WorkloadIdentityCredentialOptions) ( return nil, err } // we want "WorkloadIdentityCredential" in log messages, not "ClientAssertionCredential" - cred.s.name = credNameWorkloadIdentity + cred.client.name = credNameWorkloadIdentity w.cred = cred return &w, nil } 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 index ade7b348e..8ee66b526 100644 --- 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 @@ -14,3 +14,33 @@ type NonRetriable interface { error NonRetriable() } + +// NonRetriableError marks the specified error as non-retriable. +// This function takes an error as input and returns a new error that is marked as non-retriable. +func NonRetriableError(err error) error { + return &nonRetriableError{err} +} + +// nonRetriableError is a struct that embeds the error interface. +// It is used to represent errors that should not be retried. +type nonRetriableError struct { + error +} + +// Error method for nonRetriableError struct. +// It returns the error message of the embedded error. +func (p *nonRetriableError) Error() string { + return p.error.Error() +} + +// NonRetriable is a marker method for nonRetriableError struct. +// Non-functional and indicates that the error is non-retriable. +func (*nonRetriableError) NonRetriable() { + // marker method +} + +// Unwrap method for nonRetriableError struct. +// It returns the original error that was marked as non-retriable. +func (p *nonRetriableError) Unwrap() error { + return p.error +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/CHANGELOG.md new file mode 100644 index 000000000..77577d574 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/CHANGELOG.md @@ -0,0 +1,327 @@ +# Release History + +## 5.3.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + +## 5.3.0-beta.2 (2023-10-30) + +### Other Changes + +- Updated with latest code generator to fix a few issues in fakes. + +## 5.3.0-beta.1 (2023-10-09) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + +## 5.2.0 (2023-09-22) +### Features Added + +- New value `DiskCreateOptionCopyFromSanSnapshot` added to enum type `DiskCreateOption` +- New enum type `DomainNameLabelScopeTypes` with values `DomainNameLabelScopeTypesNoReuse`, `DomainNameLabelScopeTypesResourceGroupReuse`, `DomainNameLabelScopeTypesSubscriptionReuse`, `DomainNameLabelScopeTypesTenantReuse` +- New enum type `NetworkInterfaceAuxiliaryMode` with values `NetworkInterfaceAuxiliaryModeAcceleratedConnections`, `NetworkInterfaceAuxiliaryModeFloating`, `NetworkInterfaceAuxiliaryModeNone` +- New enum type `NetworkInterfaceAuxiliarySKU` with values `NetworkInterfaceAuxiliarySKUA1`, `NetworkInterfaceAuxiliarySKUA2`, `NetworkInterfaceAuxiliarySKUA4`, `NetworkInterfaceAuxiliarySKUA8`, `NetworkInterfaceAuxiliarySKUNone` +- New field `ElasticSanResourceID` in struct `CreationData` +- New field `LastOwnershipUpdateTime` in struct `DiskProperties` +- New field `AuxiliaryMode`, `AuxiliarySKU` in struct `VirtualMachineNetworkInterfaceConfigurationProperties` +- New field `DomainNameLabelScope` in struct `VirtualMachinePublicIPAddressDNSSettingsConfiguration` +- New field `AuxiliaryMode`, `AuxiliarySKU` in struct `VirtualMachineScaleSetNetworkConfigurationProperties` +- New field `DomainNameLabelScope` in struct `VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings` +- New field `AuxiliaryMode`, `AuxiliarySKU` in struct `VirtualMachineScaleSetUpdateNetworkConfigurationProperties` +- New field `TimeCreated` in struct `VirtualMachineScaleSetVMProperties` + + +## 5.1.0 (2023-07-28) +### Features Added + +- New enum type `FileFormat` with values `FileFormatVHD`, `FileFormatVHDX` +- New field `FileFormat` in struct `GrantAccessData` + + +## 5.0.0 (2023-05-26) +### Breaking Changes + +- Type of `CommunityGalleryImageProperties.Identifier` has been changed from `*GalleryImageIdentifier` to `*CommunityGalleryImageIdentifier` +- Type of `GalleryTargetExtendedLocation.StorageAccountType` has been changed from `*StorageAccountType` to `*EdgeZoneStorageAccountType` +- Type of `RestorePointSourceVMDataDisk.DiskRestorePoint` has been changed from `*APIEntityReference` to `*DiskRestorePointAttributes` +- Type of `RestorePointSourceVMOSDisk.DiskRestorePoint` has been changed from `*APIEntityReference` to `*DiskRestorePointAttributes` +- `StorageAccountTypeStandardSSDLRS` from enum `StorageAccountType` has been removed +- Field `ID` of struct `VirtualMachineScaleSetIPConfiguration` has been removed +- Field `ID` of struct `VirtualMachineScaleSetNetworkConfiguration` has been removed +- Field `ID` of struct `VirtualMachineScaleSetUpdateIPConfiguration` has been removed +- Field `ID` of struct `VirtualMachineScaleSetUpdateNetworkConfiguration` has been removed + +### Features Added + +- New enum type `EdgeZoneStorageAccountType` with values `EdgeZoneStorageAccountTypePremiumLRS`, `EdgeZoneStorageAccountTypeStandardLRS`, `EdgeZoneStorageAccountTypeStandardSSDLRS`, `EdgeZoneStorageAccountTypeStandardZRS` +- New enum type `ExpandTypeForListVMs` with values `ExpandTypeForListVMsInstanceView` +- New enum type `ExpandTypesForListVMs` with values `ExpandTypesForListVMsInstanceView` +- New enum type `RestorePointEncryptionType` with values `RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey`, `RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys`, `RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey` +- New function `*DedicatedHostsClient.NewListAvailableSizesPager(string, string, string, *DedicatedHostsClientListAvailableSizesOptions) *runtime.Pager[DedicatedHostsClientListAvailableSizesResponse]` +- New function `*VirtualMachineScaleSetsClient.BeginReapply(context.Context, string, string, *VirtualMachineScaleSetsClientBeginReapplyOptions) (*runtime.Poller[VirtualMachineScaleSetsClientReapplyResponse], error)` +- New struct `CommunityGalleryImageIdentifier` +- New struct `DedicatedHostSizeListResult` +- New struct `DiskRestorePointAttributes` +- New struct `RestorePointEncryption` +- New struct `RunCommandManagedIdentity` +- New struct `SecurityPostureReference` +- New field `SKU` in struct `DedicatedHostUpdate` +- New field `BypassPlatformSafetyChecksOnUserSchedule` in struct `LinuxVMGuestPatchAutomaticByPlatformSettings` +- New field `HyperVGeneration` in struct `RestorePointSourceMetadata` +- New field `WriteAcceleratorEnabled` in struct `RestorePointSourceVMDataDisk` +- New field `WriteAcceleratorEnabled` in struct `RestorePointSourceVMOSDisk` +- New field `ProvisionAfterExtensions` in struct `VirtualMachineExtensionProperties` +- New field `ErrorBlobManagedIdentity`, `OutputBlobManagedIdentity`, `TreatFailureAsDeploymentFailure` in struct `VirtualMachineRunCommandProperties` +- New field `ScriptURIManagedIdentity` in struct `VirtualMachineRunCommandScriptSource` +- New field `PriorityMixPolicy`, `SpotRestorePolicy` in struct `VirtualMachineScaleSetUpdateProperties` +- New field `Location` in struct `VirtualMachineScaleSetVMExtension` +- New field `SecurityPostureReference` in struct `VirtualMachineScaleSetVMProfile` +- New field `Hibernate` in struct `VirtualMachineScaleSetsClientBeginDeallocateOptions` +- New field `Expand` in struct `VirtualMachinesClientListAllOptions` +- New field `Expand` in struct `VirtualMachinesClientListOptions` +- New field `BypassPlatformSafetyChecksOnUserSchedule` in struct `WindowsVMGuestPatchAutomaticByPlatformSettings` + + +## 4.2.1 (2023-04-14) +### Bug Fixes + +- Fix serialization bug of empty value of `any` type. + + +## 4.2.0 (2023-03-27) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module +- New value `StorageAccountTypeStandardSSDLRS` added to enum type `StorageAccountType` +- New field `ComputerName` in struct `VirtualMachineScaleSetVMInstanceView` +- New field `HyperVGeneration` in struct `VirtualMachineScaleSetVMInstanceView` +- New field `OSName` in struct `VirtualMachineScaleSetVMInstanceView` +- New field `OSVersion` in struct `VirtualMachineScaleSetVMInstanceView` + + +## 4.1.0 (2023-01-27) +### Features Added + +- New type alias `AlternativeType` with values `AlternativeTypeNone`, `AlternativeTypeOffer`, `AlternativeTypePlan` +- New type alias `ImageState` with values `ImageStateActive`, `ImageStateDeprecated`, `ImageStateScheduledForDeprecation` +- New struct `AlternativeOption` +- New struct `ImageDeprecationStatus` +- New struct `OSImageNotificationProfile` +- New struct `OSProfileProvisioningData` +- New struct `ServiceArtifactReference` +- New field `Zones` in struct `CloudService` +- New field `UserData` in struct `RestorePointSourceMetadata` +- New field `MaxSurge` in struct `RollingUpgradePolicy` +- New field `RollbackFailedInstancesOnPolicyBreach` in struct `RollingUpgradePolicy` +- New field `OSImageNotificationProfile` in struct `ScheduledEventsProfile` +- New field `ImageDeprecationStatus` in struct `VirtualMachineImageProperties` +- New field `ExactVersion` in struct `VirtualMachineReimageParameters` +- New field `OSProfile` in struct `VirtualMachineReimageParameters` +- New field `RequireGuestProvisionSignal` in struct `VirtualMachineScaleSetOSProfile` +- New field `ConstrainedMaximumCapacity` in struct `VirtualMachineScaleSetProperties` +- New field `ExactVersion` in struct `VirtualMachineScaleSetReimageParameters` +- New field `OSProfile` in struct `VirtualMachineScaleSetReimageParameters` +- New field `ServiceArtifactReference` in struct `VirtualMachineScaleSetVMProfile` +- New field `ExactVersion` in struct `VirtualMachineScaleSetVMReimageParameters` +- New field `OSProfile` in struct `VirtualMachineScaleSetVMReimageParameters` + + +## 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). diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/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/v5/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/README.md new file mode 100644 index 000000000..87ce9c30e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/README.md @@ -0,0 +1,113 @@ +# Azure Compute Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4) + +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 (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 Compute module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 +``` + +## 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). + +## Client Factory + +Azure Compute module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armcompute.NewClientFactory(, 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, + }, +} +clientFactory, err := armcompute.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewLogAnalyticsClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## More sample code + +- [Availability Set](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/availabilityset) +- [Creating a Fake](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/compute/armcompute/fake_example_test.go) +- [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/v5/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/assets.json new file mode 100644 index 000000000..109819f62 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "go", + "TagPrefix": "go/resourcemanager/compute/armcompute", + "Tag": "go/resourcemanager/compute/armcompute_367222fc88" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/autorest.md new file mode 100644 index 000000000..f40cc3252 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 5.3.0 +tag: package-2023-07-01 +``` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/availabilitysets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/availabilitysets_client.go new file mode 100644 index 000000000..ce901d88a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/availabilitysets_client.go @@ -0,0 +1,485 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailabilitySetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or update an availability set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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) { + var err error + const operationName = "AvailabilitySetsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, availabilitySetName, parameters, options) + if err != nil { + return AvailabilitySetsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailabilitySetsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AvailabilitySetsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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) { + var err error + const operationName = "AvailabilitySetsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, availabilitySetName, options) + if err != nil { + return AvailabilitySetsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailabilitySetsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return AvailabilitySetsClientDeleteResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "AvailabilitySetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, availabilitySetName, options) + if err != nil { + return AvailabilitySetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailabilitySetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AvailabilitySetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - options - AvailabilitySetsClientListOptions contains the optional parameters for the AvailabilitySetsClient.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AvailabilitySetsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return AvailabilitySetsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - availabilitySetName - The name of the availability set. +// - options - AvailabilitySetsClientListAvailableSizesOptions contains the optional parameters for the AvailabilitySetsClient.NewListAvailableSizesPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AvailabilitySetsClient.NewListAvailableSizesPager") + req, err := client.listAvailableSizesCreateRequest(ctx, resourceGroupName, availabilitySetName, options) + if err != nil { + return AvailabilitySetsClientListAvailableSizesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailabilitySetsClientListAvailableSizesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsClientListAvailableSizesResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableSizesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - options - AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.NewListBySubscriptionPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AvailabilitySetsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return AvailabilitySetsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "AvailabilitySetsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, availabilitySetName, parameters, options) + if err != nil { + return AvailabilitySetsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailabilitySetsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AvailabilitySetsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v5/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/build.go new file mode 100644 index 000000000..f88d006f4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/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/v5/capacityreservationgroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/capacityreservationgroups_client.go new file mode 100644 index 000000000..246dbd2b5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/capacityreservationgroups_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CapacityReservationGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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) { + var err error + const operationName = "CapacityReservationGroupsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, parameters, options) + if err != nil { + return CapacityReservationGroupsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CapacityReservationGroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return CapacityReservationGroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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) { + var err error + const operationName = "CapacityReservationGroupsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, options) + if err != nil { + return CapacityReservationGroupsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CapacityReservationGroupsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CapacityReservationGroupsClientDeleteResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "CapacityReservationGroupsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, options) + if err != nil { + return CapacityReservationGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CapacityReservationGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CapacityReservationGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - options - CapacityReservationGroupsClientListByResourceGroupOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CapacityReservationGroupsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return CapacityReservationGroupsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - options - CapacityReservationGroupsClientListBySubscriptionOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListBySubscriptionPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CapacityReservationGroupsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return CapacityReservationGroupsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "CapacityReservationGroupsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, parameters, options) + if err != nil { + return CapacityReservationGroupsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CapacityReservationGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CapacityReservationGroupsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v5/capacityreservations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/capacityreservations_client.go new file mode 100644 index 000000000..3b76610c7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/capacityreservations_client.go @@ -0,0 +1,443 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CapacityReservationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CapacityReservationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CapacityReservationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *CapacityReservationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CapacityReservationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CapacityReservationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CapacityReservationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *CapacityReservationsClient) deleteOperation(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CapacityReservationsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "CapacityReservationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) + if err != nil { + return CapacityReservationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CapacityReservationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CapacityReservationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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.NewListByCapacityReservationGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CapacityReservationsClient.NewListByCapacityReservationGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByCapacityReservationGroupCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, options) + }, nil) + if err != nil { + return CapacityReservationsClientListByCapacityReservationGroupResponse{}, err + } + return client.listByCapacityReservationGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CapacityReservationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CapacityReservationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - The operation to update a capacity reservation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *CapacityReservationsClient) update(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CapacityReservationsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/ci.yml new file mode 100644 index 000000000..084ed1b49 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/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/v5/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/client_factory.go new file mode 100644 index 000000000..b8600b614 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/client_factory.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +// NewAvailabilitySetsClient creates a new instance of AvailabilitySetsClient. +func (c *ClientFactory) NewAvailabilitySetsClient() *AvailabilitySetsClient { + subClient, _ := NewAvailabilitySetsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCapacityReservationGroupsClient creates a new instance of CapacityReservationGroupsClient. +func (c *ClientFactory) NewCapacityReservationGroupsClient() *CapacityReservationGroupsClient { + subClient, _ := NewCapacityReservationGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCapacityReservationsClient creates a new instance of CapacityReservationsClient. +func (c *ClientFactory) NewCapacityReservationsClient() *CapacityReservationsClient { + subClient, _ := NewCapacityReservationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCloudServiceOperatingSystemsClient creates a new instance of CloudServiceOperatingSystemsClient. +func (c *ClientFactory) NewCloudServiceOperatingSystemsClient() *CloudServiceOperatingSystemsClient { + subClient, _ := NewCloudServiceOperatingSystemsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCloudServiceRoleInstancesClient creates a new instance of CloudServiceRoleInstancesClient. +func (c *ClientFactory) NewCloudServiceRoleInstancesClient() *CloudServiceRoleInstancesClient { + subClient, _ := NewCloudServiceRoleInstancesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCloudServiceRolesClient creates a new instance of CloudServiceRolesClient. +func (c *ClientFactory) NewCloudServiceRolesClient() *CloudServiceRolesClient { + subClient, _ := NewCloudServiceRolesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCloudServicesClient creates a new instance of CloudServicesClient. +func (c *ClientFactory) NewCloudServicesClient() *CloudServicesClient { + subClient, _ := NewCloudServicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCloudServicesUpdateDomainClient creates a new instance of CloudServicesUpdateDomainClient. +func (c *ClientFactory) NewCloudServicesUpdateDomainClient() *CloudServicesUpdateDomainClient { + subClient, _ := NewCloudServicesUpdateDomainClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCommunityGalleriesClient creates a new instance of CommunityGalleriesClient. +func (c *ClientFactory) NewCommunityGalleriesClient() *CommunityGalleriesClient { + subClient, _ := NewCommunityGalleriesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCommunityGalleryImageVersionsClient creates a new instance of CommunityGalleryImageVersionsClient. +func (c *ClientFactory) NewCommunityGalleryImageVersionsClient() *CommunityGalleryImageVersionsClient { + subClient, _ := NewCommunityGalleryImageVersionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCommunityGalleryImagesClient creates a new instance of CommunityGalleryImagesClient. +func (c *ClientFactory) NewCommunityGalleryImagesClient() *CommunityGalleryImagesClient { + subClient, _ := NewCommunityGalleryImagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDedicatedHostGroupsClient creates a new instance of DedicatedHostGroupsClient. +func (c *ClientFactory) NewDedicatedHostGroupsClient() *DedicatedHostGroupsClient { + subClient, _ := NewDedicatedHostGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDedicatedHostsClient creates a new instance of DedicatedHostsClient. +func (c *ClientFactory) NewDedicatedHostsClient() *DedicatedHostsClient { + subClient, _ := NewDedicatedHostsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDiskAccessesClient creates a new instance of DiskAccessesClient. +func (c *ClientFactory) NewDiskAccessesClient() *DiskAccessesClient { + subClient, _ := NewDiskAccessesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDiskEncryptionSetsClient creates a new instance of DiskEncryptionSetsClient. +func (c *ClientFactory) NewDiskEncryptionSetsClient() *DiskEncryptionSetsClient { + subClient, _ := NewDiskEncryptionSetsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDiskRestorePointClient creates a new instance of DiskRestorePointClient. +func (c *ClientFactory) NewDiskRestorePointClient() *DiskRestorePointClient { + subClient, _ := NewDiskRestorePointClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDisksClient creates a new instance of DisksClient. +func (c *ClientFactory) NewDisksClient() *DisksClient { + subClient, _ := NewDisksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewGalleriesClient creates a new instance of GalleriesClient. +func (c *ClientFactory) NewGalleriesClient() *GalleriesClient { + subClient, _ := NewGalleriesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewGalleryApplicationVersionsClient creates a new instance of GalleryApplicationVersionsClient. +func (c *ClientFactory) NewGalleryApplicationVersionsClient() *GalleryApplicationVersionsClient { + subClient, _ := NewGalleryApplicationVersionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewGalleryApplicationsClient creates a new instance of GalleryApplicationsClient. +func (c *ClientFactory) NewGalleryApplicationsClient() *GalleryApplicationsClient { + subClient, _ := NewGalleryApplicationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewGalleryImageVersionsClient creates a new instance of GalleryImageVersionsClient. +func (c *ClientFactory) NewGalleryImageVersionsClient() *GalleryImageVersionsClient { + subClient, _ := NewGalleryImageVersionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewGalleryImagesClient creates a new instance of GalleryImagesClient. +func (c *ClientFactory) NewGalleryImagesClient() *GalleryImagesClient { + subClient, _ := NewGalleryImagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewGallerySharingProfileClient creates a new instance of GallerySharingProfileClient. +func (c *ClientFactory) NewGallerySharingProfileClient() *GallerySharingProfileClient { + subClient, _ := NewGallerySharingProfileClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewImagesClient creates a new instance of ImagesClient. +func (c *ClientFactory) NewImagesClient() *ImagesClient { + subClient, _ := NewImagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewLogAnalyticsClient creates a new instance of LogAnalyticsClient. +func (c *ClientFactory) NewLogAnalyticsClient() *LogAnalyticsClient { + subClient, _ := NewLogAnalyticsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +// NewProximityPlacementGroupsClient creates a new instance of ProximityPlacementGroupsClient. +func (c *ClientFactory) NewProximityPlacementGroupsClient() *ProximityPlacementGroupsClient { + subClient, _ := NewProximityPlacementGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewResourceSKUsClient creates a new instance of ResourceSKUsClient. +func (c *ClientFactory) NewResourceSKUsClient() *ResourceSKUsClient { + subClient, _ := NewResourceSKUsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewRestorePointCollectionsClient creates a new instance of RestorePointCollectionsClient. +func (c *ClientFactory) NewRestorePointCollectionsClient() *RestorePointCollectionsClient { + subClient, _ := NewRestorePointCollectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewRestorePointsClient creates a new instance of RestorePointsClient. +func (c *ClientFactory) NewRestorePointsClient() *RestorePointsClient { + subClient, _ := NewRestorePointsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSSHPublicKeysClient creates a new instance of SSHPublicKeysClient. +func (c *ClientFactory) NewSSHPublicKeysClient() *SSHPublicKeysClient { + subClient, _ := NewSSHPublicKeysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSharedGalleriesClient creates a new instance of SharedGalleriesClient. +func (c *ClientFactory) NewSharedGalleriesClient() *SharedGalleriesClient { + subClient, _ := NewSharedGalleriesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSharedGalleryImageVersionsClient creates a new instance of SharedGalleryImageVersionsClient. +func (c *ClientFactory) NewSharedGalleryImageVersionsClient() *SharedGalleryImageVersionsClient { + subClient, _ := NewSharedGalleryImageVersionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSharedGalleryImagesClient creates a new instance of SharedGalleryImagesClient. +func (c *ClientFactory) NewSharedGalleryImagesClient() *SharedGalleryImagesClient { + subClient, _ := NewSharedGalleryImagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSnapshotsClient creates a new instance of SnapshotsClient. +func (c *ClientFactory) NewSnapshotsClient() *SnapshotsClient { + subClient, _ := NewSnapshotsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewUsageClient creates a new instance of UsageClient. +func (c *ClientFactory) NewUsageClient() *UsageClient { + subClient, _ := NewUsageClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineExtensionImagesClient creates a new instance of VirtualMachineExtensionImagesClient. +func (c *ClientFactory) NewVirtualMachineExtensionImagesClient() *VirtualMachineExtensionImagesClient { + subClient, _ := NewVirtualMachineExtensionImagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineExtensionsClient creates a new instance of VirtualMachineExtensionsClient. +func (c *ClientFactory) NewVirtualMachineExtensionsClient() *VirtualMachineExtensionsClient { + subClient, _ := NewVirtualMachineExtensionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineImagesClient creates a new instance of VirtualMachineImagesClient. +func (c *ClientFactory) NewVirtualMachineImagesClient() *VirtualMachineImagesClient { + subClient, _ := NewVirtualMachineImagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineImagesEdgeZoneClient creates a new instance of VirtualMachineImagesEdgeZoneClient. +func (c *ClientFactory) NewVirtualMachineImagesEdgeZoneClient() *VirtualMachineImagesEdgeZoneClient { + subClient, _ := NewVirtualMachineImagesEdgeZoneClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineRunCommandsClient creates a new instance of VirtualMachineRunCommandsClient. +func (c *ClientFactory) NewVirtualMachineRunCommandsClient() *VirtualMachineRunCommandsClient { + subClient, _ := NewVirtualMachineRunCommandsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineScaleSetExtensionsClient creates a new instance of VirtualMachineScaleSetExtensionsClient. +func (c *ClientFactory) NewVirtualMachineScaleSetExtensionsClient() *VirtualMachineScaleSetExtensionsClient { + subClient, _ := NewVirtualMachineScaleSetExtensionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineScaleSetRollingUpgradesClient creates a new instance of VirtualMachineScaleSetRollingUpgradesClient. +func (c *ClientFactory) NewVirtualMachineScaleSetRollingUpgradesClient() *VirtualMachineScaleSetRollingUpgradesClient { + subClient, _ := NewVirtualMachineScaleSetRollingUpgradesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineScaleSetVMExtensionsClient creates a new instance of VirtualMachineScaleSetVMExtensionsClient. +func (c *ClientFactory) NewVirtualMachineScaleSetVMExtensionsClient() *VirtualMachineScaleSetVMExtensionsClient { + subClient, _ := NewVirtualMachineScaleSetVMExtensionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineScaleSetVMRunCommandsClient creates a new instance of VirtualMachineScaleSetVMRunCommandsClient. +func (c *ClientFactory) NewVirtualMachineScaleSetVMRunCommandsClient() *VirtualMachineScaleSetVMRunCommandsClient { + subClient, _ := NewVirtualMachineScaleSetVMRunCommandsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineScaleSetVMsClient creates a new instance of VirtualMachineScaleSetVMsClient. +func (c *ClientFactory) NewVirtualMachineScaleSetVMsClient() *VirtualMachineScaleSetVMsClient { + subClient, _ := NewVirtualMachineScaleSetVMsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineScaleSetsClient creates a new instance of VirtualMachineScaleSetsClient. +func (c *ClientFactory) NewVirtualMachineScaleSetsClient() *VirtualMachineScaleSetsClient { + subClient, _ := NewVirtualMachineScaleSetsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachineSizesClient creates a new instance of VirtualMachineSizesClient. +func (c *ClientFactory) NewVirtualMachineSizesClient() *VirtualMachineSizesClient { + subClient, _ := NewVirtualMachineSizesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualMachinesClient creates a new instance of VirtualMachinesClient. +func (c *ClientFactory) NewVirtualMachinesClient() *VirtualMachinesClient { + subClient, _ := NewVirtualMachinesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudserviceoperatingsystems_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudserviceoperatingsystems_client.go new file mode 100644 index 000000000..bd0cda902 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudserviceoperatingsystems_client.go @@ -0,0 +1,301 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudServiceOperatingSystemsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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-09-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) { + var err error + const operationName = "CloudServiceOperatingSystemsClient.GetOSFamily" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getOSFamilyCreateRequest(ctx, location, osFamilyName, options) + if err != nil { + return CloudServiceOperatingSystemsClientGetOSFamilyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudServiceOperatingSystemsClientGetOSFamilyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudServiceOperatingSystemsClientGetOSFamilyResponse{}, err + } + resp, err := client.getOSFamilyHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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) { + var err error + const operationName = "CloudServiceOperatingSystemsClient.GetOSVersion" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getOSVersionCreateRequest(ctx, location, osVersionName, options) + if err != nil { + return CloudServiceOperatingSystemsClientGetOSVersionResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudServiceOperatingSystemsClientGetOSVersionResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudServiceOperatingSystemsClientGetOSVersionResponse{}, err + } + resp, err := client.getOSVersionHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-04 +// - location - Name of the location that the OS families pertain to. +// - options - CloudServiceOperatingSystemsClientListOSFamiliesOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.NewListOSFamiliesPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudServiceOperatingSystemsClient.NewListOSFamiliesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listOSFamiliesCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return CloudServiceOperatingSystemsClientListOSFamiliesResponse{}, err + } + return client.listOSFamiliesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-04 +// - location - Name of the location that the OS versions pertain to. +// - options - CloudServiceOperatingSystemsClientListOSVersionsOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.NewListOSVersionsPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudServiceOperatingSystemsClient.NewListOSVersionsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listOSVersionsCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return CloudServiceOperatingSystemsClientListOSVersionsResponse{}, err + } + return client.listOSVersionsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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/v5/cloudserviceroleinstances_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudserviceroleinstances_client.go new file mode 100644 index 000000000..b84530166 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudserviceroleinstances_client.go @@ -0,0 +1,648 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudServiceRoleInstancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServiceRoleInstancesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServiceRoleInstancesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a role instance from a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-04 +func (client *CloudServiceRoleInstancesClient) deleteOperation(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CloudServiceRoleInstancesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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) { + var err error + const operationName = "CloudServiceRoleInstancesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServiceRoleInstancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudServiceRoleInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudServiceRoleInstancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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) { + var err error + const operationName = "CloudServiceRoleInstancesClient.GetInstanceView" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getInstanceViewCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServiceRoleInstancesClientGetInstanceViewResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudServiceRoleInstancesClientGetInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudServiceRoleInstancesClientGetInstanceViewResponse{}, err + } + resp, err := client.getInstanceViewHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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) { + var err error + const operationName = "CloudServiceRoleInstancesClient.GetRemoteDesktopFile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getRemoteDesktopFileCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse{}, err + } + return CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse{Body: httpResp.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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-04 +// - resourceGroupName - Name of the resource group. +// - cloudServiceName - Name of the cloud service. +// - options - CloudServiceRoleInstancesClientListOptions contains the optional parameters for the CloudServiceRoleInstancesClient.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudServiceRoleInstancesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + }, nil) + if err != nil { + return CloudServiceRoleInstancesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServiceRoleInstancesClientRebuildResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServiceRoleInstancesClientRebuildResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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-09-04 +func (client *CloudServiceRoleInstancesClient) rebuild(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginRebuildOptions) (*http.Response, error) { + var err error + const operationName = "CloudServiceRoleInstancesClient.BeginRebuild" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.rebuildCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServiceRoleInstancesClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServiceRoleInstancesClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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-09-04 +func (client *CloudServiceRoleInstancesClient) reimage(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginReimageOptions) (*http.Response, error) { + var err error + const operationName = "CloudServiceRoleInstancesClient.BeginReimage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reimageCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServiceRoleInstancesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServiceRoleInstancesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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-09-04 +func (client *CloudServiceRoleInstancesClient) restart(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "CloudServiceRoleInstancesClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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/v5/cloudserviceroles_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudserviceroles_client.go new file mode 100644 index 000000000..a4572cf14 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudserviceroles_client.go @@ -0,0 +1,180 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudServiceRolesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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-09-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) { + var err error + const operationName = "CloudServiceRolesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, roleName, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServiceRolesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudServiceRolesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudServiceRolesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-04 +// - resourceGroupName - Name of the resource group. +// - cloudServiceName - Name of the cloud service. +// - options - CloudServiceRolesClientListOptions contains the optional parameters for the CloudServiceRolesClient.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudServiceRolesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + }, nil) + if err != nil { + return CloudServiceRolesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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/v5/cloudservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudservices_client.go new file mode 100644 index 000000000..283d3a6fe --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudservices_client.go @@ -0,0 +1,1013 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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-09-04 +func (client *CloudServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudService, options *CloudServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cloudServiceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-04 +func (client *CloudServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesClientDeleteInstancesResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesClientDeleteInstancesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// DeleteInstances - Deletes role instances in a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-04 +func (client *CloudServicesClient) deleteInstances(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteInstancesOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesClient.BeginDeleteInstances" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteInstancesCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + 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-09-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) { + var err error + const operationName = "CloudServicesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServicesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudServicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudServicesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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) { + var err error + const operationName = "CloudServicesClient.GetInstanceView" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServicesClientGetInstanceViewResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudServicesClientGetInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudServicesClientGetInstanceViewResponse{}, err + } + resp, err := client.getInstanceViewHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-04 +// - resourceGroupName - Name of the resource group. +// - options - CloudServicesClientListOptions contains the optional parameters for the CloudServicesClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudServicesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return CloudServicesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-04 +// - options - CloudServicesClientListAllOptions contains the optional parameters for the CloudServicesClient.NewListAllPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudServicesClient.NewListAllPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAllCreateRequest(ctx, options) + }, nil) + if err != nil { + return CloudServicesClientListAllResponse{}, err + } + return client.listAllHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesClientPowerOffResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesClientPowerOffResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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-09-04 +func (client *CloudServicesClient) powerOff(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginPowerOffOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesClient.BeginPowerOff" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.powerOffCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesClientRebuildResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesClientRebuildResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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-09-04 +func (client *CloudServicesClient) rebuild(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRebuildOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesClient.BeginRebuild" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.rebuildCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + 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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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-09-04 +func (client *CloudServicesClient) reimage(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginReimageOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesClient.BeginReimage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reimageCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + 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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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-09-04 +func (client *CloudServicesClient) restart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// BeginStart - Starts the cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Start - Starts the cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-04 +func (client *CloudServicesClient) start(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginStartOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-04 +func (client *CloudServicesClient) update(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudServiceUpdate, options *CloudServicesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, cloudServiceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudservicesupdatedomain_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudservicesupdatedomain_client.go new file mode 100644 index 000000000..a4bd1e7b1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/cloudservicesupdatedomain_client.go @@ -0,0 +1,263 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CloudServicesUpdateDomainClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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-09-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) { + var err error + const operationName = "CloudServicesUpdateDomainClient.GetUpdateDomain" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getUpdateDomainCreateRequest(ctx, resourceGroupName, cloudServiceName, updateDomain, options) + if err != nil { + return CloudServicesUpdateDomainClientGetUpdateDomainResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CloudServicesUpdateDomainClientGetUpdateDomainResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CloudServicesUpdateDomainClientGetUpdateDomainResponse{}, err + } + resp, err := client.getUpdateDomainHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-04 +// - resourceGroupName - Name of the resource group. +// - cloudServiceName - Name of the cloud service. +// - options - CloudServicesUpdateDomainClientListUpdateDomainsOptions contains the optional parameters for the CloudServicesUpdateDomainClient.NewListUpdateDomainsPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CloudServicesUpdateDomainClient.NewListUpdateDomainsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listUpdateDomainsCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + }, nil) + if err != nil { + return CloudServicesUpdateDomainClientListUpdateDomainsResponse{}, err + } + return client.listUpdateDomainsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-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-09-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudServicesUpdateDomainClientWalkUpdateDomainResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CloudServicesUpdateDomainClientWalkUpdateDomainResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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-09-04 +func (client *CloudServicesUpdateDomainClient) walkUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, parameters UpdateDomain, options *CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions) (*http.Response, error) { + var err error + const operationName = "CloudServicesUpdateDomainClient.BeginWalkUpdateDomain" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.walkUpdateDomainCreateRequest(ctx, resourceGroupName, cloudServiceName, updateDomain, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/communitygalleries_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/communitygalleries_client.go new file mode 100644 index 000000000..3cda3a9d0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/communitygalleries_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CommunityGalleriesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "CommunityGalleriesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, publicGalleryName, options) + if err != nil { + return CommunityGalleriesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CommunityGalleriesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CommunityGalleriesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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/v5/communitygalleryimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/communitygalleryimages_client.go new file mode 100644 index 000000000..8d1c8c534 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/communitygalleryimages_client.go @@ -0,0 +1,180 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CommunityGalleryImagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "CommunityGalleryImagesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, publicGalleryName, galleryImageName, options) + if err != nil { + return CommunityGalleryImagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CommunityGalleryImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CommunityGalleryImagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CommunityGalleryImagesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, publicGalleryName, options) + }, nil) + if err != nil { + return CommunityGalleryImagesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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/v5/communitygalleryimageversions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/communitygalleryimageversions_client.go new file mode 100644 index 000000000..f1c46f849 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/communitygalleryimageversions_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CommunityGalleryImageVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "CommunityGalleryImageVersionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, publicGalleryName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return CommunityGalleryImageVersionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CommunityGalleryImageVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CommunityGalleryImageVersionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CommunityGalleryImageVersionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, publicGalleryName, galleryImageName, options) + }, nil) + if err != nil { + return CommunityGalleryImageVersionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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/v5/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/constants.go new file mode 100644 index 000000000..4554f9355 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/constants.go @@ -0,0 +1,2717 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" + moduleVersion = "v5.3.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, + } +} + +// AlternativeType - Describes the type of the alternative option. +type AlternativeType string + +const ( + AlternativeTypeNone AlternativeType = "None" + AlternativeTypeOffer AlternativeType = "Offer" + AlternativeTypePlan AlternativeType = "Plan" +) + +// PossibleAlternativeTypeValues returns the possible values for the AlternativeType const type. +func PossibleAlternativeTypeValues() []AlternativeType { + return []AlternativeType{ + AlternativeTypeNone, + AlternativeTypeOffer, + AlternativeTypePlan, + } +} + +// 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. The default values are: +// 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. The default value is: 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" + // DiskCreateOptionCopyFromSanSnapshot - Create a new disk by exporting from elastic san volume snapshot + DiskCreateOptionCopyFromSanSnapshot DiskCreateOption = "CopyFromSanSnapshot" + // 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, + DiskCreateOptionCopyFromSanSnapshot, + DiskCreateOptionCopyStart, + DiskCreateOptionEmpty, + DiskCreateOptionFromImage, + DiskCreateOptionImport, + DiskCreateOptionImportSecure, + DiskCreateOptionRestore, + DiskCreateOptionUpload, + DiskCreateOptionUploadPreparedSecure, + } +} + +// DiskCreateOptionTypes - Specifies how the virtual machine should be created. Possible values are: Attach. This value is +// used when you are using a specialized disk to create the virtual machine. FromImage. 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, for example whether the managed +// disk is deleted or detached. Supported values are: 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 are: 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, + } +} + +// DomainNameLabelScopeTypes - The Domain name label scope.The concatenation of the hashed domain name label that generated +// according to the policy from domain name label scope and vm index will be the domain name labels of the +// PublicIPAddress resources that will be created +type DomainNameLabelScopeTypes string + +const ( + DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse" + DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse" + DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse" + DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse" +) + +// PossibleDomainNameLabelScopeTypesValues returns the possible values for the DomainNameLabelScopeTypes const type. +func PossibleDomainNameLabelScopeTypesValues() []DomainNameLabelScopeTypes { + return []DomainNameLabelScopeTypes{ + DomainNameLabelScopeTypesNoReuse, + DomainNameLabelScopeTypesResourceGroupReuse, + DomainNameLabelScopeTypesSubscriptionReuse, + DomainNameLabelScopeTypesTenantReuse, + } +} + +// EdgeZoneStorageAccountType - Specifies the storage account type to be used to store the image. This property is not updatable. +type EdgeZoneStorageAccountType string + +const ( + EdgeZoneStorageAccountTypePremiumLRS EdgeZoneStorageAccountType = "Premium_LRS" + EdgeZoneStorageAccountTypeStandardLRS EdgeZoneStorageAccountType = "Standard_LRS" + EdgeZoneStorageAccountTypeStandardSSDLRS EdgeZoneStorageAccountType = "StandardSSD_LRS" + EdgeZoneStorageAccountTypeStandardZRS EdgeZoneStorageAccountType = "Standard_ZRS" +) + +// PossibleEdgeZoneStorageAccountTypeValues returns the possible values for the EdgeZoneStorageAccountType const type. +func PossibleEdgeZoneStorageAccountTypeValues() []EdgeZoneStorageAccountType { + return []EdgeZoneStorageAccountType{ + EdgeZoneStorageAccountTypePremiumLRS, + EdgeZoneStorageAccountTypeStandardLRS, + EdgeZoneStorageAccountTypeStandardSSDLRS, + EdgeZoneStorageAccountTypeStandardZRS, + } +} + +// 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 ExpandTypeForListVMs string + +const ( + ExpandTypeForListVMsInstanceView ExpandTypeForListVMs = "instanceView" +) + +// PossibleExpandTypeForListVMsValues returns the possible values for the ExpandTypeForListVMs const type. +func PossibleExpandTypeForListVMsValues() []ExpandTypeForListVMs { + return []ExpandTypeForListVMs{ + ExpandTypeForListVMsInstanceView, + } +} + +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, + } +} + +type ExpandTypesForListVMs string + +const ( + ExpandTypesForListVMsInstanceView ExpandTypesForListVMs = "instanceView" +) + +// PossibleExpandTypesForListVMsValues returns the possible values for the ExpandTypesForListVMs const type. +func PossibleExpandTypesForListVMsValues() []ExpandTypesForListVMs { + return []ExpandTypesForListVMs{ + ExpandTypesForListVMsInstanceView, + } +} + +// 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, + } +} + +// FileFormat - Used to specify the file format when making request for SAS on a VHDX file format snapshot +type FileFormat string + +const ( + // FileFormatVHD - A VHD file is a disk image file in the Virtual Hard Disk file format. + FileFormatVHD FileFormat = "VHD" + // FileFormatVHDX - A VHDX file is a disk image file in the Virtual Hard Disk v2 file format. + FileFormatVHDX FileFormat = "VHDX" +) + +// PossibleFileFormatValues returns the possible values for the FileFormat const type. +func PossibleFileFormatValues() []FileFormat { + return []FileFormat{ + FileFormatVHD, + FileFormatVHDX, + } +} + +// GalleryApplicationCustomActionParameterType - Specifies the type of the custom action parameter. Possible values are: String, +// ConfigurationDataBlob or LogOutputBlob +type GalleryApplicationCustomActionParameterType string + +const ( + GalleryApplicationCustomActionParameterTypeConfigurationDataBlob GalleryApplicationCustomActionParameterType = "ConfigurationDataBlob" + GalleryApplicationCustomActionParameterTypeLogOutputBlob GalleryApplicationCustomActionParameterType = "LogOutputBlob" + GalleryApplicationCustomActionParameterTypeString GalleryApplicationCustomActionParameterType = "String" +) + +// PossibleGalleryApplicationCustomActionParameterTypeValues returns the possible values for the GalleryApplicationCustomActionParameterType const type. +func PossibleGalleryApplicationCustomActionParameterTypeValues() []GalleryApplicationCustomActionParameterType { + return []GalleryApplicationCustomActionParameterType{ + GalleryApplicationCustomActionParameterTypeConfigurationDataBlob, + GalleryApplicationCustomActionParameterTypeLogOutputBlob, + GalleryApplicationCustomActionParameterTypeString, + } +} + +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, + } +} + +// ImageState - Describes the state of the image. +type ImageState string + +const ( + ImageStateActive ImageState = "Active" + ImageStateDeprecated ImageState = "Deprecated" + ImageStateScheduledForDeprecation ImageState = "ScheduledForDeprecation" +) + +// PossibleImageStateValues returns the possible values for the ImageState const type. +func PossibleImageStateValues() []ImageState { + return []ImageState{ + ImageStateActive, + ImageStateDeprecated, + ImageStateScheduledForDeprecation, + } +} + +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 ( + IntervalInMinsFiveMins IntervalInMins = "FiveMins" + IntervalInMinsSixtyMins IntervalInMins = "SixtyMins" + IntervalInMinsThirtyMins IntervalInMins = "ThirtyMins" + IntervalInMinsThreeMins IntervalInMins = "ThreeMins" +) + +// PossibleIntervalInMinsValues returns the possible values for the IntervalInMins const type. +func PossibleIntervalInMinsValues() []IntervalInMins { + return []IntervalInMins{ + IntervalInMinsFiveMins, + IntervalInMinsSixtyMins, + IntervalInMinsThirtyMins, + IntervalInMinsThreeMins, + } +} + +// 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 ( + MaintenanceOperationResultCodeTypesMaintenanceAborted MaintenanceOperationResultCodeTypes = "MaintenanceAborted" + MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted" + MaintenanceOperationResultCodeTypesNone MaintenanceOperationResultCodeTypes = "None" + MaintenanceOperationResultCodeTypesRetryLater MaintenanceOperationResultCodeTypes = "RetryLater" +) + +// PossibleMaintenanceOperationResultCodeTypesValues returns the possible values for the MaintenanceOperationResultCodeTypes const type. +func PossibleMaintenanceOperationResultCodeTypesValues() []MaintenanceOperationResultCodeTypes { + return []MaintenanceOperationResultCodeTypes{ + MaintenanceOperationResultCodeTypesMaintenanceAborted, + MaintenanceOperationResultCodeTypesMaintenanceCompleted, + MaintenanceOperationResultCodeTypesNone, + MaintenanceOperationResultCodeTypesRetryLater, + } +} + +// 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, + } +} + +// NetworkInterfaceAuxiliaryMode - Specifies whether the Auxiliary mode is enabled for the Network Interface resource. +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +// PossibleNetworkInterfaceAuxiliaryModeValues returns the possible values for the NetworkInterfaceAuxiliaryMode const type. +func PossibleNetworkInterfaceAuxiliaryModeValues() []NetworkInterfaceAuxiliaryMode { + return []NetworkInterfaceAuxiliaryMode{ + NetworkInterfaceAuxiliaryModeAcceleratedConnections, + NetworkInterfaceAuxiliaryModeFloating, + NetworkInterfaceAuxiliaryModeNone, + } +} + +// NetworkInterfaceAuxiliarySKU - Specifies whether the Auxiliary sku is enabled for the Network Interface resource. +type NetworkInterfaceAuxiliarySKU string + +const ( + NetworkInterfaceAuxiliarySKUA1 NetworkInterfaceAuxiliarySKU = "A1" + NetworkInterfaceAuxiliarySKUA2 NetworkInterfaceAuxiliarySKU = "A2" + NetworkInterfaceAuxiliarySKUA4 NetworkInterfaceAuxiliarySKU = "A4" + NetworkInterfaceAuxiliarySKUA8 NetworkInterfaceAuxiliarySKU = "A8" + NetworkInterfaceAuxiliarySKUNone NetworkInterfaceAuxiliarySKU = "None" +) + +// PossibleNetworkInterfaceAuxiliarySKUValues returns the possible values for the NetworkInterfaceAuxiliarySKU const type. +func PossibleNetworkInterfaceAuxiliarySKUValues() []NetworkInterfaceAuxiliarySKU { + return []NetworkInterfaceAuxiliarySKU{ + NetworkInterfaceAuxiliarySKUA1, + NetworkInterfaceAuxiliarySKUA2, + NetworkInterfaceAuxiliarySKUA4, + NetworkInterfaceAuxiliarySKUA8, + NetworkInterfaceAuxiliarySKUNone, + } +} + +// 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 ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +// PossibleOperatingSystemTypesValues returns the possible values for the OperatingSystemTypes const type. +func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { + return []OperatingSystemTypes{ + OperatingSystemTypesLinux, + OperatingSystemTypesWindows, + } +} + +// 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 ( + ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeNone, + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeSystemAssignedUserAssigned, + ResourceIdentityTypeUserAssigned, + } +} + +// 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 ( + ResourceSKURestrictionsReasonCodeNotAvailableForSubscription ResourceSKURestrictionsReasonCode = "NotAvailableForSubscription" + ResourceSKURestrictionsReasonCodeQuotaID ResourceSKURestrictionsReasonCode = "QuotaId" +) + +// PossibleResourceSKURestrictionsReasonCodeValues returns the possible values for the ResourceSKURestrictionsReasonCode const type. +func PossibleResourceSKURestrictionsReasonCodeValues() []ResourceSKURestrictionsReasonCode { + return []ResourceSKURestrictionsReasonCode{ + ResourceSKURestrictionsReasonCodeNotAvailableForSubscription, + ResourceSKURestrictionsReasonCodeQuotaID, + } +} + +// 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, + } +} + +// RestorePointEncryptionType - The type of key used to encrypt the data of the disk restore point. +type RestorePointEncryptionType string + +const ( + // RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey - Disk Restore Point is encrypted at rest with Customer managed + // key that can be changed and revoked by a customer. + RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey RestorePointEncryptionType = "EncryptionAtRestWithCustomerKey" + // RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys - Disk Restore Point is encrypted at rest with 2 + // layers of encryption. One of the keys is Customer managed and the other key is Platform managed. + RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys RestorePointEncryptionType = "EncryptionAtRestWithPlatformAndCustomerKeys" + // RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey - Disk Restore Point is encrypted at rest with Platform managed + // key. + RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey RestorePointEncryptionType = "EncryptionAtRestWithPlatformKey" +) + +// PossibleRestorePointEncryptionTypeValues returns the possible values for the RestorePointEncryptionType const type. +func PossibleRestorePointEncryptionTypeValues() []RestorePointEncryptionType { + return []RestorePointEncryptionType{ + RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey, + RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys, + RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey, + } +} + +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 ( + RollingUpgradeActionTypeCancel RollingUpgradeActionType = "Cancel" + RollingUpgradeActionTypeStart RollingUpgradeActionType = "Start" +) + +// PossibleRollingUpgradeActionTypeValues returns the possible values for the RollingUpgradeActionType const type. +func PossibleRollingUpgradeActionTypeValues() []RollingUpgradeActionType { + return []RollingUpgradeActionType{ + RollingUpgradeActionTypeCancel, + RollingUpgradeActionTypeStart, + } +} + +// RollingUpgradeStatusCode - Code indicating the current status of the upgrade. +type RollingUpgradeStatusCode string + +const ( + RollingUpgradeStatusCodeCancelled RollingUpgradeStatusCode = "Cancelled" + RollingUpgradeStatusCodeCompleted RollingUpgradeStatusCode = "Completed" + RollingUpgradeStatusCodeFaulted RollingUpgradeStatusCode = "Faulted" + RollingUpgradeStatusCodeRollingForward RollingUpgradeStatusCode = "RollingForward" +) + +// PossibleRollingUpgradeStatusCodeValues returns the possible values for the RollingUpgradeStatusCode const type. +func PossibleRollingUpgradeStatusCodeValues() []RollingUpgradeStatusCode { + return []RollingUpgradeStatusCode{ + RollingUpgradeStatusCodeCancelled, + RollingUpgradeStatusCodeCompleted, + RollingUpgradeStatusCodeFaulted, + RollingUpgradeStatusCodeRollingForward, + } +} + +// 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. +// The default behavior is: 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 ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +// PossibleStatusLevelTypesValues returns the possible values for the StatusLevelTypes const type. +func PossibleStatusLevelTypesValues() []StatusLevelTypes { + return []StatusLevelTypes{ + StatusLevelTypesError, + StatusLevelTypesInfo, + StatusLevelTypesWarning, + } +} + +// 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 ( + UpgradeOperationInvokerPlatform UpgradeOperationInvoker = "Platform" + UpgradeOperationInvokerUnknown UpgradeOperationInvoker = "Unknown" + UpgradeOperationInvokerUser UpgradeOperationInvoker = "User" +) + +// PossibleUpgradeOperationInvokerValues returns the possible values for the UpgradeOperationInvoker const type. +func PossibleUpgradeOperationInvokerValues() []UpgradeOperationInvoker { + return []UpgradeOperationInvoker{ + UpgradeOperationInvokerPlatform, + UpgradeOperationInvokerUnknown, + UpgradeOperationInvokerUser, + } +} + +// UpgradeState - Code indicating the current status of the upgrade. +type UpgradeState string + +const ( + UpgradeStateCancelled UpgradeState = "Cancelled" + UpgradeStateCompleted UpgradeState = "Completed" + UpgradeStateFaulted UpgradeState = "Faulted" + UpgradeStateRollingForward UpgradeState = "RollingForward" +) + +// PossibleUpgradeStateValues returns the possible values for the UpgradeState const type. +func PossibleUpgradeStateValues() []UpgradeState { + return []UpgradeState{ + UpgradeStateCancelled, + UpgradeStateCompleted, + UpgradeStateFaulted, + UpgradeStateRollingForward, + } +} + +// 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. The 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/v5/dedicatedhostgroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/dedicatedhostgroups_client.go new file mode 100644 index 000000000..4a1eea66b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/dedicatedhostgroups_client.go @@ -0,0 +1,423 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DedicatedHostGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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) { + var err error + const operationName = "DedicatedHostGroupsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostGroupName, parameters, options) + if err != nil { + return DedicatedHostGroupsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DedicatedHostGroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DedicatedHostGroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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) { + var err error + const operationName = "DedicatedHostGroupsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostGroupName, options) + if err != nil { + return DedicatedHostGroupsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DedicatedHostGroupsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DedicatedHostGroupsClientDeleteResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "DedicatedHostGroupsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, hostGroupName, options) + if err != nil { + return DedicatedHostGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DedicatedHostGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DedicatedHostGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - options - DedicatedHostGroupsClientListByResourceGroupOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DedicatedHostGroupsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return DedicatedHostGroupsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - options - DedicatedHostGroupsClientListBySubscriptionOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListBySubscriptionPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DedicatedHostGroupsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return DedicatedHostGroupsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "DedicatedHostGroupsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, hostGroupName, parameters, options) + if err != nil { + return DedicatedHostGroupsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DedicatedHostGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DedicatedHostGroupsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v5/dedicatedhosts_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/dedicatedhosts_client.go new file mode 100644 index 000000000..d91e4db2a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/dedicatedhosts_client.go @@ -0,0 +1,593 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DedicatedHostsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a dedicated host . +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DedicatedHostsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DedicatedHostsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update a dedicated host . +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *DedicatedHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DedicatedHostsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a dedicated host. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DedicatedHostsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DedicatedHostsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a dedicated host. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *DedicatedHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DedicatedHostsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "DedicatedHostsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return DedicatedHostsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DedicatedHostsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DedicatedHostsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 +} + +// NewListAvailableSizesPager - Lists all available dedicated host sizes to which the specified dedicated host can be resized. +// NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated host. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - hostGroupName - The name of the dedicated host group. +// - hostName - The name of the dedicated host. +// - options - DedicatedHostsClientListAvailableSizesOptions contains the optional parameters for the DedicatedHostsClient.NewListAvailableSizesPager +// method. +func (client *DedicatedHostsClient) NewListAvailableSizesPager(resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientListAvailableSizesOptions) *runtime.Pager[DedicatedHostsClientListAvailableSizesResponse] { + return runtime.NewPager(runtime.PagingHandler[DedicatedHostsClientListAvailableSizesResponse]{ + More: func(page DedicatedHostsClientListAvailableSizesResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *DedicatedHostsClientListAvailableSizesResponse) (DedicatedHostsClientListAvailableSizesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DedicatedHostsClient.NewListAvailableSizesPager") + req, err := client.listAvailableSizesCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return DedicatedHostsClientListAvailableSizesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DedicatedHostsClientListAvailableSizesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostsClientListAvailableSizesResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableSizesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listAvailableSizesCreateRequest creates the ListAvailableSizes request. +func (client *DedicatedHostsClient) listAvailableSizesCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientListAvailableSizesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/hostSizes" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableSizesHandleResponse handles the ListAvailableSizes response. +func (client *DedicatedHostsClient) listAvailableSizesHandleResponse(resp *http.Response) (DedicatedHostsClientListAvailableSizesResponse, error) { + result := DedicatedHostsClientListAvailableSizesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostSizeListResult); err != nil { + return DedicatedHostsClientListAvailableSizesResponse{}, 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 2023-07-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.NewListByHostGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DedicatedHostsClient.NewListByHostGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByHostGroupCreateRequest(ctx, resourceGroupName, hostGroupName, options) + }, nil) + if err != nil { + return DedicatedHostsClientListByHostGroupResponse{}, err + } + return client.listByHostGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DedicatedHostsClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DedicatedHostsClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *DedicatedHostsClient) restart(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "DedicatedHostsClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Update a dedicated host . +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DedicatedHostsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DedicatedHostsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a dedicated host . +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *DedicatedHostsClient) update(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DedicatedHostsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/diskaccesses_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/diskaccesses_client.go new file mode 100644 index 000000000..b189a0340 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/diskaccesses_client.go @@ -0,0 +1,846 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DiskAccessesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskAccessesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskAccessesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a disk access resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DiskAccessesClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DiskAccessesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, diskAccessName, diskAccess, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, diskAccess); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskAccessesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskAccessesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DiskAccessesClient) deleteOperation(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DiskAccessesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, diskAccessName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskAccessesClientDeleteAPrivateEndpointConnectionResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskAccessesClientDeleteAPrivateEndpointConnectionResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-04-02 +func (client *DiskAccessesClient) deleteAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions) (*http.Response, error) { + var err error + const operationName = "DiskAccessesClient.BeginDeleteAPrivateEndpointConnection" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteAPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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) { + var err error + const operationName = "DiskAccessesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, diskAccessName, options) + if err != nil { + return DiskAccessesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DiskAccessesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DiskAccessesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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) { + var err error + const operationName = "DiskAccessesClient.GetAPrivateEndpointConnection" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, options) + if err != nil { + return DiskAccessesClientGetAPrivateEndpointConnectionResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DiskAccessesClientGetAPrivateEndpointConnectionResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DiskAccessesClientGetAPrivateEndpointConnectionResponse{}, err + } + resp, err := client.getAPrivateEndpointConnectionHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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) { + var err error + const operationName = "DiskAccessesClient.GetPrivateLinkResources" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getPrivateLinkResourcesCreateRequest(ctx, resourceGroupName, diskAccessName, options) + if err != nil { + return DiskAccessesClientGetPrivateLinkResourcesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DiskAccessesClientGetPrivateLinkResourcesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DiskAccessesClientGetPrivateLinkResourcesResponse{}, err + } + resp, err := client.getPrivateLinkResourcesHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-02 +// - options - DiskAccessesClientListOptions contains the optional parameters for the DiskAccessesClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiskAccessesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return DiskAccessesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-02 +// - resourceGroupName - The name of the resource group. +// - options - DiskAccessesClientListByResourceGroupOptions contains the optional parameters for the DiskAccessesClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiskAccessesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return DiskAccessesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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.NewListPrivateEndpointConnectionsPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiskAccessesClient.NewListPrivateEndpointConnectionsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listPrivateEndpointConnectionsCreateRequest(ctx, resourceGroupName, diskAccessName, options) + }, nil) + if err != nil { + return DiskAccessesClientListPrivateEndpointConnectionsResponse{}, err + } + return client.listPrivateEndpointConnectionsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskAccessesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskAccessesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates (patches) a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DiskAccessesClient) update(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DiskAccessesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, diskAccessName, diskAccess, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, diskAccess); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskAccessesClientUpdateAPrivateEndpointConnectionResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskAccessesClientUpdateAPrivateEndpointConnectionResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-04-02 +func (client *DiskAccessesClient) updateAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions) (*http.Response, error) { + var err error + const operationName = "DiskAccessesClient.BeginUpdateAPrivateEndpointConnection" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateAPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, privateEndpointConnection); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/diskencryptionsets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/diskencryptionsets_client.go new file mode 100644 index 000000000..9306f9c0d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/diskencryptionsets_client.go @@ -0,0 +1,535 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DiskEncryptionSetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskEncryptionSetsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskEncryptionSetsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a disk encryption set +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DiskEncryptionSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DiskEncryptionSetsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, diskEncryptionSet); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a disk encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskEncryptionSetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskEncryptionSetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a disk encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DiskEncryptionSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DiskEncryptionSetsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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) { + var err error + const operationName = "DiskEncryptionSetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, options) + if err != nil { + return DiskEncryptionSetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DiskEncryptionSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DiskEncryptionSetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-02 +// - options - DiskEncryptionSetsClientListOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiskEncryptionSetsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return DiskEncryptionSetsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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.NewListAssociatedResourcesPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiskEncryptionSetsClient.NewListAssociatedResourcesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAssociatedResourcesCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, options) + }, nil) + if err != nil { + return DiskEncryptionSetsClientListAssociatedResourcesResponse{}, err + } + return client.listAssociatedResourcesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-02 +// - resourceGroupName - The name of the resource group. +// - options - DiskEncryptionSetsClientListByResourceGroupOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiskEncryptionSetsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return DiskEncryptionSetsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskEncryptionSetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskEncryptionSetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates (patches) a disk encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DiskEncryptionSetsClient) update(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DiskEncryptionSetsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, diskEncryptionSet); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/diskrestorepoint_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/diskrestorepoint_client.go new file mode 100644 index 000000000..54b576957 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/diskrestorepoint_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DiskRestorePointClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get disk restorePoint resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-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) { + var err error + const operationName = "DiskRestorePointClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, options) + if err != nil { + return DiskRestorePointClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DiskRestorePointClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DiskRestorePointClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskRestorePointClientGrantAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskRestorePointClientGrantAccessResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GrantAccess - Grants access to a diskRestorePoint. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DiskRestorePointClient) grantAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, grantAccessData GrantAccessData, options *DiskRestorePointClientBeginGrantAccessOptions) (*http.Response, error) { + var err error + const operationName = "DiskRestorePointClient.BeginGrantAccess" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.grantAccessCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, grantAccessData); err != nil { + return nil, err + } + return req, nil +} + +// NewListByRestorePointPager - Lists diskRestorePoints under a vmRestorePoint. +// +// Generated from API version 2023-04-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.NewListByRestorePointPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiskRestorePointClient.NewListByRestorePointPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByRestorePointCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, options) + }, nil) + if err != nil { + return DiskRestorePointClientListByRestorePointResponse{}, err + } + return client.listByRestorePointHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DiskRestorePointClientRevokeAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DiskRestorePointClientRevokeAccessResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RevokeAccess - Revokes access to a diskRestorePoint. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DiskRestorePointClient) revokeAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointClientBeginRevokeAccessOptions) (*http.Response, error) { + var err error + const operationName = "DiskRestorePointClient.BeginRevokeAccess" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.revokeAccessCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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/v5/disks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/disks_client.go new file mode 100644 index 000000000..854a8ffd6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/disks_client.go @@ -0,0 +1,623 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DisksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DisksClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DisksClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DisksClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DisksClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, diskName, disk, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, disk); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DisksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DisksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DisksClient) deleteOperation(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DisksClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, diskName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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) { + var err error + const operationName = "DisksClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, diskName, options) + if err != nil { + return DisksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DisksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DisksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DisksClientGrantAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DisksClientGrantAccessResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GrantAccess - Grants access to a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DisksClient) grantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksClientBeginGrantAccessOptions) (*http.Response, error) { + var err error + const operationName = "DisksClient.BeginGrantAccess" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.grantAccessCreateRequest(ctx, resourceGroupName, diskName, grantAccessData, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, grantAccessData); err != nil { + return nil, err + } + return req, nil +} + +// NewListPager - Lists all the disks under a subscription. +// +// Generated from API version 2023-04-02 +// - options - DisksClientListOptions contains the optional parameters for the DisksClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DisksClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return DisksClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-02 +// - resourceGroupName - The name of the resource group. +// - options - DisksClientListByResourceGroupOptions contains the optional parameters for the DisksClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DisksClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return DisksClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DisksClientRevokeAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DisksClientRevokeAccessResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RevokeAccess - Revokes access to a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DisksClient) revokeAccess(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginRevokeAccessOptions) (*http.Response, error) { + var err error + const operationName = "DisksClient.BeginRevokeAccess" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.revokeAccessCreateRequest(ctx, resourceGroupName, diskName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DisksClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DisksClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates (patches) a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *DisksClient) update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DisksClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, diskName, disk, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, disk); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleries_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleries_client.go new file mode 100644 index 000000000..5bd114c06 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleries_client.go @@ -0,0 +1,465 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GalleriesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleriesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleriesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleriesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, gallery, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, gallery); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleriesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleriesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleriesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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) { + var err error + const operationName = "GalleriesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, options) + if err != nil { + return GalleriesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleriesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GalleriesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GalleriesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return GalleriesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GalleriesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return GalleriesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleriesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleriesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleriesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, gallery, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, gallery); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryapplications_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryapplications_client.go new file mode 100644 index 000000000..897c18a2f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryapplications_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GalleryApplicationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryApplicationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryApplicationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryApplicationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, galleryApplication); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryApplicationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryApplicationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryApplicationsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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) { + var err error + const operationName = "GalleryApplicationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) + if err != nil { + return GalleryApplicationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryApplicationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GalleryApplicationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListByGalleryPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GalleryApplicationsClient.NewListByGalleryPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByGalleryCreateRequest(ctx, resourceGroupName, galleryName, options) + }, nil) + if err != nil { + return GalleryApplicationsClientListByGalleryResponse{}, err + } + return client.listByGalleryHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryApplicationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryApplicationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryApplicationsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, galleryApplication); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryapplicationversions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryapplicationversions_client.go new file mode 100644 index 000000000..3148aa31d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryapplicationversions_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GalleryApplicationVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryApplicationVersionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryApplicationVersionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryApplicationVersionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, galleryApplicationVersion); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryApplicationVersionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryApplicationVersionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryApplicationVersionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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) { + var err error + const operationName = "GalleryApplicationVersionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, options) + if err != nil { + return GalleryApplicationVersionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryApplicationVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GalleryApplicationVersionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListByGalleryApplicationPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GalleryApplicationVersionsClient.NewListByGalleryApplicationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByGalleryApplicationCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) + }, nil) + if err != nil { + return GalleryApplicationVersionsClientListByGalleryApplicationResponse{}, err + } + return client.listByGalleryApplicationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryApplicationVersionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryApplicationVersionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryApplicationVersionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, galleryApplicationVersion); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryimages_client.go new file mode 100644 index 000000000..84fc57a2b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryimages_client.go @@ -0,0 +1,433 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GalleryImagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryImagesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryImagesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryImagesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, galleryImage); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryImagesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryImagesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryImagesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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) { + var err error + const operationName = "GalleryImagesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) + if err != nil { + return GalleryImagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GalleryImagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListByGalleryPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GalleryImagesClient.NewListByGalleryPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByGalleryCreateRequest(ctx, resourceGroupName, galleryName, options) + }, nil) + if err != nil { + return GalleryImagesClientListByGalleryResponse{}, err + } + return client.listByGalleryHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryImagesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryImagesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryImagesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, galleryImage); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryimageversions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryimageversions_client.go new file mode 100644 index 000000000..7bbe1f00f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/galleryimageversions_client.go @@ -0,0 +1,463 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GalleryImageVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryImageVersionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryImageVersionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryImageVersionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, galleryImageVersion); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryImageVersionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryImageVersionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryImageVersionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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) { + var err error + const operationName = "GalleryImageVersionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return GalleryImageVersionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryImageVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GalleryImageVersionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListByGalleryImagePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GalleryImageVersionsClient.NewListByGalleryImagePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByGalleryImageCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) + }, nil) + if err != nil { + return GalleryImageVersionsClientListByGalleryImageResponse{}, err + } + return client.listByGalleryImageHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleryImageVersionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GalleryImageVersionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GalleryImageVersionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, galleryImageVersion); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/gallerysharingprofile_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/gallerysharingprofile_client.go new file mode 100644 index 000000000..e53a8f08a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/gallerysharingprofile_client.go @@ -0,0 +1,125 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GallerySharingProfileClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GallerySharingProfileClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GallerySharingProfileClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "GallerySharingProfileClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, sharingUpdate, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, sharingUpdate); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/images_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/images_client.go new file mode 100644 index 000000000..e97d6fa30 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/images_client.go @@ -0,0 +1,462 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ImagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update an image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImagesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ImagesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update an image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *ImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ImagesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes an Image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImagesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ImagesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes an Image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *ImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ImagesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, imageName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "ImagesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, imageName, options) + if err != nil { + return ImagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-01 +// - options - ImagesClientListOptions contains the optional parameters for the ImagesClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImagesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return ImagesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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. 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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - options - ImagesClientListByResourceGroupOptions contains the optional parameters for the ImagesClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImagesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return ImagesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImagesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ImagesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update an image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *ImagesClient) update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ImagesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/loganalytics_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/loganalytics_client.go new file mode 100644 index 000000000..6dfabd2bf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/loganalytics_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LogAnalyticsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LogAnalyticsClientExportRequestRateByIntervalResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LogAnalyticsClientExportRequestRateByIntervalResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *LogAnalyticsClient) exportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsClientBeginExportRequestRateByIntervalOptions) (*http.Response, error) { + var err error + const operationName = "LogAnalyticsClient.BeginExportRequestRateByInterval" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportRequestRateByIntervalCreateRequest(ctx, location, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LogAnalyticsClientExportThrottledRequestsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LogAnalyticsClientExportThrottledRequestsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *LogAnalyticsClient) exportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsClientBeginExportThrottledRequestsOptions) (*http.Response, error) { + var err error + const operationName = "LogAnalyticsClient.BeginExportThrottledRequests" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportThrottledRequestsCreateRequest(ctx, location, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/models.go new file mode 100644 index 000000000..8275c7791 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/models.go @@ -0,0 +1,8341 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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 +} + +// APIError - Api error. +type APIError struct { + // The error code. + Code *string + + // The Api error details + Details []*APIErrorBase + + // The Api inner error + Innererror *InnerError + + // The error message. + Message *string + + // The target of the particular error. + Target *string +} + +// APIErrorBase - Api error base. +type APIErrorBase struct { + // The error code. + Code *string + + // The error message. + Message *string + + // The target of the particular error. + Target *string +} + +// AccessURI - A disk access SAS uri. +type AccessURI struct { + // READ-ONLY; A SAS uri for accessing a disk. + AccessSAS *string + + // READ-ONLY; A SAS uri for accessing a VM guest state. + SecurityDataAccessSAS *string +} + +// 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 + + // 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 +} + +// 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 + + // 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 + + // The pass name. Currently, the only allowable value is OobeSystem. + PassName *string + + // Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. + SettingName *SettingNames +} + +// AlternativeOption - Describes the alternative option specified by the Publisher for this image when this image is deprecated. +type AlternativeOption struct { + // Describes the type of the alternative option. + Type *AlternativeType + + // Indicates the alternative option value specified by the Publisher. This is the Offer name when the type is Offer or the + // Plan name when the type is Plan. + Value *string +} + +// 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 +} + +// 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 + + // 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 + + // 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 +} + +// 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 +} + +// 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 + + // 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 + + // 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 +} + +// 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 an +// availability set at creation time. An existing VM cannot be added to an availability set. +type AvailabilitySet struct { + // REQUIRED; Resource location + Location *string + + // The instance view of a resource. + Properties *AvailabilitySetProperties + + // 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 + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// AvailabilitySetListResult - The List Availability Set operation response. +type AvailabilitySetListResult struct { + // REQUIRED; The list of availability sets + Value []*AvailabilitySet + + // The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to fetch the next page of AvailabilitySets. + NextLink *string +} + +// AvailabilitySetProperties - The instance view of a resource. +type AvailabilitySetProperties struct { + // Fault Domain count. + PlatformFaultDomainCount *int32 + + // Update Domain count. + PlatformUpdateDomainCount *int32 + + // Specifies information about the proximity placement group that the availability set should be assigned to. Minimum api-version: + // 2018-04-01. + ProximityPlacementGroup *SubResource + + // A list of references to all virtual machines in the availability set. + VirtualMachines []*SubResource + + // READ-ONLY; The resource status information. + Statuses []*InstanceViewStatus +} + +// 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 + + // Sku of the availability set + SKU *SKU + + // Resource tags + Tags map[string]*string +} + +// 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 + + // READ-ONLY; The number of critical or security patches that have been detected as available and not yet installed. + CriticalAndSecurityPatchCount *int32 + + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + Error *APIError + + // READ-ONLY; The UTC timestamp when the operation began. + LastModifiedTime *time.Time + + // READ-ONLY; The number of all available patches excluding critical and security. + OtherPatchCount *int32 + + // 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 + + // READ-ONLY; The UTC timestamp when the operation began. + StartTime *time.Time + + // 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 +} + +// 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 +} + +// 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 + + // 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 +} + +// 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 + + // 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 + + // 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 +} + +// CapacityReservation - Specifies information about the capacity reservation. +type CapacityReservation struct { + // REQUIRED; Resource location + Location *string + + // 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 + + // Properties of the Capacity reservation. + Properties *CapacityReservationProperties + + // Resource tags + Tags map[string]*string + + // 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 + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // capacity reservation group Properties. + Properties *CapacityReservationGroupProperties + + // Resource tags + Tags map[string]*string + + // 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 + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +type CapacityReservationGroupInstanceView struct { + // READ-ONLY; List of instance view of the capacity reservations under the capacity reservation group. + CapacityReservations []*CapacityReservationInstanceViewWithName +} + +// CapacityReservationGroupListResult - The List capacity reservation group with resource group response. +type CapacityReservationGroupListResult struct { + // REQUIRED; The list of capacity reservation groups + Value []*CapacityReservationGroup + + // 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 +} + +// 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 + + // 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 + + // READ-ONLY; A list of references to all virtual machines associated to the capacity reservation group. + VirtualMachinesAssociated []*SubResourceReadOnly +} + +// CapacityReservationGroupUpdate - Specifies information about the capacity reservation group. Only tags can be updated. +type CapacityReservationGroupUpdate struct { + // capacity reservation group Properties. + Properties *CapacityReservationGroupProperties + + // Resource tags + Tags map[string]*string +} + +// 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 + + // Unutilized capacity of the capacity reservation. + UtilizationInfo *CapacityReservationUtilization +} + +// 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 + + // Unutilized capacity of the capacity reservation. + UtilizationInfo *CapacityReservationUtilization + + // READ-ONLY; The name of the capacity reservation. + Name *string +} + +// CapacityReservationListResult - The list capacity reservation operation response. +type CapacityReservationListResult struct { + // REQUIRED; The list of capacity reservations + Value []*CapacityReservation + + // 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 +} + +// 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 +} + +// CapacityReservationProperties - Properties of the Capacity reservation. +type CapacityReservationProperties struct { + // READ-ONLY; The Capacity reservation instance view. + InstanceView *CapacityReservationInstanceView + + // 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 + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string + + // READ-ONLY; The date time when the capacity reservation was last updated. + ProvisioningTime *time.Time + + // 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 + + // READ-ONLY; Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01. + TimeCreated *time.Time + + // READ-ONLY; A list of all virtual machine resource ids that are associated with the capacity reservation. + VirtualMachinesAssociated []*SubResourceReadOnly +} + +// 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 + + // 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 + + // Resource tags + Tags map[string]*string +} + +// 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 + + // READ-ONLY; A list of all virtual machines resource ids allocated against the capacity reservation. + VirtualMachinesAllocated []*SubResourceReadOnly +} + +// CloudService - Describes the cloud service. +type CloudService struct { + // REQUIRED; Resource location. + Location *string + + // Cloud service properties + Properties *CloudServiceProperties + + // The system meta data relating to this resource. + SystemData *SystemData + + // Resource tags. + Tags map[string]*string + + // List of logical availability zone of the resource. List should contain only 1 zone where cloud service should be provisioned. + // This field is optional. + Zones []*string + + // READ-ONLY; Resource Id. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// CloudServiceExtensionProfile - Describes a cloud service extension profile. +type CloudServiceExtensionProfile struct { + // List of extensions for the cloud service. + Extensions []*Extension +} + +// CloudServiceExtensionProperties - Extension Properties. +type CloudServiceExtensionProperties struct { + // Explicitly specify whether platform can automatically upgrade typeHandlerVersion to higher minor versions when they become + // available. + AutoUpgradeMinorVersion *bool + + // 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 + + // Protected settings for the extension which are encrypted before sent to the role instance. + ProtectedSettings any + + // Protected settings for the extension, referenced using KeyVault which are encrypted before sent to the role instance. + ProtectedSettingsFromKeyVault *CloudServiceVaultAndSecretReference + + // The name of the extension handler publisher. + Publisher *string + + // 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 + + // 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 any + + // Specifies the type of the extension. + Type *string + + // 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 + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string +} + +// CloudServiceInstanceView - InstanceView of CloudService as a whole +type CloudServiceInstanceView struct { + // Instance view statuses. + RoleInstance *InstanceViewStatusesSummary + + // 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 + + // READ-ONLY; The version of the SDK that was used to generate the package for the cloud service. + SdkVersion *string + + // READ-ONLY + Statuses []*ResourceInstanceViewStatus +} + +// CloudServiceListResult - The list operation result. +type CloudServiceListResult struct { + // REQUIRED; The list of resources. + Value []*CloudService + + // 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 +} + +// 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 + + // Slot type for the cloud service. Possible values are + // Production + // Staging + // If not specified, the default value is Production. + SlotType *CloudServiceSlotType + + // 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 +} + +// 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 +} + +// 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 + + // Specifies the XML service configuration (.cscfg) for the cloud service. + Configuration *string + + // 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 + + // Describes a cloud service extension profile. + ExtensionProfile *CloudServiceExtensionProfile + + // Network Profile for the cloud service. + NetworkProfile *CloudServiceNetworkProfile + + // Describes the OS profile for the cloud service. + OSProfile *CloudServiceOsProfile + + // 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 + + // Describes the role profile for the cloud service. + RoleProfile *CloudServiceRoleProfile + + // (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 + + // 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 + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string + + // READ-ONLY; The unique identifier for the cloud service. + UniqueID *string +} + +// CloudServiceRole - Describes a role of the cloud service. +type CloudServiceRole struct { + // The cloud service role properties. + Properties *CloudServiceRoleProperties + + // Describes the cloud service role sku. + SKU *CloudServiceRoleSKU + + // READ-ONLY; Resource id + ID *string + + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// CloudServiceRoleListResult - The list operation result. +type CloudServiceRoleListResult struct { + // REQUIRED; The list of resources. + Value []*CloudServiceRole + + // 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 +} + +// CloudServiceRoleProfile - Describes the role profile for the cloud service. +type CloudServiceRoleProfile struct { + // List of roles for the cloud service. + Roles []*CloudServiceRoleProfileProperties +} + +// CloudServiceRoleProfileProperties - Describes the role properties. +type CloudServiceRoleProfileProperties struct { + // Resource name. + Name *string + + // Describes the cloud service role sku. + SKU *CloudServiceRoleSKU +} + +// CloudServiceRoleProperties - The cloud service role properties. +type CloudServiceRoleProperties struct { + // READ-ONLY; Specifies the ID which uniquely identifies a cloud service role. + UniqueID *string +} + +// CloudServiceRoleSKU - Describes the cloud service role sku. +type CloudServiceRoleSKU struct { + // Specifies the number of role instances in the cloud service. + Capacity *int64 + + // 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 + + // Specifies the tier of the cloud service. Possible Values are + // Standard + // Basic + Tier *string +} + +type CloudServiceUpdate struct { + // Resource tags + Tags map[string]*string +} + +// 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 + + // The ARM Resource ID of the Key Vault + SourceVault *SubResource +} + +// 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 +} + +// 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 + + // The list of key vault references in SourceVault which contain certificates. + VaultCertificates []*CloudServiceVaultCertificate +} + +// 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 + + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// CommunityGalleryIdentifier - The identifier information of community gallery. +type CommunityGalleryIdentifier struct { + // The unique id of this community gallery. + UniqueID *string +} + +// 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 + + // Describes the properties of a gallery image definition. + Properties *CommunityGalleryImageProperties + + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// CommunityGalleryImageIdentifier - This is the community gallery image definition identifier. +type CommunityGalleryImageIdentifier struct { + // The name of the gallery image definition offer. + Offer *string + + // The name of the gallery image definition publisher. + Publisher *string + + // The name of the gallery image definition SKU. + SKU *string +} + +// CommunityGalleryImageList - The List Community Gallery Images operation response. +type CommunityGalleryImageList struct { + // REQUIRED; A list of community gallery images. + Value []*CommunityGalleryImage + + // 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 +} + +// CommunityGalleryImageProperties - Describes the properties of a gallery image definition. +type CommunityGalleryImageProperties struct { + // REQUIRED; This is the community gallery image definition identifier. + Identifier *CommunityGalleryImageIdentifier + + // REQUIRED; This property allows the user to specify whether the virtual machines created under this image are 'Generalized' + // or 'Specialized'. + OSState *OperatingSystemStateTypes + + // 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 + + // The architecture of the image. Applicable to OS disks only. + Architecture *Architecture + + // Describes the disallowed disk types. + Disallowed *Disallowed + + // 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 + + // End-user license agreement for the current community gallery image. + Eula *string + + // A list of gallery image features. + Features []*GalleryImageFeature + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration + + // Privacy statement uri for the current community gallery image. + PrivacyStatementURI *string + + // Describes the gallery image definition purchase plan. This is used by marketplace images. + PurchasePlan *ImagePurchasePlan + + // The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + Recommended *RecommendedMachineConfiguration +} + +// 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 + + // Describes the properties of a gallery image version. + Properties *CommunityGalleryImageVersionProperties + + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// CommunityGalleryImageVersionList - The List Community Gallery Image versions operation response. +type CommunityGalleryImageVersionList struct { + // REQUIRED; A list of community gallery image versions. + Value []*CommunityGalleryImageVersion + + // 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 +} + +// 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 + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool + + // The published date of the gallery image version Definition. This property can be used for decommissioning purposes. This + // property is updatable. + PublishedDate *time.Time + + // Describes the storage profile of the image version. + StorageProfile *SharedGalleryImageVersionStorageProfile +} + +// 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 + + // The prefix of the gallery name that will be displayed publicly. Visible to all users. + PublicNamePrefix *string + + // Community gallery publisher support email. The email address of the publisher. Visible to all users. + PublisherContact *string + + // The link to the publisher website. Visible to all users. + PublisherURI *string + + // READ-ONLY; Contains info about whether community gallery sharing is enabled. + CommunityGalleryEnabled *bool + + // READ-ONLY; Community gallery public name list. + PublicNames []*string +} + +// 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 + + // REQUIRED; Indicates the error message if the background copy of a resource created via the CopyStart operation fails. + ErrorMessage *string +} + +// CreationData - Data used when creating a disk. +type CreationData struct { + // REQUIRED; This enumerates the possible sources of a disk's creation. + CreateOption *DiskCreateOption + + // Required if createOption is CopyFromSanSnapshot. This is the ARM id of the source elastic san volume snapshot. + ElasticSanResourceID *string + + // 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 + + // Disk source information for PIR or user images. + ImageReference *ImageDiskReference + + // Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default. + LogicalSectorSize *int32 + + // 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 + + // If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state. + SecurityDataURI *string + + // If createOption is Copy, this is the ARM id of the source snapshot or disk. + SourceResourceID *string + + // If createOption is Import, this is the URI of a blob to be imported into a managed disk. + SourceURI *string + + // Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to + // import as a disk. + StorageAccountID *string + + // 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 + + // READ-ONLY; If this field is set, this is the unique id identifying the source of this resource. + SourceUniqueID *string +} + +// DataDisk - Describes a data disk. +type DataDisk struct { + // REQUIRED; Specifies how the virtual machine should be created. Possible values are: Attach. This value is used when you + // are using a specialized disk to create the virtual machine. FromImage. This value is used + // when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference + // element described above. If you are using a marketplace image, you + // should also use the plan element previously described. + CreateOption *DiskCreateOptionTypes + + // 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 + + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for + // Standard storage. ReadOnly for Premium storage. + Caching *CachingTypes + + // Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: 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 + + // 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 + + // 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. The property 'diskSizeGB' is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. + DiskSizeGB *int32 + + // 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 + + // The managed disk parameters. + ManagedDisk *ManagedDiskParameters + + // The disk name. + Name *string + + // Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset + ToBeDetached *bool + + // The virtual hard disk. + Vhd *VirtualHardDisk + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool + + // 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 + + // 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 +} + +// 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 +} + +// 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 + + // A relative URI containing the resource ID of the disk encryption set. + DiskEncryptionSetID *string +} + +// DedicatedHost - Specifies information about the Dedicated host. +type DedicatedHost struct { + // REQUIRED; Resource location + Location *string + + // 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 + + // Properties of the dedicated host. + Properties *DedicatedHostProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // VM size in terms of which the unutilized capacity is represented. + VMSize *string +} + +// 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 +} + +// 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 + + // Dedicated Host Group Properties. + Properties *DedicatedHostGroupProperties + + // Resource tags + Tags map[string]*string + + // 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 + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +type DedicatedHostGroupInstanceView struct { + // List of instance view of the dedicated hosts under the dedicated host group. + Hosts []*DedicatedHostInstanceViewWithName +} + +// DedicatedHostGroupListResult - The List Dedicated Host Group with resource group response. +type DedicatedHostGroupListResult struct { + // REQUIRED; The list of dedicated host groups + Value []*DedicatedHostGroup + + // 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 +} + +// DedicatedHostGroupProperties - Dedicated Host Group Properties. +type DedicatedHostGroupProperties struct { + // REQUIRED; Number of fault domains that the host group can span. + PlatformFaultDomainCount *int32 + + // Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01. + AdditionalCapabilities *DedicatedHostGroupPropertiesAdditionalCapabilities + + // 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 + + // READ-ONLY; A list of references to all dedicated hosts in the dedicated host group. + Hosts []*SubResourceReadOnly + + // 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 +} + +// 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 +} + +// 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 + + // Resource tags + Tags map[string]*string + + // 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 +} + +// DedicatedHostInstanceView - The instance view of a dedicated host. +type DedicatedHostInstanceView struct { + // Unutilized capacity of the dedicated host. + AvailableCapacity *DedicatedHostAvailableCapacity + + // The resource status information. + Statuses []*InstanceViewStatus + + // READ-ONLY; Specifies the unique id of the dedicated physical machine on which the dedicated host resides. + AssetID *string +} + +// 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 + + // The resource status information. + Statuses []*InstanceViewStatus + + // READ-ONLY; Specifies the unique id of the dedicated physical machine on which the dedicated host resides. + AssetID *string + + // READ-ONLY; The name of the dedicated host. + Name *string +} + +// DedicatedHostListResult - The list dedicated host operation response. +type DedicatedHostListResult struct { + // REQUIRED; The list of dedicated hosts + Value []*DedicatedHost + + // 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 +} + +// 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 + + // Specifies the software license type that will be applied to the VMs deployed on the dedicated host. Possible values are: + // None, WindowsServerHybrid, WindowsServerPerpetual. The default value is: None. + LicenseType *DedicatedHostLicenseTypes + + // Fault domain of the dedicated host within a dedicated host group. + PlatformFaultDomain *int32 + + // 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 + + // READ-ONLY; The dedicated host instance view. + InstanceView *DedicatedHostInstanceView + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string + + // READ-ONLY; The date when the host was first provisioned. + ProvisioningTime *time.Time + + // READ-ONLY; Specifies the time at which the Dedicated Host resource was created. Minimum api-version: 2021-11-01. + TimeCreated *time.Time + + // READ-ONLY; A list of references to all virtual machines in the Dedicated Host. + VirtualMachines []*SubResourceReadOnly +} + +// DedicatedHostSizeListResult - The List Dedicated Host sizes operation response. +type DedicatedHostSizeListResult struct { + // The list of dedicated host sizes. + Value []*string +} + +// 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 + + // List all available dedicated host sizes for resizing [https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes]. + // Resizing can be only used to scale up DedicatedHost. Only name is + // required to be set. + SKU *SKU + + // Resource tags + Tags map[string]*string +} + +// 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 +} + +// 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 + + // Specifies the ephemeral disk placement for operating system disk. Possible values are: CacheDisk, ResourceDisk. The defaulting + // behavior is: CacheDisk if one is configured for the VM size otherwise + // ResourceDisk is used. Refer to the 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 +} + +// Disallowed - Describes the disallowed disk types. +type Disallowed struct { + // A list of disk types. + DiskTypes []*string +} + +// DisallowedConfiguration - Specifies the disallowed configuration for a virtual machine image. +type DisallowedConfiguration struct { + // VM disk types which are disallowed. + VMDiskType *VMDiskTypes +} + +// Disk resource. +type Disk struct { + // REQUIRED; Resource location + Location *string + + // The extended location where the disk will be created. Extended location cannot be changed. + ExtendedLocation *ExtendedLocation + + // Disk resource properties. + Properties *DiskProperties + + // The disks sku name. Can be StandardLRS, PremiumLRS, StandardSSDLRS, UltraSSDLRS, PremiumZRS, StandardSSDZRS, or PremiumV2_LRS. + SKU *DiskSKU + + // Resource tags + Tags map[string]*string + + // The Logical zone list for Disk. + Zones []*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; A relative URI containing the ID of the VM that has the disk attached. + ManagedBy *string + + // 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 + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// DiskAccess - disk access resource. +type DiskAccess struct { + // REQUIRED; Resource location + Location *string + + // The extended location where the disk access will be created. Extended location cannot be changed. + ExtendedLocation *ExtendedLocation + Properties *DiskAccessProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// DiskAccessList - The List disk access operation response. +type DiskAccessList struct { + // REQUIRED; A list of disk access resources. + Value []*DiskAccess + + // 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 +} + +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 + + // READ-ONLY; The disk access resource provisioning state. + ProvisioningState *string + + // READ-ONLY; The time when the disk access was created. + TimeCreated *time.Time +} + +// DiskAccessUpdate - Used for updating a disk access resource. +type DiskAccessUpdate struct { + // Resource tags + Tags map[string]*string +} + +// DiskEncryptionSet - disk encryption set resource. +type DiskEncryptionSet struct { + // REQUIRED; Resource location + Location *string + + // 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 + Properties *EncryptionSetProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// DiskEncryptionSetList - The List disk encryption set operation response. +type DiskEncryptionSetList struct { + // REQUIRED; A list of disk encryption sets. + Value []*DiskEncryptionSet + + // 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 +} + +// 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 +} + +// 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 + + // disk encryption set resource update properties. + Properties *DiskEncryptionSetUpdateProperties + + // Resource tags + Tags map[string]*string +} + +// 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 + + // The type of key used to encrypt the data of the disk. + EncryptionType *DiskEncryptionSetType + + // Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the + // property. + FederatedClientID *string + + // Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. + RotationToLatestKeyVersionEnabled *bool +} + +// 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 + + // Specifies whether disk encryption should be enabled on the virtual machine. + Enabled *bool + + // Specifies the location of the key encryption key in Key Vault. + KeyEncryptionKey *KeyVaultKeyReference +} + +// 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 +} + +// 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 + + // The disk name. + Name *string + + // The resource status information. + Statuses []*InstanceViewStatus +} + +// DiskList - The List Disks operation response. +type DiskList struct { + // REQUIRED; A list of disks. + Value []*Disk + + // The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. + NextLink *string +} + +// DiskProperties - Disk resource properties. +type DiskProperties struct { + // REQUIRED; Disk source information. CreationData information cannot be changed after the disk has been created. + CreationData *CreationData + + // 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 + + // Percentage complete for the background copy when a resource is created via the CopyStart operation. + CompletionPercent *float32 + + // Additional authentication requirements when exporting or uploading to a disk or snapshot. + DataAccessAuthMode *DataAccessAuthMode + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string + + // 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 + + // The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k + // bytes. + DiskIOPSReadWrite *int64 + + // 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 + + // 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 + + // 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 + + // Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption + + // Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration + + // 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 + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy + + // The Operating System type. + OSType *OperatingSystemTypes + + // 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 + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess + + // 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 + + // Contains the security related information for the resource. + SecurityProfile *DiskSecurityProfile + + // List of supported capabilities for the image from which the OS disk was created. + SupportedCapabilities *SupportedCapabilities + + // Indicates the OS on a disk supports hibernation. + SupportsHibernation *bool + + // 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 + + // READ-ONLY; Latest time when bursting was last enabled on a disk. + BurstingEnabledTime *time.Time + + // READ-ONLY; The size of the disk in bytes. This field is read only. + DiskSizeBytes *int64 + + // READ-ONLY; The state of the disk. + DiskState *DiskState + + // READ-ONLY; The UTC time when the ownership state of the disk was last changed i.e., the time the disk was last attached + // or detached from a VM or the time when the VM to which the disk was attached was + // deallocated or started. + LastOwnershipUpdateTime *time.Time + + // READ-ONLY; Properties of the disk for which update is pending. + PropertyUpdatesInProgress *PropertyUpdatesInProgress + + // READ-ONLY; The disk provisioning state. + ProvisioningState *string + + // 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 + + // READ-ONLY; The time when the disk was created. + TimeCreated *time.Time + + // READ-ONLY; Unique Guid identifying the resource. + UniqueID *string +} + +// DiskPurchasePlan - Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. +type DiskPurchasePlan struct { + // REQUIRED; The plan ID. + Name *string + + // REQUIRED; Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference + // element. + Product *string + + // REQUIRED; The publisher ID. + Publisher *string + + // The Offer Promotion Code. + PromotionCode *string +} + +// DiskRestorePoint - Properties of disk restore point +type DiskRestorePoint struct { + // Properties of an incremental disk restore point + Properties *DiskRestorePointProperties + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// DiskRestorePointAttributes - Disk Restore Point details. +type DiskRestorePointAttributes struct { + // Encryption at rest settings for disk restore point. It is an optional property that can be specified in the input while + // creating a restore point. + Encryption *RestorePointEncryption + + // Resource Id of the source disk restore point. + SourceDiskRestorePoint *APIEntityReference + + // READ-ONLY; Resource Id + ID *string +} + +// DiskRestorePointInstanceView - The instance view of a disk restore point. +type DiskRestorePointInstanceView struct { + // Disk restore point Id. + ID *string + + // The disk restore point replication status information. + ReplicationStatus *DiskRestorePointReplicationStatus +} + +// DiskRestorePointList - The List Disk Restore Points operation response. +type DiskRestorePointList struct { + // REQUIRED; A list of disk restore points. + Value []*DiskRestorePoint + + // 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 +} + +// 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 + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess + + // Purchase plan information for the the image from which the OS disk was created. + PurchasePlan *DiskPurchasePlan + + // Contains the security related information for the resource. + SecurityProfile *DiskSecurityProfile + + // List of supported capabilities for the image from which the OS disk was created. + SupportedCapabilities *SupportedCapabilities + + // Indicates the OS on a disk supports hibernation. + SupportsHibernation *bool + + // READ-ONLY; Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption + + // READ-ONLY; id of the backing snapshot's MIS family + FamilyID *string + + // READ-ONLY; The Operating System type. + OSType *OperatingSystemTypes + + // READ-ONLY; Replication state of disk restore point when source resource is from a different region. + ReplicationState *string + + // READ-ONLY; arm id of source disk or source disk restore point. + SourceResourceID *string + + // READ-ONLY; Location of source disk or source disk restore point when source resource is from a different region. + SourceResourceLocation *string + + // READ-ONLY; unique incarnation id of the source disk + SourceUniqueID *string + + // READ-ONLY; The timestamp of restorePoint creation + TimeCreated *time.Time +} + +// DiskRestorePointReplicationStatus - The instance view of a disk restore point. +type DiskRestorePointReplicationStatus struct { + // Replication completion percentage. + CompletionPercent *int32 + + // The resource status information. + Status *InstanceViewStatus +} + +// DiskSKU - The disks sku name. Can be StandardLRS, PremiumLRS, StandardSSDLRS, UltraSSDLRS, PremiumZRS, StandardSSDZRS, +// or PremiumV2_LRS. +type DiskSKU struct { + // The sku name. + Name *DiskStorageAccountTypes + + // READ-ONLY; The sku tier. + Tier *string +} + +// 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 + + // Specifies the SecurityType of the VM. Applicable for OS disks only. + SecurityType *DiskSecurityTypes +} + +// DiskUpdate - Disk update resource. +type DiskUpdate struct { + // Disk resource update properties. + Properties *DiskUpdateProperties + + // The disks sku name. Can be StandardLRS, PremiumLRS, StandardSSDLRS, UltraSSDLRS, PremiumZRS, StandardSSDZRS, or PremiumV2_LRS. + SKU *DiskSKU + + // Resource tags + Tags map[string]*string +} + +// 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 + + // Additional authentication requirements when exporting or uploading to a disk or snapshot. + DataAccessAuthMode *DataAccessAuthMode + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string + + // 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 + + // The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k + // bytes. + DiskIOPSReadWrite *int64 + + // 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 + + // 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 + + // 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 + + // Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption + + // Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection + + // 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 + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy + + // the Operating System type. + OSType *OperatingSystemTypes + + // 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 + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess + + // Purchase plan information to be added on the OS disk + PurchasePlan *DiskPurchasePlan + + // List of supported capabilities to be added on the OS disk. + SupportedCapabilities *SupportedCapabilities + + // Indicates the OS on a disk supports hibernation. + SupportsHibernation *bool + + // 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 + + // READ-ONLY; Properties of the disk for which update is pending. + PropertyUpdatesInProgress *PropertyUpdatesInProgress +} + +// 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 + + // The type of key used to encrypt the data of the disk. + Type *EncryptionType +} + +// 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 + + // Contains encryption settings for an OS disk image. + OSDiskImage *OSDiskImageEncryption +} + +// 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 + + // 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 + + // 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 + + // 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 +} + +type EncryptionSetProperties struct { + // The key vault key which is currently used by this disk encryption set. + ActiveKey *KeyForDiskEncryptionSet + + // The type of key used to encrypt the data of the disk. + EncryptionType *DiskEncryptionSetType + + // Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the + // property. + FederatedClientID *string + + // Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. + RotationToLatestKeyVersionEnabled *bool + + // 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 + + // READ-ONLY; The time when the active key of this disk encryption set was updated. + LastKeyRotationTimestamp *time.Time + + // 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 + + // READ-ONLY; The disk encryption set provisioning state. + ProvisioningState *string +} + +// 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 + + // A collection of encryption settings, one for each disk volume. + EncryptionSettings []*EncryptionSettingsElement + + // 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 +} + +// EncryptionSettingsElement - Encryption settings for one disk volume. +type EncryptionSettingsElement struct { + // Key Vault Secret Url and vault id of the disk encryption key + DiskEncryptionKey *KeyVaultAndSecretReference + + // 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 +} + +// ExtendedLocation - The complex type of the extended location. +type ExtendedLocation struct { + // The name of the extended location. + Name *string + + // The type of the extended location. + Type *ExtendedLocationTypes +} + +// Extension - Describes a cloud service Extension. +type Extension struct { + // The name of the extension. + Name *string + + // Extension Properties. + Properties *CloudServiceExtensionProperties +} + +// Gallery - Specifies information about the Shared Image Gallery that you want to create or update. +type Gallery struct { + // REQUIRED; Resource location + Location *string + + // Describes the properties of a Shared Image Gallery. + Properties *GalleryProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// GalleryApplication - Specifies information about the gallery Application Definition that you want to create or update. +type GalleryApplication struct { + // REQUIRED; Resource location + Location *string + + // Describes the properties of a gallery Application Definition. + Properties *GalleryApplicationProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // REQUIRED; The script to run when executing this custom action. + Script *string + + // Description to help the users understand what this custom action does. + Description *string + + // The parameters that this custom action uses + Parameters []*GalleryApplicationCustomActionParameter +} + +// 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 + + // The default value of the parameter. Only applies to string types + DefaultValue *string + + // A description to help users understand what this parameter means + Description *string + + // Indicates whether this parameter must be passed when running the custom action. + Required *bool + + // Specifies the type of the custom action parameter. Possible values are: String, ConfigurationDataBlob or LogOutputBlob + Type *GalleryApplicationCustomActionParameterType +} + +// GalleryApplicationList - The List Gallery Applications operation response. +type GalleryApplicationList struct { + // REQUIRED; A list of Gallery Applications. + Value []*GalleryApplication + + // 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 +} + +// 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 + + // A list of custom actions that can be performed with all of the Gallery Application Versions within this Gallery Application. + CustomActions []*GalleryApplicationCustomAction + + // The description of this gallery Application Definition resource. This property is updatable. + Description *string + + // 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 + + // The Eula agreement for the gallery Application Definition. + Eula *string + + // The privacy statement uri. + PrivacyStatementURI *string + + // The release note uri. + ReleaseNoteURI *string +} + +// 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 + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// GalleryApplicationVersion - Specifies information about the gallery Application Version that you want to create or update. +type GalleryApplicationVersion struct { + // REQUIRED; Resource location + Location *string + + // Describes the properties of a gallery image version. + Properties *GalleryApplicationVersionProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// GalleryApplicationVersionList - The List Gallery Application version operation response. +type GalleryApplicationVersionList struct { + // REQUIRED; A list of gallery Application Versions. + Value []*GalleryApplicationVersion + + // 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 +} + +// GalleryApplicationVersionProperties - Describes the properties of a gallery image version. +type GalleryApplicationVersionProperties struct { + // REQUIRED; The publishing profile of a gallery image version. + PublishingProfile *GalleryApplicationVersionPublishingProfile + + // The safety profile of the Gallery Application Version. + SafetyProfile *GalleryApplicationVersionSafetyProfile + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *GalleryProvisioningState + + // READ-ONLY; This is the replication status of the gallery image version. + ReplicationStatus *ReplicationStatus +} + +// 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 + + // Optional. Additional settings to pass to the vm-application-manager extension. For advanced use only. + AdvancedSettings map[string]*string + + // A list of custom actions that can be performed with this Gallery Application Version. + CustomActions []*GalleryApplicationCustomAction + + // Optional. Whether or not this application reports health. + EnableHealthCheck *bool + + // 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 + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool + ManageActions *UserArtifactManage + + // 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 + + // Optional parameter which specifies the mode to be used for replication. This property is not updatable. + ReplicationMode *ReplicationMode + + // 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 + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *StorageAccountType + + // The target extended locations where the Image Version is going to be replicated to. This property is updatable. + TargetExtendedLocations []*GalleryTargetExtendedLocation + + // The target regions where the Image Version is going to be replicated to. This property is updatable. + TargetRegions []*TargetRegion + + // READ-ONLY; The timestamp for when the gallery image version is published. + PublishedDate *time.Time +} + +// 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 +} + +// 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 + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool + + // 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 + + // Optional parameter which specifies the mode to be used for replication. This property is not updatable. + ReplicationMode *ReplicationMode + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *StorageAccountType + + // The target extended locations where the Image Version is going to be replicated to. This property is updatable. + TargetExtendedLocations []*GalleryTargetExtendedLocation + + // The target regions where the Image Version is going to be replicated to. This property is updatable. + TargetRegions []*TargetRegion + + // READ-ONLY; The timestamp for when the gallery image version is published. + PublishedDate *time.Time +} + +// 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 +} + +// GalleryArtifactSource - The source image from which the Image Version is going to be created. +type GalleryArtifactSource struct { + // REQUIRED; The managed artifact. + ManagedImage *ManagedArtifact +} + +// 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 + + // The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. + ID *string +} + +// 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 +} + +// 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 + + // The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + HostCaching *HostCaching + + // The source for the disk image. + Source *GalleryDiskImageSource + + // READ-ONLY; This property indicates the size of the VHD to be created. + SizeInGB *int32 +} + +// 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 + + // The source for the disk image. + Source *GalleryDiskImageSource + + // READ-ONLY; This property indicates the size of the VHD to be created. + SizeInGB *int32 +} + +// 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 + + // The Storage Account Id that contains the vhd blob being used as a source for this artifact version. + StorageAccountID *string + + // The uri of the gallery artifact version source. Currently used to specify vhd/blob source. + URI *string +} + +// GalleryExtendedLocation - The name of the extended location. +type GalleryExtendedLocation struct { + Name *string + + // It is type of the extended location. + Type *GalleryExtendedLocationType +} + +// 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 +} + +// GalleryImage - Specifies information about the gallery image definition that you want to create or update. +type GalleryImage struct { + // REQUIRED; Resource location + Location *string + + // Describes the properties of a gallery image definition. + Properties *GalleryImageProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// GalleryImageFeature - A feature for gallery image. +type GalleryImageFeature struct { + // The name of the gallery image feature. + Name *string + + // The value of the gallery image feature. + Value *string +} + +// GalleryImageIdentifier - This is the gallery image definition identifier. +type GalleryImageIdentifier struct { + // REQUIRED; The name of the gallery image definition offer. + Offer *string + + // REQUIRED; The name of the gallery image definition publisher. + Publisher *string + + // REQUIRED; The name of the gallery image definition SKU. + SKU *string +} + +// GalleryImageList - The List Gallery Images operation response. +type GalleryImageList struct { + // REQUIRED; A list of Shared Image Gallery images. + Value []*GalleryImage + + // 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 +} + +// GalleryImageProperties - Describes the properties of a gallery image definition. +type GalleryImageProperties struct { + // REQUIRED; This is the gallery image definition identifier. + Identifier *GalleryImageIdentifier + + // REQUIRED; This property allows the user to specify whether the virtual machines created under this image are 'Generalized' + // or 'Specialized'. + OSState *OperatingSystemStateTypes + + // 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 + + // The architecture of the image. Applicable to OS disks only. + Architecture *Architecture + + // The description of this gallery image definition resource. This property is updatable. + Description *string + + // Describes the disallowed disk types. + Disallowed *Disallowed + + // 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 + + // The Eula agreement for the gallery image definition. + Eula *string + + // A list of gallery image features. + Features []*GalleryImageFeature + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration + + // The privacy statement uri. + PrivacyStatementURI *string + + // Describes the gallery image definition purchase plan. This is used by marketplace images. + PurchasePlan *ImagePurchasePlan + + // The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + Recommended *RecommendedMachineConfiguration + + // The release note uri. + ReleaseNoteURI *string + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *GalleryProvisioningState +} + +// 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 + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// GalleryImageVersion - Specifies information about the gallery image version that you want to create or update. +type GalleryImageVersion struct { + // REQUIRED; Resource location + Location *string + + // Describes the properties of a gallery image version. + Properties *GalleryImageVersionProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// GalleryImageVersionList - The List Gallery Image version operation response. +type GalleryImageVersionList struct { + // REQUIRED; A list of gallery image versions. + Value []*GalleryImageVersion + + // 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 +} + +// 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 + + // The publishing profile of a gallery image Version. + PublishingProfile *GalleryImageVersionPublishingProfile + + // This is the safety profile of the Gallery Image Version. + SafetyProfile *GalleryImageVersionSafetyProfile + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *GalleryProvisioningState + + // READ-ONLY; This is the replication status of the gallery image version. + ReplicationStatus *ReplicationStatus +} + +// 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 + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool + + // 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 + + // Optional parameter which specifies the mode to be used for replication. This property is not updatable. + ReplicationMode *ReplicationMode + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *StorageAccountType + + // The target extended locations where the Image Version is going to be replicated to. This property is updatable. + TargetExtendedLocations []*GalleryTargetExtendedLocation + + // The target regions where the Image Version is going to be replicated to. This property is updatable. + TargetRegions []*TargetRegion + + // READ-ONLY; The timestamp for when the gallery image version is published. + PublishedDate *time.Time +} + +// 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 + + // READ-ONLY; A list of Policy Violations that have been reported for this Gallery Image Version. + PolicyViolations []*PolicyViolation + + // READ-ONLY; Indicates whether this image has been reported as violating Microsoft's policies. + ReportedForPolicyViolation *bool +} + +// GalleryImageVersionStorageProfile - This is the storage profile of a Gallery Image Version. +type GalleryImageVersionStorageProfile struct { + // A list of data disk images. + DataDiskImages []*GalleryDataDiskImage + + // This is the OS disk image. + OSDiskImage *GalleryOSDiskImage + + // The source of the gallery artifact version. + Source *GalleryArtifactVersionFullSource +} + +// 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 + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// GalleryList - The List Galleries operation response. +type GalleryList struct { + // REQUIRED; A list of galleries. + Value []*Gallery + + // The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. + NextLink *string +} + +// 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 + + // The source for the disk image. + Source *GalleryDiskImageSource + + // READ-ONLY; This property indicates the size of the VHD to be created. + SizeInGB *int32 +} + +// 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 + + // Describes the gallery unique name. + Identifier *GalleryIdentifier + + // Profile for gallery sharing to subscription or tenant + SharingProfile *SharingProfile + + // Contains information about the soft deletion policy of the gallery. + SoftDeletePolicy *SoftDeletePolicy + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *GalleryProvisioningState + + // READ-ONLY; Sharing status of current gallery. + SharingStatus *SharingStatus +} + +type GalleryTargetExtendedLocation struct { + // Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. + Encryption *EncryptionImages + + // The name of the extended location. + ExtendedLocation *GalleryExtendedLocation + + // The number of replicas of the Image Version to be created per extended location. This property is updatable. + ExtendedLocationReplicaCount *int32 + + // The name of the region. + Name *string + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *EdgeZoneStorageAccountType +} + +// 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 + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// GrantAccessData - Data used for requesting a SAS. +type GrantAccessData struct { + // REQUIRED + Access *AccessLevel + + // REQUIRED; Time duration in seconds until the SAS access expires. + DurationInSeconds *int32 + + // Used to specify the file format when making request for SAS on a VHDX file format snapshot + FileFormat *FileFormat + + // Set this flag to true to get additional SAS for VM guest state + GetSecureVMGuestStateSAS *bool +} + +// 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. The 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 + + // 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 +} + +// 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 + + // The extended location of the Image. + ExtendedLocation *ExtendedLocation + + // Describes the properties of an Image. + Properties *ImageProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // The Virtual Hard Disk. + BlobURI *string + + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. + Caching *CachingTypes + + // Specifies the customer managed disk encryption set resource id for the managed image disk. + DiskEncryptionSet *DiskEncryptionSetParameters + + // 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 + + // The managedDisk. + ManagedDisk *SubResource + + // The snapshot. + Snapshot *SubResource + + // 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 +} + +// ImageDeprecationStatus - Describes image deprecation status properties on the image. +type ImageDeprecationStatus struct { + // Describes the alternative option specified by the Publisher for this image when this image is deprecated. + AlternativeOption *AlternativeOption + + // Describes the state of the image. + ImageState *ImageState + + // The time, in future, at which this image will be marked as deprecated. This scheduled time is chosen by the Publisher. + ScheduledDeprecationTime *time.Time +} + +// ImageDisk - Describes a image disk. +type ImageDisk struct { + // The Virtual Hard Disk. + BlobURI *string + + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. + Caching *CachingTypes + + // Specifies the customer managed disk encryption set resource id for the managed image disk. + DiskEncryptionSet *DiskEncryptionSetParameters + + // 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 + + // The managedDisk. + ManagedDisk *SubResource + + // The snapshot. + Snapshot *SubResource + + // 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 +} + +// 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 + + // A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference. + ID *string + + // 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 + + // A relative uri containing a direct shared Azure Compute Gallery image reference. + SharedGalleryImageID *string +} + +// ImageListResult - The List Image operation response. +type ImageListResult struct { + // REQUIRED; The list of Images. + Value []*Image + + // The uri to fetch the next page of Images. Call ListNext() with this to fetch the next page of Images. + NextLink *string +} + +// ImageOSDisk - Describes an Operating System disk. +type ImageOSDisk struct { + // REQUIRED; The OS State. For managed images, use Generalized. + OSState *OperatingSystemStateTypes + + // 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 + + // The Virtual Hard Disk. + BlobURI *string + + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. + Caching *CachingTypes + + // Specifies the customer managed disk encryption set resource id for the managed image disk. + DiskEncryptionSet *DiskEncryptionSetParameters + + // 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 + + // The managedDisk. + ManagedDisk *SubResource + + // The snapshot. + Snapshot *SubResource + + // 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 +} + +// 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 + + // The source virtual machine from which Image is created. + SourceVirtualMachine *SubResource + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *ImageStorageProfile + + // READ-ONLY; The provisioning state. + ProvisioningState *string +} + +// ImagePurchasePlan - Describes the gallery image definition purchase plan. This is used by marketplace images. +type ImagePurchasePlan struct { + // The plan ID. + Name *string + + // The product ID. + Product *string + + // The publisher ID. + Publisher *string +} + +// 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 + + // Resource Id + ID *string + + // Specifies the offer of the platform image or marketplace image used to create the virtual machine. + Offer *string + + // The image publisher. + Publisher *string + + // The image SKU. + SKU *string + + // Specified the shared gallery image unique id for vm deployment. This can be fetched from shared gallery image GET call. + SharedGalleryImageID *string + + // 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 + + // 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 +} + +// 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 + + // 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 + + // 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 +} + +// ImageUpdate - The source user image virtual hard disk. Only tags may be updated. +type ImageUpdate struct { + // Describes the properties of an Image. + Properties *ImageProperties + + // Resource tags + Tags map[string]*string +} + +// InnerError - Inner error details. +type InnerError struct { + // The internal error message or exception dump. + Errordetail *string + + // The exception type. + Exceptiontype *string +} + +// InstanceSKU - The role instance SKU. +type InstanceSKU struct { + // READ-ONLY; The sku name. + Name *string + + // READ-ONLY; The tier of the cloud service role instance. + Tier *string +} + +// InstanceViewStatus - Instance view status. +type InstanceViewStatus struct { + // The status code. + Code *string + + // The short localizable label for the status. + DisplayStatus *string + + // The level code. + Level *StatusLevelTypes + + // The detailed status message, including for alerts and error messages. + Message *string + + // The time of the status. + Time *time.Time +} + +// InstanceViewStatusesSummary - Instance view statuses. +type InstanceViewStatusesSummary struct { + // READ-ONLY; The summary. + StatusesSummary []*StatusCodeCount +} + +// 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 + + // 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 +} + +// 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 + + // REQUIRED; Resource id of the KeyVault containing the key or secret + SourceVault *SourceVault +} + +// 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 + + // REQUIRED; Resource id of the KeyVault containing the key or secret + SourceVault *SourceVault +} + +// KeyVaultKeyReference - Describes a reference to Key Vault Key +type KeyVaultKeyReference struct { + // REQUIRED; The URL referencing a key encryption key in Key Vault. + KeyURL *string + + // REQUIRED; The relative URL of the Key Vault containing the key. + SourceVault *SubResource +} + +// KeyVaultSecretReference - Describes a reference to Key Vault Secret +type KeyVaultSecretReference struct { + // REQUIRED; The URL referencing a secret in a Key Vault. + SecretURL *string + + // REQUIRED; The relative URL of the Key Vault containing the secret. + SourceVault *SubResource +} + +// 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 + + // READ-ONLY; The number of all available patches but excluded explicitly by a customer-specified exclusion list match. + ExcludedPatchCount *int32 + + // READ-ONLY; The count of patches that failed installation. + FailedPatchCount *int32 + + // READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension + // logs. + InstallationActivityID *string + + // READ-ONLY; The count of patches that successfully installed. + InstalledPatchCount *int32 + + // READ-ONLY; The UTC timestamp when the operation began. + LastModifiedTime *time.Time + + // READ-ONLY; Describes whether the operation ran out of time before it completed all its intended actions + MaintenanceWindowExceeded *bool + + // 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 + + // READ-ONLY; The number of all available patches expected to be installed over the course of the patch installation operation. + PendingPatchCount *int32 + + // READ-ONLY; The UTC timestamp when the operation began. + StartTime *time.Time + + // 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 +} + +// 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 + + // region of the Gallery Image Version. + Location *string +} + +// 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 + + // Indicates whether VMAgent Platform Updates is enabled for the Linux virtual machine. Default value is false. + EnableVMAgentPlatformUpdates *bool + + // [Preview Feature] Specifies settings related to VM Guest Patching on Linux. + PatchSettings *LinuxPatchSettings + + // 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 + + // Specifies the ssh key configuration for a Linux OS. + SSH *SSHConfiguration +} + +// 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 + + // This is used as a maintenance run identifier for Auto VM Guest Patching in Linux. + MaintenanceRunID *string + + // packages to exclude in the patch operation. Format: packageName_packageVersion + PackageNameMasksToExclude []*string + + // packages to include in the patch operation. Format: packageName_packageVersion + PackageNameMasksToInclude []*string +} + +// 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 + + // Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Linux. + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings + + // 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 +} + +// LinuxVMGuestPatchAutomaticByPlatformSettings - Specifies additional settings to be applied when patch mode AutomaticByPlatform +// is selected in Linux patch settings. +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + // Enables customer to schedule patching without accidental upgrades + BypassPlatformSafetyChecksOnUserSchedule *bool + + // Specifies the reboot setting for all AutomaticByPlatform patch installation operations. + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting +} + +// ListUsagesResult - The List Usages operation response. +type ListUsagesResult struct { + // REQUIRED; The list of compute resource usages. + Value []*Usage + + // 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 +} + +// LoadBalancerConfiguration - Describes the load balancer configuration. +type LoadBalancerConfiguration struct { + // REQUIRED; The name of the Load balancer + Name *string + + // REQUIRED; Properties of the load balancer configuration. + Properties *LoadBalancerConfigurationProperties + + // Resource Id + ID *string +} + +// 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 +} + +// 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 + + // REQUIRED; Properties of load balancer frontend ip configuration. + Properties *LoadBalancerFrontendIPConfigurationProperties +} + +// LoadBalancerFrontendIPConfigurationProperties - Describes a cloud service IP Configuration +type LoadBalancerFrontendIPConfigurationProperties struct { + // The virtual network private IP address of the IP configuration. + PrivateIPAddress *string + + // The reference to the public ip address resource. + PublicIPAddress *SubResource + + // The reference to the virtual network subnet resource. + Subnet *SubResource +} + +// 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 + + // REQUIRED; From time of the query + FromTime *time.Time + + // REQUIRED; To time of the query + ToTime *time.Time + + // Group query result by Client Application ID. + GroupByClientApplicationID *bool + + // Group query result by Operation Name. + GroupByOperationName *bool + + // Group query result by Resource Name. + GroupByResourceName *bool + + // Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool + + // Group query result by User Agent. + GroupByUserAgent *bool +} + +// LogAnalyticsOperationResult - LogAnalytics operation status response +type LogAnalyticsOperationResult struct { + // READ-ONLY; LogAnalyticsOutput + Properties *LogAnalyticsOutput +} + +// LogAnalyticsOutput - LogAnalytics output properties +type LogAnalyticsOutput struct { + // READ-ONLY; Output file Uri path to blob container. + Output *string +} + +// MaintenanceRedeployStatus - Maintenance Operation Status. +type MaintenanceRedeployStatus struct { + // True, if customer is allowed to perform Maintenance. + IsCustomerInitiatedMaintenanceAllowed *bool + + // Message returned for the last Maintenance Operation. + LastOperationMessage *string + + // The Last Maintenance Operation Result Code. + LastOperationResultCode *MaintenanceOperationResultCodeTypes + + // End Time for the Maintenance Window. + MaintenanceWindowEndTime *time.Time + + // Start Time for the Maintenance Window. + MaintenanceWindowStartTime *time.Time + + // End Time for the Pre Maintenance Window. + PreMaintenanceWindowEndTime *time.Time + + // Start Time for the Pre Maintenance Window. + PreMaintenanceWindowStartTime *time.Time +} + +// ManagedArtifact - The managed artifact. +type ManagedArtifact struct { + // REQUIRED; The managed artifact id. + ID *string +} + +// 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 + + // Resource Id + ID *string + + // Specifies the security profile for the managed disk. + SecurityProfile *VMDiskSecurityProfile + + // 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 +} + +// NetworkInterfaceReference - Describes a network interface reference. +type NetworkInterfaceReference struct { + // Resource Id + ID *string + + // Describes a network interface reference properties. + Properties *NetworkInterfaceReferenceProperties +} + +// NetworkInterfaceReferenceProperties - Describes a network interface reference properties. +type NetworkInterfaceReferenceProperties struct { + // Specify what happens to the network interface when the VM is deleted + DeleteOption *DeleteOptions + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool +} + +// 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 + + // Specifies the networking configurations that will be used to create the virtual machine networking resources. + NetworkInterfaceConfigurations []*VirtualMachineNetworkInterfaceConfiguration + + // Specifies the list of resource Ids for the network interfaces associated with the virtual machine. + NetworkInterfaces []*NetworkInterfaceReference +} + +// 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. This value is used when you + // are using a specialized disk to create the virtual machine. FromImage. This value is used + // when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference + // element described above. If you are using a marketplace image, you + // should also use the plan element previously described. + CreateOption *DiskCreateOptionTypes + + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for + // Standard storage. ReadOnly for Premium storage. + Caching *CachingTypes + + // Specifies whether OS Disk should be deleted or detached upon VM deletion. Possible values are: 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. The user cannot change the delete option for an ephemeral + // OS Disk. + DeleteOption *DiskDeleteOptionTypes + + // Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. + DiffDiskSettings *DiffDiskSettings + + // 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. The property 'diskSizeGB' is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. + DiskSizeGB *int32 + + // Specifies the encryption settings for the OS Disk. Minimum api-version: 2015-06-15. + EncryptionSettings *DiskEncryptionSettings + + // 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 + + // The managed disk parameters. + ManagedDisk *ManagedDiskParameters + + // The disk name. + Name *string + + // 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 + + // The virtual hard disk. + Vhd *VirtualHardDisk + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool +} + +// OSDiskImage - Contains the os disk image information. +type OSDiskImage struct { + // REQUIRED; The operating system of the osDiskImage. + OperatingSystem *OperatingSystemTypes +} + +// 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 + + // This property specifies the security profile of an OS disk image. + SecurityProfile *OSDiskImageSecurityProfile +} + +// OSDiskImageSecurityProfile - Contains security profile for an OS disk image. +type OSDiskImageSecurityProfile struct { + // confidential VM encryption types + ConfidentialVMEncryptionType *ConfidentialVMEncryptionType + + // secure VM disk encryption set id + SecureVMDiskEncryptionSetID *string +} + +// OSFamily - Describes a cloud service OS family. +type OSFamily struct { + // OS family properties. + Properties *OSFamilyProperties + + // READ-ONLY; Resource Id. + ID *string + + // READ-ONLY; Resource location. + Location *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// OSFamilyListResult - The list operation result. +type OSFamilyListResult struct { + // REQUIRED; The list of resources. + Value []*OSFamily + + // 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 +} + +// OSFamilyProperties - OS family properties. +type OSFamilyProperties struct { + // READ-ONLY; The OS family label. + Label *string + + // READ-ONLY; The OS family name. + Name *string + + // READ-ONLY; List of OS versions belonging to this family. + Versions []*OSVersionPropertiesBase +} + +type OSImageNotificationProfile struct { + // Specifies whether the OS Image Scheduled event is enabled or disabled. + Enable *bool + + // Length of time a Virtual Machine being reimaged or having its OS upgraded will have to potentially approve the OS Image + // Scheduled Event before the event is auto approved (timed out). The configuration + // is specified in ISO 8601 format, and the value must be 15 minutes (PT15M) + NotBeforeTimeout *string +} + +// 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 + + // 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 + + // 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 + + // 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 + + // 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. The property '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 + + // 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 + + // Optional property which must either be set to True or omitted. + RequireGuestProvisionSignal *bool + + // 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 + + // Specifies Windows operating system settings on the virtual machine. + WindowsConfiguration *WindowsConfiguration +} + +// OSProfileProvisioningData - Additional parameters for Reimaging Non-Ephemeral Virtual Machine. +type OSProfileProvisioningData 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 + + // 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. The property 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/]. + // If 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 +} + +// OSVersion - Describes a cloud service OS version. +type OSVersion struct { + // OS version properties. + Properties *OSVersionProperties + + // READ-ONLY; Resource Id. + ID *string + + // READ-ONLY; Resource location. + Location *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// OSVersionListResult - The list operation result. +type OSVersionListResult struct { + // REQUIRED; The list of resources. + Value []*OSVersion + + // 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 +} + +// OSVersionProperties - OS version properties. +type OSVersionProperties struct { + // READ-ONLY; The family of this OS version. + Family *string + + // READ-ONLY; The family label of this OS version. + FamilyLabel *string + + // READ-ONLY; Specifies whether this OS version is active. + IsActive *bool + + // READ-ONLY; Specifies whether this is the default OS version for its family. + IsDefault *bool + + // READ-ONLY; The OS version label. + Label *string + + // READ-ONLY; The OS version. + Version *string +} + +// OSVersionPropertiesBase - Configuration view of an OS version. +type OSVersionPropertiesBase struct { + // READ-ONLY; Specifies whether this OS version is active. + IsActive *bool + + // READ-ONLY; Specifies whether this is the default OS version for its family. + IsDefault *bool + + // READ-ONLY; The OS version label. + Label *string + + // READ-ONLY; The OS version. + Version *string +} + +// OperationListResult - The List Compute Operation operation response. +type OperationListResult struct { + // READ-ONLY; The list of compute operations + Value []*OperationValue +} + +// OperationValue - Describes the properties of a Compute Operation value. +type OperationValue struct { + // Describes the properties of a Compute Operation Value Display. + Display *OperationValueDisplay + + // READ-ONLY; The name of the compute operation. + Name *string + + // READ-ONLY; The origin of the compute operation. + Origin *string +} + +// OperationValueDisplay - Describes the properties of a Compute Operation Value Display. +type OperationValueDisplay struct { + // READ-ONLY; The description of the operation. + Description *string + + // READ-ONLY; The display name of the compute operation. + Operation *string + + // READ-ONLY; The resource provider for the operation. + Provider *string + + // READ-ONLY; The display name of the resource the operation applies to. + Resource *string +} + +// OrchestrationServiceStateInput - The input for OrchestrationServiceState +type OrchestrationServiceStateInput struct { + // REQUIRED; The action to be performed. + Action *OrchestrationServiceStateAction + + // REQUIRED; The name of the service. + ServiceName *OrchestrationServiceNames +} + +// OrchestrationServiceSummary - Summary for an orchestration service of a virtual machine scale set. +type OrchestrationServiceSummary struct { + // READ-ONLY; The name of the service. + ServiceName *OrchestrationServiceNames + + // READ-ONLY; The current state of the service. + ServiceState *OrchestrationServiceState +} + +// 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 + + // READ-ONLY; The state of the patch after the installation operation completed. + InstallationState *PatchInstallationState + + // READ-ONLY; The KBID of the patch. Only applies to Windows patches. + KbID *string + + // READ-ONLY; The friendly name of the patch. + Name *string + + // READ-ONLY; A unique identifier for the patch. + PatchID *string + + // READ-ONLY; The version string of the package. It may conform to Semantic Versioning. Only applies to Linux. + Version *string +} + +// 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 + + // Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Windows. + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings + + // 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 + + // 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 +} + +// PirCommunityGalleryResource - Base information about the community gallery resource in pir. +type PirCommunityGalleryResource struct { + // The identifier information of community gallery. + Identifier *CommunityGalleryIdentifier + + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// PirResource - The Resource model definition. +type PirResource struct { + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string +} + +// PirSharedGalleryResource - Base information about the shared gallery resource in pir. +type PirSharedGalleryResource struct { + // The identifier information of shared gallery. + Identifier *SharedGalleryIdentifier + + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string +} + +// 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 + + // Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. + Product *string + + // The promotion code. + PromotionCode *string + + // The publisher ID. + Publisher *string +} + +// PolicyViolation - A policy violation reported against a gallery artifact. +type PolicyViolation struct { + // Describes the nature of the policy violation. + Category *PolicyViolationCategory + + // Describes specific details about why this policy violation was reported. + Details *string +} + +// 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 + + // The percentage of VM instances, after the base regular priority count has been reached, that are expected to use regular + // priority. + RegularPriorityPercentageAboveBase *int32 +} + +// PrivateEndpoint - The Private Endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for Private Endpoint + ID *string +} + +// PrivateEndpointConnection - The Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + // Resource properties. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; private endpoint connection Id + ID *string + + // READ-ONLY; private endpoint connection name + Name *string + + // READ-ONLY; private endpoint connection type + Type *string +} + +// 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 + + // Array of private endpoint connections + Value []*PrivateEndpointConnection +} + +// 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 + + // READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + // Resource properties. + Properties *PrivateLinkResourceProperties + + // READ-ONLY; private link resource Id + ID *string + + // READ-ONLY; private link resource name + Name *string + + // READ-ONLY; private link resource type + Type *string +} + +// PrivateLinkResourceListResult - A list of private link resources +type PrivateLinkResourceListResult struct { + // Array of private link resources + Value []*PrivateLinkResource +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource DNS zone name. + RequiredZoneNames []*string + + // READ-ONLY; The private link resource group id. + GroupID *string + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string +} + +// 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 + + // The reason for approval/rejection of the connection. + Description *string + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus +} + +// 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 +} + +// ProximityPlacementGroup - Specifies information about the proximity placement group. +type ProximityPlacementGroup struct { + // REQUIRED; Resource location + Location *string + + // Describes the properties of a Proximity Placement Group. + Properties *ProximityPlacementGroupProperties + + // Resource tags + Tags map[string]*string + + // 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 + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// ProximityPlacementGroupListResult - The List Proximity Placement Group operation response. +type ProximityPlacementGroupListResult struct { + // REQUIRED; The list of proximity placement groups + Value []*ProximityPlacementGroup + + // The URI to fetch the next page of proximity placement groups. + NextLink *string +} + +// ProximityPlacementGroupProperties - Describes the properties of a Proximity Placement Group. +type ProximityPlacementGroupProperties struct { + // Describes colocation status of the Proximity Placement Group. + ColocationStatus *InstanceViewStatus + + // Specifies the user intent of the proximity placement group. + Intent *ProximityPlacementGroupPropertiesIntent + + // 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 + + // READ-ONLY; A list of references to all availability sets in the proximity placement group. + AvailabilitySets []*SubResourceWithColocationStatus + + // READ-ONLY; A list of references to all virtual machine scale sets in the proximity placement group. + VirtualMachineScaleSets []*SubResourceWithColocationStatus + + // READ-ONLY; A list of references to all virtual machines in the proximity placement group. + VirtualMachines []*SubResourceWithColocationStatus +} + +// 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 +} + +// ProximityPlacementGroupUpdate - Specifies information about the proximity placement group. +type ProximityPlacementGroupUpdate struct { + // Resource tags + Tags map[string]*string +} + +// ProxyOnlyResource - The ProxyOnly Resource model definition. +type ProxyOnlyResource struct { + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // Specify public IP sku tier + Tier *PublicIPAddressSKUTier +} + +// PurchasePlan - Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. +type PurchasePlan struct { + // REQUIRED; The plan ID. + Name *string + + // REQUIRED; Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference + // element. + Product *string + + // REQUIRED; The publisher ID. + Publisher *string +} + +// 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 + + // Describes the resource range. + VCPUs *ResourceRange +} + +// 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 + + // READ-ONLY; Whether the recovery walk was performed + WalkPerformed *bool +} + +// RegionalReplicationStatus - This is the regional replication status. +type RegionalReplicationStatus struct { + // READ-ONLY; The details of the replication status. + Details *string + + // READ-ONLY; It indicates progress of the replication job. + Progress *int32 + + // READ-ONLY; The region to which the gallery image version is being replicated to. + Region *string + + // READ-ONLY; This is the regional replication state. + State *ReplicationState +} + +// RegionalSharingStatus - Gallery regional sharing status +type RegionalSharingStatus struct { + // Details of gallery regional sharing failure. + Details *string + + // Region name + Region *string + + // READ-ONLY; Gallery sharing state in current region + State *SharingState +} + +// 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 + + // READ-ONLY; This is a summary of replication status for each region. + Summary []*RegionalReplicationStatus +} + +// 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 + + // REQUIRED; From time of the query + FromTime *time.Time + + // REQUIRED; Interval value in minutes used to create LogAnalytics call rate logs. + IntervalLength *IntervalInMins + + // REQUIRED; To time of the query + ToTime *time.Time + + // Group query result by Client Application ID. + GroupByClientApplicationID *bool + + // Group query result by Operation Name. + GroupByOperationName *bool + + // Group query result by Resource Name. + GroupByResourceName *bool + + // Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool + + // Group query result by User Agent. + GroupByUserAgent *bool +} + +// Resource - The Resource model definition. +type Resource struct { + // REQUIRED; Resource location + Location *string + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// ResourceInstanceViewStatus - Instance view status. +type ResourceInstanceViewStatus struct { + // The level code. + Level *StatusLevelTypes + + // READ-ONLY; The status code. + Code *string + + // READ-ONLY; The short localizable label for the status. + DisplayStatus *string + + // READ-ONLY; The detailed status message, including for alerts and error messages. + Message *string + + // READ-ONLY; The time of the status. + Time *time.Time +} + +// ResourceRange - Describes the resource range. +type ResourceRange struct { + // The maximum number of the resource. + Max *int32 + + // The minimum number of the resource. + Min *int32 +} + +// ResourceSKU - Describes an available Compute SKU. +type ResourceSKU struct { + // READ-ONLY; The api versions that support this SKU. + APIVersions []*string + + // READ-ONLY; A name value pair to describe the capability. + Capabilities []*ResourceSKUCapabilities + + // READ-ONLY; Specifies the number of virtual machines in the scale set. + Capacity *ResourceSKUCapacity + + // READ-ONLY; Metadata for retrieving price info. + Costs []*ResourceSKUCosts + + // READ-ONLY; The Family of this particular SKU. + Family *string + + // READ-ONLY; The Kind of resources that are supported in this SKU. + Kind *string + + // READ-ONLY; A list of locations and availability zones in those locations where the SKU is available. + LocationInfo []*ResourceSKULocationInfo + + // READ-ONLY; The set of locations that the SKU is available. + Locations []*string + + // READ-ONLY; The name of SKU. + Name *string + + // READ-ONLY; The type of resource the SKU applies to. + ResourceType *string + + // READ-ONLY; The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + Restrictions []*ResourceSKURestrictions + + // READ-ONLY; The Size of the SKU. + Size *string + + // READ-ONLY; Specifies the tier of virtual machines in a scale set. + // Possible Values: + // Standard + // Basic + Tier *string +} + +// ResourceSKUCapabilities - Describes The SKU capabilities object. +type ResourceSKUCapabilities struct { + // READ-ONLY; An invariant to describe the feature. + Name *string + + // READ-ONLY; An invariant if the feature is measured by quantity. + Value *string +} + +// ResourceSKUCapacity - Describes scaling information of a SKU. +type ResourceSKUCapacity struct { + // READ-ONLY; The default capacity. + Default *int64 + + // READ-ONLY; The maximum capacity that can be set. + Maximum *int64 + + // READ-ONLY; The minimum capacity. + Minimum *int64 + + // READ-ONLY; The scale type applicable to the sku. + ScaleType *ResourceSKUCapacityScaleType +} + +// ResourceSKUCosts - Describes metadata for retrieving price info. +type ResourceSKUCosts struct { + // READ-ONLY; An invariant to show the extended unit. + ExtendedUnit *string + + // READ-ONLY; Used for querying price from commerce. + MeterID *string + + // READ-ONLY; The multiplier is needed to extend the base metered cost. + Quantity *int64 +} + +// ResourceSKULocationInfo - Describes an available Compute SKU Location Information. +type ResourceSKULocationInfo struct { + // READ-ONLY; The names of extended locations. + ExtendedLocations []*string + + // READ-ONLY; Location of the SKU + Location *string + + // READ-ONLY; The type of the extended location. + Type *ExtendedLocationType + + // READ-ONLY; Details of capabilities available to a SKU in specific zones. + ZoneDetails []*ResourceSKUZoneDetails + + // READ-ONLY; List of availability zones where the SKU is supported. + Zones []*string +} + +// ResourceSKURestrictionInfo - Describes an available Compute SKU Restriction Information. +type ResourceSKURestrictionInfo struct { + // READ-ONLY; Locations where the SKU is restricted + Locations []*string + + // READ-ONLY; List of availability zones where the SKU is restricted. + Zones []*string +} + +// ResourceSKURestrictions - Describes scaling information of a SKU. +type ResourceSKURestrictions struct { + // READ-ONLY; The reason for restriction. + ReasonCode *ResourceSKURestrictionsReasonCode + + // READ-ONLY; The information about the restriction where the SKU cannot be used. + RestrictionInfo *ResourceSKURestrictionInfo + + // READ-ONLY; The type of restrictions. + Type *ResourceSKURestrictionsType + + // 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 +} + +// 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 + + // READ-ONLY; The set of zones that the SKU is available in with the specified capabilities. + Name []*string +} + +// ResourceSKUsResult - The List Resource Skus operation response. +type ResourceSKUsResult struct { + // REQUIRED; The list of skus available for the subscription. + Value []*ResourceSKU + + // 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 +} + +// 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 + + // The uri to fetch the next page of encrypted resources. Call ListNext() with this to fetch the next page of encrypted resources. + NextLink *string +} + +// ResourceWithOptionalLocation - The Resource model definition with location property as optional. +type ResourceWithOptionalLocation struct { + // Resource location + Location *string + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// RestorePoint - Restore Point details. +type RestorePoint struct { + // The restore point properties. + Properties *RestorePointProperties + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// RestorePointCollection - Create or update Restore Point collection parameters. +type RestorePointCollection struct { + // REQUIRED; Resource location + Location *string + + // The restore point collection properties. + Properties *RestorePointCollectionProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // Gets the list of restore point collections. + Value []*RestorePointCollection +} + +// 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 + + // READ-ONLY; The provisioning state of the restore point collection. + ProvisioningState *string + + // READ-ONLY; The unique id of the restore point collection. + RestorePointCollectionID *string + + // READ-ONLY; A list containing all restore points created under this restore point collection. + RestorePoints []*RestorePoint +} + +// 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 + + // READ-ONLY; Location of the source resource used to create this restore point collection. + Location *string +} + +// RestorePointCollectionUpdate - Update Restore Point collection parameters. +type RestorePointCollectionUpdate struct { + // The restore point collection properties. + Properties *RestorePointCollectionProperties + + // Resource tags + Tags map[string]*string +} + +// RestorePointEncryption - Encryption at rest settings for disk restore point. It is an optional property that can be specified +// in the input while creating a restore point. +type RestorePointEncryption struct { + // 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. + DiskEncryptionSet *DiskEncryptionSetParameters + + // The type of key used to encrypt the data of the disk restore point. + Type *RestorePointEncryptionType +} + +// RestorePointInstanceView - The instance view of a restore point. +type RestorePointInstanceView struct { + // The disk restore points information. + DiskRestorePoints []*DiskRestorePointInstanceView + + // The resource status information. + Statuses []*InstanceViewStatus +} + +// 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 + + // 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 + + // Gets the details of the VM captured at the time of the restore point creation. + SourceMetadata *RestorePointSourceMetadata + + // Resource Id of the source restore point from which a copy needs to be created. + SourceRestorePoint *APIEntityReference + + // Gets the creation time of the restore point. + TimeCreated *time.Time + + // READ-ONLY; The restore point instance view. + InstanceView *RestorePointInstanceView + + // READ-ONLY; Gets the provisioning state of the restore point. + ProvisioningState *string +} + +// 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 storage profile. + StorageProfile *RestorePointSourceVMStorageProfile + + // READ-ONLY; Gets the diagnostics profile. + DiagnosticsProfile *DiagnosticsProfile + + // READ-ONLY; Gets the hardware profile. + HardwareProfile *HardwareProfile + + // READ-ONLY; HyperVGeneration of the source VM for which restore point is captured. + HyperVGeneration *HyperVGenerationTypes + + // READ-ONLY; Gets the license type, which is for bring your own license scenario. + LicenseType *string + + // READ-ONLY; Location of the VM from which the restore point was created. + Location *string + + // READ-ONLY; Gets the OS profile. + OSProfile *OSProfile + + // READ-ONLY; Gets the security profile. + SecurityProfile *SecurityProfile + + // READ-ONLY; UserData associated with the source VM for which restore point is captured, which is a base-64 encoded value. + UserData *string + + // READ-ONLY; Gets the virtual machine unique id. + VMID *string +} + +// RestorePointSourceVMDataDisk - Describes a data disk. +type RestorePointSourceVMDataDisk struct { + // Contains Disk Restore Point properties. + DiskRestorePoint *DiskRestorePointAttributes + + // Contains the managed disk details. + ManagedDisk *ManagedDiskParameters + + // READ-ONLY; Gets the caching type. + Caching *CachingTypes + + // READ-ONLY; Gets the initial disk size in GB for blank data disks, and the new desired size for existing OS and Data disks. + DiskSizeGB *int32 + + // READ-ONLY; Gets the logical unit number. + Lun *int32 + + // READ-ONLY; Gets the disk name. + Name *string + + // READ-ONLY; Shows true if the disk is write-accelerator enabled. + WriteAcceleratorEnabled *bool +} + +// RestorePointSourceVMOSDisk - Describes an Operating System disk. +type RestorePointSourceVMOSDisk struct { + // Contains Disk Restore Point properties. + DiskRestorePoint *DiskRestorePointAttributes + + // Gets the managed disk details + ManagedDisk *ManagedDiskParameters + + // READ-ONLY; Gets the caching type. + Caching *CachingTypes + + // READ-ONLY; Gets the disk size in GB. + DiskSizeGB *int32 + + // READ-ONLY; Gets the disk encryption settings. + EncryptionSettings *DiskEncryptionSettings + + // READ-ONLY; Gets the disk name. + Name *string + + // READ-ONLY; Gets the Operating System type. + OSType *OperatingSystemType + + // READ-ONLY; Shows true if the disk is write-accelerator enabled. + WriteAcceleratorEnabled *bool +} + +// 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 + + // Gets the OS disk of the VM captured at the time of the restore point creation. + OSDisk *RestorePointSourceVMOSDisk +} + +// RetrieveBootDiagnosticsDataResult - The SAS URIs of the console screenshot and serial log blobs. +type RetrieveBootDiagnosticsDataResult struct { + // READ-ONLY; The console screenshot blob URI + ConsoleScreenshotBlobURI *string + + // READ-ONLY; The serial console log blob URI. + SerialConsoleLogBlobURI *string +} + +// RoleInstance - Describes the cloud service role instance. +type RoleInstance struct { + // Role instance properties. + Properties *RoleInstanceProperties + + // The role instance SKU. + SKU *InstanceSKU + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource Location. + Location *string + + // READ-ONLY; Resource Name. + Name *string + + // READ-ONLY; Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource Type. + Type *string +} + +// RoleInstanceListResult - The list operation result. +type RoleInstanceListResult struct { + // REQUIRED; The list of resources. + Value []*RoleInstance + + // 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 +} + +// 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 +} + +// RoleInstanceProperties - Role instance properties. +type RoleInstanceProperties struct { + // The instance view of the role instance. + InstanceView *RoleInstanceView + + // Describes the network profile for the role instance. + NetworkProfile *RoleInstanceNetworkProfile +} + +// RoleInstanceView - The instance view of the role instance. +type RoleInstanceView struct { + // READ-ONLY; The Fault Domain. + PlatformFaultDomain *int32 + + // READ-ONLY; The Update Domain. + PlatformUpdateDomain *int32 + + // 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 + + // READ-ONLY + Statuses []*ResourceInstanceViewStatus +} + +// 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 +} + +// 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 + + // READ-ONLY; Error details if OS rollback failed. + RollbackError *APIError + + // READ-ONLY; The number of instances which have been successfully rolled back. + SuccessfullyRolledbackInstanceCount *int32 +} + +// 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 + + // 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 + + // Create new virtual machines to upgrade the scale set, rather than updating the existing virtual machines. Existing virtual + // machines will be deleted once the new virtual machines are created for each + // batch. + MaxSurge *bool + + // 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 + + // 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 + + // 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 + + // Upgrade all unhealthy instances in a scale set before any healthy instances. + PrioritizeUnhealthyInstances *bool + + // Rollback failed instances to previous model if the Rolling Upgrade policy is violated. + RollbackFailedInstancesOnPolicyBreach *bool +} + +// 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 + + // READ-ONLY; The number of instances that are currently being upgraded. + InProgressInstanceCount *int32 + + // READ-ONLY; The number of instances that have not yet begun to be upgraded. + PendingInstanceCount *int32 + + // READ-ONLY; The number of instances that have been successfully upgraded. + SuccessfulInstanceCount *int32 +} + +// 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 + + // READ-ONLY; The last action performed on the rolling upgrade. + LastAction *RollingUpgradeActionType + + // READ-ONLY; Last action time of the upgrade. + LastActionTime *time.Time + + // READ-ONLY; Start time of the upgrade. + StartTime *time.Time +} + +// RollingUpgradeStatusInfo - The status of the latest virtual machine scale set rolling upgrade. +type RollingUpgradeStatusInfo struct { + // REQUIRED; Resource location + Location *string + + // The status of the latest virtual machine scale set rolling upgrade. + Properties *RollingUpgradeStatusInfoProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // READ-ONLY; The rolling upgrade policies applied for this upgrade. + Policy *RollingUpgradePolicy + + // READ-ONLY; Information about the number of virtual machine instances in each upgrade state. + Progress *RollingUpgradeProgressInfo + + // READ-ONLY; Information about the current running state of the overall upgrade. + RunningStatus *RollingUpgradeRunningStatus +} + +// RunCommandDocument - Describes the properties of a Run Command. +type RunCommandDocument struct { + // REQUIRED; The VM run command description. + Description *string + + // REQUIRED; The VM run command id. + ID *string + + // REQUIRED; The VM run command label. + Label *string + + // REQUIRED; The Operating System type. + OSType *OperatingSystemTypes + + // REQUIRED; The VM run command schema. + Schema *string + + // REQUIRED; The script to be executed. + Script []*string + + // The parameters used by the script. + Parameters []*RunCommandParameterDefinition +} + +// RunCommandDocumentBase - Describes the properties of a Run Command metadata. +type RunCommandDocumentBase struct { + // REQUIRED; The VM run command description. + Description *string + + // REQUIRED; The VM run command id. + ID *string + + // REQUIRED; The VM run command label. + Label *string + + // REQUIRED; The Operating System type. + OSType *OperatingSystemTypes + + // REQUIRED; The VM run command schema. + Schema *string +} + +// RunCommandInput - Capture Virtual Machine parameters. +type RunCommandInput struct { + // REQUIRED; The run command id. + CommandID *string + + // The run command parameters. + Parameters []*RunCommandInputParameter + + // Optional. The script to be executed. When this value is given, the given script will override the default script of the + // command. + Script []*string +} + +// RunCommandInputParameter - Describes the properties of a run command parameter. +type RunCommandInputParameter struct { + // REQUIRED; The run command parameter name. + Name *string + + // REQUIRED; The run command parameter value. + Value *string +} + +// RunCommandListResult - The List Virtual Machine operation response. +type RunCommandListResult struct { + // REQUIRED; The list of virtual machine run commands. + Value []*RunCommandDocumentBase + + // The uri to fetch the next page of run commands. Call ListNext() with this to fetch the next page of run commands. + NextLink *string +} + +// RunCommandManagedIdentity - Contains clientId or objectId (use only one, not both) of a user-assigned managed identity +// that has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object in case of +// system-assigned identity. Make sure the Azure storage blob exists in case of scriptUri, and managed identity has been given +// access to blob's container with 'Storage Blob Data Reader' role assignment +// with scriptUri blob and 'Storage Blob Data Contributor' for Append blobs(outputBlobUri, errorBlobUri). In case of user +// assigned identity, make sure you add it under VM's identity. For more info on +// managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. +type RunCommandManagedIdentity struct { + // Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided. + ClientID *string + + // Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided. + ObjectID *string +} + +// RunCommandParameterDefinition - Describes the properties of a run command parameter. +type RunCommandParameterDefinition struct { + // REQUIRED; The run command parameter name. + Name *string + + // REQUIRED; The run command parameter type. + Type *string + + // The run command parameter default value. + DefaultValue *string + + // The run command parameter required. + Required *bool +} + +type RunCommandResult struct { + // Run command operation response. + Value []*InstanceViewStatus +} + +// 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 + + // The sku name. + Name *string + + // Specifies the tier of virtual machines in a scale set. + // Possible Values: + // Standard + // Basic + Tier *string +} + +// 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 +} + +// 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 + + // 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 +} + +// 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 + + // 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 + + // 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 +} + +// SSHPublicKeyResource - Specifies information about the SSH public key. +type SSHPublicKeyResource struct { + // REQUIRED; Resource location + Location *string + + // Properties of the SSH public key. + Properties *SSHPublicKeyResourceProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 +} + +// SSHPublicKeyUpdateResource - Specifies information about the SSH public key. +type SSHPublicKeyUpdateResource struct { + // Properties of the SSH public key. + Properties *SSHPublicKeyResourceProperties + + // Resource tags + Tags map[string]*string +} + +// SSHPublicKeysGroupListResult - The list SSH public keys operation response. +type SSHPublicKeysGroupListResult struct { + // REQUIRED; The list of SSH public keys + Value []*SSHPublicKeyResource + + // 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 +} + +// 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 + + // 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 +} + +type ScheduledEventsProfile struct { + // Specifies OS Image Scheduled Event related configurations. + OSImageNotificationProfile *OSImageNotificationProfile + + // Specifies Terminate Scheduled Event related configurations. + TerminateNotificationProfile *TerminateNotificationProfile +} + +// SecurityPostureReference - Specifies the security posture to be used for all virtual machines in the scale set. Minimum +// api-version: 2023-03-01 +type SecurityPostureReference struct { + // List of virtual machine extensions to exclude when applying the Security Posture. + ExcludeExtensions []*VirtualMachineExtension + + // The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest + ID *string +} + +// 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. The default behavior is: The Encryption at host will be disabled unless this + // property is set to true for the resource. + EncryptionAtHost *bool + + // Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. The + // default behavior is: UefiSettings will not be enabled unless this property is + // set. + SecurityType *SecurityTypes + + // Specifies the security settings like secure boot and vTPM used while creating the virtual machine. Minimum api-version: + // 2020-12-01. + UefiSettings *UefiSettings +} + +// ServiceArtifactReference - Specifies the service artifact reference id used to set same image version for all virtual machines +// in the scale set when using 'latest' image version. Minimum api-version: 2022-11-01 +type ServiceArtifactReference struct { + // The service artifact reference id in the form of + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName} + ID *string +} + +type ShareInfoElement struct { + // READ-ONLY; A relative URI containing the ID of the VM that has the disk attached. + VMURI *string +} + +// 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 + + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string +} + +// 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 + + // The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + HostCaching *SharedGalleryHostCaching + + // READ-ONLY; This property indicates the size of the VHD to be created. + DiskSizeGB *int32 +} + +// 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 + + // READ-ONLY; This property indicates the size of the VHD to be created. + DiskSizeGB *int32 +} + +// SharedGalleryIdentifier - The identifier information of shared gallery. +type SharedGalleryIdentifier struct { + // The unique id of this shared gallery. + UniqueID *string +} + +// 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 + + // Describes the properties of a gallery image definition. + Properties *SharedGalleryImageProperties + + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string +} + +// SharedGalleryImageList - The List Shared Gallery Images operation response. +type SharedGalleryImageList struct { + // REQUIRED; A list of shared gallery images. + Value []*SharedGalleryImage + + // 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 +} + +// SharedGalleryImageProperties - Describes the properties of a gallery image definition. +type SharedGalleryImageProperties struct { + // REQUIRED; This is the gallery image definition identifier. + Identifier *GalleryImageIdentifier + + // REQUIRED; This property allows the user to specify whether the virtual machines created under this image are 'Generalized' + // or 'Specialized'. + OSState *OperatingSystemStateTypes + + // 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 + + // The architecture of the image. Applicable to OS disks only. + Architecture *Architecture + + // Describes the disallowed disk types. + Disallowed *Disallowed + + // 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 + + // End-user license agreement for the current community gallery image. + Eula *string + + // A list of gallery image features. + Features []*GalleryImageFeature + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration + + // Privacy statement uri for the current community gallery image. + PrivacyStatementURI *string + + // Describes the gallery image definition purchase plan. This is used by marketplace images. + PurchasePlan *ImagePurchasePlan + + // The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + Recommended *RecommendedMachineConfiguration +} + +// 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 + + // Describes the properties of a gallery image version. + Properties *SharedGalleryImageVersionProperties + + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Resource name + Name *string +} + +// SharedGalleryImageVersionList - The List Shared Gallery Image versions operation response. +type SharedGalleryImageVersionList struct { + // REQUIRED; A list of shared gallery images versions. + Value []*SharedGalleryImageVersion + + // 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 +} + +// 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 + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool + + // The published date of the gallery image version Definition. This property can be used for decommissioning purposes. This + // property is updatable. + PublishedDate *time.Time + + // Describes the storage profile of the image version. + StorageProfile *SharedGalleryImageVersionStorageProfile +} + +// SharedGalleryImageVersionStorageProfile - This is the storage profile of a Gallery Image Version. +type SharedGalleryImageVersionStorageProfile struct { + // A list of data disk images. + DataDiskImages []*SharedGalleryDataDiskImage + + // This is the OS disk image. + OSDiskImage *SharedGalleryOSDiskImage +} + +// SharedGalleryList - The List Shared Galleries operation response. +type SharedGalleryList struct { + // REQUIRED; A list of shared galleries. + Value []*SharedGallery + + // The uri to fetch the next page of shared galleries. Call ListNext() with this to fetch the next page of shared galleries. + NextLink *string +} + +// 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 + + // READ-ONLY; This property indicates the size of the VHD to be created. + DiskSizeGB *int32 +} + +// 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 + + // This property allows you to specify the permission of sharing gallery. + // Possible values are: + // Private + // Groups + // Community + Permissions *GallerySharingPermissionTypes + + // READ-ONLY; A list of sharing profile groups. + Groups []*SharingProfileGroup +} + +// 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 + + // This property allows you to specify the type of sharing group. + // Possible values are: + // Subscriptions + // AADTenants + Type *SharingProfileGroupTypes +} + +// SharingStatus - Sharing status of current gallery. +type SharingStatus struct { + // Summary of all regional sharing status. + Summary []*RegionalSharingStatus + + // READ-ONLY; Aggregated sharing state of current gallery. + AggregatedState *SharingState +} + +// 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 + + // A list of sharing profile groups. + Groups []*SharingProfileGroup +} + +// Snapshot resource. +type Snapshot struct { + // REQUIRED; Resource location + Location *string + + // The extended location where the snapshot will be created. Extended location cannot be changed. + ExtendedLocation *ExtendedLocation + + // Snapshot resource properties. + Properties *SnapshotProperties + + // 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 + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Unused. Always Null. + ManagedBy *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// SnapshotList - The List Snapshots operation response. +type SnapshotList struct { + // REQUIRED; A list of snapshots. + Value []*Snapshot + + // The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. + NextLink *string +} + +// SnapshotProperties - Snapshot resource properties. +type SnapshotProperties struct { + // REQUIRED; Disk source information. CreationData information cannot be changed after the disk has been created. + CreationData *CreationData + + // Percentage complete for the background copy when a resource is created via the CopyStart operation. + CompletionPercent *float32 + + // Indicates the error details if the background copy of a resource created via the CopyStart operation fails. + CopyCompletionError *CopyCompletionError + + // Additional authentication requirements when exporting or uploading to a disk or snapshot. + DataAccessAuthMode *DataAccessAuthMode + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string + + // 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 + + // Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption + + // Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration + + // Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can + // be diffed. + Incremental *bool + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy + + // The Operating System type. + OSType *OperatingSystemTypes + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess + + // Purchase plan information for the image from which the source disk for the snapshot was originally created. + PurchasePlan *DiskPurchasePlan + + // Contains the security related information for the resource. + SecurityProfile *DiskSecurityProfile + + // List of supported capabilities for the image from which the source disk from the snapshot was originally created. + SupportedCapabilities *SupportedCapabilities + + // Indicates the OS on a snapshot supports hibernation. + SupportsHibernation *bool + + // READ-ONLY; The size of the disk in bytes. This field is read only. + DiskSizeBytes *int64 + + // READ-ONLY; The state of the snapshot. + DiskState *DiskState + + // 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 + + // READ-ONLY; The disk provisioning state. + ProvisioningState *string + + // READ-ONLY; The time when the snapshot was created. + TimeCreated *time.Time + + // READ-ONLY; Unique Guid identifying the resource. + UniqueID *string +} + +// 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 + + // READ-ONLY; The sku tier. + Tier *string +} + +// SnapshotUpdate - Snapshot update resource. +type SnapshotUpdate struct { + // Snapshot resource update properties. + Properties *SnapshotUpdateProperties + + // 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 + + // Resource tags + Tags map[string]*string +} + +// SnapshotUpdateProperties - Snapshot resource update properties. +type SnapshotUpdateProperties struct { + // Additional authentication requirements when exporting or uploading to a disk or snapshot. + DataAccessAuthMode *DataAccessAuthMode + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string + + // 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 + + // Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption + + // Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy + + // the Operating System type. + OSType *OperatingSystemTypes + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess + + // List of supported capabilities for the image from which the OS disk was created. + SupportedCapabilities *SupportedCapabilities + + // Indicates the OS on a snapshot supports hibernation. + SupportsHibernation *bool +} + +// 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 +} + +// 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 +} + +// 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 + + // Timeout value expressed as an ISO 8601 time duration after which the platform will not try to restore the VMSS SPOT instances + RestoreTimeout *string +} + +// 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 + + // READ-ONLY; Number of instances having this status code + Count *int32 +} + +// 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 + + // 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 with + // 'hyperVGeneration' set to 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 + + // 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 + + // 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 +} + +type SubResource struct { + // Resource Id + ID *string +} + +type SubResourceReadOnly struct { + // READ-ONLY; Resource Id + ID *string +} + +type SubResourceWithColocationStatus struct { + // Describes colocation status of a resource in the Proximity Placement Group. + ColocationStatus *InstanceViewStatus + + // Resource Id + ID *string +} + +// 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 + + // CPU architecture supported by an OS disk. + Architecture *Architecture + + // The disk controllers that an OS disk supports. If set it can be SCSI or SCSI, NVME or NVME, SCSI. + DiskControllerTypes *string +} + +// 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 + + // 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 +} + +// TargetRegion - Describes the target region information. +type TargetRegion struct { + // REQUIRED; The name of the region. + Name *string + + // Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. + Encryption *EncryptionImages + + // Contains the flag setting to hide an image when users specify version='latest' + ExcludeFromLatest *bool + + // The number of replicas of the Image Version to be created per region. This property is updatable. + RegionalReplicaCount *int32 + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *StorageAccountType +} + +type TerminateNotificationProfile struct { + // Specifies whether the Terminate Scheduled event is enabled or disabled. + Enable *bool + + // 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 +} + +// 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 + + // REQUIRED; From time of the query + FromTime *time.Time + + // REQUIRED; To time of the query + ToTime *time.Time + + // Group query result by Client Application ID. + GroupByClientApplicationID *bool + + // Group query result by Operation Name. + GroupByOperationName *bool + + // Group query result by Resource Name. + GroupByResourceName *bool + + // Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool + + // Group query result by User Agent. + GroupByUserAgent *bool +} + +// 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 + + // Specifies whether vTPM should be enabled on the virtual machine. Minimum api-version: 2020-12-01. + VTpmEnabled *bool +} + +// UpdateDomain - Defines an update domain for the cloud service. +type UpdateDomain struct { + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource Name + Name *string +} + +// UpdateDomainListResult - The list operation result. +type UpdateDomainListResult struct { + // REQUIRED; The list of resources. + Value []*UpdateDomain + + // 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 +} + +// UpdateResource - The Update Resource model definition. +type UpdateResource struct { + // Resource tags + Tags map[string]*string +} + +// UpdateResourceDefinition - The Update Resource model definition. +type UpdateResourceDefinition struct { + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// UpgradeOperationHistoricalStatusInfo - Virtual Machine Scale Set OS Upgrade History operation response. +type UpgradeOperationHistoricalStatusInfo struct { + // READ-ONLY; Resource location + Location *string + + // READ-ONLY; Information about the properties of the upgrade operation. + Properties *UpgradeOperationHistoricalStatusInfoProperties + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // READ-ONLY; Counts of the VMs in each state. + Progress *RollingUpgradeProgressInfo + + // READ-ONLY; Information about OS rollback if performed + RollbackInfo *RollbackStatusInfo + + // READ-ONLY; Information about the overall status of the upgrade operation. + RunningStatus *UpgradeOperationHistoryStatus + + // READ-ONLY; Invoker of the Upgrade Operation + StartedBy *UpgradeOperationInvoker + + // READ-ONLY; Image Reference details + TargetImageReference *ImageReference +} + +// 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 + + // READ-ONLY; End time of the upgrade. + EndTime *time.Time + + // READ-ONLY; Start time of the upgrade. + StartTime *time.Time +} + +// UpgradePolicy - Describes an upgrade policy - automatic, manual, or rolling. +type UpgradePolicy struct { + // Configuration parameters used for performing automatic OS Upgrade. + AutomaticOSUpgradePolicy *AutomaticOSUpgradePolicy + + // 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 + + // The configuration parameters used while performing a rolling upgrade. + RollingUpgradePolicy *RollingUpgradePolicy +} + +// Usage - Describes Compute Resource Usage. +type Usage struct { + // REQUIRED; The current usage of the resource. + CurrentValue *int32 + + // REQUIRED; The maximum permitted usage of the resource. + Limit *int64 + + // REQUIRED; The name of the type of usage. + Name *UsageName + + // REQUIRED; An enum describing the unit of usage measurement. + Unit *string +} + +// UsageName - The Usage Names. +type UsageName struct { + // The localized name of the resource. + LocalizedValue *string + + // The name of the resource. + Value *string +} + +type UserArtifactManage struct { + // REQUIRED; Required. The path and arguments to install the gallery application. This is limited to 4096 characters. + Install *string + + // REQUIRED; Required. The path and arguments to remove the gallery application. This is limited to 4096 characters. + Remove *string + + // 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 +} + +// 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 + + // 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 +} + +// 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 + + // Optional. The defaultConfigurationLink of the artifact, must be a readable storage page blob. + DefaultConfigurationLink *string +} + +type UserAssignedIdentitiesValue struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string +} + +// 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 + + // 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 +} + +// 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 + + // Optional, Specifies the uri to an azure blob that will replace the default configuration for the package if provided + ConfigurationReference *string + + // 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 + + // Optional, Specifies the order in which the packages have to be installed + Order *int32 + + // Optional, Specifies a passthrough value for more generic context. + Tags *string + + // Optional, If true, any failure for any operation in the VmApplication will fail the deployment + TreatFailureAsDeploymentFailure *bool +} + +// 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 + + // The list of VMImages in EdgeZone + Value []*VirtualMachineImageResource +} + +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 +} + +// 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 + + // 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 +} + +// 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 + + // 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 +} + +// 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 + + // The list of key vault references in SourceVault which contain certificates. + VaultCertificates []*VaultCertificate +} + +// VirtualHardDisk - Describes the uri of a disk. +type VirtualHardDisk struct { + // Specifies the virtual hard disk's uri. + URI *string +} + +// VirtualMachine - Describes a Virtual Machine. +type VirtualMachine struct { + // REQUIRED; Resource location + Location *string + + // The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation + + // The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity + + // 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 + + // Describes the properties of a Virtual Machine. + Properties *VirtualMachineProperties + + // Resource tags + Tags map[string]*string + + // The virtual machine zones. + Zones []*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; The virtual machine child extension resources. + Resources []*VirtualMachineExtension + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // The resource status information. + Statuses []*InstanceViewStatus + + // The VM Agent full version. + VMAgentVersion *string +} + +// 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 + + // READ-ONLY; The list of patches that have been detected as available for installation. + AvailablePatches []*VirtualMachineSoftwarePatchProperties + + // READ-ONLY; The number of critical or security patches that have been detected as available and not yet installed. + CriticalAndSecurityPatchCount *int32 + + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + Error *APIError + + // READ-ONLY; The number of all available patches excluding critical and security. + OtherPatchCount *int32 + + // 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 + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time + + // 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 +} + +// VirtualMachineCaptureParameters - Capture Virtual Machine parameters. +type VirtualMachineCaptureParameters struct { + // REQUIRED; The destination container name. + DestinationContainerName *string + + // REQUIRED; Specifies whether to overwrite the destination virtual hard disk, in case of conflict. + OverwriteVhds *bool + + // REQUIRED; The captured virtual hard disk's name prefix. + VhdPrefix *string +} + +// VirtualMachineCaptureResult - Output of virtual machine capture operation. +type VirtualMachineCaptureResult struct { + // Resource Id + ID *string + + // READ-ONLY; the version of the content + ContentVersion *string + + // READ-ONLY; parameters of the captured virtual machine + Parameters any + + // READ-ONLY; a list of resource items of the captured virtual machine + Resources []any + + // READ-ONLY; the schema of the captured virtual machine + Schema *string +} + +// VirtualMachineExtension - Describes a Virtual Machine Extension. +type VirtualMachineExtension struct { + // Resource location + Location *string + + // Describes the properties of a Virtual Machine Extension. + Properties *VirtualMachineExtensionProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// VirtualMachineExtensionHandlerInstanceView - The instance view of a virtual machine extension handler. +type VirtualMachineExtensionHandlerInstanceView struct { + // The extension handler status. + Status *InstanceViewStatus + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string +} + +// VirtualMachineExtensionImage - Describes a Virtual Machine Extension Image. +type VirtualMachineExtensionImage struct { + // REQUIRED; Resource location + Location *string + + // Describes the properties of a Virtual Machine Extension Image. + Properties *VirtualMachineExtensionImageProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // REQUIRED; The schema defined by publisher, where extension consumers should provide settings in a matching schema. + HandlerSchema *string + + // REQUIRED; The operating system this extension supports. + OperatingSystem *string + + // Whether the handler can support multiple extensions. + SupportsMultipleExtensions *bool + + // 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 +} + +// VirtualMachineExtensionInstanceView - The instance view of a virtual machine extension. +type VirtualMachineExtensionInstanceView struct { + // The virtual machine extension name. + Name *string + + // The resource status information. + Statuses []*InstanceViewStatus + + // The resource status information. + Substatuses []*InstanceViewStatus + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string +} + +// 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 + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension + // available. + EnableAutomaticUpgrade *bool + + // How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string + + // The virtual machine extension instance view. + InstanceView *VirtualMachineExtensionInstanceView + + // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings any + + // The extensions protected settings that are passed by reference, and consumed from key vault + ProtectedSettingsFromKeyVault *KeyVaultSecretReference + + // Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions []*string + + // The name of the extension handler publisher. + Publisher *string + + // Json formatted public settings for the extension. + Settings any + + // 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 + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string +} + +// VirtualMachineExtensionUpdate - Describes a Virtual Machine Extension. +type VirtualMachineExtensionUpdate struct { + // Describes the properties of a Virtual Machine Extension. + Properties *VirtualMachineExtensionUpdateProperties + + // Resource tags + Tags map[string]*string +} + +// 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 + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension + // available. + EnableAutomaticUpgrade *bool + + // How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string + + // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings any + + // The extensions protected settings that are passed by reference, and consumed from key vault + ProtectedSettingsFromKeyVault *KeyVaultSecretReference + + // The name of the extension handler publisher. + Publisher *string + + // Json formatted public settings for the extension. + Settings any + + // 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 + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string +} + +// VirtualMachineExtensionsListResult - The List Extension operation response +type VirtualMachineExtensionsListResult struct { + // The list of extensions + Value []*VirtualMachineExtension +} + +// VirtualMachineHealthStatus - The health status of the VM. +type VirtualMachineHealthStatus struct { + // READ-ONLY; The health status information for the VM. + Status *InstanceViewStatus +} + +// VirtualMachineIPTag - Contains the IP tag associated with the public IP address. +type VirtualMachineIPTag struct { + // IP tag type. Example: FirstPartyUsage. + IPTagType *string + + // IP tag associated with the public IP. Example: SQL, Storage etc. + Tag *string +} + +// 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 + + // 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 + + // READ-ONLY; The principal id of virtual machine identity. This property will only be provided for a system assigned identity. + PrincipalID *string + + // READ-ONLY; The tenant id associated with the virtual machine. This property will only be provided for a system assigned + // identity. + TenantID *string +} + +// VirtualMachineImage - Describes a Virtual Machine Image. +type VirtualMachineImage struct { + // REQUIRED; The supported Azure location of the resource. + Location *string + + // REQUIRED; The name of the resource. + Name *string + + // The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation + + // Resource Id + ID *string + + // Describes the properties of a Virtual Machine Image. + Properties *VirtualMachineImageProperties + + // 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 +} + +// VirtualMachineImageFeature - Specifies additional capabilities supported by the image +type VirtualMachineImageFeature struct { + // The name of the feature. + Name *string + + // The corresponding value for the feature. + Value *string +} + +// VirtualMachineImageProperties - Describes the properties of a Virtual Machine Image. +type VirtualMachineImageProperties struct { + // Specifies the Architecture Type + Architecture *ArchitectureTypes + + // Describes automatic OS upgrade properties on the image. + AutomaticOSUpgradeProperties *AutomaticOSUpgradeProperties + DataDiskImages []*DataDiskImage + + // Specifies disallowed configuration for the VirtualMachine created from the image + Disallowed *DisallowedConfiguration + Features []*VirtualMachineImageFeature + + // Specifies the HyperVGeneration Type + HyperVGeneration *HyperVGenerationTypes + + // Describes image deprecation status properties on the image. + ImageDeprecationStatus *ImageDeprecationStatus + + // Contains the os disk image information. + OSDiskImage *OSDiskImage + + // Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + Plan *PurchasePlan +} + +// VirtualMachineImageResource - Virtual machine image resource information. +type VirtualMachineImageResource struct { + // REQUIRED; The supported Azure location of the resource. + Location *string + + // REQUIRED; The name of the resource. + Name *string + + // The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation + + // Resource Id + ID *string + + // 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 +} + +// 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 + + // Input for InstallPatches on a Linux VM, as directly received by the API + LinuxParameters *LinuxParameters + + // 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 + + // Input for InstallPatches on a Windows VM, as directly received by the API + WindowsParameters *WindowsParameters +} + +// 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 + + // READ-ONLY; The number of patches that were not installed due to the user blocking their installation. + ExcludedPatchCount *int32 + + // READ-ONLY; The number of patches that could not be installed due to some issue. See errors for details. + FailedPatchCount *int32 + + // READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension + // logs. + InstallationActivityID *string + + // READ-ONLY; The number of patches successfully installed. + InstalledPatchCount *int32 + + // READ-ONLY; Whether the operation ran out of time before it completed all its intended actions. + MaintenanceWindowExceeded *bool + + // READ-ONLY; The number of patches that were detected as available for install, but did not meet the operation's criteria. + NotSelectedPatchCount *int32 + + // READ-ONLY; The patches that were installed during the operation. + Patches []*PatchInstallationDetail + + // 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 + + // READ-ONLY; The reboot state of the VM following completion of the operation. + RebootStatus *VMGuestPatchRebootStatus + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time + + // 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 +} + +// 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 + + // The computer name assigned to the virtual machine. + ComputerName *string + + // The virtual machine disk information. + Disks []*DiskInstanceView + + // The extensions information. + Extensions []*VirtualMachineExtensionInstanceView + + // Specifies the HyperVGeneration Type associated with a resource + HyperVGeneration *HyperVGenerationType + + // The Maintenance Operation status on the virtual machine. + MaintenanceRedeployStatus *MaintenanceRedeployStatus + + // The Operating System running on the virtual machine. + OSName *string + + // The version of Operating System running on the virtual machine. + OSVersion *string + + // [Preview Feature] The status of virtual machine patch operations. + PatchStatus *VirtualMachinePatchStatus + + // Specifies the fault domain of the virtual machine. + PlatformFaultDomain *int32 + + // Specifies the update domain of the virtual machine. + PlatformUpdateDomain *int32 + + // The Remote desktop certificate thumbprint. + RdpThumbPrint *string + + // The resource status information. + Statuses []*InstanceViewStatus + + // The VM Agent running on the virtual machine. + VMAgent *VirtualMachineAgentInstanceView + + // 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 + + // READ-ONLY; The health status for the VM. + VMHealth *VirtualMachineHealthStatus +} + +// VirtualMachineListResult - The List Virtual Machine operation response. +type VirtualMachineListResult struct { + // REQUIRED; The list of virtual machines. + Value []*VirtualMachine + + // The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next page of Virtual Machines. + NextLink *string +} + +// VirtualMachineNetworkInterfaceConfiguration - Describes a virtual machine network interface configurations. +type VirtualMachineNetworkInterfaceConfiguration struct { + // REQUIRED; The network interface configuration name. + Name *string + + // Describes a virtual machine network profile's IP configuration. + Properties *VirtualMachineNetworkInterfaceConfigurationProperties +} + +// VirtualMachineNetworkInterfaceConfigurationProperties - Describes a virtual machine network profile's IP configuration. +type VirtualMachineNetworkInterfaceConfigurationProperties struct { + // REQUIRED; Specifies the IP configurations of the network interface. + IPConfigurations []*VirtualMachineNetworkInterfaceIPConfiguration + + // Specifies whether the Auxiliary mode is enabled for the Network Interface resource. + AuxiliaryMode *NetworkInterfaceAuxiliaryMode + + // Specifies whether the Auxiliary sku is enabled for the Network Interface resource. + AuxiliarySKU *NetworkInterfaceAuxiliarySKU + + // The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineNetworkInterfaceDNSSettingsConfiguration + + // Specify what happens to the network interface when the VM is deleted + DeleteOption *DeleteOptions + + // Specifies whether the network interface is disabled for tcp state tracking. + DisableTCPStateTracking *bool + DscpConfiguration *SubResource + + // Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool + + // Specifies whether the network interface is FPGA networking-enabled. + EnableFpga *bool + + // Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool + + // The network security group. + NetworkSecurityGroup *SubResource + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool +} + +// VirtualMachineNetworkInterfaceDNSSettingsConfiguration - Describes a virtual machines network configuration's DNS settings. +type VirtualMachineNetworkInterfaceDNSSettingsConfiguration struct { + // List of DNS servers IP addresses + DNSServers []*string +} + +// VirtualMachineNetworkInterfaceIPConfiguration - Describes a virtual machine network profile's IP configuration. +type VirtualMachineNetworkInterfaceIPConfiguration struct { + // REQUIRED; The IP configuration name. + Name *string + + // Describes a virtual machine network interface IP configuration properties. + Properties *VirtualMachineNetworkInterfaceIPConfigurationProperties +} + +// 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 + + // Specifies an array of references to application security group. + ApplicationSecurityGroups []*SubResource + + // 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 + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool + + // 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 + + // The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachinePublicIPAddressConfiguration + + // Specifies the identifier of the subnet. + Subnet *SubResource +} + +// 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 + + // The installation summary of the latest installation operation for the virtual machine. + LastPatchInstallationSummary *LastPatchInstallationSummary + + // READ-ONLY; The enablement status of the specified patchMode + ConfigurationStatuses []*InstanceViewStatus +} + +// VirtualMachineProperties - Describes the properties of a Virtual Machine. +type VirtualMachineProperties struct { + // Specifies additional capabilities enabled or disabled on the virtual machine. + AdditionalCapabilities *AdditionalCapabilities + + // Specifies the gallery applications that should be made available to the VM/VMSS. + ApplicationProfile *ApplicationProfile + + // 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 + + // Specifies the billing related details of a Azure Spot virtual machine. Minimum api-version: 2019-03-01. + BillingProfile *BillingProfile + + // Specifies information about the capacity reservation that is used to allocate virtual machine. Minimum api-version: 2021-04-01. + CapacityReservation *CapacityReservationProfile + + // Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile + + // 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 + + // 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 + + // Specifies the hardware settings for the virtual machine. + HardwareProfile *HardwareProfile + + // Specifies information about the dedicated host that the virtual machine resides in. Minimum api-version: 2018-10-01. + Host *SubResource + + // Specifies information about the dedicated host group that the virtual machine resides in. Note: User cannot specify both + // host and hostGroup properties. Minimum api-version: 2020-06-01. + HostGroup *SubResource + + // 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 + + // Specifies the network interfaces of the virtual machine. + NetworkProfile *NetworkProfile + + // Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed + // once VM is provisioned. + OSProfile *OSProfile + + // 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' greater than 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 + + // Specifies the priority for the virtual machine. Minimum api-version: 2019-03-01 + Priority *VirtualMachinePriorityTypes + + // Specifies information about the proximity placement group that the virtual machine should be assigned to. Minimum api-version: + // 2018-04-01. + ProximityPlacementGroup *SubResource + + // Specifies Scheduled Event related configurations. + ScheduledEventsProfile *ScheduledEventsProfile + + // Specifies the Security related profile settings for the virtual machine. + SecurityProfile *SecurityProfile + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfile + + // 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 + + // 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 + + // READ-ONLY; The virtual machine instance view. + InstanceView *VirtualMachineInstanceView + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string + + // READ-ONLY; Specifies the time at which the Virtual Machine resource was created. Minimum api-version: 2021-11-01. + TimeCreated *time.Time + + // 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 +} + +// VirtualMachinePublicIPAddressConfiguration - Describes a virtual machines IP Configuration's PublicIPAddress configuration +type VirtualMachinePublicIPAddressConfiguration struct { + // REQUIRED; The publicIP address configuration name. + Name *string + + // Describes a virtual machines IP Configuration's PublicIPAddress configuration + Properties *VirtualMachinePublicIPAddressConfigurationProperties + + // Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + SKU *PublicIPAddressSKU +} + +// 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 + + // Specify what happens to the public IP address when the VM is deleted + DeleteOption *DeleteOptions + + // The list of IP tags associated with the public IP address. + IPTags []*VirtualMachineIPTag + + // The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 + + // 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 + + // Specify the public IP allocation type + PublicIPAllocationMethod *PublicIPAllocationMethod + + // The PublicIPPrefix from which to allocate publicIP addresses. + PublicIPPrefix *SubResource +} + +// 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 + + // The Domain name label scope of the PublicIPAddress resources that will be created. The generated name label is the concatenation + // of the hashed domain name label with policy according to the domain + // name label scope and vm network profile unique ID. + DomainNameLabelScope *DomainNameLabelScopeTypes +} + +// VirtualMachineReimageParameters - Parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk will always be +// reimaged +type VirtualMachineReimageParameters struct { + // Specifies in decimal number, the version the OS disk should be reimaged to. If exact version is not provided, the OS disk + // is reimaged to the existing version of OS Disk. + ExactVersion *string + + // Specifies information required for reimaging the non-ephemeral OS disk. + OSProfile *OSProfileProvisioningData + + // 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 +} + +// VirtualMachineRunCommand - Describes a Virtual Machine run command. +type VirtualMachineRunCommand struct { + // REQUIRED; Resource location + Location *string + + // Describes the properties of a Virtual Machine run command. + Properties *VirtualMachineRunCommandProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// VirtualMachineRunCommandInstanceView - The instance view of a virtual machine run command. +type VirtualMachineRunCommandInstanceView struct { + // Script end time. + EndTime *time.Time + + // Script error stream. + Error *string + + // Communicate script configuration errors or execution messages. + ExecutionMessage *string + + // Script execution status. + ExecutionState *ExecutionState + + // Exit code returned from script execution. + ExitCode *int32 + + // Script output stream. + Output *string + + // Script start time. + StartTime *time.Time + + // The resource status information. + Statuses []*InstanceViewStatus +} + +// 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 + + // User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned + // identity. Make sure managed identity has been given access to blob's + // container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it + // under VM's identity. For more info on managed identity and Run Command, refer + // https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + ErrorBlobManagedIdentity *RunCommandManagedIdentity + + // Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write + // access OR use managed identity to provide the VM access to the blob. Refer + // errorBlobManagedIdentity parameter. + ErrorBlobURI *string + + // User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned + // identity. Make sure managed identity has been given access to blob's + // container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it + // under VM's identity. For more info on managed identity and Run Command, refer + // https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + OutputBlobManagedIdentity *RunCommandManagedIdentity + + // Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, + // write access OR use managed identity to provide the VM access to the blob. Refer + // outputBlobManagedIdentity parameter. + OutputBlobURI *string + + // The parameters used by the script. + Parameters []*RunCommandInputParameter + + // The parameters used by the script. + ProtectedParameters []*RunCommandInputParameter + + // Specifies the user account password on the VM when executing the run command. + RunAsPassword *string + + // Specifies the user account on the VM when executing the run command. + RunAsUser *string + + // The source of the run command script. + Source *VirtualMachineRunCommandScriptSource + + // The timeout in seconds to execute the run command. + TimeoutInSeconds *int32 + + // Optional. If set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. + // If set to false, ProvisioningState would only reflect whether the run + // command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. + // See instance view of run command in case of script failures to see + // executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results + TreatFailureAsDeploymentFailure *bool + + // READ-ONLY; The virtual machine run command instance view. + InstanceView *VirtualMachineRunCommandInstanceView + + // READ-ONLY; The provisioning state, which only appears in the response. If treatFailureAsDeploymentFailure set to true, + // any failure in the script will fail the deployment and ProvisioningState will be marked as + // Failed. If treatFailureAsDeploymentFailure set to false, ProvisioningState would only reflect whether the run command was + // run or not by the extensions platform, it would not indicate whether script + // failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, + // output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results + ProvisioningState *string +} + +// VirtualMachineRunCommandScriptSource - Describes the script sources for run command. Use only one of script, scriptUri, +// commandId. +type VirtualMachineRunCommandScriptSource struct { + // Specifies a commandId of predefined built-in script. + CommandID *string + + // Specifies the script content to be executed on the VM. + Script *string + + // Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI. + ScriptURI *string + + // User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case + // of system-assigned identity. Make sure the Azure storage blob exists, and managed + // identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned + // identity, make sure you add it under VM's identity. For more info on + // managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. + ScriptURIManagedIdentity *RunCommandManagedIdentity +} + +// VirtualMachineRunCommandUpdate - Describes a Virtual Machine run command. +type VirtualMachineRunCommandUpdate struct { + // Describes the properties of a Virtual Machine run command. + Properties *VirtualMachineRunCommandProperties + + // Resource tags + Tags map[string]*string +} + +// VirtualMachineRunCommandsListResult - The List run command operation response +type VirtualMachineRunCommandsListResult struct { + // REQUIRED; The list of run commands + Value []*VirtualMachineRunCommand + + // The uri to fetch the next page of run commands. + NextLink *string +} + +// VirtualMachineScaleSet - Describes a Virtual Machine Scale Set. +type VirtualMachineScaleSet struct { + // REQUIRED; Resource location + Location *string + + // The extended location of the Virtual Machine Scale Set. + ExtendedLocation *ExtendedLocation + + // The identity of the virtual machine scale set, if configured. + Identity *VirtualMachineScaleSetIdentity + + // 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 + + // Describes the properties of a Virtual Machine Scale Set. + Properties *VirtualMachineScaleSetProperties + + // The virtual machine scale set sku. + SKU *SKU + + // Resource tags + Tags map[string]*string + + // The virtual machine scale set zones. NOTE: Availability zones can only be set when you create the scale set + Zones []*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// VirtualMachineScaleSetDataDisk - Describes a virtual machine scale set data disk. +type VirtualMachineScaleSetDataDisk struct { + // REQUIRED; The create option. + CreateOption *DiskCreateOptionTypes + + // 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 + + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. + Caching *CachingTypes + + // 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 + + // 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 + + // 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 + + // 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. The property diskSizeGB is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. + DiskSizeGB *int32 + + // The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters + + // The disk name. + Name *string + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool +} + +// VirtualMachineScaleSetExtension - Describes a Virtual Machine Scale Set Extension. +type VirtualMachineScaleSetExtension struct { + // The name of the extension. + Name *string + + // Describes the properties of a Virtual Machine Scale Set Extension. + Properties *VirtualMachineScaleSetExtensionProperties + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; Resource type + Type *string +} + +// VirtualMachineScaleSetExtensionListResult - The List VM scale set extension operation response. +type VirtualMachineScaleSetExtensionListResult struct { + // REQUIRED; The list of VM scale set extensions. + Value []*VirtualMachineScaleSetExtension + + // 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 +} + +// VirtualMachineScaleSetExtensionProfile - Describes a virtual machine scale set extension profile. +type VirtualMachineScaleSetExtensionProfile struct { + // The virtual machine scale set child extension resources. + Extensions []*VirtualMachineScaleSetExtension + + // 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 +} + +// 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 + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension + // available. + EnableAutomaticUpgrade *bool + + // 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 + + // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings any + + // The extensions protected settings that are passed by reference, and consumed from key vault + ProtectedSettingsFromKeyVault *KeyVaultSecretReference + + // Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions []*string + + // The name of the extension handler publisher. + Publisher *string + + // Json formatted public settings for the extension. + Settings any + + // 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 + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string +} + +// VirtualMachineScaleSetExtensionUpdate - Describes a Virtual Machine Scale Set Extension. +type VirtualMachineScaleSetExtensionUpdate struct { + // Describes the properties of a Virtual Machine Scale Set Extension. + Properties *VirtualMachineScaleSetExtensionProperties + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; The name of the extension. + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 +} + +// VirtualMachineScaleSetIPConfiguration - Describes a virtual machine scale set network profile's IP configuration. +type VirtualMachineScaleSetIPConfiguration struct { + // REQUIRED; The IP configuration name. + Name *string + + // Describes a virtual machine scale set network profile's IP configuration properties. + Properties *VirtualMachineScaleSetIPConfigurationProperties +} + +// 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 + + // Specifies an array of references to application security group. + ApplicationSecurityGroups []*SubResource + + // 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 + + // 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 + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool + + // 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 + + // The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration + + // Specifies the identifier of the subnet. + Subnet *APIEntityReference +} + +// VirtualMachineScaleSetIPTag - Contains the IP tag associated with the public IP address. +type VirtualMachineScaleSetIPTag struct { + // IP tag type. Example: FirstPartyUsage. + IPTagType *string + + // IP tag associated with the public IP. Example: SQL, Storage etc. + Tag *string +} + +// 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 + + // 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 + + // READ-ONLY; The principal id of virtual machine scale set identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // 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 +} + +// VirtualMachineScaleSetInstanceView - The instance view of a virtual machine scale set. +type VirtualMachineScaleSetInstanceView struct { + // The resource status information. + Statuses []*InstanceViewStatus + + // READ-ONLY; The extensions information. + Extensions []*VirtualMachineScaleSetVMExtensionsSummary + + // READ-ONLY; The orchestration services information. + OrchestrationServices []*OrchestrationServiceSummary + + // READ-ONLY; The instance view status summary for the virtual machine scale set. + VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary +} + +// VirtualMachineScaleSetInstanceViewStatusesSummary - Instance view statuses summary for virtual machines of a virtual machine +// scale set. +type VirtualMachineScaleSetInstanceViewStatusesSummary struct { + // READ-ONLY; The extensions information. + StatusesSummary []*VirtualMachineStatusCodeCount +} + +// 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 + + // 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 +} + +// VirtualMachineScaleSetListResult - The List Virtual Machine operation response. +type VirtualMachineScaleSetListResult struct { + // REQUIRED; The list of virtual machine scale sets. + Value []*VirtualMachineScaleSet + + // 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 +} + +// 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 + + // 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 +} + +// VirtualMachineScaleSetListWithLinkResult - The List Virtual Machine operation response. +type VirtualMachineScaleSetListWithLinkResult struct { + // REQUIRED; The list of virtual machine scale sets. + Value []*VirtualMachineScaleSet + + // 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 +} + +// 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 + + // Specifies the security profile for the managed disk. + SecurityProfile *VMDiskSecurityProfile + + // 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 +} + +// VirtualMachineScaleSetNetworkConfiguration - Describes a virtual machine scale set network profile's network configurations. +type VirtualMachineScaleSetNetworkConfiguration struct { + // REQUIRED; The network configuration name. + Name *string + + // Describes a virtual machine scale set network profile's IP configuration. + Properties *VirtualMachineScaleSetNetworkConfigurationProperties +} + +// VirtualMachineScaleSetNetworkConfigurationDNSSettings - Describes a virtual machines scale sets network configuration's +// DNS settings. +type VirtualMachineScaleSetNetworkConfigurationDNSSettings struct { + // List of DNS servers IP addresses + DNSServers []*string +} + +// 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 + + // Specifies whether the Auxiliary mode is enabled for the Network Interface resource. + AuxiliaryMode *NetworkInterfaceAuxiliaryMode + + // Specifies whether the Auxiliary sku is enabled for the Network Interface resource. + AuxiliarySKU *NetworkInterfaceAuxiliarySKU + + // The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineScaleSetNetworkConfigurationDNSSettings + + // Specify what happens to the network interface when the VM is deleted + DeleteOption *DeleteOptions + + // Specifies whether the network interface is disabled for tcp state tracking. + DisableTCPStateTracking *bool + + // Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool + + // Specifies whether the network interface is FPGA networking-enabled. + EnableFpga *bool + + // Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool + + // The network security group. + NetworkSecurityGroup *SubResource + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool +} + +// 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 + + // 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 + + // The list of network configurations. + NetworkInterfaceConfigurations []*VirtualMachineScaleSetNetworkConfiguration +} + +// 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. + // 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 + + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. + Caching *CachingTypes + + // 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 + + // Specifies the ephemeral disk Settings for the operating system disk used by the virtual machine scale set. + DiffDiskSettings *DiffDiskSettings + + // 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. The property 'diskSizeGB' is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. + DiskSizeGB *int32 + + // Specifies information about the unmanaged user image to base the scale set on. + Image *VirtualHardDisk + + // The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters + + // The disk name. + Name *string + + // 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 + + // Specifies the container urls that are used to store operating system disks for the scale set. + VhdContainers []*string + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool +} + +// 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 + + // 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 + + // 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 + + // 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 + + // 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 + + // 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 + + // Optional property which must either be set to True or omitted. + RequireGuestProvisionSignal *bool + + // 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 + + // Specifies Windows operating system settings on the virtual machine. + WindowsConfiguration *WindowsConfiguration +} + +// 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 + + // Policy for automatic repairs. + AutomaticRepairsPolicy *AutomaticRepairsPolicy + + // Optional property which must either be set to True or omitted. + ConstrainedMaximumCapacity *bool + + // 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 + + // Specifies information about the dedicated host group that the virtual machine scale set resides in. Minimum api-version: + // 2020-06-01. + HostGroup *SubResource + + // Specifies the orchestration mode for the virtual machine scale set. + OrchestrationMode *OrchestrationMode + + // Specifies whether the Virtual Machine Scale Set should be overprovisioned. + Overprovision *bool + + // Fault Domain count for each placement group. + PlatformFaultDomainCount *int32 + + // Specifies the desired targets for mixing Spot and Regular priority VMs within the same VMSS Flex instance. + PriorityMixPolicy *PriorityMixPolicy + + // 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 + + // Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. + ScaleInPolicy *ScaleInPolicy + + // 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 + + // Specifies the Spot Restore properties for the virtual machine scale set. + SpotRestorePolicy *SpotRestorePolicy + + // The upgrade policy. + UpgradePolicy *UpgradePolicy + + // The virtual machine profile. + VirtualMachineProfile *VirtualMachineScaleSetVMProfile + + // 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 + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string + + // READ-ONLY; Specifies the time at which the Virtual Machine Scale Set resource was created. Minimum api-version: 2021-11-01. + TimeCreated *time.Time + + // READ-ONLY; Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + UniqueID *string +} + +// VirtualMachineScaleSetPublicIPAddressConfiguration - Describes a virtual machines scale set IP Configuration's PublicIPAddress +// configuration +type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + // REQUIRED; The publicIP address configuration name. + Name *string + + // Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration + Properties *VirtualMachineScaleSetPublicIPAddressConfigurationProperties + + // Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + SKU *PublicIPAddressSKU +} + +// 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 + + // The Domain name label scope.The concatenation of the hashed domain name label that generated according to the policy from + // domain name label scope and vm index will be the domain name labels of the + // PublicIPAddress resources that will be created + DomainNameLabelScope *DomainNameLabelScopeTypes +} + +// 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 + + // Specify what happens to the public IP when the VM is deleted + DeleteOption *DeleteOptions + + // The list of IP tags associated with the public IP address. + IPTags []*VirtualMachineScaleSetIPTag + + // The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 + + // 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 + + // The PublicIPPrefix from which to allocate publicIP addresses. + PublicIPPrefix *SubResource +} + +// VirtualMachineScaleSetReimageParameters - Describes a Virtual Machine Scale Set VM Reimage Parameters. +type VirtualMachineScaleSetReimageParameters struct { + // Specifies in decimal number, the version the OS disk should be reimaged to. If exact version is not provided, the OS disk + // is reimaged to the existing version of OS Disk. + ExactVersion *string + + // 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 + + // Specifies information required for reimaging the non-ephemeral OS disk. + OSProfile *OSProfileProvisioningData + + // 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 +} + +// 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 + + // READ-ONLY; The type of resource the sku applies to. + ResourceType *string + + // READ-ONLY; The Sku. + SKU *SKU +} + +// VirtualMachineScaleSetSKUCapacity - Describes scaling information of a sku. +type VirtualMachineScaleSetSKUCapacity struct { + // READ-ONLY; The default capacity. + DefaultCapacity *int64 + + // READ-ONLY; The maximum capacity that can be set. + Maximum *int64 + + // READ-ONLY; The minimum capacity. + Minimum *int64 + + // READ-ONLY; The scale type applicable to the sku. + ScaleType *VirtualMachineScaleSetSKUScaleType +} + +// 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 + DiskControllerType *string + + // 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 + + // 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 +} + +// VirtualMachineScaleSetUpdate - Describes a Virtual Machine Scale Set. +type VirtualMachineScaleSetUpdate struct { + // The identity of the virtual machine scale set, if configured. + Identity *VirtualMachineScaleSetIdentity + + // The purchase plan when deploying a virtual machine scale set from VM Marketplace images. + Plan *Plan + + // Describes the properties of a Virtual Machine Scale Set. + Properties *VirtualMachineScaleSetUpdateProperties + + // The virtual machine scale set sku. + SKU *SKU + + // Resource tags + Tags map[string]*string +} + +// 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 { + // The IP configuration name. + Name *string + + // Describes a virtual machine scale set network profile's IP configuration properties. + Properties *VirtualMachineScaleSetUpdateIPConfigurationProperties +} + +// VirtualMachineScaleSetUpdateIPConfigurationProperties - Describes a virtual machine scale set network profile's IP configuration +// properties. +type VirtualMachineScaleSetUpdateIPConfigurationProperties struct { + // The application gateway backend address pools. + ApplicationGatewayBackendAddressPools []*SubResource + + // Specifies an array of references to application security group. + ApplicationSecurityGroups []*SubResource + + // The load balancer backend address pools. + LoadBalancerBackendAddressPools []*SubResource + + // The load balancer inbound nat pools. + LoadBalancerInboundNatPools []*SubResource + + // Specifies the primary IP Configuration in case the network interface has more than one IP Configuration. + Primary *bool + + // 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 + + // The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + + // The subnet. + Subnet *APIEntityReference +} + +// VirtualMachineScaleSetUpdateNetworkConfiguration - Describes a virtual machine scale set network profile's network configurations. +type VirtualMachineScaleSetUpdateNetworkConfiguration struct { + // The network configuration name. + Name *string + + // Describes a virtual machine scale set updatable network profile's IP configuration.Use this object for updating network + // profile's IP Configuration. + Properties *VirtualMachineScaleSetUpdateNetworkConfigurationProperties +} + +// 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 { + // Specifies whether the Auxiliary mode is enabled for the Network Interface resource. + AuxiliaryMode *NetworkInterfaceAuxiliaryMode + + // Specifies whether the Auxiliary sku is enabled for the Network Interface resource. + AuxiliarySKU *NetworkInterfaceAuxiliarySKU + + // The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineScaleSetNetworkConfigurationDNSSettings + + // Specify what happens to the network interface when the VM is deleted + DeleteOption *DeleteOptions + + // Specifies whether the network interface is disabled for tcp state tracking. + DisableTCPStateTracking *bool + + // Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool + + // Specifies whether the network interface is FPGA networking-enabled. + EnableFpga *bool + + // Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool + + // The virtual machine scale set IP Configuration. + IPConfigurations []*VirtualMachineScaleSetUpdateIPConfiguration + + // The network security group. + NetworkSecurityGroup *SubResource + + // Whether this is a primary NIC on a virtual machine. + Primary *bool +} + +// 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 + + // 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 + + // The list of network configurations. + NetworkInterfaceConfigurations []*VirtualMachineScaleSetUpdateNetworkConfiguration +} + +// 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 + + // 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 + + // 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 + + // 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 + + // The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters + + // The list of virtual hard disk container uris. + VhdContainers []*string + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool +} + +// VirtualMachineScaleSetUpdateOSProfile - Describes a virtual machine scale set OS profile. +type VirtualMachineScaleSetUpdateOSProfile struct { + // A base-64 encoded string of custom data. + CustomData *string + + // The Linux Configuration of the OS profile. + LinuxConfiguration *LinuxConfiguration + + // The List of certificates for addition to the VM. + Secrets []*VaultSecretGroup + + // The Windows Configuration of the OS profile. + WindowsConfiguration *WindowsConfiguration +} + +// 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 + + // Policy for automatic repairs. + AutomaticRepairsPolicy *AutomaticRepairsPolicy + + // 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 + + // Specifies whether the Virtual Machine Scale Set should be overprovisioned. + Overprovision *bool + + // Specifies the desired targets for mixing Spot and Regular priority VMs within the same VMSS Flex instance. + PriorityMixPolicy *PriorityMixPolicy + + // 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 + + // Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. + ScaleInPolicy *ScaleInPolicy + + // 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 + + // Specifies the Spot Restore properties for the virtual machine scale set. + SpotRestorePolicy *SpotRestorePolicy + + // The upgrade policy. + UpgradePolicy *UpgradePolicy + + // The virtual machine profile. + VirtualMachineProfile *VirtualMachineScaleSetUpdateVMProfile +} + +// VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - Describes a virtual machines scale set IP Configuration's PublicIPAddress +// configuration +type VirtualMachineScaleSetUpdatePublicIPAddressConfiguration struct { + // The publicIP address configuration name. + Name *string + + // Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration + Properties *VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties +} + +// 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 + + // Specify what happens to the public IP when the VM is deleted + DeleteOption *DeleteOptions + + // The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 + + // The PublicIPPrefix from which to allocate publicIP addresses. + PublicIPPrefix *SubResource +} + +// VirtualMachineScaleSetUpdateStorageProfile - Describes a virtual machine scale set storage profile. +type VirtualMachineScaleSetUpdateStorageProfile struct { + // The data disks. + DataDisks []*VirtualMachineScaleSetDataDisk + DiskControllerType *string + + // The image reference. + ImageReference *ImageReference + + // The OS disk. + OSDisk *VirtualMachineScaleSetUpdateOSDisk +} + +// 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 + + // The virtual machine scale set diagnostics profile. + DiagnosticsProfile *DiagnosticsProfile + + // The virtual machine scale set extension profile. + ExtensionProfile *VirtualMachineScaleSetExtensionProfile + + // Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. + HardwareProfile *VirtualMachineScaleSetHardwareProfile + + // The license type, which is for bring your own license scenario. + LicenseType *string + + // The virtual machine scale set network profile. + NetworkProfile *VirtualMachineScaleSetUpdateNetworkProfile + + // The virtual machine scale set OS profile. + OSProfile *VirtualMachineScaleSetUpdateOSProfile + + // Specifies Scheduled Event related configurations. + ScheduledEventsProfile *ScheduledEventsProfile + + // The virtual machine scale set Security profile + SecurityProfile *SecurityProfile + + // The virtual machine scale set storage profile. + StorageProfile *VirtualMachineScaleSetUpdateStorageProfile + + // 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 +} + +// VirtualMachineScaleSetVM - Describes a virtual machine scale set virtual machine. +type VirtualMachineScaleSetVM struct { + // REQUIRED; Resource location + Location *string + + // The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity + + // 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 + + // Describes the properties of a virtual machine scale set virtual machine. + Properties *VirtualMachineScaleSetVMProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; The virtual machine instance ID. + InstanceID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; The virtual machine child extension resources. + Resources []*VirtualMachineExtension + + // READ-ONLY; The virtual machine SKU. + SKU *SKU + + // READ-ONLY; Resource type + Type *string + + // READ-ONLY; The virtual machine zones. + Zones []*string +} + +// VirtualMachineScaleSetVMExtension - Describes a VMSS VM Extension. +type VirtualMachineScaleSetVMExtension struct { + // The location of the extension. + Location *string + + // Describes the properties of a Virtual Machine Extension. + Properties *VirtualMachineExtensionProperties + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; The name of the extension. + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// VirtualMachineScaleSetVMExtensionUpdate - Describes a VMSS VM Extension. +type VirtualMachineScaleSetVMExtensionUpdate struct { + // Describes the properties of a Virtual Machine Extension. + Properties *VirtualMachineExtensionUpdateProperties + + // READ-ONLY; Resource Id + ID *string + + // READ-ONLY; The name of the extension. + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// VirtualMachineScaleSetVMExtensionsListResult - The List VMSS VM Extension operation response +type VirtualMachineScaleSetVMExtensionsListResult struct { + // The list of VMSS VM extensions + Value []*VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMExtensionsSummary - Extensions summary for virtual machines of a virtual machine scale set. +type VirtualMachineScaleSetVMExtensionsSummary struct { + // READ-ONLY; The extension name. + Name *string + + // READ-ONLY; The extensions information. + StatusesSummary []*VirtualMachineStatusCodeCount +} + +// 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 +} + +// 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 +} + +// 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 + + // 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/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions]. + ComputerName *string + + // The disks information. + Disks []*DiskInstanceView + + // The extensions information. + Extensions []*VirtualMachineExtensionInstanceView + + // The hypervisor generation of the Virtual Machine [V1, V2] + HyperVGeneration *HyperVGeneration + + // The Maintenance Operation status on the virtual machine. + MaintenanceRedeployStatus *MaintenanceRedeployStatus + + // The Operating System running on the hybrid machine. + OSName *string + + // The version of Operating System running on the hybrid machine. + OSVersion *string + + // The placement group in which the VM is running. If the VM is deallocated it will not have a placementGroupId. + PlacementGroupID *string + + // The Fault Domain count. + PlatformFaultDomain *int32 + + // The Update Domain count. + PlatformUpdateDomain *int32 + + // The Remote desktop certificate thumbprint. + RdpThumbPrint *string + + // The resource status information. + Statuses []*InstanceViewStatus + + // The VM Agent running on the virtual machine. + VMAgent *VirtualMachineAgentInstanceView + + // 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 + + // READ-ONLY; The health status for the VM. + VMHealth *VirtualMachineHealthStatus +} + +// VirtualMachineScaleSetVMListResult - The List Virtual Machine Scale Set VMs operation response. +type VirtualMachineScaleSetVMListResult struct { + // REQUIRED; The list of virtual machine scale sets VMs. + Value []*VirtualMachineScaleSetVM + + // 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 +} + +// VirtualMachineScaleSetVMNetworkProfileConfiguration - Describes a virtual machine scale set VM network profile. +type VirtualMachineScaleSetVMNetworkProfileConfiguration struct { + // The list of network configurations. + NetworkInterfaceConfigurations []*VirtualMachineScaleSetNetworkConfiguration +} + +// 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 + + // Specifies the billing related details of a Azure Spot VMSS. Minimum api-version: 2019-03-01. + BillingProfile *BillingProfile + + // Specifies the capacity reservation related details of a scale set. Minimum api-version: 2021-04-01. + CapacityReservation *CapacityReservationProfile + + // Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile + + // 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 + + // Specifies a collection of settings for extensions installed on virtual machines in the scale set. + ExtensionProfile *VirtualMachineScaleSetExtensionProfile + + // Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. + HardwareProfile *VirtualMachineScaleSetHardwareProfile + + // 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 + + // Specifies properties of the network interfaces of the virtual machines in the scale set. + NetworkProfile *VirtualMachineScaleSetNetworkProfile + + // Specifies the operating system settings for the virtual machines in the scale set. + OSProfile *VirtualMachineScaleSetOSProfile + + // Specifies the priority for the virtual machines in the scale set. Minimum api-version: 2017-10-30-preview. + Priority *VirtualMachinePriorityTypes + + // Specifies Scheduled Event related configurations. + ScheduledEventsProfile *ScheduledEventsProfile + + // Specifies the security posture to be used for all virtual machines in the scale set. Minimum api-version: 2023-03-01 + SecurityPostureReference *SecurityPostureReference + + // Specifies the Security related profile settings for the virtual machines in the scale set. + SecurityProfile *SecurityProfile + + // Specifies the service artifact reference id used to set same image version for all virtual machines in the scale set when + // using 'latest' image version. Minimum api-version: 2022-11-01 + ServiceArtifactReference *ServiceArtifactReference + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *VirtualMachineScaleSetStorageProfile + + // 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 +} + +// 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 + + // 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 + + // Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile + + // Specifies the hardware settings for the virtual machine. + HardwareProfile *HardwareProfile + + // 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 + + // Specifies the network interfaces of the virtual machine. + NetworkProfile *NetworkProfile + + // Specifies the network profile configuration of the virtual machine. + NetworkProfileConfiguration *VirtualMachineScaleSetVMNetworkProfileConfiguration + + // Specifies the operating system settings for the virtual machine. + OSProfile *OSProfile + + // Specifies the protection policy of the virtual machine. + ProtectionPolicy *VirtualMachineScaleSetVMProtectionPolicy + + // Specifies the Security related profile settings for the virtual machine. + SecurityProfile *SecurityProfile + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfile + + // 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 + + // READ-ONLY; The virtual machine instance view. + InstanceView *VirtualMachineScaleSetVMInstanceView + + // READ-ONLY; Specifies whether the latest model has been applied to the virtual machine. + LatestModelApplied *bool + + // 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 + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string + + // READ-ONLY; Specifies the time at which the Virtual Machine resource was created. + // Minimum api-version: 2021-11-01. + TimeCreated *time.Time + + // READ-ONLY; Azure VM unique ID. + VMID *string +} + +// 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 + + // 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 +} + +// VirtualMachineScaleSetVMReimageParameters - Describes a Virtual Machine Scale Set VM Reimage Parameters. +type VirtualMachineScaleSetVMReimageParameters struct { + // Specifies in decimal number, the version the OS disk should be reimaged to. If exact version is not provided, the OS disk + // is reimaged to the existing version of OS Disk. + ExactVersion *string + + // Specifies information required for reimaging the non-ephemeral OS disk. + OSProfile *OSProfileProvisioningData + + // 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 +} + +// 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 + + // The amount of memory, in MB, supported by the virtual machine size. + MemoryInMB *int32 + + // The name of the virtual machine size. + Name *string + + // 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 + + // The OS disk size, in MB, allowed by the virtual machine size. + OSDiskSizeInMB *int32 + + // The resource disk size, in MB, allowed by the virtual machine size. + ResourceDiskSizeInMB *int32 +} + +// VirtualMachineSizeListResult - The List Virtual Machine operation response. +type VirtualMachineSizeListResult struct { + // The list of virtual machine sizes. + Value []*VirtualMachineSize +} + +// 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 + + // READ-ONLY; Describes the availability of a given patch. + AssessmentState *PatchAssessmentState + + // READ-ONLY; The classification(s) of the patch as provided by the patch publisher. + Classifications []*string + + // READ-ONLY; The KBID of the patch. Only applies to Windows patches. + KbID *string + + // READ-ONLY; The UTC timestamp of the last update to this patch record. + LastModifiedDateTime *time.Time + + // READ-ONLY; The friendly name of the patch. + Name *string + + // READ-ONLY; A unique identifier for the patch. + PatchID *string + + // READ-ONLY; The UTC timestamp when the repository published this patch. + PublishedDate *time.Time + + // READ-ONLY; Describes the reboot requirements of the patch. + RebootBehavior *VMGuestPatchRebootBehavior + + // READ-ONLY; The version number of the patch. This property applies only to Linux patches. + Version *string +} + +// 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 + + // READ-ONLY; The number of instances having a particular status code. + Count *int32 +} + +// VirtualMachineUpdate - Describes a Virtual Machine Update. +type VirtualMachineUpdate struct { + // The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity + + // 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 + + // Describes the properties of a Virtual Machine. + Properties *VirtualMachineProperties + + // Resource tags + Tags map[string]*string + + // The virtual machine zones. + Zones []*string +} + +// WinRMConfiguration - Describes Windows Remote Management configuration of the VM +type WinRMConfiguration struct { + // The list of Windows Remote Management listeners + Listeners []*WinRMListener +} + +// 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 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 + + // Specifies the protocol of WinRM listener. Possible values are: http, https. + Protocol *ProtocolTypes +} + +// 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 + + // 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 + + // Indicates whether VMAgent Platform Updates is enabled for the Windows virtual machine. Default value is false. + EnableVMAgentPlatformUpdates *bool + + // [Preview Feature] Specifies settings related to VM Guest Patching on Windows. + PatchSettings *PatchSettings + + // Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified + // in the request body, it is set to true by default. This will ensure that VM + // Agent is installed on the VM so that extensions can be added to the VM later. + ProvisionVMAgent *bool + + // 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 + + // Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. + WinRM *WinRMConfiguration +} + +// 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 + + // Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. + ExcludeKbsRequiringReboot *bool + + // Kbs to exclude in the patch operation + KbNumbersToExclude []*string + + // Kbs to include in the patch operation + KbNumbersToInclude []*string + + // This is used to install patches that were published on or before this given max published date. + MaxPatchPublishDate *time.Time +} + +// WindowsVMGuestPatchAutomaticByPlatformSettings - Specifies additional settings to be applied when patch mode AutomaticByPlatform +// is selected in Windows patch settings. +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + // Enables customer to schedule patching without accidental upgrades + BypassPlatformSafetyChecksOnUserSchedule *bool + + // Specifies the reboot setting for all AutomaticByPlatform patch installation operations. + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/models_serde.go new file mode 100644 index 000000000..08c5d8c40 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/models_serde.go @@ -0,0 +1,19156 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 AlternativeOption. +func (a AlternativeOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", a.Type) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlternativeOption. +func (a *AlternativeOption) UnmarshalJSON(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) + 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 ApplicationProfile. +func (a ApplicationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "assessmentActivityId", a.AssessmentActivityID) + populate(objectMap, "criticalAndSecurityPatchCount", a.CriticalAndSecurityPatchCount) + populate(objectMap, "error", a.Error) + populateDateTimeRFC3339(objectMap, "lastModifiedTime", a.LastModifiedTime) + populate(objectMap, "otherPatchCount", a.OtherPatchCount) + populate(objectMap, "rebootPending", a.RebootPending) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "instanceView", c.InstanceView) + populate(objectMap, "platformFaultDomainCount", c.PlatformFaultDomainCount) + populate(objectMap, "provisioningState", c.ProvisioningState) + populateDateTimeRFC3339(objectMap, "provisioningTime", c.ProvisioningTime) + populate(objectMap, "reservationId", c.ReservationID) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "ProvisioningTime", &c.ProvisioningTime) + delete(rawMsg, key) + case "reservationId": + err = unpopulate(val, "ReservationID", &c.ReservationID) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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) + populate(objectMap, "zones", c.Zones) + 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) + 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 CloudServiceExtensionProfile. +func (c CloudServiceExtensionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + populate(objectMap, "autoUpgradeMinorVersion", c.AutoUpgradeMinorVersion) + populate(objectMap, "forceUpdateTag", c.ForceUpdateTag) + populateAny(objectMap, "protectedSettings", c.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", c.ProtectedSettingsFromKeyVault) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "publisher", c.Publisher) + populate(objectMap, "rolesAppliedTo", c.RolesAppliedTo) + populateAny(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 CommunityGalleryImageIdentifier. +func (c CommunityGalleryImageIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "offer", c.Offer) + populate(objectMap, "publisher", c.Publisher) + populate(objectMap, "sku", c.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageIdentifier. +func (c *CommunityGalleryImageIdentifier) UnmarshalJSON(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 "offer": + err = unpopulate(val, "Offer", &c.Offer) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &c.Publisher) + 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 CommunityGalleryImageList. +func (c CommunityGalleryImageList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + populate(objectMap, "architecture", c.Architecture) + populate(objectMap, "disallowed", c.Disallowed) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + populateDateTimeRFC3339(objectMap, "endOfLifeDate", c.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", c.ExcludeFromLatest) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "EndOfLifeDate", &c.EndOfLifeDate) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &c.ExcludeFromLatest) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + populate(objectMap, "createOption", c.CreateOption) + populate(objectMap, "elasticSanResourceId", c.ElasticSanResourceID) + 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 "elasticSanResourceId": + err = unpopulate(val, "ElasticSanResourceID", &c.ElasticSanResourceID) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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) + populateDateTimeRFC3339(objectMap, "provisioningTime", d.ProvisioningTime) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "ProvisioningTime", &d.ProvisioningTime) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(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 DedicatedHostSizeListResult. +func (d DedicatedHostSizeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostSizeListResult. +func (d *DedicatedHostSizeListResult) UnmarshalJSON(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 "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 DedicatedHostUpdate. +func (d DedicatedHostUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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 "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 DiagnosticsProfile. +func (d DiagnosticsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections) + populate(objectMap, "provisioningState", d.ProvisioningState) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "burstingEnabled", d.BurstingEnabled) + populateDateTimeRFC3339(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) + populateDateTimeRFC3339(objectMap, "LastOwnershipUpdateTime", d.LastOwnershipUpdateTime) + 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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 "LastOwnershipUpdateTime": + err = unpopulateDateTimeRFC3339(val, "LastOwnershipUpdateTime", &d.LastOwnershipUpdateTime) + 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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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 DiskRestorePointAttributes. +func (d DiskRestorePointAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "encryption", d.Encryption) + populate(objectMap, "id", d.ID) + populate(objectMap, "sourceDiskRestorePoint", d.SourceDiskRestorePoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointAttributes. +func (d *DiskRestorePointAttributes) UnmarshalJSON(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 "encryption": + err = unpopulate(val, "Encryption", &d.Encryption) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "sourceDiskRestorePoint": + err = unpopulate(val, "SourceDiskRestorePoint", &d.SourceDiskRestorePoint) + 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]any) + 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]any) + 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]any) + 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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "activeKey", e.ActiveKey) + populate(objectMap, "autoKeyRotationError", e.AutoKeyRotationError) + populate(objectMap, "encryptionType", e.EncryptionType) + populate(objectMap, "federatedClientId", e.FederatedClientID) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "customActions", g.CustomActions) + populate(objectMap, "description", g.Description) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "advancedSettings", g.AdvancedSettings) + populate(objectMap, "customActions", g.CustomActions) + populate(objectMap, "enableHealthCheck", g.EnableHealthCheck) + populateDateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", g.ExcludeFromLatest) + populate(objectMap, "manageActions", g.ManageActions) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + populateDateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", g.ExcludeFromLatest) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "EndOfLifeDate", &g.EndOfLifeDate) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &g.ExcludeFromLatest) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "architecture", g.Architecture) + populate(objectMap, "description", g.Description) + populate(objectMap, "disallowed", g.Disallowed) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populateDateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", g.ExcludeFromLatest) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "EndOfLifeDate", &g.EndOfLifeDate) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &g.ExcludeFromLatest) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "access", g.Access) + populate(objectMap, "durationInSeconds", g.DurationInSeconds) + populate(objectMap, "fileFormat", g.FileFormat) + 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 "fileFormat": + err = unpopulate(val, "FileFormat", &g.FileFormat) + 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]any) + 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]any) + 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]any) + 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 ImageDeprecationStatus. +func (i ImageDeprecationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alternativeOption", i.AlternativeOption) + populate(objectMap, "imageState", i.ImageState) + populateDateTimeRFC3339(objectMap, "scheduledDeprecationTime", i.ScheduledDeprecationTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDeprecationStatus. +func (i *ImageDeprecationStatus) UnmarshalJSON(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 "alternativeOption": + err = unpopulate(val, "AlternativeOption", &i.AlternativeOption) + delete(rawMsg, key) + case "imageState": + err = unpopulate(val, "ImageState", &i.ImageState) + delete(rawMsg, key) + case "scheduledDeprecationTime": + err = unpopulateDateTimeRFC3339(val, "ScheduledDeprecationTime", &i.ScheduledDeprecationTime) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "code", i.Code) + populate(objectMap, "displayStatus", i.DisplayStatus) + populate(objectMap, "level", i.Level) + populate(objectMap, "message", i.Message) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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) + populateDateTimeRFC3339(objectMap, "lastModifiedTime", l.LastModifiedTime) + populate(objectMap, "maintenanceWindowExceeded", l.MaintenanceWindowExceeded) + populate(objectMap, "notSelectedPatchCount", l.NotSelectedPatchCount) + populate(objectMap, "pendingPatchCount", l.PendingPatchCount) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "bypassPlatformSafetyChecksOnUserSchedule", l.BypassPlatformSafetyChecksOnUserSchedule) + 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 "bypassPlatformSafetyChecksOnUserSchedule": + err = unpopulate(val, "BypassPlatformSafetyChecksOnUserSchedule", &l.BypassPlatformSafetyChecksOnUserSchedule) + delete(rawMsg, 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "blobContainerSasUri", l.BlobContainerSasURI) + populateDateTimeRFC3339(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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + populate(objectMap, "isCustomerInitiatedMaintenanceAllowed", m.IsCustomerInitiatedMaintenanceAllowed) + populate(objectMap, "lastOperationMessage", m.LastOperationMessage) + populate(objectMap, "lastOperationResultCode", m.LastOperationResultCode) + populateDateTimeRFC3339(objectMap, "maintenanceWindowEndTime", m.MaintenanceWindowEndTime) + populateDateTimeRFC3339(objectMap, "maintenanceWindowStartTime", m.MaintenanceWindowStartTime) + populateDateTimeRFC3339(objectMap, "preMaintenanceWindowEndTime", m.PreMaintenanceWindowEndTime) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "MaintenanceWindowEndTime", &m.MaintenanceWindowEndTime) + delete(rawMsg, key) + case "maintenanceWindowStartTime": + err = unpopulateDateTimeRFC3339(val, "MaintenanceWindowStartTime", &m.MaintenanceWindowStartTime) + delete(rawMsg, key) + case "preMaintenanceWindowEndTime": + err = unpopulateDateTimeRFC3339(val, "PreMaintenanceWindowEndTime", &m.PreMaintenanceWindowEndTime) + delete(rawMsg, key) + case "preMaintenanceWindowStartTime": + err = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 OSImageNotificationProfile. +func (o OSImageNotificationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enable", o.Enable) + populate(objectMap, "notBeforeTimeout", o.NotBeforeTimeout) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSImageNotificationProfile. +func (o *OSImageNotificationProfile) UnmarshalJSON(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 "enable": + err = unpopulate(val, "Enable", &o.Enable) + delete(rawMsg, key) + case "notBeforeTimeout": + err = unpopulate(val, "NotBeforeTimeout", &o.NotBeforeTimeout) + 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]any) + 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 OSProfileProvisioningData. +func (o OSProfileProvisioningData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminPassword", o.AdminPassword) + populate(objectMap, "customData", o.CustomData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSProfileProvisioningData. +func (o *OSProfileProvisioningData) UnmarshalJSON(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 "customData": + err = unpopulate(val, "CustomData", &o.CustomData) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "blobContainerSasUri", r.BlobContainerSasURI) + populateDateTimeRFC3339(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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + populate(objectMap, "code", r.Code) + populate(objectMap, "displayStatus", r.DisplayStatus) + populate(objectMap, "level", r.Level) + populate(objectMap, "message", r.Message) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 RestorePointEncryption. +func (r RestorePointEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskEncryptionSet", r.DiskEncryptionSet) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointEncryption. +func (r *RestorePointEncryption) UnmarshalJSON(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 "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &r.DiskEncryptionSet) + 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 RestorePointInstanceView. +func (r RestorePointInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + populate(objectMap, "diagnosticsProfile", r.DiagnosticsProfile) + populate(objectMap, "hardwareProfile", r.HardwareProfile) + populate(objectMap, "hyperVGeneration", r.HyperVGeneration) + 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, "userData", r.UserData) + 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 "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &r.HyperVGeneration) + 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 "userData": + err = unpopulate(val, "UserData", &r.UserData) + 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]any) + 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) + populate(objectMap, "writeAcceleratorEnabled", r.WriteAcceleratorEnabled) + 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) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &r.WriteAcceleratorEnabled) + 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]any) + 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) + populate(objectMap, "writeAcceleratorEnabled", r.WriteAcceleratorEnabled) + 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) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &r.WriteAcceleratorEnabled) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "enableCrossZoneUpgrade", r.EnableCrossZoneUpgrade) + populate(objectMap, "maxBatchInstancePercent", r.MaxBatchInstancePercent) + populate(objectMap, "maxSurge", r.MaxSurge) + populate(objectMap, "maxUnhealthyInstancePercent", r.MaxUnhealthyInstancePercent) + populate(objectMap, "maxUnhealthyUpgradedInstancePercent", r.MaxUnhealthyUpgradedInstancePercent) + populate(objectMap, "pauseTimeBetweenBatches", r.PauseTimeBetweenBatches) + populate(objectMap, "prioritizeUnhealthyInstances", r.PrioritizeUnhealthyInstances) + populate(objectMap, "rollbackFailedInstancesOnPolicyBreach", r.RollbackFailedInstancesOnPolicyBreach) + 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 "maxSurge": + err = unpopulate(val, "MaxSurge", &r.MaxSurge) + 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) + case "rollbackFailedInstancesOnPolicyBreach": + err = unpopulate(val, "RollbackFailedInstancesOnPolicyBreach", &r.RollbackFailedInstancesOnPolicyBreach) + 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]any) + 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]any) + populate(objectMap, "code", r.Code) + populate(objectMap, "lastAction", r.LastAction) + populateDateTimeRFC3339(objectMap, "lastActionTime", r.LastActionTime) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "LastActionTime", &r.LastActionTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 RunCommandManagedIdentity. +func (r RunCommandManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", r.ClientID) + populate(objectMap, "objectId", r.ObjectID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandManagedIdentity. +func (r *RunCommandManagedIdentity) UnmarshalJSON(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 "clientId": + err = unpopulate(val, "ClientID", &r.ClientID) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &r.ObjectID) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "osImageNotificationProfile", s.OSImageNotificationProfile) + 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 "osImageNotificationProfile": + err = unpopulate(val, "OSImageNotificationProfile", &s.OSImageNotificationProfile) + delete(rawMsg, 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 SecurityPostureReference. +func (s SecurityPostureReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "excludeExtensions", s.ExcludeExtensions) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPostureReference. +func (s *SecurityPostureReference) UnmarshalJSON(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 "excludeExtensions": + err = unpopulate(val, "ExcludeExtensions", &s.ExcludeExtensions) + 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 SecurityProfile. +func (s SecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 ServiceArtifactReference. +func (s ServiceArtifactReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceArtifactReference. +func (s *ServiceArtifactReference) UnmarshalJSON(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 ShareInfoElement. +func (s ShareInfoElement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "architecture", s.Architecture) + populate(objectMap, "disallowed", s.Disallowed) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + populateDateTimeRFC3339(objectMap, "endOfLifeDate", s.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", s.ExcludeFromLatest) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "EndOfLifeDate", &s.EndOfLifeDate) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &s.ExcludeFromLatest) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + populate(objectMap, "blobContainerSasUri", t.BlobContainerSasURI) + populateDateTimeRFC3339(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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "code", u.Code) + populateDateTimeRFC3339(objectMap, "endTime", u.EndTime) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(val, "EndTime", &u.EndTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + populate(objectMap, "contentVersion", v.ContentVersion) + populate(objectMap, "id", v.ID) + populateAny(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", v.ForceUpdateTag) + populate(objectMap, "instanceView", v.InstanceView) + populateAny(objectMap, "protectedSettings", v.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", v.ProtectedSettingsFromKeyVault) + populate(objectMap, "provisionAfterExtensions", v.ProvisionAfterExtensions) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publisher", v.Publisher) + populateAny(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 "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 VirtualMachineExtensionUpdate. +func (v VirtualMachineExtensionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", v.ForceUpdateTag) + populateAny(objectMap, "protectedSettings", v.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", v.ProtectedSettingsFromKeyVault) + populate(objectMap, "publisher", v.Publisher) + populateAny(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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, "imageDeprecationStatus", v.ImageDeprecationStatus) + 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 "imageDeprecationStatus": + err = unpopulate(val, "ImageDeprecationStatus", &v.ImageDeprecationStatus) + 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]any) + 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]any) + 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]any) + 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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "auxiliaryMode", v.AuxiliaryMode) + populate(objectMap, "auxiliarySku", v.AuxiliarySKU) + 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 "auxiliaryMode": + err = unpopulate(val, "AuxiliaryMode", &v.AuxiliaryMode) + delete(rawMsg, key) + case "auxiliarySku": + err = unpopulate(val, "AuxiliarySKU", &v.AuxiliarySKU) + delete(rawMsg, 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + populate(objectMap, "domainNameLabel", v.DomainNameLabel) + populate(objectMap, "domainNameLabelScope", v.DomainNameLabelScope) + 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) + case "domainNameLabelScope": + err = unpopulate(val, "DomainNameLabelScope", &v.DomainNameLabelScope) + 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]any) + populate(objectMap, "exactVersion", v.ExactVersion) + populate(objectMap, "osProfile", v.OSProfile) + 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 "exactVersion": + err = unpopulate(val, "ExactVersion", &v.ExactVersion) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) + 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 VirtualMachineRunCommand. +func (v VirtualMachineRunCommand) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + populateDateTimeRFC3339(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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + populate(objectMap, "asyncExecution", v.AsyncExecution) + populate(objectMap, "errorBlobManagedIdentity", v.ErrorBlobManagedIdentity) + populate(objectMap, "errorBlobUri", v.ErrorBlobURI) + populate(objectMap, "instanceView", v.InstanceView) + populate(objectMap, "outputBlobManagedIdentity", v.OutputBlobManagedIdentity) + 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) + populate(objectMap, "treatFailureAsDeploymentFailure", v.TreatFailureAsDeploymentFailure) + 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 "errorBlobManagedIdentity": + err = unpopulate(val, "ErrorBlobManagedIdentity", &v.ErrorBlobManagedIdentity) + 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 "outputBlobManagedIdentity": + err = unpopulate(val, "OutputBlobManagedIdentity", &v.OutputBlobManagedIdentity) + 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) + 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 VirtualMachineRunCommandScriptSource. +func (v VirtualMachineRunCommandScriptSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "commandId", v.CommandID) + populate(objectMap, "script", v.Script) + populate(objectMap, "scriptUri", v.ScriptURI) + populate(objectMap, "scriptUriManagedIdentity", v.ScriptURIManagedIdentity) + 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) + case "scriptUriManagedIdentity": + err = unpopulate(val, "ScriptURIManagedIdentity", &v.ScriptURIManagedIdentity) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", v.ForceUpdateTag) + populateAny(objectMap, "protectedSettings", v.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", v.ProtectedSettingsFromKeyVault) + populate(objectMap, "provisionAfterExtensions", v.ProvisionAfterExtensions) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publisher", v.Publisher) + populateAny(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]any) + 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]any) + 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]any) + 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 "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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 "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]any) + 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]any) + populate(objectMap, "auxiliaryMode", v.AuxiliaryMode) + populate(objectMap, "auxiliarySku", v.AuxiliarySKU) + 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 "auxiliaryMode": + err = unpopulate(val, "AuxiliaryMode", &v.AuxiliaryMode) + delete(rawMsg, key) + case "auxiliarySku": + err = unpopulate(val, "AuxiliarySKU", &v.AuxiliarySKU) + delete(rawMsg, 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]any) + 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]any) + 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]any) + 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, "requireGuestProvisionSignal", v.RequireGuestProvisionSignal) + 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 "requireGuestProvisionSignal": + err = unpopulate(val, "RequireGuestProvisionSignal", &v.RequireGuestProvisionSignal) + 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]any) + populate(objectMap, "additionalCapabilities", v.AdditionalCapabilities) + populate(objectMap, "automaticRepairsPolicy", v.AutomaticRepairsPolicy) + populate(objectMap, "constrainedMaximumCapacity", v.ConstrainedMaximumCapacity) + 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) + populateDateTimeRFC3339(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 "constrainedMaximumCapacity": + err = unpopulate(val, "ConstrainedMaximumCapacity", &v.ConstrainedMaximumCapacity) + 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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + populate(objectMap, "domainNameLabel", v.DomainNameLabel) + populate(objectMap, "domainNameLabelScope", v.DomainNameLabelScope) + 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) + case "domainNameLabelScope": + err = unpopulate(val, "DomainNameLabelScope", &v.DomainNameLabelScope) + 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]any) + 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]any) + populate(objectMap, "exactVersion", v.ExactVersion) + populate(objectMap, "instanceIds", v.InstanceIDs) + populate(objectMap, "osProfile", v.OSProfile) + 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 "exactVersion": + err = unpopulate(val, "ExactVersion", &v.ExactVersion) + delete(rawMsg, key) + case "instanceIds": + err = unpopulate(val, "InstanceIDs", &v.InstanceIDs) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 "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]any) + 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]any) + 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 "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]any) + populate(objectMap, "auxiliaryMode", v.AuxiliaryMode) + populate(objectMap, "auxiliarySku", v.AuxiliarySKU) + 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 "auxiliaryMode": + err = unpopulate(val, "AuxiliaryMode", &v.AuxiliaryMode) + delete(rawMsg, key) + case "auxiliarySku": + err = unpopulate(val, "AuxiliarySKU", &v.AuxiliarySKU) + delete(rawMsg, 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "additionalCapabilities", v.AdditionalCapabilities) + populate(objectMap, "automaticRepairsPolicy", v.AutomaticRepairsPolicy) + populate(objectMap, "doNotRunExtensionsOnOverprovisionedVMs", v.DoNotRunExtensionsOnOverprovisionedVMs) + populate(objectMap, "overprovision", v.Overprovision) + populate(objectMap, "priorityMixPolicy", v.PriorityMixPolicy) + populate(objectMap, "proximityPlacementGroup", v.ProximityPlacementGroup) + populate(objectMap, "scaleInPolicy", v.ScaleInPolicy) + populate(objectMap, "singlePlacementGroup", v.SinglePlacementGroup) + populate(objectMap, "spotRestorePolicy", v.SpotRestorePolicy) + 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 "priorityMixPolicy": + err = unpopulate(val, "PriorityMixPolicy", &v.PriorityMixPolicy) + 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 "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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + 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 "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 "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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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, "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 "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 "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]any) + 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]any) + 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]any) + 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, "securityPostureReference", v.SecurityPostureReference) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "serviceArtifactReference", v.ServiceArtifactReference) + 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 "securityPostureReference": + err = unpopulate(val, "SecurityPostureReference", &v.SecurityPostureReference) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) + delete(rawMsg, key) + case "serviceArtifactReference": + err = unpopulate(val, "ServiceArtifactReference", &v.ServiceArtifactReference) + 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]any) + 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) + populateDateTimeRFC3339(objectMap, "timeCreated", v.TimeCreated) + 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 "timeCreated": + err = unpopulateDateTimeRFC3339(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) + } + 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]any) + 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]any) + populate(objectMap, "exactVersion", v.ExactVersion) + populate(objectMap, "osProfile", v.OSProfile) + 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 "exactVersion": + err = unpopulate(val, "ExactVersion", &v.ExactVersion) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) + 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 VirtualMachineSize. +func (v VirtualMachineSize) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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]any) + populate(objectMap, "activityId", v.ActivityID) + populate(objectMap, "assessmentState", v.AssessmentState) + populate(objectMap, "classifications", v.Classifications) + populate(objectMap, "kbId", v.KbID) + populateDateTimeRFC3339(objectMap, "lastModifiedDateTime", v.LastModifiedDateTime) + populate(objectMap, "name", v.Name) + populate(objectMap, "patchId", v.PatchID) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "classificationsToInclude", w.ClassificationsToInclude) + populate(objectMap, "excludeKbsRequiringReboot", w.ExcludeKbsRequiringReboot) + populate(objectMap, "kbNumbersToExclude", w.KbNumbersToExclude) + populate(objectMap, "kbNumbersToInclude", w.KbNumbersToInclude) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + populate(objectMap, "bypassPlatformSafetyChecksOnUserSchedule", w.BypassPlatformSafetyChecksOnUserSchedule) + 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 "bypassPlatformSafetyChecksOnUserSchedule": + err = unpopulate(val, "BypassPlatformSafetyChecksOnUserSchedule", &w.BypassPlatformSafetyChecksOnUserSchedule) + delete(rawMsg, 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]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) 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/v5/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/operations_client.go new file mode 100644 index 000000000..545c016fc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/operations_client.go @@ -0,0 +1,89 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "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/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 { + internal *arm.Client +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Gets a list of compute operations. +// +// Generated from API version 2023-07-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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/v5/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/options.go new file mode 100644 index 000000000..39d7b0f15 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/options.go @@ -0,0 +1,1901 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +// 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.NewListAvailableSizesPager +// method. +type AvailabilitySetsClientListAvailableSizesOptions struct { + // placeholder for future optional parameters +} + +// AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.NewListBySubscriptionPager +// 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.NewListPager 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 +} + +// 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.NewListByResourceGroupPager +// 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.NewListBySubscriptionPager +// 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 +} + +// 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.NewListByCapacityReservationGroupPager +// method. +type CapacityReservationsClientListByCapacityReservationGroupOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListOSFamiliesPager +// method. +type CloudServiceOperatingSystemsClientListOSFamiliesOptions struct { + // placeholder for future optional parameters +} + +// CloudServiceOperatingSystemsClientListOSVersionsOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.NewListOSVersionsPager +// method. +type CloudServiceOperatingSystemsClientListOSVersionsOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type CloudServiceRoleInstancesClientListOptions struct { + // The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + Expand *InstanceViewTypes +} + +// 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.NewListPager method. +type CloudServiceRolesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAllPager method. +type CloudServicesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// CloudServicesClientListOptions contains the optional parameters for the CloudServicesClient.NewListPager 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.NewListUpdateDomainsPager +// 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 +} + +// 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.NewListPager +// 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.NewListPager +// method. +type CommunityGalleryImagesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type DedicatedHostGroupsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DedicatedHostGroupsClientListBySubscriptionOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListBySubscriptionPager +// 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 +} + +// 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 +} + +// DedicatedHostsClientListAvailableSizesOptions contains the optional parameters for the DedicatedHostsClient.NewListAvailableSizesPager +// method. +type DedicatedHostsClientListAvailableSizesOptions struct { + // placeholder for future optional parameters +} + +// DedicatedHostsClientListByHostGroupOptions contains the optional parameters for the DedicatedHostsClient.NewListByHostGroupPager +// method. +type DedicatedHostsClientListByHostGroupOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type DiskAccessesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DiskAccessesClientListOptions contains the optional parameters for the DiskAccessesClient.NewListPager method. +type DiskAccessesClientListOptions struct { + // placeholder for future optional parameters +} + +// DiskAccessesClientListPrivateEndpointConnectionsOptions contains the optional parameters for the DiskAccessesClient.NewListPrivateEndpointConnectionsPager +// method. +type DiskAccessesClientListPrivateEndpointConnectionsOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAssociatedResourcesPager +// method. +type DiskEncryptionSetsClientListAssociatedResourcesOptions struct { + // placeholder for future optional parameters +} + +// DiskEncryptionSetsClientListByResourceGroupOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListByResourceGroupPager +// method. +type DiskEncryptionSetsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DiskEncryptionSetsClientListOptions contains the optional parameters for the DiskEncryptionSetsClient.NewListPager method. +type DiskEncryptionSetsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByRestorePointPager +// method. +type DiskRestorePointClientListByRestorePointOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type DisksClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DisksClientListOptions contains the optional parameters for the DisksClient.NewListPager method. +type DisksClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type GalleriesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// GalleriesClientListOptions contains the optional parameters for the GalleriesClient.NewListPager method. +type GalleriesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByGalleryApplicationPager +// 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.NewListByGalleryPager +// method. +type GalleryApplicationsClientListByGalleryOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByGalleryImagePager +// 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.NewListByGalleryPager +// method. +type GalleryImagesClientListByGalleryOptions struct { + // placeholder for future optional parameters +} + +// GallerySharingProfileClientBeginUpdateOptions contains the optional parameters for the GallerySharingProfileClient.BeginUpdate +// method. +type GallerySharingProfileClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// 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.NewListByResourceGroupPager +// method. +type ImagesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ImagesClientListOptions contains the optional parameters for the ImagesClient.NewListPager method. +type ImagesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type ProximityPlacementGroupsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ProximityPlacementGroupsClientListBySubscriptionOptions contains the optional parameters for the ProximityPlacementGroupsClient.NewListBySubscriptionPager +// 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 +} + +// ResourceSKUsClientListOptions contains the optional parameters for the ResourceSKUsClient.NewListPager 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 +} + +// 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.NewListAllPager +// method. +type RestorePointCollectionsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// RestorePointCollectionsClientListOptions contains the optional parameters for the RestorePointCollectionsClient.NewListPager +// 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 +} + +// 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 +} + +// 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.NewListByResourceGroupPager +// method. +type SSHPublicKeysClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SSHPublicKeysClientListBySubscriptionOptions contains the optional parameters for the SSHPublicKeysClient.NewListBySubscriptionPager +// 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 +} + +// 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.NewListPager method. +type SharedGalleriesClientListOptions struct { + // The query parameter to decide what shared galleries to fetch when doing listing operations. + SharedTo *SharedToValues +} + +// 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.NewListPager +// 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.NewListPager method. +type SharedGalleryImagesClientListOptions struct { + // The query parameter to decide what shared galleries to fetch when doing listing operations. + SharedTo *SharedToValues +} + +// 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.NewListByResourceGroupPager +// method. +type SnapshotsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsClientListOptions contains the optional parameters for the SnapshotsClient.NewListPager method. +type SnapshotsClientListOptions struct { + // placeholder for future optional parameters +} + +// UsageClientListOptions contains the optional parameters for the UsageClient.NewListPager method. +type UsageClientListOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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.NewListByVirtualMachinePager +// method. +type VirtualMachineRunCommandsClientListByVirtualMachineOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineRunCommandsClientListOptions contains the optional parameters for the VirtualMachineRunCommandsClient.NewListPager +// method. +type VirtualMachineRunCommandsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type VirtualMachineScaleSetExtensionsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// 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 +} + +// 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.NewListPager +// 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.NewListPager +// 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 { + // Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is available for VMSS with Flexible + // OrchestrationMode only) + Hibernate *bool + + // 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 +} + +// VirtualMachineScaleSetsClientBeginReapplyOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReapply +// method. +type VirtualMachineScaleSetsClientBeginReapplyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// 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.NewGetOSUpgradeHistoryPager +// 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.NewListAllPager +// method. +type VirtualMachineScaleSetsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientListByLocationOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListByLocationPager +// method. +type VirtualMachineScaleSetsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientListOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListPager +// method. +type VirtualMachineScaleSetsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientListSKUsOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListSKUsPager +// method. +type VirtualMachineScaleSetsClientListSKUsOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineSizesClientListOptions contains the optional parameters for the VirtualMachineSizesClient.NewListPager method. +type VirtualMachineSizesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAllPager method. +type VirtualMachinesClientListAllOptions struct { + // The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this + // can only be specified if a valid $filter option is specified + Expand *ExpandTypesForListVMs + + // 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.NewListAvailableSizesPager +// method. +type VirtualMachinesClientListAvailableSizesOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachinesClientListByLocationOptions contains the optional parameters for the VirtualMachinesClient.NewListByLocationPager +// method. +type VirtualMachinesClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.NewListPager method. +type VirtualMachinesClientListOptions struct { + // The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this + // can only be specified if a valid $filter option is specified + Expand *ExpandTypeForListVMs + + // 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 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/proximityplacementgroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/proximityplacementgroups_client.go new file mode 100644 index 000000000..7dbfd8f5b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/proximityplacementgroups_client.go @@ -0,0 +1,421 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProximityPlacementGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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) { + var err error + const operationName = "ProximityPlacementGroupsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, parameters, options) + if err != nil { + return ProximityPlacementGroupsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProximityPlacementGroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ProximityPlacementGroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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) { + var err error + const operationName = "ProximityPlacementGroupsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, options) + if err != nil { + return ProximityPlacementGroupsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProximityPlacementGroupsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProximityPlacementGroupsClientDeleteResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "ProximityPlacementGroupsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, options) + if err != nil { + return ProximityPlacementGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProximityPlacementGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProximityPlacementGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - options - ProximityPlacementGroupsClientListByResourceGroupOptions contains the optional parameters for the ProximityPlacementGroupsClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProximityPlacementGroupsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return ProximityPlacementGroupsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - options - ProximityPlacementGroupsClientListBySubscriptionOptions contains the optional parameters for the ProximityPlacementGroupsClient.NewListBySubscriptionPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProximityPlacementGroupsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return ProximityPlacementGroupsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "ProximityPlacementGroupsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, parameters, options) + if err != nil { + return ProximityPlacementGroupsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProximityPlacementGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProximityPlacementGroupsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v5/resourceskus_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/resourceskus_client.go new file mode 100644 index 000000000..e0dd1afa4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/resourceskus_client.go @@ -0,0 +1,105 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ResourceSKUsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceSKUsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return ResourceSKUsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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/v5/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/response_types.go new file mode 100644 index 000000000..360dfc34b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/response_types.go @@ -0,0 +1,1646 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import "io" + +// AvailabilitySetsClientCreateOrUpdateResponse contains the response from method AvailabilitySetsClient.CreateOrUpdate. +type AvailabilitySetsClientCreateOrUpdateResponse struct { + // 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 an availability set at creation time. An existing VM cannot be added to an availability + // set. + 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 { + // 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 an availability set at creation time. An existing VM cannot be added to an availability + // set. + AvailabilitySet +} + +// AvailabilitySetsClientListAvailableSizesResponse contains the response from method AvailabilitySetsClient.NewListAvailableSizesPager. +type AvailabilitySetsClientListAvailableSizesResponse struct { + // The List Virtual Machine operation response. + VirtualMachineSizeListResult +} + +// AvailabilitySetsClientListBySubscriptionResponse contains the response from method AvailabilitySetsClient.NewListBySubscriptionPager. +type AvailabilitySetsClientListBySubscriptionResponse struct { + // The List Availability Set operation response. + AvailabilitySetListResult +} + +// AvailabilitySetsClientListResponse contains the response from method AvailabilitySetsClient.NewListPager. +type AvailabilitySetsClientListResponse struct { + // The List Availability Set operation response. + AvailabilitySetListResult +} + +// AvailabilitySetsClientUpdateResponse contains the response from method AvailabilitySetsClient.Update. +type AvailabilitySetsClientUpdateResponse struct { + // 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 an availability set at creation time. An existing VM cannot be added to an availability + // set. + AvailabilitySet +} + +// CapacityReservationGroupsClientCreateOrUpdateResponse contains the response from method CapacityReservationGroupsClient.CreateOrUpdate. +type CapacityReservationGroupsClientCreateOrUpdateResponse struct { + // 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. + 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 { + // 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. + CapacityReservationGroup +} + +// CapacityReservationGroupsClientListByResourceGroupResponse contains the response from method CapacityReservationGroupsClient.NewListByResourceGroupPager. +type CapacityReservationGroupsClientListByResourceGroupResponse struct { + // The List capacity reservation group with resource group response. + CapacityReservationGroupListResult +} + +// CapacityReservationGroupsClientListBySubscriptionResponse contains the response from method CapacityReservationGroupsClient.NewListBySubscriptionPager. +type CapacityReservationGroupsClientListBySubscriptionResponse struct { + // The List capacity reservation group with resource group response. + CapacityReservationGroupListResult +} + +// CapacityReservationGroupsClientUpdateResponse contains the response from method CapacityReservationGroupsClient.Update. +type CapacityReservationGroupsClientUpdateResponse struct { + // 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. + CapacityReservationGroup +} + +// CapacityReservationsClientCreateOrUpdateResponse contains the response from method CapacityReservationsClient.BeginCreateOrUpdate. +type CapacityReservationsClientCreateOrUpdateResponse struct { + // Specifies information about the capacity reservation. + CapacityReservation +} + +// CapacityReservationsClientDeleteResponse contains the response from method CapacityReservationsClient.BeginDelete. +type CapacityReservationsClientDeleteResponse struct { + // placeholder for future response values +} + +// CapacityReservationsClientGetResponse contains the response from method CapacityReservationsClient.Get. +type CapacityReservationsClientGetResponse struct { + // Specifies information about the capacity reservation. + CapacityReservation +} + +// CapacityReservationsClientListByCapacityReservationGroupResponse contains the response from method CapacityReservationsClient.NewListByCapacityReservationGroupPager. +type CapacityReservationsClientListByCapacityReservationGroupResponse struct { + // The list capacity reservation operation response. + CapacityReservationListResult +} + +// CapacityReservationsClientUpdateResponse contains the response from method CapacityReservationsClient.BeginUpdate. +type CapacityReservationsClientUpdateResponse struct { + // Specifies information about the capacity reservation. + CapacityReservation +} + +// CloudServiceOperatingSystemsClientGetOSFamilyResponse contains the response from method CloudServiceOperatingSystemsClient.GetOSFamily. +type CloudServiceOperatingSystemsClientGetOSFamilyResponse struct { + // Describes a cloud service OS family. + OSFamily +} + +// CloudServiceOperatingSystemsClientGetOSVersionResponse contains the response from method CloudServiceOperatingSystemsClient.GetOSVersion. +type CloudServiceOperatingSystemsClientGetOSVersionResponse struct { + // Describes a cloud service OS version. + OSVersion +} + +// CloudServiceOperatingSystemsClientListOSFamiliesResponse contains the response from method CloudServiceOperatingSystemsClient.NewListOSFamiliesPager. +type CloudServiceOperatingSystemsClientListOSFamiliesResponse struct { + // The list operation result. + OSFamilyListResult +} + +// CloudServiceOperatingSystemsClientListOSVersionsResponse contains the response from method CloudServiceOperatingSystemsClient.NewListOSVersionsPager. +type CloudServiceOperatingSystemsClientListOSVersionsResponse struct { + // The list operation result. + OSVersionListResult +} + +// CloudServiceRoleInstancesClientDeleteResponse contains the response from method CloudServiceRoleInstancesClient.BeginDelete. +type CloudServiceRoleInstancesClientDeleteResponse struct { + // placeholder for future response values +} + +// CloudServiceRoleInstancesClientGetInstanceViewResponse contains the response from method CloudServiceRoleInstancesClient.GetInstanceView. +type CloudServiceRoleInstancesClientGetInstanceViewResponse struct { + // The instance view of the role instance. + 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 { + // Describes the cloud service role instance. + RoleInstance +} + +// CloudServiceRoleInstancesClientListResponse contains the response from method CloudServiceRoleInstancesClient.NewListPager. +type CloudServiceRoleInstancesClientListResponse struct { + // The list operation result. + RoleInstanceListResult +} + +// CloudServiceRoleInstancesClientRebuildResponse contains the response from method CloudServiceRoleInstancesClient.BeginRebuild. +type CloudServiceRoleInstancesClientRebuildResponse struct { + // placeholder for future response values +} + +// CloudServiceRoleInstancesClientReimageResponse contains the response from method CloudServiceRoleInstancesClient.BeginReimage. +type CloudServiceRoleInstancesClientReimageResponse struct { + // placeholder for future response values +} + +// CloudServiceRoleInstancesClientRestartResponse contains the response from method CloudServiceRoleInstancesClient.BeginRestart. +type CloudServiceRoleInstancesClientRestartResponse struct { + // placeholder for future response values +} + +// CloudServiceRolesClientGetResponse contains the response from method CloudServiceRolesClient.Get. +type CloudServiceRolesClientGetResponse struct { + // Describes a role of the cloud service. + CloudServiceRole +} + +// CloudServiceRolesClientListResponse contains the response from method CloudServiceRolesClient.NewListPager. +type CloudServiceRolesClientListResponse struct { + // The list operation result. + CloudServiceRoleListResult +} + +// CloudServicesClientCreateOrUpdateResponse contains the response from method CloudServicesClient.BeginCreateOrUpdate. +type CloudServicesClientCreateOrUpdateResponse struct { + // Describes the cloud service. + CloudService +} + +// CloudServicesClientDeleteInstancesResponse contains the response from method CloudServicesClient.BeginDeleteInstances. +type CloudServicesClientDeleteInstancesResponse struct { + // placeholder for future response values +} + +// CloudServicesClientDeleteResponse contains the response from method CloudServicesClient.BeginDelete. +type CloudServicesClientDeleteResponse struct { + // placeholder for future response values +} + +// CloudServicesClientGetInstanceViewResponse contains the response from method CloudServicesClient.GetInstanceView. +type CloudServicesClientGetInstanceViewResponse struct { + // InstanceView of CloudService as a whole + CloudServiceInstanceView +} + +// CloudServicesClientGetResponse contains the response from method CloudServicesClient.Get. +type CloudServicesClientGetResponse struct { + // Describes the cloud service. + CloudService +} + +// CloudServicesClientListAllResponse contains the response from method CloudServicesClient.NewListAllPager. +type CloudServicesClientListAllResponse struct { + // The list operation result. + CloudServiceListResult +} + +// CloudServicesClientListResponse contains the response from method CloudServicesClient.NewListPager. +type CloudServicesClientListResponse struct { + // The list operation result. + CloudServiceListResult +} + +// CloudServicesClientPowerOffResponse contains the response from method CloudServicesClient.BeginPowerOff. +type CloudServicesClientPowerOffResponse struct { + // placeholder for future response values +} + +// CloudServicesClientRebuildResponse contains the response from method CloudServicesClient.BeginRebuild. +type CloudServicesClientRebuildResponse struct { + // placeholder for future response values +} + +// CloudServicesClientReimageResponse contains the response from method CloudServicesClient.BeginReimage. +type CloudServicesClientReimageResponse struct { + // placeholder for future response values +} + +// CloudServicesClientRestartResponse contains the response from method CloudServicesClient.BeginRestart. +type CloudServicesClientRestartResponse struct { + // placeholder for future response values +} + +// CloudServicesClientStartResponse contains the response from method CloudServicesClient.BeginStart. +type CloudServicesClientStartResponse struct { + // placeholder for future response values +} + +// CloudServicesClientUpdateResponse contains the response from method CloudServicesClient.BeginUpdate. +type CloudServicesClientUpdateResponse struct { + // Describes the cloud service. + CloudService +} + +// CloudServicesUpdateDomainClientGetUpdateDomainResponse contains the response from method CloudServicesUpdateDomainClient.GetUpdateDomain. +type CloudServicesUpdateDomainClientGetUpdateDomainResponse struct { + // Defines an update domain for the cloud service. + UpdateDomain +} + +// CloudServicesUpdateDomainClientListUpdateDomainsResponse contains the response from method CloudServicesUpdateDomainClient.NewListUpdateDomainsPager. +type CloudServicesUpdateDomainClientListUpdateDomainsResponse struct { + // The list operation result. + UpdateDomainListResult +} + +// CloudServicesUpdateDomainClientWalkUpdateDomainResponse contains the response from method CloudServicesUpdateDomainClient.BeginWalkUpdateDomain. +type CloudServicesUpdateDomainClientWalkUpdateDomainResponse struct { + // placeholder for future response values +} + +// CommunityGalleriesClientGetResponse contains the response from method CommunityGalleriesClient.Get. +type CommunityGalleriesClientGetResponse struct { + // Specifies information about the Community Gallery that you want to create or update. + CommunityGallery +} + +// CommunityGalleryImageVersionsClientGetResponse contains the response from method CommunityGalleryImageVersionsClient.Get. +type CommunityGalleryImageVersionsClientGetResponse struct { + // Specifies information about the gallery image version that you want to create or update. + CommunityGalleryImageVersion +} + +// CommunityGalleryImageVersionsClientListResponse contains the response from method CommunityGalleryImageVersionsClient.NewListPager. +type CommunityGalleryImageVersionsClientListResponse struct { + // The List Community Gallery Image versions operation response. + CommunityGalleryImageVersionList +} + +// CommunityGalleryImagesClientGetResponse contains the response from method CommunityGalleryImagesClient.Get. +type CommunityGalleryImagesClientGetResponse struct { + // Specifies information about the gallery image definition that you want to create or update. + CommunityGalleryImage +} + +// CommunityGalleryImagesClientListResponse contains the response from method CommunityGalleryImagesClient.NewListPager. +type CommunityGalleryImagesClientListResponse struct { + // The List Community Gallery Images operation response. + CommunityGalleryImageList +} + +// DedicatedHostGroupsClientCreateOrUpdateResponse contains the response from method DedicatedHostGroupsClient.CreateOrUpdate. +type DedicatedHostGroupsClientCreateOrUpdateResponse struct { + // 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. + 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 { + // 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. + DedicatedHostGroup +} + +// DedicatedHostGroupsClientListByResourceGroupResponse contains the response from method DedicatedHostGroupsClient.NewListByResourceGroupPager. +type DedicatedHostGroupsClientListByResourceGroupResponse struct { + // The List Dedicated Host Group with resource group response. + DedicatedHostGroupListResult +} + +// DedicatedHostGroupsClientListBySubscriptionResponse contains the response from method DedicatedHostGroupsClient.NewListBySubscriptionPager. +type DedicatedHostGroupsClientListBySubscriptionResponse struct { + // The List Dedicated Host Group with resource group response. + DedicatedHostGroupListResult +} + +// DedicatedHostGroupsClientUpdateResponse contains the response from method DedicatedHostGroupsClient.Update. +type DedicatedHostGroupsClientUpdateResponse struct { + // 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. + DedicatedHostGroup +} + +// DedicatedHostsClientCreateOrUpdateResponse contains the response from method DedicatedHostsClient.BeginCreateOrUpdate. +type DedicatedHostsClientCreateOrUpdateResponse struct { + // Specifies information about the Dedicated host. + DedicatedHost +} + +// DedicatedHostsClientDeleteResponse contains the response from method DedicatedHostsClient.BeginDelete. +type DedicatedHostsClientDeleteResponse struct { + // placeholder for future response values +} + +// DedicatedHostsClientGetResponse contains the response from method DedicatedHostsClient.Get. +type DedicatedHostsClientGetResponse struct { + // Specifies information about the Dedicated host. + DedicatedHost +} + +// DedicatedHostsClientListAvailableSizesResponse contains the response from method DedicatedHostsClient.NewListAvailableSizesPager. +type DedicatedHostsClientListAvailableSizesResponse struct { + // The List Dedicated Host sizes operation response. + DedicatedHostSizeListResult +} + +// DedicatedHostsClientListByHostGroupResponse contains the response from method DedicatedHostsClient.NewListByHostGroupPager. +type DedicatedHostsClientListByHostGroupResponse struct { + // The list dedicated host operation response. + DedicatedHostListResult +} + +// DedicatedHostsClientRestartResponse contains the response from method DedicatedHostsClient.BeginRestart. +type DedicatedHostsClientRestartResponse struct { + // placeholder for future response values +} + +// DedicatedHostsClientUpdateResponse contains the response from method DedicatedHostsClient.BeginUpdate. +type DedicatedHostsClientUpdateResponse struct { + // Specifies information about the Dedicated host. + DedicatedHost +} + +// DiskAccessesClientCreateOrUpdateResponse contains the response from method DiskAccessesClient.BeginCreateOrUpdate. +type DiskAccessesClientCreateOrUpdateResponse struct { + // disk access resource. + DiskAccess +} + +// DiskAccessesClientDeleteAPrivateEndpointConnectionResponse contains the response from method DiskAccessesClient.BeginDeleteAPrivateEndpointConnection. +type DiskAccessesClientDeleteAPrivateEndpointConnectionResponse struct { + // placeholder for future response values +} + +// DiskAccessesClientDeleteResponse contains the response from method DiskAccessesClient.BeginDelete. +type DiskAccessesClientDeleteResponse struct { + // placeholder for future response values +} + +// DiskAccessesClientGetAPrivateEndpointConnectionResponse contains the response from method DiskAccessesClient.GetAPrivateEndpointConnection. +type DiskAccessesClientGetAPrivateEndpointConnectionResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnection +} + +// DiskAccessesClientGetPrivateLinkResourcesResponse contains the response from method DiskAccessesClient.GetPrivateLinkResources. +type DiskAccessesClientGetPrivateLinkResourcesResponse struct { + // A list of private link resources + PrivateLinkResourceListResult +} + +// DiskAccessesClientGetResponse contains the response from method DiskAccessesClient.Get. +type DiskAccessesClientGetResponse struct { + // disk access resource. + DiskAccess +} + +// DiskAccessesClientListByResourceGroupResponse contains the response from method DiskAccessesClient.NewListByResourceGroupPager. +type DiskAccessesClientListByResourceGroupResponse struct { + // The List disk access operation response. + DiskAccessList +} + +// DiskAccessesClientListPrivateEndpointConnectionsResponse contains the response from method DiskAccessesClient.NewListPrivateEndpointConnectionsPager. +type DiskAccessesClientListPrivateEndpointConnectionsResponse struct { + // A list of private link resources + PrivateEndpointConnectionListResult +} + +// DiskAccessesClientListResponse contains the response from method DiskAccessesClient.NewListPager. +type DiskAccessesClientListResponse struct { + // The List disk access operation response. + DiskAccessList +} + +// DiskAccessesClientUpdateAPrivateEndpointConnectionResponse contains the response from method DiskAccessesClient.BeginUpdateAPrivateEndpointConnection. +type DiskAccessesClientUpdateAPrivateEndpointConnectionResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnection +} + +// DiskAccessesClientUpdateResponse contains the response from method DiskAccessesClient.BeginUpdate. +type DiskAccessesClientUpdateResponse struct { + // disk access resource. + DiskAccess +} + +// DiskEncryptionSetsClientCreateOrUpdateResponse contains the response from method DiskEncryptionSetsClient.BeginCreateOrUpdate. +type DiskEncryptionSetsClientCreateOrUpdateResponse struct { + // disk encryption set resource. + DiskEncryptionSet +} + +// DiskEncryptionSetsClientDeleteResponse contains the response from method DiskEncryptionSetsClient.BeginDelete. +type DiskEncryptionSetsClientDeleteResponse struct { + // placeholder for future response values +} + +// DiskEncryptionSetsClientGetResponse contains the response from method DiskEncryptionSetsClient.Get. +type DiskEncryptionSetsClientGetResponse struct { + // disk encryption set resource. + DiskEncryptionSet +} + +// DiskEncryptionSetsClientListAssociatedResourcesResponse contains the response from method DiskEncryptionSetsClient.NewListAssociatedResourcesPager. +type DiskEncryptionSetsClientListAssociatedResourcesResponse struct { + // The List resources which are encrypted with the disk encryption set. + ResourceURIList +} + +// DiskEncryptionSetsClientListByResourceGroupResponse contains the response from method DiskEncryptionSetsClient.NewListByResourceGroupPager. +type DiskEncryptionSetsClientListByResourceGroupResponse struct { + // The List disk encryption set operation response. + DiskEncryptionSetList +} + +// DiskEncryptionSetsClientListResponse contains the response from method DiskEncryptionSetsClient.NewListPager. +type DiskEncryptionSetsClientListResponse struct { + // The List disk encryption set operation response. + DiskEncryptionSetList +} + +// DiskEncryptionSetsClientUpdateResponse contains the response from method DiskEncryptionSetsClient.BeginUpdate. +type DiskEncryptionSetsClientUpdateResponse struct { + // disk encryption set resource. + DiskEncryptionSet +} + +// DiskRestorePointClientGetResponse contains the response from method DiskRestorePointClient.Get. +type DiskRestorePointClientGetResponse struct { + // Properties of disk restore point + DiskRestorePoint +} + +// DiskRestorePointClientGrantAccessResponse contains the response from method DiskRestorePointClient.BeginGrantAccess. +type DiskRestorePointClientGrantAccessResponse struct { + // A disk access SAS uri. + AccessURI +} + +// DiskRestorePointClientListByRestorePointResponse contains the response from method DiskRestorePointClient.NewListByRestorePointPager. +type DiskRestorePointClientListByRestorePointResponse struct { + // The List Disk Restore Points operation response. + DiskRestorePointList +} + +// DiskRestorePointClientRevokeAccessResponse contains the response from method DiskRestorePointClient.BeginRevokeAccess. +type DiskRestorePointClientRevokeAccessResponse struct { + // placeholder for future response values +} + +// DisksClientCreateOrUpdateResponse contains the response from method DisksClient.BeginCreateOrUpdate. +type DisksClientCreateOrUpdateResponse struct { + // Disk resource. + Disk +} + +// DisksClientDeleteResponse contains the response from method DisksClient.BeginDelete. +type DisksClientDeleteResponse struct { + // placeholder for future response values +} + +// DisksClientGetResponse contains the response from method DisksClient.Get. +type DisksClientGetResponse struct { + // Disk resource. + Disk +} + +// DisksClientGrantAccessResponse contains the response from method DisksClient.BeginGrantAccess. +type DisksClientGrantAccessResponse struct { + // A disk access SAS uri. + AccessURI +} + +// DisksClientListByResourceGroupResponse contains the response from method DisksClient.NewListByResourceGroupPager. +type DisksClientListByResourceGroupResponse struct { + // The List Disks operation response. + DiskList +} + +// DisksClientListResponse contains the response from method DisksClient.NewListPager. +type DisksClientListResponse struct { + // The List Disks operation response. + DiskList +} + +// DisksClientRevokeAccessResponse contains the response from method DisksClient.BeginRevokeAccess. +type DisksClientRevokeAccessResponse struct { + // placeholder for future response values +} + +// DisksClientUpdateResponse contains the response from method DisksClient.BeginUpdate. +type DisksClientUpdateResponse struct { + // Disk resource. + Disk +} + +// GalleriesClientCreateOrUpdateResponse contains the response from method GalleriesClient.BeginCreateOrUpdate. +type GalleriesClientCreateOrUpdateResponse struct { + // Specifies information about the Shared Image Gallery that you want to create or update. + Gallery +} + +// GalleriesClientDeleteResponse contains the response from method GalleriesClient.BeginDelete. +type GalleriesClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleriesClientGetResponse contains the response from method GalleriesClient.Get. +type GalleriesClientGetResponse struct { + // Specifies information about the Shared Image Gallery that you want to create or update. + Gallery +} + +// GalleriesClientListByResourceGroupResponse contains the response from method GalleriesClient.NewListByResourceGroupPager. +type GalleriesClientListByResourceGroupResponse struct { + // The List Galleries operation response. + GalleryList +} + +// GalleriesClientListResponse contains the response from method GalleriesClient.NewListPager. +type GalleriesClientListResponse struct { + // The List Galleries operation response. + GalleryList +} + +// GalleriesClientUpdateResponse contains the response from method GalleriesClient.BeginUpdate. +type GalleriesClientUpdateResponse struct { + // Specifies information about the Shared Image Gallery that you want to create or update. + Gallery +} + +// GalleryApplicationVersionsClientCreateOrUpdateResponse contains the response from method GalleryApplicationVersionsClient.BeginCreateOrUpdate. +type GalleryApplicationVersionsClientCreateOrUpdateResponse struct { + // Specifies information about the gallery Application Version that you want to create or update. + GalleryApplicationVersion +} + +// GalleryApplicationVersionsClientDeleteResponse contains the response from method GalleryApplicationVersionsClient.BeginDelete. +type GalleryApplicationVersionsClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleryApplicationVersionsClientGetResponse contains the response from method GalleryApplicationVersionsClient.Get. +type GalleryApplicationVersionsClientGetResponse struct { + // Specifies information about the gallery Application Version that you want to create or update. + GalleryApplicationVersion +} + +// GalleryApplicationVersionsClientListByGalleryApplicationResponse contains the response from method GalleryApplicationVersionsClient.NewListByGalleryApplicationPager. +type GalleryApplicationVersionsClientListByGalleryApplicationResponse struct { + // The List Gallery Application version operation response. + GalleryApplicationVersionList +} + +// GalleryApplicationVersionsClientUpdateResponse contains the response from method GalleryApplicationVersionsClient.BeginUpdate. +type GalleryApplicationVersionsClientUpdateResponse struct { + // Specifies information about the gallery Application Version that you want to create or update. + GalleryApplicationVersion +} + +// GalleryApplicationsClientCreateOrUpdateResponse contains the response from method GalleryApplicationsClient.BeginCreateOrUpdate. +type GalleryApplicationsClientCreateOrUpdateResponse struct { + // Specifies information about the gallery Application Definition that you want to create or update. + GalleryApplication +} + +// GalleryApplicationsClientDeleteResponse contains the response from method GalleryApplicationsClient.BeginDelete. +type GalleryApplicationsClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleryApplicationsClientGetResponse contains the response from method GalleryApplicationsClient.Get. +type GalleryApplicationsClientGetResponse struct { + // Specifies information about the gallery Application Definition that you want to create or update. + GalleryApplication +} + +// GalleryApplicationsClientListByGalleryResponse contains the response from method GalleryApplicationsClient.NewListByGalleryPager. +type GalleryApplicationsClientListByGalleryResponse struct { + // The List Gallery Applications operation response. + GalleryApplicationList +} + +// GalleryApplicationsClientUpdateResponse contains the response from method GalleryApplicationsClient.BeginUpdate. +type GalleryApplicationsClientUpdateResponse struct { + // Specifies information about the gallery Application Definition that you want to create or update. + GalleryApplication +} + +// GalleryImageVersionsClientCreateOrUpdateResponse contains the response from method GalleryImageVersionsClient.BeginCreateOrUpdate. +type GalleryImageVersionsClientCreateOrUpdateResponse struct { + // Specifies information about the gallery image version that you want to create or update. + GalleryImageVersion +} + +// GalleryImageVersionsClientDeleteResponse contains the response from method GalleryImageVersionsClient.BeginDelete. +type GalleryImageVersionsClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleryImageVersionsClientGetResponse contains the response from method GalleryImageVersionsClient.Get. +type GalleryImageVersionsClientGetResponse struct { + // Specifies information about the gallery image version that you want to create or update. + GalleryImageVersion +} + +// GalleryImageVersionsClientListByGalleryImageResponse contains the response from method GalleryImageVersionsClient.NewListByGalleryImagePager. +type GalleryImageVersionsClientListByGalleryImageResponse struct { + // The List Gallery Image version operation response. + GalleryImageVersionList +} + +// GalleryImageVersionsClientUpdateResponse contains the response from method GalleryImageVersionsClient.BeginUpdate. +type GalleryImageVersionsClientUpdateResponse struct { + // Specifies information about the gallery image version that you want to create or update. + GalleryImageVersion +} + +// GalleryImagesClientCreateOrUpdateResponse contains the response from method GalleryImagesClient.BeginCreateOrUpdate. +type GalleryImagesClientCreateOrUpdateResponse struct { + // Specifies information about the gallery image definition that you want to create or update. + GalleryImage +} + +// GalleryImagesClientDeleteResponse contains the response from method GalleryImagesClient.BeginDelete. +type GalleryImagesClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleryImagesClientGetResponse contains the response from method GalleryImagesClient.Get. +type GalleryImagesClientGetResponse struct { + // Specifies information about the gallery image definition that you want to create or update. + GalleryImage +} + +// GalleryImagesClientListByGalleryResponse contains the response from method GalleryImagesClient.NewListByGalleryPager. +type GalleryImagesClientListByGalleryResponse struct { + // The List Gallery Images operation response. + GalleryImageList +} + +// GalleryImagesClientUpdateResponse contains the response from method GalleryImagesClient.BeginUpdate. +type GalleryImagesClientUpdateResponse struct { + // Specifies information about the gallery image definition that you want to create or update. + GalleryImage +} + +// GallerySharingProfileClientUpdateResponse contains the response from method GallerySharingProfileClient.BeginUpdate. +type GallerySharingProfileClientUpdateResponse struct { + // Specifies information about the gallery sharing profile update. + SharingUpdate +} + +// ImagesClientCreateOrUpdateResponse contains the response from method ImagesClient.BeginCreateOrUpdate. +type ImagesClientCreateOrUpdateResponse struct { + // 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 +} + +// ImagesClientDeleteResponse contains the response from method ImagesClient.BeginDelete. +type ImagesClientDeleteResponse struct { + // placeholder for future response values +} + +// ImagesClientGetResponse contains the response from method ImagesClient.Get. +type ImagesClientGetResponse struct { + // 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 +} + +// ImagesClientListByResourceGroupResponse contains the response from method ImagesClient.NewListByResourceGroupPager. +type ImagesClientListByResourceGroupResponse struct { + // The List Image operation response. + ImageListResult +} + +// ImagesClientListResponse contains the response from method ImagesClient.NewListPager. +type ImagesClientListResponse struct { + // The List Image operation response. + ImageListResult +} + +// ImagesClientUpdateResponse contains the response from method ImagesClient.BeginUpdate. +type ImagesClientUpdateResponse struct { + // 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 +} + +// LogAnalyticsClientExportRequestRateByIntervalResponse contains the response from method LogAnalyticsClient.BeginExportRequestRateByInterval. +type LogAnalyticsClientExportRequestRateByIntervalResponse struct { + // LogAnalytics operation status response + LogAnalyticsOperationResult +} + +// LogAnalyticsClientExportThrottledRequestsResponse contains the response from method LogAnalyticsClient.BeginExportThrottledRequests. +type LogAnalyticsClientExportThrottledRequestsResponse struct { + // LogAnalytics operation status response + LogAnalyticsOperationResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // The List Compute Operation operation response. + OperationListResult +} + +// ProximityPlacementGroupsClientCreateOrUpdateResponse contains the response from method ProximityPlacementGroupsClient.CreateOrUpdate. +type ProximityPlacementGroupsClientCreateOrUpdateResponse struct { + // Specifies information about the proximity placement group. + 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 { + // Specifies information about the proximity placement group. + ProximityPlacementGroup +} + +// ProximityPlacementGroupsClientListByResourceGroupResponse contains the response from method ProximityPlacementGroupsClient.NewListByResourceGroupPager. +type ProximityPlacementGroupsClientListByResourceGroupResponse struct { + // The List Proximity Placement Group operation response. + ProximityPlacementGroupListResult +} + +// ProximityPlacementGroupsClientListBySubscriptionResponse contains the response from method ProximityPlacementGroupsClient.NewListBySubscriptionPager. +type ProximityPlacementGroupsClientListBySubscriptionResponse struct { + // The List Proximity Placement Group operation response. + ProximityPlacementGroupListResult +} + +// ProximityPlacementGroupsClientUpdateResponse contains the response from method ProximityPlacementGroupsClient.Update. +type ProximityPlacementGroupsClientUpdateResponse struct { + // Specifies information about the proximity placement group. + ProximityPlacementGroup +} + +// ResourceSKUsClientListResponse contains the response from method ResourceSKUsClient.NewListPager. +type ResourceSKUsClientListResponse struct { + // The List Resource Skus operation response. + ResourceSKUsResult +} + +// RestorePointCollectionsClientCreateOrUpdateResponse contains the response from method RestorePointCollectionsClient.CreateOrUpdate. +type RestorePointCollectionsClientCreateOrUpdateResponse struct { + // Create or update Restore Point collection parameters. + RestorePointCollection +} + +// RestorePointCollectionsClientDeleteResponse contains the response from method RestorePointCollectionsClient.BeginDelete. +type RestorePointCollectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// RestorePointCollectionsClientGetResponse contains the response from method RestorePointCollectionsClient.Get. +type RestorePointCollectionsClientGetResponse struct { + // Create or update Restore Point collection parameters. + RestorePointCollection +} + +// RestorePointCollectionsClientListAllResponse contains the response from method RestorePointCollectionsClient.NewListAllPager. +type RestorePointCollectionsClientListAllResponse struct { + // The List restore point collection operation response. + RestorePointCollectionListResult +} + +// RestorePointCollectionsClientListResponse contains the response from method RestorePointCollectionsClient.NewListPager. +type RestorePointCollectionsClientListResponse struct { + // The List restore point collection operation response. + RestorePointCollectionListResult +} + +// RestorePointCollectionsClientUpdateResponse contains the response from method RestorePointCollectionsClient.Update. +type RestorePointCollectionsClientUpdateResponse struct { + // Create or update Restore Point collection parameters. + RestorePointCollection +} + +// RestorePointsClientCreateResponse contains the response from method RestorePointsClient.BeginCreate. +type RestorePointsClientCreateResponse struct { + // Restore Point details. + RestorePoint +} + +// RestorePointsClientDeleteResponse contains the response from method RestorePointsClient.BeginDelete. +type RestorePointsClientDeleteResponse struct { + // placeholder for future response values +} + +// RestorePointsClientGetResponse contains the response from method RestorePointsClient.Get. +type RestorePointsClientGetResponse struct { + // Restore Point details. + RestorePoint +} + +// SSHPublicKeysClientCreateResponse contains the response from method SSHPublicKeysClient.Create. +type SSHPublicKeysClientCreateResponse struct { + // Specifies information about the SSH public key. + 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 { + // Response from generation of an SSH key pair. + SSHPublicKeyGenerateKeyPairResult +} + +// SSHPublicKeysClientGetResponse contains the response from method SSHPublicKeysClient.Get. +type SSHPublicKeysClientGetResponse struct { + // Specifies information about the SSH public key. + SSHPublicKeyResource +} + +// SSHPublicKeysClientListByResourceGroupResponse contains the response from method SSHPublicKeysClient.NewListByResourceGroupPager. +type SSHPublicKeysClientListByResourceGroupResponse struct { + // The list SSH public keys operation response. + SSHPublicKeysGroupListResult +} + +// SSHPublicKeysClientListBySubscriptionResponse contains the response from method SSHPublicKeysClient.NewListBySubscriptionPager. +type SSHPublicKeysClientListBySubscriptionResponse struct { + // The list SSH public keys operation response. + SSHPublicKeysGroupListResult +} + +// SSHPublicKeysClientUpdateResponse contains the response from method SSHPublicKeysClient.Update. +type SSHPublicKeysClientUpdateResponse struct { + // Specifies information about the SSH public key. + SSHPublicKeyResource +} + +// SharedGalleriesClientGetResponse contains the response from method SharedGalleriesClient.Get. +type SharedGalleriesClientGetResponse struct { + // Specifies information about the Shared Gallery that you want to create or update. + SharedGallery +} + +// SharedGalleriesClientListResponse contains the response from method SharedGalleriesClient.NewListPager. +type SharedGalleriesClientListResponse struct { + // The List Shared Galleries operation response. + SharedGalleryList +} + +// SharedGalleryImageVersionsClientGetResponse contains the response from method SharedGalleryImageVersionsClient.Get. +type SharedGalleryImageVersionsClientGetResponse struct { + // Specifies information about the gallery image version that you want to create or update. + SharedGalleryImageVersion +} + +// SharedGalleryImageVersionsClientListResponse contains the response from method SharedGalleryImageVersionsClient.NewListPager. +type SharedGalleryImageVersionsClientListResponse struct { + // The List Shared Gallery Image versions operation response. + SharedGalleryImageVersionList +} + +// SharedGalleryImagesClientGetResponse contains the response from method SharedGalleryImagesClient.Get. +type SharedGalleryImagesClientGetResponse struct { + // Specifies information about the gallery image definition that you want to create or update. + SharedGalleryImage +} + +// SharedGalleryImagesClientListResponse contains the response from method SharedGalleryImagesClient.NewListPager. +type SharedGalleryImagesClientListResponse struct { + // The List Shared Gallery Images operation response. + SharedGalleryImageList +} + +// SnapshotsClientCreateOrUpdateResponse contains the response from method SnapshotsClient.BeginCreateOrUpdate. +type SnapshotsClientCreateOrUpdateResponse struct { + // Snapshot resource. + Snapshot +} + +// SnapshotsClientDeleteResponse contains the response from method SnapshotsClient.BeginDelete. +type SnapshotsClientDeleteResponse struct { + // placeholder for future response values +} + +// SnapshotsClientGetResponse contains the response from method SnapshotsClient.Get. +type SnapshotsClientGetResponse struct { + // Snapshot resource. + Snapshot +} + +// SnapshotsClientGrantAccessResponse contains the response from method SnapshotsClient.BeginGrantAccess. +type SnapshotsClientGrantAccessResponse struct { + // A disk access SAS uri. + AccessURI +} + +// SnapshotsClientListByResourceGroupResponse contains the response from method SnapshotsClient.NewListByResourceGroupPager. +type SnapshotsClientListByResourceGroupResponse struct { + // The List Snapshots operation response. + SnapshotList +} + +// SnapshotsClientListResponse contains the response from method SnapshotsClient.NewListPager. +type SnapshotsClientListResponse struct { + // The List Snapshots operation response. + SnapshotList +} + +// SnapshotsClientRevokeAccessResponse contains the response from method SnapshotsClient.BeginRevokeAccess. +type SnapshotsClientRevokeAccessResponse struct { + // placeholder for future response values +} + +// SnapshotsClientUpdateResponse contains the response from method SnapshotsClient.BeginUpdate. +type SnapshotsClientUpdateResponse struct { + // Snapshot resource. + Snapshot +} + +// UsageClientListResponse contains the response from method UsageClient.NewListPager. +type UsageClientListResponse struct { + // The List Usages operation response. + ListUsagesResult +} + +// VirtualMachineExtensionImagesClientGetResponse contains the response from method VirtualMachineExtensionImagesClient.Get. +type VirtualMachineExtensionImagesClientGetResponse struct { + // Describes a Virtual Machine Extension Image. + 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.BeginCreateOrUpdate. +type VirtualMachineExtensionsClientCreateOrUpdateResponse struct { + // Describes a Virtual Machine Extension. + VirtualMachineExtension +} + +// VirtualMachineExtensionsClientDeleteResponse contains the response from method VirtualMachineExtensionsClient.BeginDelete. +type VirtualMachineExtensionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineExtensionsClientGetResponse contains the response from method VirtualMachineExtensionsClient.Get. +type VirtualMachineExtensionsClientGetResponse struct { + // Describes a Virtual Machine Extension. + VirtualMachineExtension +} + +// VirtualMachineExtensionsClientListResponse contains the response from method VirtualMachineExtensionsClient.List. +type VirtualMachineExtensionsClientListResponse struct { + // The List Extension operation response + VirtualMachineExtensionsListResult +} + +// VirtualMachineExtensionsClientUpdateResponse contains the response from method VirtualMachineExtensionsClient.BeginUpdate. +type VirtualMachineExtensionsClientUpdateResponse struct { + // Describes a Virtual Machine Extension. + VirtualMachineExtension +} + +// VirtualMachineImagesClientGetResponse contains the response from method VirtualMachineImagesClient.Get. +type VirtualMachineImagesClientGetResponse struct { + // Describes a Virtual Machine Image. + VirtualMachineImage +} + +// VirtualMachineImagesClientListByEdgeZoneResponse contains the response from method VirtualMachineImagesClient.ListByEdgeZone. +type VirtualMachineImagesClientListByEdgeZoneResponse struct { + // The List VmImages in EdgeZone operation response. + 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 { + // Describes a Virtual Machine Image. + 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.BeginCreateOrUpdate. +type VirtualMachineRunCommandsClientCreateOrUpdateResponse struct { + // Describes a Virtual Machine run command. + VirtualMachineRunCommand +} + +// VirtualMachineRunCommandsClientDeleteResponse contains the response from method VirtualMachineRunCommandsClient.BeginDelete. +type VirtualMachineRunCommandsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineRunCommandsClientGetByVirtualMachineResponse contains the response from method VirtualMachineRunCommandsClient.GetByVirtualMachine. +type VirtualMachineRunCommandsClientGetByVirtualMachineResponse struct { + // Describes a Virtual Machine run command. + VirtualMachineRunCommand +} + +// VirtualMachineRunCommandsClientGetResponse contains the response from method VirtualMachineRunCommandsClient.Get. +type VirtualMachineRunCommandsClientGetResponse struct { + // Describes the properties of a Run Command. + RunCommandDocument +} + +// VirtualMachineRunCommandsClientListByVirtualMachineResponse contains the response from method VirtualMachineRunCommandsClient.NewListByVirtualMachinePager. +type VirtualMachineRunCommandsClientListByVirtualMachineResponse struct { + // The List run command operation response + VirtualMachineRunCommandsListResult +} + +// VirtualMachineRunCommandsClientListResponse contains the response from method VirtualMachineRunCommandsClient.NewListPager. +type VirtualMachineRunCommandsClientListResponse struct { + // The List Virtual Machine operation response. + RunCommandListResult +} + +// VirtualMachineRunCommandsClientUpdateResponse contains the response from method VirtualMachineRunCommandsClient.BeginUpdate. +type VirtualMachineRunCommandsClientUpdateResponse struct { + // Describes a Virtual Machine run command. + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetExtensionsClientCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetExtensionsClient.BeginCreateOrUpdate. +type VirtualMachineScaleSetExtensionsClientCreateOrUpdateResponse struct { + // Describes a Virtual Machine Scale Set Extension. + VirtualMachineScaleSetExtension +} + +// VirtualMachineScaleSetExtensionsClientDeleteResponse contains the response from method VirtualMachineScaleSetExtensionsClient.BeginDelete. +type VirtualMachineScaleSetExtensionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetExtensionsClientGetResponse contains the response from method VirtualMachineScaleSetExtensionsClient.Get. +type VirtualMachineScaleSetExtensionsClientGetResponse struct { + // Describes a Virtual Machine Scale Set Extension. + VirtualMachineScaleSetExtension +} + +// VirtualMachineScaleSetExtensionsClientListResponse contains the response from method VirtualMachineScaleSetExtensionsClient.NewListPager. +type VirtualMachineScaleSetExtensionsClientListResponse struct { + // The List VM scale set extension operation response. + VirtualMachineScaleSetExtensionListResult +} + +// VirtualMachineScaleSetExtensionsClientUpdateResponse contains the response from method VirtualMachineScaleSetExtensionsClient.BeginUpdate. +type VirtualMachineScaleSetExtensionsClientUpdateResponse struct { + // Describes a Virtual Machine Scale Set Extension. + VirtualMachineScaleSetExtension +} + +// VirtualMachineScaleSetRollingUpgradesClientCancelResponse contains the response from method VirtualMachineScaleSetRollingUpgradesClient.BeginCancel. +type VirtualMachineScaleSetRollingUpgradesClientCancelResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse contains the response from method VirtualMachineScaleSetRollingUpgradesClient.GetLatest. +type VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse struct { + // The status of the latest virtual machine scale set rolling upgrade. + RollingUpgradeStatusInfo +} + +// VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradeResponse contains the response from method VirtualMachineScaleSetRollingUpgradesClient.BeginStartExtensionUpgrade. +type VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradeResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradeResponse contains the response from method VirtualMachineScaleSetRollingUpgradesClient.BeginStartOSUpgrade. +type VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradeResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.BeginCreateOrUpdate. +type VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse struct { + // Describes a VMSS VM Extension. + VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMExtensionsClientDeleteResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.BeginDelete. +type VirtualMachineScaleSetVMExtensionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMExtensionsClientGetResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.Get. +type VirtualMachineScaleSetVMExtensionsClientGetResponse struct { + // Describes a VMSS VM Extension. + VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMExtensionsClientListResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.List. +type VirtualMachineScaleSetVMExtensionsClientListResponse struct { + // The List VMSS VM Extension operation response + VirtualMachineScaleSetVMExtensionsListResult +} + +// VirtualMachineScaleSetVMExtensionsClientUpdateResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.BeginUpdate. +type VirtualMachineScaleSetVMExtensionsClientUpdateResponse struct { + // Describes a VMSS VM Extension. + VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.BeginCreateOrUpdate. +type VirtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponse struct { + // Describes a Virtual Machine run command. + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetVMRunCommandsClientDeleteResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.BeginDelete. +type VirtualMachineScaleSetVMRunCommandsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMRunCommandsClientGetResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.Get. +type VirtualMachineScaleSetVMRunCommandsClientGetResponse struct { + // Describes a Virtual Machine run command. + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetVMRunCommandsClientListResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.NewListPager. +type VirtualMachineScaleSetVMRunCommandsClientListResponse struct { + // The List run command operation response + VirtualMachineRunCommandsListResult +} + +// VirtualMachineScaleSetVMRunCommandsClientUpdateResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.BeginUpdate. +type VirtualMachineScaleSetVMRunCommandsClientUpdateResponse struct { + // Describes a Virtual Machine run command. + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetVMsClientDeallocateResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginDeallocate. +type VirtualMachineScaleSetVMsClientDeallocateResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientDeleteResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginDelete. +type VirtualMachineScaleSetVMsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientGetInstanceViewResponse contains the response from method VirtualMachineScaleSetVMsClient.GetInstanceView. +type VirtualMachineScaleSetVMsClientGetInstanceViewResponse struct { + // The instance view of a virtual machine scale set VM. + VirtualMachineScaleSetVMInstanceView +} + +// VirtualMachineScaleSetVMsClientGetResponse contains the response from method VirtualMachineScaleSetVMsClient.Get. +type VirtualMachineScaleSetVMsClientGetResponse struct { + // Describes a virtual machine scale set virtual machine. + VirtualMachineScaleSetVM +} + +// VirtualMachineScaleSetVMsClientListResponse contains the response from method VirtualMachineScaleSetVMsClient.NewListPager. +type VirtualMachineScaleSetVMsClientListResponse struct { + // The List Virtual Machine Scale Set VMs operation response. + VirtualMachineScaleSetVMListResult +} + +// VirtualMachineScaleSetVMsClientPerformMaintenanceResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginPerformMaintenance. +type VirtualMachineScaleSetVMsClientPerformMaintenanceResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientPowerOffResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginPowerOff. +type VirtualMachineScaleSetVMsClientPowerOffResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientRedeployResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginRedeploy. +type VirtualMachineScaleSetVMsClientRedeployResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientReimageAllResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginReimageAll. +type VirtualMachineScaleSetVMsClientReimageAllResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientReimageResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginReimage. +type VirtualMachineScaleSetVMsClientReimageResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientRestartResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginRestart. +type VirtualMachineScaleSetVMsClientRestartResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse contains the response from method VirtualMachineScaleSetVMsClient.RetrieveBootDiagnosticsData. +type VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse struct { + // The SAS URIs of the console screenshot and serial log blobs. + RetrieveBootDiagnosticsDataResult +} + +// VirtualMachineScaleSetVMsClientRunCommandResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginRunCommand. +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.BeginStart. +type VirtualMachineScaleSetVMsClientStartResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientUpdateResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginUpdate. +type VirtualMachineScaleSetVMsClientUpdateResponse struct { + // Describes a virtual machine scale set virtual machine. + VirtualMachineScaleSetVM +} + +// VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse contains the response from method VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup. +type VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetsClient.BeginCreateOrUpdate. +type VirtualMachineScaleSetsClientCreateOrUpdateResponse struct { + // Describes a Virtual Machine Scale Set. + VirtualMachineScaleSet +} + +// VirtualMachineScaleSetsClientDeallocateResponse contains the response from method VirtualMachineScaleSetsClient.BeginDeallocate. +type VirtualMachineScaleSetsClientDeallocateResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientDeleteInstancesResponse contains the response from method VirtualMachineScaleSetsClient.BeginDeleteInstances. +type VirtualMachineScaleSetsClientDeleteInstancesResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientDeleteResponse contains the response from method VirtualMachineScaleSetsClient.BeginDelete. +type VirtualMachineScaleSetsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse contains the response from method +// VirtualMachineScaleSetsClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk. +type VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse struct { + // Response after calling a manual recovery walk + RecoveryWalkResponse +} + +// VirtualMachineScaleSetsClientGetInstanceViewResponse contains the response from method VirtualMachineScaleSetsClient.GetInstanceView. +type VirtualMachineScaleSetsClientGetInstanceViewResponse struct { + // The instance view of a virtual machine scale set. + VirtualMachineScaleSetInstanceView +} + +// VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse contains the response from method VirtualMachineScaleSetsClient.NewGetOSUpgradeHistoryPager. +type VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse struct { + // List of Virtual Machine Scale Set OS Upgrade History operation response. + VirtualMachineScaleSetListOSUpgradeHistory +} + +// VirtualMachineScaleSetsClientGetResponse contains the response from method VirtualMachineScaleSetsClient.Get. +type VirtualMachineScaleSetsClientGetResponse struct { + // Describes a Virtual Machine Scale Set. + VirtualMachineScaleSet +} + +// VirtualMachineScaleSetsClientListAllResponse contains the response from method VirtualMachineScaleSetsClient.NewListAllPager. +type VirtualMachineScaleSetsClientListAllResponse struct { + // The List Virtual Machine operation response. + VirtualMachineScaleSetListWithLinkResult +} + +// VirtualMachineScaleSetsClientListByLocationResponse contains the response from method VirtualMachineScaleSetsClient.NewListByLocationPager. +type VirtualMachineScaleSetsClientListByLocationResponse struct { + // The List Virtual Machine operation response. + VirtualMachineScaleSetListResult +} + +// VirtualMachineScaleSetsClientListResponse contains the response from method VirtualMachineScaleSetsClient.NewListPager. +type VirtualMachineScaleSetsClientListResponse struct { + // The List Virtual Machine operation response. + VirtualMachineScaleSetListResult +} + +// VirtualMachineScaleSetsClientListSKUsResponse contains the response from method VirtualMachineScaleSetsClient.NewListSKUsPager. +type VirtualMachineScaleSetsClientListSKUsResponse struct { + // The Virtual Machine Scale Set List Skus operation response. + VirtualMachineScaleSetListSKUsResult +} + +// VirtualMachineScaleSetsClientPerformMaintenanceResponse contains the response from method VirtualMachineScaleSetsClient.BeginPerformMaintenance. +type VirtualMachineScaleSetsClientPerformMaintenanceResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientPowerOffResponse contains the response from method VirtualMachineScaleSetsClient.BeginPowerOff. +type VirtualMachineScaleSetsClientPowerOffResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientReapplyResponse contains the response from method VirtualMachineScaleSetsClient.BeginReapply. +type VirtualMachineScaleSetsClientReapplyResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientRedeployResponse contains the response from method VirtualMachineScaleSetsClient.BeginRedeploy. +type VirtualMachineScaleSetsClientRedeployResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientReimageAllResponse contains the response from method VirtualMachineScaleSetsClient.BeginReimageAll. +type VirtualMachineScaleSetsClientReimageAllResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientReimageResponse contains the response from method VirtualMachineScaleSetsClient.BeginReimage. +type VirtualMachineScaleSetsClientReimageResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientRestartResponse contains the response from method VirtualMachineScaleSetsClient.BeginRestart. +type VirtualMachineScaleSetsClientRestartResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientSetOrchestrationServiceStateResponse contains the response from method VirtualMachineScaleSetsClient.BeginSetOrchestrationServiceState. +type VirtualMachineScaleSetsClientSetOrchestrationServiceStateResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientStartResponse contains the response from method VirtualMachineScaleSetsClient.BeginStart. +type VirtualMachineScaleSetsClientStartResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientUpdateInstancesResponse contains the response from method VirtualMachineScaleSetsClient.BeginUpdateInstances. +type VirtualMachineScaleSetsClientUpdateInstancesResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientUpdateResponse contains the response from method VirtualMachineScaleSetsClient.BeginUpdate. +type VirtualMachineScaleSetsClientUpdateResponse struct { + // Describes a Virtual Machine Scale Set. + VirtualMachineScaleSet +} + +// VirtualMachineSizesClientListResponse contains the response from method VirtualMachineSizesClient.NewListPager. +type VirtualMachineSizesClientListResponse struct { + // The List Virtual Machine operation response. + VirtualMachineSizeListResult +} + +// VirtualMachinesClientAssessPatchesResponse contains the response from method VirtualMachinesClient.BeginAssessPatches. +type VirtualMachinesClientAssessPatchesResponse struct { + // Describes the properties of an AssessPatches result. + VirtualMachineAssessPatchesResult +} + +// VirtualMachinesClientCaptureResponse contains the response from method VirtualMachinesClient.BeginCapture. +type VirtualMachinesClientCaptureResponse struct { + // Output of virtual machine capture operation. + VirtualMachineCaptureResult +} + +// VirtualMachinesClientConvertToManagedDisksResponse contains the response from method VirtualMachinesClient.BeginConvertToManagedDisks. +type VirtualMachinesClientConvertToManagedDisksResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientCreateOrUpdateResponse contains the response from method VirtualMachinesClient.BeginCreateOrUpdate. +type VirtualMachinesClientCreateOrUpdateResponse struct { + // Describes a Virtual Machine. + VirtualMachine +} + +// VirtualMachinesClientDeallocateResponse contains the response from method VirtualMachinesClient.BeginDeallocate. +type VirtualMachinesClientDeallocateResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientDeleteResponse contains the response from method VirtualMachinesClient.BeginDelete. +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 { + // Describes a Virtual Machine. + VirtualMachine +} + +// VirtualMachinesClientInstallPatchesResponse contains the response from method VirtualMachinesClient.BeginInstallPatches. +type VirtualMachinesClientInstallPatchesResponse struct { + // The result summary of an installation operation. + VirtualMachineInstallPatchesResult +} + +// VirtualMachinesClientInstanceViewResponse contains the response from method VirtualMachinesClient.InstanceView. +type VirtualMachinesClientInstanceViewResponse struct { + // The instance view of a virtual machine. + VirtualMachineInstanceView +} + +// VirtualMachinesClientListAllResponse contains the response from method VirtualMachinesClient.NewListAllPager. +type VirtualMachinesClientListAllResponse struct { + // The List Virtual Machine operation response. + VirtualMachineListResult +} + +// VirtualMachinesClientListAvailableSizesResponse contains the response from method VirtualMachinesClient.NewListAvailableSizesPager. +type VirtualMachinesClientListAvailableSizesResponse struct { + // The List Virtual Machine operation response. + VirtualMachineSizeListResult +} + +// VirtualMachinesClientListByLocationResponse contains the response from method VirtualMachinesClient.NewListByLocationPager. +type VirtualMachinesClientListByLocationResponse struct { + // The List Virtual Machine operation response. + VirtualMachineListResult +} + +// VirtualMachinesClientListResponse contains the response from method VirtualMachinesClient.NewListPager. +type VirtualMachinesClientListResponse struct { + // The List Virtual Machine operation response. + VirtualMachineListResult +} + +// VirtualMachinesClientPerformMaintenanceResponse contains the response from method VirtualMachinesClient.BeginPerformMaintenance. +type VirtualMachinesClientPerformMaintenanceResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientPowerOffResponse contains the response from method VirtualMachinesClient.BeginPowerOff. +type VirtualMachinesClientPowerOffResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientReapplyResponse contains the response from method VirtualMachinesClient.BeginReapply. +type VirtualMachinesClientReapplyResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientRedeployResponse contains the response from method VirtualMachinesClient.BeginRedeploy. +type VirtualMachinesClientRedeployResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientReimageResponse contains the response from method VirtualMachinesClient.BeginReimage. +type VirtualMachinesClientReimageResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientRestartResponse contains the response from method VirtualMachinesClient.BeginRestart. +type VirtualMachinesClientRestartResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientRetrieveBootDiagnosticsDataResponse contains the response from method VirtualMachinesClient.RetrieveBootDiagnosticsData. +type VirtualMachinesClientRetrieveBootDiagnosticsDataResponse struct { + // The SAS URIs of the console screenshot and serial log blobs. + RetrieveBootDiagnosticsDataResult +} + +// VirtualMachinesClientRunCommandResponse contains the response from method VirtualMachinesClient.BeginRunCommand. +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.BeginStart. +type VirtualMachinesClientStartResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientUpdateResponse contains the response from method VirtualMachinesClient.BeginUpdate. +type VirtualMachinesClientUpdateResponse struct { + // Describes a Virtual Machine. + VirtualMachine +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/restorepointcollections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/restorepointcollections_client.go new file mode 100644 index 000000000..343e99867 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/restorepointcollections_client.go @@ -0,0 +1,447 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RestorePointCollectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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) { + var err error + const operationName = "RestorePointCollectionsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, restorePointCollectionName, parameters, options) + if err != nil { + return RestorePointCollectionsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RestorePointCollectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RestorePointCollectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RestorePointCollectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RestorePointCollectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *RestorePointCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "RestorePointCollectionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "RestorePointCollectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, restorePointCollectionName, options) + if err != nil { + return RestorePointCollectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RestorePointCollectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestorePointCollectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - options - RestorePointCollectionsClientListOptions contains the optional parameters for the RestorePointCollectionsClient.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RestorePointCollectionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return RestorePointCollectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - options - RestorePointCollectionsClientListAllOptions contains the optional parameters for the RestorePointCollectionsClient.NewListAllPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RestorePointCollectionsClient.NewListAllPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAllCreateRequest(ctx, options) + }, nil) + if err != nil { + return RestorePointCollectionsClientListAllResponse{}, err + } + return client.listAllHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "RestorePointCollectionsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, restorePointCollectionName, parameters, options) + if err != nil { + return RestorePointCollectionsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RestorePointCollectionsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestorePointCollectionsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v5/restorepoints_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/restorepoints_client.go new file mode 100644 index 000000000..a04794bbb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/restorepoints_client.go @@ -0,0 +1,283 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RestorePointsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RestorePointsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RestorePointsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *RestorePointsClient) create(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "RestorePointsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete the restore point. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RestorePointsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RestorePointsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete the restore point. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *RestorePointsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "RestorePointsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "RestorePointsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) + if err != nil { + return RestorePointsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RestorePointsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestorePointsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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/v5/sharedgalleries_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/sharedgalleries_client.go new file mode 100644 index 000000000..b1239fadd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/sharedgalleries_client.go @@ -0,0 +1,172 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SharedGalleriesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "SharedGalleriesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, galleryUniqueName, options) + if err != nil { + return SharedGalleriesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SharedGalleriesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SharedGalleriesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SharedGalleriesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return SharedGalleriesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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/v5/sharedgalleryimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/sharedgalleryimages_client.go new file mode 100644 index 000000000..461801f26 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/sharedgalleryimages_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SharedGalleryImagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "SharedGalleryImagesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, galleryUniqueName, galleryImageName, options) + if err != nil { + return SharedGalleryImagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SharedGalleryImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SharedGalleryImagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SharedGalleryImagesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, galleryUniqueName, options) + }, nil) + if err != nil { + return SharedGalleryImagesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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/v5/sharedgalleryimageversions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/sharedgalleryimageversions_client.go new file mode 100644 index 000000000..2f0c5b048 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/sharedgalleryimageversions_client.go @@ -0,0 +1,195 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SharedGalleryImageVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "SharedGalleryImageVersionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, galleryUniqueName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return SharedGalleryImageVersionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SharedGalleryImageVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SharedGalleryImageVersionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SharedGalleryImageVersionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, galleryUniqueName, galleryImageName, options) + }, nil) + if err != nil { + return SharedGalleryImageVersionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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/v5/snapshots_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/snapshots_client.go new file mode 100644 index 000000000..a0d263613 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/snapshots_client.go @@ -0,0 +1,625 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SnapshotsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SnapshotsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SnapshotsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *SnapshotsClient) createOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SnapshotsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, snapshotName, snapshot, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, snapshot); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SnapshotsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SnapshotsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *SnapshotsClient) deleteOperation(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SnapshotsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, snapshotName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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) { + var err error + const operationName = "SnapshotsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, snapshotName, options) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SnapshotsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SnapshotsClientGrantAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SnapshotsClientGrantAccessResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GrantAccess - Grants access to a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *SnapshotsClient) grantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsClientBeginGrantAccessOptions) (*http.Response, error) { + var err error + const operationName = "SnapshotsClient.BeginGrantAccess" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.grantAccessCreateRequest(ctx, resourceGroupName, snapshotName, grantAccessData, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, grantAccessData); err != nil { + return nil, err + } + return req, nil +} + +// NewListPager - Lists snapshots under a subscription. +// +// Generated from API version 2023-04-02 +// - options - SnapshotsClientListOptions contains the optional parameters for the SnapshotsClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SnapshotsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return SnapshotsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-02 +// - resourceGroupName - The name of the resource group. +// - options - SnapshotsClientListByResourceGroupOptions contains the optional parameters for the SnapshotsClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SnapshotsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return SnapshotsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SnapshotsClientRevokeAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SnapshotsClientRevokeAccessResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RevokeAccess - Revokes access to a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *SnapshotsClient) revokeAccess(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientBeginRevokeAccessOptions) (*http.Response, error) { + var err error + const operationName = "SnapshotsClient.BeginRevokeAccess" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.revokeAccessCreateRequest(ctx, resourceGroupName, snapshotName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-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 2023-04-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SnapshotsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SnapshotsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates (patches) a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-02 +func (client *SnapshotsClient) update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SnapshotsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, snapshotName, snapshot, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, snapshot); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/sshpublickeys_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/sshpublickeys_client.go new file mode 100644 index 000000000..5d08d5596 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/sshpublickeys_client.go @@ -0,0 +1,483 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SSHPublicKeysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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) { + var err error + const operationName = "SSHPublicKeysClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, sshPublicKeyName, parameters, options) + if err != nil { + return SSHPublicKeysClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SSHPublicKeysClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SSHPublicKeysClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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) { + var err error + const operationName = "SSHPublicKeysClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sshPublicKeyName, options) + if err != nil { + return SSHPublicKeysClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SSHPublicKeysClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SSHPublicKeysClientDeleteResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "SSHPublicKeysClient.GenerateKeyPair" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateKeyPairCreateRequest(ctx, resourceGroupName, sshPublicKeyName, options) + if err != nil { + return SSHPublicKeysClientGenerateKeyPairResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SSHPublicKeysClientGenerateKeyPairResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SSHPublicKeysClientGenerateKeyPairResponse{}, err + } + resp, err := client.generateKeyPairHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "SSHPublicKeysClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, sshPublicKeyName, options) + if err != nil { + return SSHPublicKeysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SSHPublicKeysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SSHPublicKeysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - options - SSHPublicKeysClientListByResourceGroupOptions contains the optional parameters for the SSHPublicKeysClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SSHPublicKeysClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return SSHPublicKeysClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - options - SSHPublicKeysClientListBySubscriptionOptions contains the optional parameters for the SSHPublicKeysClient.NewListBySubscriptionPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SSHPublicKeysClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return SSHPublicKeysClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "SSHPublicKeysClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, sshPublicKeyName, parameters, options) + if err != nil { + return SSHPublicKeysClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SSHPublicKeysClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SSHPublicKeysClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v5/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/time_rfc3339.go new file mode 100644 index 000000000..4f75ccd6f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// 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+)*"*$`) + +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func populateDateTimeRFC3339(m map[string]any, 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] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateTimeRFC3339 + 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/v5/usage_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/usage_client.go new file mode 100644 index 000000000..2ea544447 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/usage_client.go @@ -0,0 +1,105 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UsageClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-01 +// - location - The location for which resource usage is queried. +// - options - UsageClientListOptions contains the optional parameters for the UsageClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UsageClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return UsageClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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/v5/virtualmachineextensionimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineextensionimages_client.go new file mode 100644 index 000000000..0e0b62612 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineextensionimages_client.go @@ -0,0 +1,259 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineExtensionImagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a virtual machine extension image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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) { + var err error + const operationName = "VirtualMachineExtensionImagesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, publisherName, typeParam, version, options) + if err != nil { + return VirtualMachineExtensionImagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineExtensionImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineExtensionImagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineExtensionImagesClient.ListTypes" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listTypesCreateRequest(ctx, location, publisherName, options) + if err != nil { + return VirtualMachineExtensionImagesClientListTypesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineExtensionImagesClientListTypesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineExtensionImagesClientListTypesResponse{}, err + } + resp, err := client.listTypesHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineExtensionImagesClient.ListVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listVersionsCreateRequest(ctx, location, publisherName, typeParam, options) + if err != nil { + return VirtualMachineExtensionImagesClientListVersionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineExtensionImagesClientListVersionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineExtensionImagesClientListVersionsResponse{}, err + } + resp, err := client.listVersionsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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/v5/virtualmachineextensions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineextensions_client.go new file mode 100644 index 000000000..f1cba272c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineextensions_client.go @@ -0,0 +1,437 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineExtensionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineExtensionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineExtensionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - The operation to create or update the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineExtensionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineExtensionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineExtensionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineExtensionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineExtensionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, options) + if err != nil { + return VirtualMachineExtensionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineExtensionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineExtensionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineExtensionsClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachineExtensionsClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineExtensionsClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineExtensionsClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineExtensionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineExtensionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - The operation to update the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineExtensionsClient) update(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineExtensionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineimages_client.go new file mode 100644 index 000000000..42f941766 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineimages_client.go @@ -0,0 +1,470 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineImagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a virtual machine image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, publisherName, offer, skus, version, options) + if err != nil { + return VirtualMachineImagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, location, publisherName, offer, skus, options) + if err != nil { + return VirtualMachineImagesClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesClient.ListByEdgeZone" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listByEdgeZoneCreateRequest(ctx, location, edgeZone, options) + if err != nil { + return VirtualMachineImagesClientListByEdgeZoneResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesClientListByEdgeZoneResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesClientListByEdgeZoneResponse{}, err + } + resp, err := client.listByEdgeZoneHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesClient.ListOffers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listOffersCreateRequest(ctx, location, publisherName, options) + if err != nil { + return VirtualMachineImagesClientListOffersResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesClientListOffersResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesClientListOffersResponse{}, err + } + resp, err := client.listOffersHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesClient.ListPublishers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listPublishersCreateRequest(ctx, location, options) + if err != nil { + return VirtualMachineImagesClientListPublishersResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesClientListPublishersResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesClientListPublishersResponse{}, err + } + resp, err := client.listPublishersHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesClient.ListSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listSKUsCreateRequest(ctx, location, publisherName, offer, options) + if err != nil { + return VirtualMachineImagesClientListSKUsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesClientListSKUsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesClientListSKUsResponse{}, err + } + resp, err := client.listSKUsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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/v5/virtualmachineimagesedgezone_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineimagesedgezone_client.go new file mode 100644 index 000000000..f946cd4d8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineimagesedgezone_client.go @@ -0,0 +1,430 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineImagesEdgeZoneClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesEdgeZoneClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, edgeZone, publisherName, offer, skus, version, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesEdgeZoneClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesEdgeZoneClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, location, edgeZone, publisherName, offer, skus, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesEdgeZoneClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesEdgeZoneClient.ListOffers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listOffersCreateRequest(ctx, location, edgeZone, publisherName, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListOffersResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListOffersResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesEdgeZoneClientListOffersResponse{}, err + } + resp, err := client.listOffersHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesEdgeZoneClient.ListPublishers" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listPublishersCreateRequest(ctx, location, edgeZone, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListPublishersResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListPublishersResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesEdgeZoneClientListPublishersResponse{}, err + } + resp, err := client.listPublishersHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineImagesEdgeZoneClient.ListSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listSKUsCreateRequest(ctx, location, edgeZone, publisherName, offer, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListSKUsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListSKUsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineImagesEdgeZoneClientListSKUsResponse{}, err + } + resp, err := client.listSKUsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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/v5/virtualmachineruncommands_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineruncommands_client.go new file mode 100644 index 000000000..6b40675ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachineruncommands_client.go @@ -0,0 +1,562 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineRunCommandsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineRunCommandsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineRunCommandsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - The operation to create or update the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineRunCommandsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + if err := runtime.MarshalAsJSON(req, runCommand); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineRunCommandsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineRunCommandsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineRunCommandsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, runCommandName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineRunCommandsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, commandID, options) + if err != nil { + return VirtualMachineRunCommandsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineRunCommandsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineRunCommandsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineRunCommandsClient.GetByVirtualMachine" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getByVirtualMachineCreateRequest(ctx, resourceGroupName, vmName, runCommandName, options) + if err != nil { + return VirtualMachineRunCommandsClientGetByVirtualMachineResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineRunCommandsClientGetByVirtualMachineResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineRunCommandsClientGetByVirtualMachineResponse{}, err + } + resp, err := client.getByVirtualMachineHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-01 +// - location - The location upon which run commands is queried. +// - options - VirtualMachineRunCommandsClientListOptions contains the optional parameters for the VirtualMachineRunCommandsClient.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineRunCommandsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return VirtualMachineRunCommandsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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.NewListByVirtualMachinePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineRunCommandsClient.NewListByVirtualMachinePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByVirtualMachineCreateRequest(ctx, resourceGroupName, vmName, options) + }, nil) + if err != nil { + return VirtualMachineRunCommandsClientListByVirtualMachineResponse{}, err + } + return client.listByVirtualMachineHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineRunCommandsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineRunCommandsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - The operation to update the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineRunCommandsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + if err := runtime.MarshalAsJSON(req, runCommand); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachines_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachines_client.go new file mode 100644 index 000000000..e02d32dc6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachines_client.go @@ -0,0 +1,1891 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachinesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginAssessPatches - Assess patches on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientAssessPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientAssessPatchesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// AssessPatches - Assess patches on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginAssessPatches" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientCaptureResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachinesClient) capture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesClientBeginCaptureOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginCapture" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.captureCreateRequest(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientConvertToManagedDisksResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientConvertToManagedDisksResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachinesClient) convertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginConvertToManagedDisksOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginConvertToManagedDisks" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.convertToManagedDisksCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientDeallocateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientDeallocateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachinesClient) deallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeallocateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginDeallocate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachinesClient.Generalize" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generalizeCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientGeneralizeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachinesClientGeneralizeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachinesClientGeneralizeResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachinesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachinesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachinesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientInstallPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientInstallPatchesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// InstallPatches - Installs patches on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginInstallPatches" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, vmName, installPatchesInput, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, installPatchesInput); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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) { + var err error + const operationName = "VirtualMachinesClient.InstanceView" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.instanceViewCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientInstanceViewResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachinesClientInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachinesClientInstanceViewResponse{}, err + } + resp, err := client.instanceViewHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - options - VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachinesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return VirtualMachinesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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", string(*options.Expand)) + } + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - options - VirtualMachinesClientListAllOptions contains the optional parameters for the VirtualMachinesClient.NewListAllPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachinesClient.NewListAllPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAllCreateRequest(ctx, options) + }, nil) + if err != nil { + return VirtualMachinesClientListAllResponse{}, err + } + return client.listAllHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + if options != nil && options.StatusOnly != nil { + reqQP.Set("statusOnly", *options.StatusOnly) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + 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 +} + +// 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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - vmName - The name of the virtual machine. +// - options - VirtualMachinesClientListAvailableSizesOptions contains the optional parameters for the VirtualMachinesClient.NewListAvailableSizesPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachinesClient.NewListAvailableSizesPager") + req, err := client.listAvailableSizesCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientListAvailableSizesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachinesClientListAvailableSizesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientListAvailableSizesResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableSizesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - location - The location for which virtual machines under the subscription are queried. +// - options - VirtualMachinesClientListByLocationOptions contains the optional parameters for the VirtualMachinesClient.NewListByLocationPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachinesClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return VirtualMachinesClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientPerformMaintenanceResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientPerformMaintenanceResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// PerformMaintenance - The operation to perform maintenance on a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) performMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPerformMaintenanceOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginPerformMaintenance" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientPowerOffResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientPowerOffResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachinesClient) powerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPowerOffOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginPowerOff" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientReapplyResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientReapplyResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Reapply - The operation to reapply a virtual machine's state. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) reapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReapplyOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginReapply" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reapplyCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientRedeployResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientRedeployResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginRedeploy" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginReimage - Reimages (upgrade the operating system) a virtual machine 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. NOTE: +// The retaining of old OS disk depends on the value of deleteOption of OS disk. If deleteOption is detach, the old OS disk +// will be preserved after reimage. If deleteOption is delete, the old OS disk +// will be deleted after reimage. The deleteOption of the OS disk should be updated accordingly before performing the reimage. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Reimage - Reimages (upgrade the operating system) a virtual machine 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. NOTE: +// The retaining of old OS disk depends on the value of deleteOption of OS disk. If deleteOption is detach, the old OS disk +// will be preserved after reimage. If deleteOption is delete, the old OS disk +// will be deleted after reimage. The deleteOption of the OS disk should be updated accordingly before performing the reimage. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) reimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReimageOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginReimage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Restart - The operation to restart a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) restart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachinesClient.RetrieveBootDiagnosticsData" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.retrieveBootDiagnosticsDataCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientRetrieveBootDiagnosticsDataResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachinesClientRetrieveBootDiagnosticsDataResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachinesClientRetrieveBootDiagnosticsDataResponse{}, err + } + resp, err := client.retrieveBootDiagnosticsDataHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientRunCommandResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientRunCommandResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RunCommand - Run command on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) runCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesClientBeginRunCommandOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginRunCommand" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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) { + var err error + const operationName = "VirtualMachinesClient.SimulateEviction" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.simulateEvictionCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientSimulateEvictionResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachinesClientSimulateEvictionResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return VirtualMachinesClientSimulateEvictionResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Start - The operation to start a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachinesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - The operation to update a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachinesClient) update(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachinesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetextensions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetextensions_client.go new file mode 100644 index 000000000..8e5820d44 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetextensions_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetExtensionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetExtensionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetExtensionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - The operation to create or update an extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetExtensionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetExtensionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetExtensionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetExtensionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetExtensionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) + if err != nil { + return VirtualMachineScaleSetExtensionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetExtensionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetExtensionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineScaleSetExtensionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + }, nil) + if err != nil { + return VirtualMachineScaleSetExtensionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetExtensionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetExtensionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - The operation to update an extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetExtensionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetrollingupgrades_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetrollingupgrades_client.go new file mode 100644 index 000000000..7856e8e69 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetrollingupgrades_client.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetRollingUpgradesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetRollingUpgradesClientCancelResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetRollingUpgradesClientCancelResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Cancel - Cancels the current virtual machine scale set rolling upgrade. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetRollingUpgradesClient) cancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetRollingUpgradesClient.BeginCancel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetRollingUpgradesClient.GetLatest" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getLatestCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse{}, err + } + resp, err := client.getLatestHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetRollingUpgradesClient.BeginStartExtensionUpgrade" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startExtensionUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetRollingUpgradesClient.BeginStartOSUpgrade" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startOSUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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/v5/virtualmachinescalesets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesets_client.go new file mode 100644 index 000000000..dc9276c62 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesets_client.go @@ -0,0 +1,1861 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.convertToSinglePlacementGroupCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginCreateOrUpdate - Create or update a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientDeallocateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientDeallocateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeallocateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginDeallocate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + if err := runtime.MarshalAsJSON(req, *options.VMInstanceIDs); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// BeginDelete - Deletes a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientDeleteInstancesResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientDeleteInstancesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// DeleteInstances - Deletes virtual machines in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetsClient) deleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginDeleteInstancesOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginDeleteInstances" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vmInstanceIDs); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetsClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.forceRecoveryServiceFabricPlatformUpdateDomainWalkCreateRequest(ctx, resourceGroupName, vmScaleSetName, platformUpdateDomain, options) + if err != nil { + return VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err + } + resp, err := client.forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return VirtualMachineScaleSetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetsClient.GetInstanceView" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return VirtualMachineScaleSetsClientGetInstanceViewResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetsClientGetInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetsClientGetInstanceViewResponse{}, err + } + resp, err := client.getInstanceViewHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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.NewGetOSUpgradeHistoryPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineScaleSetsClient.NewGetOSUpgradeHistoryPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.getOSUpgradeHistoryCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + }, nil) + if err != nil { + return VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse{}, err + } + return client.getOSUpgradeHistoryHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - options - VirtualMachineScaleSetsClientListOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineScaleSetsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return VirtualMachineScaleSetsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - options - VirtualMachineScaleSetsClientListAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListAllPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineScaleSetsClient.NewListAllPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAllCreateRequest(ctx, options) + }, nil) + if err != nil { + return VirtualMachineScaleSetsClientListAllResponse{}, err + } + return client.listAllHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-01 +// - location - The location for which VM scale sets under the subscription are queried. +// - options - VirtualMachineScaleSetsClientListByLocationOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListByLocationPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineScaleSetsClient.NewListByLocationPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByLocationCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return VirtualMachineScaleSetsClientListByLocationResponse{}, err + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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.NewListSKUsPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineScaleSetsClient.NewListSKUsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listSKUsCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + }, nil) + if err != nil { + return VirtualMachineScaleSetsClientListSKUsResponse{}, err + } + return client.listSKUsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientPerformMaintenanceResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientPerformMaintenanceResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginPerformMaintenance" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + if err := runtime.MarshalAsJSON(req, *options.VMInstanceIDs); err != nil { + return nil, err + } + return req, nil + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientPowerOffResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientPowerOffResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPowerOffOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginPowerOff" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + if err := runtime.MarshalAsJSON(req, *options.VMInstanceIDs); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// BeginReapply - Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. +// - vmScaleSetName - The name of the VM scale set. +// - options - VirtualMachineScaleSetsClientBeginReapplyOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReapply +// method. +func (client *VirtualMachineScaleSetsClient) BeginReapply(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReapplyOptions) (*runtime.Poller[VirtualMachineScaleSetsClientReapplyResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reapply(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientReapplyResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientReapplyResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Reapply - Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetsClient) reapply(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReapplyOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginReapply" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reapplyCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reapplyCreateRequest creates the Reapply request. +func (client *VirtualMachineScaleSetsClient) reapplyCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReapplyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reapply" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientRedeployResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientRedeployResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRedeployOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginRedeploy" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + if err := runtime.MarshalAsJSON(req, *options.VMInstanceIDs); err != nil { + return nil, err + } + return req, nil + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginReimage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMScaleSetReimageInput != nil { + if err := runtime.MarshalAsJSON(req, *options.VMScaleSetReimageInput); err != nil { + return nil, err + } + return req, nil + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientReimageAllResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientReimageAllResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageAllOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginReimageAll" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + if err := runtime.MarshalAsJSON(req, *options.VMInstanceIDs); err != nil { + return nil, err + } + return req, nil + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + if err := runtime.MarshalAsJSON(req, *options.VMInstanceIDs); err != nil { + return nil, err + } + return req, nil + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientSetOrchestrationServiceStateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientSetOrchestrationServiceStateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SetOrchestrationServiceState - Changes ServiceState property for a given service +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginSetOrchestrationServiceState" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.setOrchestrationServiceStateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginStartOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + if err := runtime.MarshalAsJSON(req, *options.VMInstanceIDs); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// BeginUpdate - Update a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientUpdateInstancesResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetsClientUpdateInstancesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetsClient) updateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginUpdateInstancesOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginUpdateInstances" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vmInstanceIDs); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetvmextensions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetvmextensions_client.go new file mode 100644 index 000000000..8d657b688 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetvmextensions_client.go @@ -0,0 +1,462 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetVMExtensionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMExtensionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMExtensionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMExtensionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetVMExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMExtensionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetVMExtensionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) + if err != nil { + return VirtualMachineScaleSetVMExtensionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetVMExtensionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetVMExtensionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetVMExtensionsClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMExtensionsClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetVMExtensionsClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetVMExtensionsClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMExtensionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMExtensionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - The operation to update the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetVMExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMExtensionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetvmruncommands_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetvmruncommands_client.go new file mode 100644 index 000000000..beb09f99b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetvmruncommands_client.go @@ -0,0 +1,462 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetVMRunCommandsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMRunCommandsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + if err := runtime.MarshalAsJSON(req, runCommand); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMRunCommandsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMRunCommandsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMRunCommandsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetVMRunCommandsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) + if err != nil { + return VirtualMachineScaleSetVMRunCommandsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetVMRunCommandsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetVMRunCommandsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineScaleSetVMRunCommandsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + }, nil) + if err != nil { + return VirtualMachineScaleSetVMRunCommandsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMRunCommandsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMRunCommandsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - The operation to update the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetVMRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMRunCommandsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + if err := runtime.MarshalAsJSON(req, runCommand); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetvms_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetvms_client.go new file mode 100644 index 000000000..e27cc0a64 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinescalesetvms_client.go @@ -0,0 +1,1321 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetVMsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientDeallocateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientDeallocateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeallocateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginDeallocate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a virtual machine from a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetVMsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetVMsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.GetInstanceView" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMsClientGetInstanceViewResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetVMsClientGetInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetVMsClientGetInstanceViewResponse{}, err + } + resp, err := client.getInstanceViewHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineScaleSetVMsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, options) + }, nil) + if err != nil { + return VirtualMachineScaleSetVMsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientPerformMaintenanceResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientPerformMaintenanceResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginPerformMaintenance" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientPowerOffResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientPowerOffResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPowerOffOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginPowerOff" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientRedeployResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientRedeployResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRedeployOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginRedeploy" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientReimageResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginReimage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMScaleSetVMReimageInput != nil { + if err := runtime.MarshalAsJSON(req, *options.VMScaleSetVMReimageInput); err != nil { + return nil, err + } + return req, nil + } + 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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientReimageAllResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientReimageAllResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageAllOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginReimageAll" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Restart - Restarts a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.RetrieveBootDiagnosticsData" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.retrieveBootDiagnosticsDataCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse{}, err + } + resp, err := client.retrieveBootDiagnosticsDataHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientRunCommandResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientRunCommandResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) runCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsClientBeginRunCommandOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginRunCommand" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-07-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) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.SimulateEviction" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.simulateEvictionCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMsClientSimulateEvictionResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineScaleSetVMsClientSimulateEvictionResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return VirtualMachineScaleSetVMsClientSimulateEvictionResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Start - Starts a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginStartOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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 2023-07-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualMachineScaleSetVMsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a virtual machine of a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *VirtualMachineScaleSetVMsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinesizes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinesizes_client.go new file mode 100644 index 000000000..066ecc7b4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5/virtualmachinesizes_client.go @@ -0,0 +1,106 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualMachineSizesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - This API is deprecated. Use Resources Skus [https://docs.microsoft.com/rest/api/compute/resourceskus/list] +// +// Generated from API version 2023-07-01 +// - location - The location upon which virtual-machine-sizes is queried. +// - options - VirtualMachineSizesClientListOptions contains the optional parameters for the VirtualMachineSizesClient.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualMachineSizesClient.NewListPager") + req, err := client.listCreateRequest(ctx, location, options) + if err != nil { + return VirtualMachineSizesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualMachineSizesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineSizesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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/containerregistry/armcontainerregistry/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md new file mode 100644 index 000000000..279da452a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md @@ -0,0 +1,315 @@ +# Release History + +## 1.2.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + +## 1.2.0-beta.2 (2023-10-09) +### Other Changes + +- Updated to latest `azcore` beta. + +## 1.2.0-beta.1 (2023-09-22) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. +- New enum type `ActivationStatus` with values `ActivationStatusActive`, `ActivationStatusInactive` +- New enum type `AuditLogStatus` with values `AuditLogStatusDisabled`, `AuditLogStatusEnabled` +- New enum type `AzureADAuthenticationAsArmPolicyStatus` with values `AzureADAuthenticationAsArmPolicyStatusDisabled`, `AzureADAuthenticationAsArmPolicyStatusEnabled` +- New enum type `CertificateType` with values `CertificateTypeLocalDirectory` +- New enum type `ConnectedRegistryMode` with values `ConnectedRegistryModeMirror`, `ConnectedRegistryModeReadOnly`, `ConnectedRegistryModeReadWrite`, `ConnectedRegistryModeRegistry` +- New enum type `ConnectionState` with values `ConnectionStateOffline`, `ConnectionStateOnline`, `ConnectionStateSyncing`, `ConnectionStateUnhealthy` +- New enum type `LogLevel` with values `LogLevelDebug`, `LogLevelError`, `LogLevelInformation`, `LogLevelNone`, `LogLevelWarning` +- New enum type `PackageSourceType` with values `PackageSourceTypeRemote` +- New enum type `PipelineOptions` with values `PipelineOptionsContinueOnErrors`, `PipelineOptionsDeleteSourceBlobOnSuccess`, `PipelineOptionsOverwriteBlobs`, `PipelineOptionsOverwriteTags` +- New enum type `PipelineRunSourceType` with values `PipelineRunSourceTypeAzureStorageBlob` +- New enum type `PipelineRunTargetType` with values `PipelineRunTargetTypeAzureStorageBlob` +- New enum type `PipelineSourceType` with values `PipelineSourceTypeAzureStorageBlobContainer` +- New enum type `TLSStatus` with values `TLSStatusDisabled`, `TLSStatusEnabled` +- New function `NewArchiveVersionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ArchiveVersionsClient, error)` +- New function `*ArchiveVersionsClient.BeginCreate(context.Context, string, string, string, string, string, *ArchiveVersionsClientBeginCreateOptions) (*runtime.Poller[ArchiveVersionsClientCreateResponse], error)` +- New function `*ArchiveVersionsClient.BeginDelete(context.Context, string, string, string, string, string, *ArchiveVersionsClientBeginDeleteOptions) (*runtime.Poller[ArchiveVersionsClientDeleteResponse], error)` +- New function `*ArchiveVersionsClient.Get(context.Context, string, string, string, string, string, *ArchiveVersionsClientGetOptions) (ArchiveVersionsClientGetResponse, error)` +- New function `*ArchiveVersionsClient.NewListPager(string, string, string, string, *ArchiveVersionsClientListOptions) *runtime.Pager[ArchiveVersionsClientListResponse]` +- New function `NewArchivesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ArchivesClient, error)` +- New function `*ArchivesClient.BeginCreate(context.Context, string, string, string, string, Archive, *ArchivesClientBeginCreateOptions) (*runtime.Poller[ArchivesClientCreateResponse], error)` +- New function `*ArchivesClient.BeginDelete(context.Context, string, string, string, string, *ArchivesClientBeginDeleteOptions) (*runtime.Poller[ArchivesClientDeleteResponse], error)` +- New function `*ArchivesClient.Get(context.Context, string, string, string, string, *ArchivesClientGetOptions) (ArchivesClientGetResponse, error)` +- New function `*ArchivesClient.NewListPager(string, string, string, *ArchivesClientListOptions) *runtime.Pager[ArchivesClientListResponse]` +- New function `*ArchivesClient.Update(context.Context, string, string, string, string, ArchiveUpdateParameters, *ArchivesClientUpdateOptions) (ArchivesClientUpdateResponse, error)` +- New function `*ClientFactory.NewArchiveVersionsClient() *ArchiveVersionsClient` +- New function `*ClientFactory.NewArchivesClient() *ArchivesClient` +- New function `*ClientFactory.NewConnectedRegistriesClient() *ConnectedRegistriesClient` +- New function `*ClientFactory.NewExportPipelinesClient() *ExportPipelinesClient` +- New function `*ClientFactory.NewImportPipelinesClient() *ImportPipelinesClient` +- New function `*ClientFactory.NewPipelineRunsClient() *PipelineRunsClient` +- New function `NewConnectedRegistriesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectedRegistriesClient, error)` +- New function `*ConnectedRegistriesClient.BeginCreate(context.Context, string, string, string, ConnectedRegistry, *ConnectedRegistriesClientBeginCreateOptions) (*runtime.Poller[ConnectedRegistriesClientCreateResponse], error)` +- New function `*ConnectedRegistriesClient.BeginDeactivate(context.Context, string, string, string, *ConnectedRegistriesClientBeginDeactivateOptions) (*runtime.Poller[ConnectedRegistriesClientDeactivateResponse], error)` +- New function `*ConnectedRegistriesClient.BeginDelete(context.Context, string, string, string, *ConnectedRegistriesClientBeginDeleteOptions) (*runtime.Poller[ConnectedRegistriesClientDeleteResponse], error)` +- New function `*ConnectedRegistriesClient.Get(context.Context, string, string, string, *ConnectedRegistriesClientGetOptions) (ConnectedRegistriesClientGetResponse, error)` +- New function `*ConnectedRegistriesClient.NewListPager(string, string, *ConnectedRegistriesClientListOptions) *runtime.Pager[ConnectedRegistriesClientListResponse]` +- New function `*ConnectedRegistriesClient.BeginUpdate(context.Context, string, string, string, ConnectedRegistryUpdateParameters, *ConnectedRegistriesClientBeginUpdateOptions) (*runtime.Poller[ConnectedRegistriesClientUpdateResponse], error)` +- New function `NewExportPipelinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExportPipelinesClient, error)` +- New function `*ExportPipelinesClient.BeginCreate(context.Context, string, string, string, ExportPipeline, *ExportPipelinesClientBeginCreateOptions) (*runtime.Poller[ExportPipelinesClientCreateResponse], error)` +- New function `*ExportPipelinesClient.BeginDelete(context.Context, string, string, string, *ExportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ExportPipelinesClientDeleteResponse], error)` +- New function `*ExportPipelinesClient.Get(context.Context, string, string, string, *ExportPipelinesClientGetOptions) (ExportPipelinesClientGetResponse, error)` +- New function `*ExportPipelinesClient.NewListPager(string, string, *ExportPipelinesClientListOptions) *runtime.Pager[ExportPipelinesClientListResponse]` +- New function `NewImportPipelinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ImportPipelinesClient, error)` +- New function `*ImportPipelinesClient.BeginCreate(context.Context, string, string, string, ImportPipeline, *ImportPipelinesClientBeginCreateOptions) (*runtime.Poller[ImportPipelinesClientCreateResponse], error)` +- New function `*ImportPipelinesClient.BeginDelete(context.Context, string, string, string, *ImportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ImportPipelinesClientDeleteResponse], error)` +- New function `*ImportPipelinesClient.Get(context.Context, string, string, string, *ImportPipelinesClientGetOptions) (ImportPipelinesClientGetResponse, error)` +- New function `*ImportPipelinesClient.NewListPager(string, string, *ImportPipelinesClientListOptions) *runtime.Pager[ImportPipelinesClientListResponse]` +- New function `NewPipelineRunsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PipelineRunsClient, error)` +- New function `*PipelineRunsClient.BeginCreate(context.Context, string, string, string, PipelineRun, *PipelineRunsClientBeginCreateOptions) (*runtime.Poller[PipelineRunsClientCreateResponse], error)` +- New function `*PipelineRunsClient.BeginDelete(context.Context, string, string, string, *PipelineRunsClientBeginDeleteOptions) (*runtime.Poller[PipelineRunsClientDeleteResponse], error)` +- New function `*PipelineRunsClient.Get(context.Context, string, string, string, *PipelineRunsClientGetOptions) (PipelineRunsClientGetResponse, error)` +- New function `*PipelineRunsClient.NewListPager(string, string, *PipelineRunsClientListOptions) *runtime.Pager[PipelineRunsClientListResponse]` +- New struct `ActivationProperties` +- New struct `Archive` +- New struct `ArchiveListResult` +- New struct `ArchivePackageSourceProperties` +- New struct `ArchiveProperties` +- New struct `ArchiveUpdateParameters` +- New struct `ArchiveUpdateProperties` +- New struct `ArchiveVersion` +- New struct `ArchiveVersionListResult` +- New struct `ArchiveVersionProperties` +- New struct `AzureADAuthenticationAsArmPolicy` +- New struct `ConnectedRegistry` +- New struct `ConnectedRegistryListResult` +- New struct `ConnectedRegistryProperties` +- New struct `ConnectedRegistryUpdateParameters` +- New struct `ConnectedRegistryUpdateProperties` +- New struct `ExportPipeline` +- New struct `ExportPipelineListResult` +- New struct `ExportPipelineProperties` +- New struct `ExportPipelineTargetProperties` +- New struct `ImportPipeline` +- New struct `ImportPipelineListResult` +- New struct `ImportPipelineProperties` +- New struct `ImportPipelineSourceProperties` +- New struct `LoggingProperties` +- New struct `LoginServerProperties` +- New struct `ParentProperties` +- New struct `PipelineRun` +- New struct `PipelineRunListResult` +- New struct `PipelineRunProperties` +- New struct `PipelineRunRequest` +- New struct `PipelineRunResponse` +- New struct `PipelineRunSourceProperties` +- New struct `PipelineRunTargetProperties` +- New struct `PipelineSourceTriggerDescriptor` +- New struct `PipelineSourceTriggerProperties` +- New struct `PipelineTriggerDescriptor` +- New struct `PipelineTriggerProperties` +- New struct `ProgressProperties` +- New struct `SoftDeletePolicy` +- New struct `StatusDetailProperties` +- New struct `SyncProperties` +- New struct `SyncUpdateProperties` +- New struct `TLSCertificateProperties` +- New struct `TLSProperties` +- New field `AzureADAuthenticationAsArmPolicy`, `SoftDeletePolicy` in struct `Policies` +- New field `AnonymousPullEnabled` in struct `RegistryProperties` +- New field `AnonymousPullEnabled` in struct `RegistryPropertiesUpdateParameters` + + +## 1.1.0 (2023-09-22) +### Features Added + +- New enum type `CredentialHealthStatus` with values `CredentialHealthStatusHealthy`, `CredentialHealthStatusUnhealthy` +- New enum type `CredentialName` with values `CredentialNameCredential1` +- New function `NewCacheRulesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CacheRulesClient, error)` +- New function `*CacheRulesClient.BeginCreate(context.Context, string, string, string, CacheRule, *CacheRulesClientBeginCreateOptions) (*runtime.Poller[CacheRulesClientCreateResponse], error)` +- New function `*CacheRulesClient.BeginDelete(context.Context, string, string, string, *CacheRulesClientBeginDeleteOptions) (*runtime.Poller[CacheRulesClientDeleteResponse], error)` +- New function `*CacheRulesClient.Get(context.Context, string, string, string, *CacheRulesClientGetOptions) (CacheRulesClientGetResponse, error)` +- New function `*CacheRulesClient.NewListPager(string, string, *CacheRulesClientListOptions) *runtime.Pager[CacheRulesClientListResponse]` +- New function `*CacheRulesClient.BeginUpdate(context.Context, string, string, string, CacheRuleUpdateParameters, *CacheRulesClientBeginUpdateOptions) (*runtime.Poller[CacheRulesClientUpdateResponse], error)` +- New function `*ClientFactory.NewCacheRulesClient() *CacheRulesClient` +- New function `*ClientFactory.NewCredentialSetsClient() *CredentialSetsClient` +- New function `NewCredentialSetsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CredentialSetsClient, error)` +- New function `*CredentialSetsClient.BeginCreate(context.Context, string, string, string, CredentialSet, *CredentialSetsClientBeginCreateOptions) (*runtime.Poller[CredentialSetsClientCreateResponse], error)` +- New function `*CredentialSetsClient.BeginDelete(context.Context, string, string, string, *CredentialSetsClientBeginDeleteOptions) (*runtime.Poller[CredentialSetsClientDeleteResponse], error)` +- New function `*CredentialSetsClient.Get(context.Context, string, string, string, *CredentialSetsClientGetOptions) (CredentialSetsClientGetResponse, error)` +- New function `*CredentialSetsClient.NewListPager(string, string, *CredentialSetsClientListOptions) *runtime.Pager[CredentialSetsClientListResponse]` +- New function `*CredentialSetsClient.BeginUpdate(context.Context, string, string, string, CredentialSetUpdateParameters, *CredentialSetsClientBeginUpdateOptions) (*runtime.Poller[CredentialSetsClientUpdateResponse], error)` +- New struct `AuthCredential` +- New struct `CacheRule` +- New struct `CacheRuleProperties` +- New struct `CacheRuleUpdateParameters` +- New struct `CacheRuleUpdateProperties` +- New struct `CacheRulesListResult` +- New struct `CredentialHealth` +- New struct `CredentialSet` +- New struct `CredentialSetListResult` +- New struct `CredentialSetProperties` +- New struct `CredentialSetUpdateParameters` +- New struct `CredentialSetUpdateProperties` + + +## 1.0.0 (2023-03-24) +### Breaking Changes + +- Type alias `ActivationStatus` has been removed +- Type alias `AuditLogStatus` has been removed +- Type alias `AzureADAuthenticationAsArmPolicyStatus` has been removed +- Type alias `CertificateType` has been removed +- Type alias `ConnectedRegistryMode` has been removed +- Type alias `ConnectionState` has been removed +- Type alias `CredentialHealthStatus` has been removed +- Type alias `CredentialName` has been removed +- Type alias `LogLevel` has been removed +- Type alias `PipelineOptions` has been removed +- Type alias `PipelineRunSourceType` has been removed +- Type alias `PipelineRunTargetType` has been removed +- Type alias `PipelineSourceType` has been removed +- Type alias `TLSStatus` has been removed +- Function `NewCacheRulesClient` has been removed +- Function `*CacheRulesClient.BeginCreate` has been removed +- Function `*CacheRulesClient.BeginDelete` has been removed +- Function `*CacheRulesClient.Get` has been removed +- Function `*CacheRulesClient.NewListPager` has been removed +- Function `*CacheRulesClient.BeginUpdate` has been removed +- Function `NewConnectedRegistriesClient` has been removed +- Function `*ConnectedRegistriesClient.BeginCreate` has been removed +- Function `*ConnectedRegistriesClient.BeginDeactivate` has been removed +- Function `*ConnectedRegistriesClient.BeginDelete` has been removed +- Function `*ConnectedRegistriesClient.Get` has been removed +- Function `*ConnectedRegistriesClient.NewListPager` has been removed +- Function `*ConnectedRegistriesClient.BeginUpdate` has been removed +- Function `NewCredentialSetsClient` has been removed +- Function `*CredentialSetsClient.BeginCreate` has been removed +- Function `*CredentialSetsClient.BeginDelete` has been removed +- Function `*CredentialSetsClient.Get` has been removed +- Function `*CredentialSetsClient.NewListPager` has been removed +- Function `*CredentialSetsClient.BeginUpdate` has been removed +- Function `NewExportPipelinesClient` has been removed +- Function `*ExportPipelinesClient.BeginCreate` has been removed +- Function `*ExportPipelinesClient.BeginDelete` has been removed +- Function `*ExportPipelinesClient.Get` has been removed +- Function `*ExportPipelinesClient.NewListPager` has been removed +- Function `NewImportPipelinesClient` has been removed +- Function `*ImportPipelinesClient.BeginCreate` has been removed +- Function `*ImportPipelinesClient.BeginDelete` has been removed +- Function `*ImportPipelinesClient.Get` has been removed +- Function `*ImportPipelinesClient.NewListPager` has been removed +- Function `NewPipelineRunsClient` has been removed +- Function `*PipelineRunsClient.BeginCreate` has been removed +- Function `*PipelineRunsClient.BeginDelete` has been removed +- Function `*PipelineRunsClient.Get` has been removed +- Function `*PipelineRunsClient.NewListPager` has been removed +- Struct `ActivationProperties` has been removed +- Struct `AuthCredential` has been removed +- Struct `AzureADAuthenticationAsArmPolicy` has been removed +- Struct `CacheRule` has been removed +- Struct `CacheRuleProperties` has been removed +- Struct `CacheRuleUpdateParameters` has been removed +- Struct `CacheRuleUpdateProperties` has been removed +- Struct `CacheRulesClient` has been removed +- Struct `CacheRulesListResult` has been removed +- Struct `ConnectedRegistriesClient` has been removed +- Struct `ConnectedRegistry` has been removed +- Struct `ConnectedRegistryListResult` has been removed +- Struct `ConnectedRegistryProperties` has been removed +- Struct `ConnectedRegistryUpdateParameters` has been removed +- Struct `ConnectedRegistryUpdateProperties` has been removed +- Struct `CredentialHealth` has been removed +- Struct `CredentialSet` has been removed +- Struct `CredentialSetListResult` has been removed +- Struct `CredentialSetProperties` has been removed +- Struct `CredentialSetUpdateParameters` has been removed +- Struct `CredentialSetUpdateProperties` has been removed +- Struct `CredentialSetsClient` has been removed +- Struct `ExportPipeline` has been removed +- Struct `ExportPipelineListResult` has been removed +- Struct `ExportPipelineProperties` has been removed +- Struct `ExportPipelineTargetProperties` has been removed +- Struct `ExportPipelinesClient` has been removed +- Struct `ImportPipeline` has been removed +- Struct `ImportPipelineListResult` has been removed +- Struct `ImportPipelineProperties` has been removed +- Struct `ImportPipelineSourceProperties` has been removed +- Struct `ImportPipelinesClient` has been removed +- Struct `LoggingProperties` has been removed +- Struct `LoginServerProperties` has been removed +- Struct `ParentProperties` has been removed +- Struct `PipelineRun` has been removed +- Struct `PipelineRunListResult` has been removed +- Struct `PipelineRunProperties` has been removed +- Struct `PipelineRunRequest` has been removed +- Struct `PipelineRunResponse` has been removed +- Struct `PipelineRunSourceProperties` has been removed +- Struct `PipelineRunTargetProperties` has been removed +- Struct `PipelineRunsClient` has been removed +- Struct `PipelineSourceTriggerDescriptor` has been removed +- Struct `PipelineSourceTriggerProperties` has been removed +- Struct `PipelineTriggerDescriptor` has been removed +- Struct `PipelineTriggerProperties` has been removed +- Struct `ProgressProperties` has been removed +- Struct `SoftDeletePolicy` has been removed +- Struct `StatusDetailProperties` has been removed +- Struct `SyncProperties` has been removed +- Struct `SyncUpdateProperties` has been removed +- Struct `TLSCertificateProperties` has been removed +- Struct `TLSProperties` has been removed +- Field `AzureADAuthenticationAsArmPolicy` of struct `Policies` has been removed +- Field `SoftDeletePolicy` of struct `Policies` has been removed +- Field `AnonymousPullEnabled` of struct `RegistryProperties` has been removed +- Field `AnonymousPullEnabled` of struct `RegistryPropertiesUpdateParameters` has been removed + +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + +## 0.7.0 (2023-02-24) +### Features Added + +- New type alias `CredentialHealthStatus` with values `CredentialHealthStatusHealthy`, `CredentialHealthStatusUnhealthy` +- New type alias `CredentialName` with values `CredentialNameCredential1` +- New function `NewCacheRulesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CacheRulesClient, error)` +- New function `*CacheRulesClient.BeginCreate(context.Context, string, string, string, CacheRule, *CacheRulesClientBeginCreateOptions) (*runtime.Poller[CacheRulesClientCreateResponse], error)` +- New function `*CacheRulesClient.BeginDelete(context.Context, string, string, string, *CacheRulesClientBeginDeleteOptions) (*runtime.Poller[CacheRulesClientDeleteResponse], error)` +- New function `*CacheRulesClient.Get(context.Context, string, string, string, *CacheRulesClientGetOptions) (CacheRulesClientGetResponse, error)` +- New function `*CacheRulesClient.NewListPager(string, string, *CacheRulesClientListOptions) *runtime.Pager[CacheRulesClientListResponse]` +- New function `*CacheRulesClient.BeginUpdate(context.Context, string, string, string, CacheRuleUpdateParameters, *CacheRulesClientBeginUpdateOptions) (*runtime.Poller[CacheRulesClientUpdateResponse], error)` +- New function `NewCredentialSetsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CredentialSetsClient, error)` +- New function `*CredentialSetsClient.BeginCreate(context.Context, string, string, string, CredentialSet, *CredentialSetsClientBeginCreateOptions) (*runtime.Poller[CredentialSetsClientCreateResponse], error)` +- New function `*CredentialSetsClient.BeginDelete(context.Context, string, string, string, *CredentialSetsClientBeginDeleteOptions) (*runtime.Poller[CredentialSetsClientDeleteResponse], error)` +- New function `*CredentialSetsClient.Get(context.Context, string, string, string, *CredentialSetsClientGetOptions) (CredentialSetsClientGetResponse, error)` +- New function `*CredentialSetsClient.NewListPager(string, string, *CredentialSetsClientListOptions) *runtime.Pager[CredentialSetsClientListResponse]` +- New function `*CredentialSetsClient.BeginUpdate(context.Context, string, string, string, CredentialSetUpdateParameters, *CredentialSetsClientBeginUpdateOptions) (*runtime.Poller[CredentialSetsClientUpdateResponse], error)` +- New struct `AuthCredential` +- New struct `CacheRule` +- New struct `CacheRuleProperties` +- New struct `CacheRuleUpdateParameters` +- New struct `CacheRuleUpdateProperties` +- New struct `CacheRulesClient` +- New struct `CacheRulesClientCreateResponse` +- New struct `CacheRulesClientDeleteResponse` +- New struct `CacheRulesClientListResponse` +- New struct `CacheRulesClientUpdateResponse` +- New struct `CacheRulesListResult` +- New struct `CredentialHealth` +- New struct `CredentialSet` +- New struct `CredentialSetListResult` +- New struct `CredentialSetProperties` +- New struct `CredentialSetUpdateParameters` +- New struct `CredentialSetUpdateProperties` +- New struct `CredentialSetsClient` +- New struct `CredentialSetsClientCreateResponse` +- New struct `CredentialSetsClientDeleteResponse` +- New struct `CredentialSetsClientListResponse` +- New struct `CredentialSetsClientUpdateResponse` + + +## 0.6.0 (2022-05-17) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.6.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/containerregistry/armcontainerregistry/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/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/containerregistry/armcontainerregistry/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md new file mode 100644 index 000000000..0a21899c1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md @@ -0,0 +1,99 @@ +# Azure Container Registry Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry) + +The `armcontainerregistry` module provides operations for working with Azure Container Registry. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/containerregistry/armcontainerregistry) + +# 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 Container Registry module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Container Registry. 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). + +## Client Factory + +Azure Container Registry module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armcontainerregistry.NewClientFactory(, 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, + }, +} +clientFactory, err := armcontainerregistry.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewImportPipelinesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## More sample code + +- [Container Registry](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerregistry/registry) +- [Replication](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerregistry/replication) +- [Container Task](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerregistry/task) +- [Container Token](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerregistry/token) + +## 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 `Container Registry` 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/containerregistry/armcontainerregistry/agentpools_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go new file mode 100644 index 000000000..07a033069 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go @@ -0,0 +1,495 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AgentPoolsClient contains the methods for the AgentPools group. +// Don't use this type directly, use NewAgentPoolsClient() instead. +type AgentPoolsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAgentPoolsClient creates a new instance of AgentPoolsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAgentPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AgentPoolsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AgentPoolsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates an agent pool for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - agentPoolName - The name of the agent pool. +// - agentPool - The parameters of an agent pool that needs to scheduled. +// - options - AgentPoolsClientBeginCreateOptions contains the optional parameters for the AgentPoolsClient.BeginCreate method. +func (client *AgentPoolsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool, options *AgentPoolsClientBeginCreateOptions) (*runtime.Poller[AgentPoolsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, agentPoolName, agentPool, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates an agent pool for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *AgentPoolsClient) create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool, options *AgentPoolsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, agentPool, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *AgentPoolsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool, options *AgentPoolsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, agentPool); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a specified agent pool resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - agentPoolName - The name of the agent pool. +// - options - AgentPoolsClientBeginDeleteOptions contains the optional parameters for the AgentPoolsClient.BeginDelete method. +func (client *AgentPoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*runtime.Poller[AgentPoolsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, agentPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a specified agent pool resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *AgentPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the detailed information for a given agent pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - agentPoolName - The name of the agent pool. +// - options - AgentPoolsClientGetOptions contains the optional parameters for the AgentPoolsClient.Get method. +func (client *AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetOptions) (AgentPoolsClientGetResponse, error) { + var err error + const operationName = "AgentPoolsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, options) + if err != nil { + return AgentPoolsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentPoolsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentPoolsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AgentPoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AgentPoolsClient) getHandleResponse(resp *http.Response) (AgentPoolsClientGetResponse, error) { + result := AgentPoolsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentPool); err != nil { + return AgentPoolsClientGetResponse{}, err + } + return result, nil +} + +// GetQueueStatus - Gets the count of queued runs for a given agent pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - agentPoolName - The name of the agent pool. +// - options - AgentPoolsClientGetQueueStatusOptions contains the optional parameters for the AgentPoolsClient.GetQueueStatus +// method. +func (client *AgentPoolsClient) GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetQueueStatusOptions) (AgentPoolsClientGetQueueStatusResponse, error) { + var err error + const operationName = "AgentPoolsClient.GetQueueStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getQueueStatusCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, options) + if err != nil { + return AgentPoolsClientGetQueueStatusResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentPoolsClientGetQueueStatusResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentPoolsClientGetQueueStatusResponse{}, err + } + resp, err := client.getQueueStatusHandleResponse(httpResp) + return resp, err +} + +// getQueueStatusCreateRequest creates the GetQueueStatus request. +func (client *AgentPoolsClient) getQueueStatusCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetQueueStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getQueueStatusHandleResponse handles the GetQueueStatus response. +func (client *AgentPoolsClient) getQueueStatusHandleResponse(resp *http.Response) (AgentPoolsClientGetQueueStatusResponse, error) { + result := AgentPoolsClientGetQueueStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolQueueStatus); err != nil { + return AgentPoolsClientGetQueueStatusResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the agent pools for a specified container registry. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - options - AgentPoolsClientListOptions contains the optional parameters for the AgentPoolsClient.NewListPager method. +func (client *AgentPoolsClient) NewListPager(resourceGroupName string, registryName string, options *AgentPoolsClientListOptions) *runtime.Pager[AgentPoolsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AgentPoolsClientListResponse]{ + More: func(page AgentPoolsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AgentPoolsClientListResponse) (AgentPoolsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AgentPoolsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return AgentPoolsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *AgentPoolsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *AgentPoolsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AgentPoolsClient) listHandleResponse(resp *http.Response) (AgentPoolsClientListResponse, error) { + result := AgentPoolsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolListResult); err != nil { + return AgentPoolsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates an agent pool with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - agentPoolName - The name of the agent pool. +// - updateParameters - The parameters for updating an agent pool. +// - options - AgentPoolsClientBeginUpdateOptions contains the optional parameters for the AgentPoolsClient.BeginUpdate method. +func (client *AgentPoolsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters, options *AgentPoolsClientBeginUpdateOptions) (*runtime.Poller[AgentPoolsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, agentPoolName, updateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates an agent pool with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *AgentPoolsClient) update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters, options *AgentPoolsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, updateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *AgentPoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters, options *AgentPoolsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/assets.json new file mode 100644 index 000000000..545db436e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "go", + "TagPrefix": "go/resourcemanager/containerregistry/armcontainerregistry", + "Tag": "go/resourcemanager/containerregistry/armcontainerregistry_9fcf492e3c" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md new file mode 100644 index 000000000..726e7154a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/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/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.2.0 +tag: package-2023-07 +``` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/build.go new file mode 100644 index 000000000..f0c69abc5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/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 -removeUnreferencedTypes resourcemanager/containerregistry/armcontainerregistry + +package armcontainerregistry diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go new file mode 100644 index 000000000..21ac29dfd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CacheRulesClient contains the methods for the CacheRules group. +// Don't use this type directly, use NewCacheRulesClient() instead. +type CacheRulesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCacheRulesClient creates a new instance of CacheRulesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCacheRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CacheRulesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CacheRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a cache rule for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - cacheRuleName - The name of the cache rule. +// - cacheRuleCreateParameters - The parameters for creating a cache rule. +// - options - CacheRulesClientBeginCreateOptions contains the optional parameters for the CacheRulesClient.BeginCreate method. +func (client *CacheRulesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters CacheRule, options *CacheRulesClientBeginCreateOptions) (*runtime.Poller[CacheRulesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleCreateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CacheRulesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CacheRulesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a cache rule for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *CacheRulesClient) create(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters CacheRule, options *CacheRulesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "CacheRulesClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleCreateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *CacheRulesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters CacheRule, options *CacheRulesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if cacheRuleName == "" { + return nil, errors.New("parameter cacheRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheRuleName}", url.PathEscape(cacheRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, cacheRuleCreateParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a cache rule resource from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - cacheRuleName - The name of the cache rule. +// - options - CacheRulesClientBeginDeleteOptions contains the optional parameters for the CacheRulesClient.BeginDelete method. +func (client *CacheRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientBeginDeleteOptions) (*runtime.Poller[CacheRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, cacheRuleName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CacheRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CacheRulesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a cache rule resource from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *CacheRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CacheRulesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CacheRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if cacheRuleName == "" { + return nil, errors.New("parameter cacheRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheRuleName}", url.PathEscape(cacheRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the properties of the specified cache rule resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - cacheRuleName - The name of the cache rule. +// - options - CacheRulesClientGetOptions contains the optional parameters for the CacheRulesClient.Get method. +func (client *CacheRulesClient) Get(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientGetOptions) (CacheRulesClientGetResponse, error) { + var err error + const operationName = "CacheRulesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, options) + if err != nil { + return CacheRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CacheRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CacheRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CacheRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if cacheRuleName == "" { + return nil, errors.New("parameter cacheRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheRuleName}", url.PathEscape(cacheRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CacheRulesClient) getHandleResponse(resp *http.Response) (CacheRulesClientGetResponse, error) { + result := CacheRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheRule); err != nil { + return CacheRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all cache rule resources for the specified container registry. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - CacheRulesClientListOptions contains the optional parameters for the CacheRulesClient.NewListPager method. +func (client *CacheRulesClient) NewListPager(resourceGroupName string, registryName string, options *CacheRulesClientListOptions) *runtime.Pager[CacheRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CacheRulesClientListResponse]{ + More: func(page CacheRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CacheRulesClientListResponse) (CacheRulesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CacheRulesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return CacheRulesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *CacheRulesClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *CacheRulesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CacheRulesClient) listHandleResponse(resp *http.Response) (CacheRulesClientListResponse, error) { + result := CacheRulesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheRulesListResult); err != nil { + return CacheRulesClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a cache rule for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - cacheRuleName - The name of the cache rule. +// - cacheRuleUpdateParameters - The parameters for updating a cache rule. +// - options - CacheRulesClientBeginUpdateOptions contains the optional parameters for the CacheRulesClient.BeginUpdate method. +func (client *CacheRulesClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*runtime.Poller[CacheRulesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleUpdateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CacheRulesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CacheRulesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a cache rule for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *CacheRulesClient) update(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CacheRulesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleUpdateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *CacheRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if cacheRuleName == "" { + return nil, errors.New("parameter cacheRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheRuleName}", url.PathEscape(cacheRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, cacheRuleUpdateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/ci.yml new file mode 100644 index 000000000..dc1b35e2f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/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/containerregistry/armcontainerregistry/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/containerregistry/armcontainerregistry/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/containerregistry/armcontainerregistry' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go new file mode 100644 index 000000000..1444ae659 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +// NewAgentPoolsClient creates a new instance of AgentPoolsClient. +func (c *ClientFactory) NewAgentPoolsClient() *AgentPoolsClient { + subClient, _ := NewAgentPoolsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCacheRulesClient creates a new instance of CacheRulesClient. +func (c *ClientFactory) NewCacheRulesClient() *CacheRulesClient { + subClient, _ := NewCacheRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewCredentialSetsClient creates a new instance of CredentialSetsClient. +func (c *ClientFactory) NewCredentialSetsClient() *CredentialSetsClient { + subClient, _ := NewCredentialSetsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewRegistriesClient creates a new instance of RegistriesClient. +func (c *ClientFactory) NewRegistriesClient() *RegistriesClient { + subClient, _ := NewRegistriesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewReplicationsClient creates a new instance of ReplicationsClient. +func (c *ClientFactory) NewReplicationsClient() *ReplicationsClient { + subClient, _ := NewReplicationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewRunsClient creates a new instance of RunsClient. +func (c *ClientFactory) NewRunsClient() *RunsClient { + subClient, _ := NewRunsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewScopeMapsClient creates a new instance of ScopeMapsClient. +func (c *ClientFactory) NewScopeMapsClient() *ScopeMapsClient { + subClient, _ := NewScopeMapsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTaskRunsClient creates a new instance of TaskRunsClient. +func (c *ClientFactory) NewTaskRunsClient() *TaskRunsClient { + subClient, _ := NewTaskRunsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTasksClient creates a new instance of TasksClient. +func (c *ClientFactory) NewTasksClient() *TasksClient { + subClient, _ := NewTasksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTokensClient creates a new instance of TokensClient. +func (c *ClientFactory) NewTokensClient() *TokensClient { + subClient, _ := NewTokensClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewWebhooksClient creates a new instance of WebhooksClient. +func (c *ClientFactory) NewWebhooksClient() *WebhooksClient { + subClient, _ := NewWebhooksClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go new file mode 100644 index 000000000..65bc6456a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go @@ -0,0 +1,760 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" + moduleVersion = "v1.2.0" +) + +// Action - The action of IP ACL rule. +type Action string + +const ( + ActionAllow Action = "Allow" +) + +// PossibleActionValues returns the possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{ + ActionAllow, + } +} + +// ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. +type ActionsRequired string + +const ( + ActionsRequiredNone ActionsRequired = "None" + ActionsRequiredRecreate ActionsRequired = "Recreate" +) + +// PossibleActionsRequiredValues returns the possible values for the ActionsRequired const type. +func PossibleActionsRequiredValues() []ActionsRequired { + return []ActionsRequired{ + ActionsRequiredNone, + ActionsRequiredRecreate, + } +} + +// Architecture - The OS architecture. +type Architecture string + +const ( + ArchitectureAmd64 Architecture = "amd64" + ArchitectureArm Architecture = "arm" + ArchitectureArm64 Architecture = "arm64" + ArchitectureThreeHundredEightySix Architecture = "386" + ArchitectureX86 Architecture = "x86" +) + +// PossibleArchitectureValues returns the possible values for the Architecture const type. +func PossibleArchitectureValues() []Architecture { + return []Architecture{ + ArchitectureAmd64, + ArchitectureArm, + ArchitectureArm64, + ArchitectureThreeHundredEightySix, + ArchitectureX86, + } +} + +// BaseImageDependencyType - The type of the base image dependency. +type BaseImageDependencyType string + +const ( + BaseImageDependencyTypeBuildTime BaseImageDependencyType = "BuildTime" + BaseImageDependencyTypeRunTime BaseImageDependencyType = "RunTime" +) + +// PossibleBaseImageDependencyTypeValues returns the possible values for the BaseImageDependencyType const type. +func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { + return []BaseImageDependencyType{ + BaseImageDependencyTypeBuildTime, + BaseImageDependencyTypeRunTime, + } +} + +// BaseImageTriggerType - The type of the auto trigger for base image dependency updates. +type BaseImageTriggerType string + +const ( + BaseImageTriggerTypeAll BaseImageTriggerType = "All" + BaseImageTriggerTypeRuntime BaseImageTriggerType = "Runtime" +) + +// PossibleBaseImageTriggerTypeValues returns the possible values for the BaseImageTriggerType const type. +func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { + return []BaseImageTriggerType{ + BaseImageTriggerTypeAll, + BaseImageTriggerTypeRuntime, + } +} + +// ConnectionStatus - The private link service connection status. +type ConnectionStatus string + +const ( + ConnectionStatusApproved ConnectionStatus = "Approved" + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + ConnectionStatusPending ConnectionStatus = "Pending" + ConnectionStatusRejected ConnectionStatus = "Rejected" +) + +// PossibleConnectionStatusValues returns the possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ + ConnectionStatusApproved, + ConnectionStatusDisconnected, + ConnectionStatusPending, + ConnectionStatusRejected, + } +} + +// 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, + } +} + +// CredentialHealthStatus - The health status of credential. +type CredentialHealthStatus string + +const ( + CredentialHealthStatusHealthy CredentialHealthStatus = "Healthy" + CredentialHealthStatusUnhealthy CredentialHealthStatus = "Unhealthy" +) + +// PossibleCredentialHealthStatusValues returns the possible values for the CredentialHealthStatus const type. +func PossibleCredentialHealthStatusValues() []CredentialHealthStatus { + return []CredentialHealthStatus{ + CredentialHealthStatusHealthy, + CredentialHealthStatusUnhealthy, + } +} + +// CredentialName - The name of the credential. +type CredentialName string + +const ( + CredentialNameCredential1 CredentialName = "Credential1" +) + +// PossibleCredentialNameValues returns the possible values for the CredentialName const type. +func PossibleCredentialNameValues() []CredentialName { + return []CredentialName{ + CredentialNameCredential1, + } +} + +// DefaultAction - The default action of allow or deny when no other rules match. +type DefaultAction string + +const ( + DefaultActionAllow DefaultAction = "Allow" + DefaultActionDeny DefaultAction = "Deny" +) + +// PossibleDefaultActionValues returns the possible values for the DefaultAction const type. +func PossibleDefaultActionValues() []DefaultAction { + return []DefaultAction{ + DefaultActionAllow, + DefaultActionDeny, + } +} + +// EncryptionStatus - Indicates whether or not the encryption is enabled for container registry. +type EncryptionStatus string + +const ( + EncryptionStatusDisabled EncryptionStatus = "disabled" + EncryptionStatusEnabled EncryptionStatus = "enabled" +) + +// PossibleEncryptionStatusValues returns the possible values for the EncryptionStatus const type. +func PossibleEncryptionStatusValues() []EncryptionStatus { + return []EncryptionStatus{ + EncryptionStatusDisabled, + EncryptionStatusEnabled, + } +} + +// ExportPolicyStatus - The value that indicates whether the policy is enabled or not. +type ExportPolicyStatus string + +const ( + ExportPolicyStatusDisabled ExportPolicyStatus = "disabled" + ExportPolicyStatusEnabled ExportPolicyStatus = "enabled" +) + +// PossibleExportPolicyStatusValues returns the possible values for the ExportPolicyStatus const type. +func PossibleExportPolicyStatusValues() []ExportPolicyStatus { + return []ExportPolicyStatus{ + ExportPolicyStatusDisabled, + ExportPolicyStatusEnabled, + } +} + +// ImportMode - When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail +// the operation before any copying begins. +type ImportMode string + +const ( + ImportModeForce ImportMode = "Force" + ImportModeNoForce ImportMode = "NoForce" +) + +// PossibleImportModeValues returns the possible values for the ImportMode const type. +func PossibleImportModeValues() []ImportMode { + return []ImportMode{ + ImportModeForce, + ImportModeNoForce, + } +} + +// LastModifiedByType - The type of identity that last modified the resource. +type LastModifiedByType string + +const ( + LastModifiedByTypeApplication LastModifiedByType = "Application" + LastModifiedByTypeKey LastModifiedByType = "Key" + LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" + LastModifiedByTypeUser LastModifiedByType = "User" +) + +// PossibleLastModifiedByTypeValues returns the possible values for the LastModifiedByType const type. +func PossibleLastModifiedByTypeValues() []LastModifiedByType { + return []LastModifiedByType{ + LastModifiedByTypeApplication, + LastModifiedByTypeKey, + LastModifiedByTypeManagedIdentity, + LastModifiedByTypeUser, + } +} + +// NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. +type NetworkRuleBypassOptions string + +const ( + NetworkRuleBypassOptionsAzureServices NetworkRuleBypassOptions = "AzureServices" + NetworkRuleBypassOptionsNone NetworkRuleBypassOptions = "None" +) + +// PossibleNetworkRuleBypassOptionsValues returns the possible values for the NetworkRuleBypassOptions const type. +func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { + return []NetworkRuleBypassOptions{ + NetworkRuleBypassOptionsAzureServices, + NetworkRuleBypassOptionsNone, + } +} + +// OS - The OS of agent machine +type OS string + +const ( + OSLinux OS = "Linux" + OSWindows OS = "Windows" +) + +// PossibleOSValues returns the possible values for the OS const type. +func PossibleOSValues() []OS { + return []OS{ + OSLinux, + OSWindows, + } +} + +// PasswordName - The password name. +type PasswordName string + +const ( + PasswordNamePassword PasswordName = "password" + PasswordNamePassword2 PasswordName = "password2" +) + +// PossiblePasswordNameValues returns the possible values for the PasswordName const type. +func PossiblePasswordNameValues() []PasswordName { + return []PasswordName{ + PasswordNamePassword, + PasswordNamePassword2, + } +} + +// PolicyStatus - The value that indicates whether the policy is enabled or not. +type PolicyStatus string + +const ( + PolicyStatusDisabled PolicyStatus = "disabled" + PolicyStatusEnabled PolicyStatus = "enabled" +) + +// PossiblePolicyStatusValues returns the possible values for the PolicyStatus const type. +func PossiblePolicyStatusValues() []PolicyStatus { + return []PolicyStatus{ + PolicyStatusDisabled, + PolicyStatusEnabled, + } +} + +// ProvisioningState - The provisioning state of this agent pool +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + 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{ + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// PublicNetworkAccess - Whether or not public network access is allowed for the container registry. +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + +// RegistryUsageUnit - The unit of measurement. +type RegistryUsageUnit string + +const ( + RegistryUsageUnitBytes RegistryUsageUnit = "Bytes" + RegistryUsageUnitCount RegistryUsageUnit = "Count" +) + +// PossibleRegistryUsageUnitValues returns the possible values for the RegistryUsageUnit const type. +func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { + return []RegistryUsageUnit{ + RegistryUsageUnitBytes, + RegistryUsageUnitCount, + } +} + +// ResourceIdentityType - The identity type. +type ResourceIdentityType string + +const ( + ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeNone, + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeSystemAssignedUserAssigned, + ResourceIdentityTypeUserAssigned, + } +} + +// RunStatus - The current status of the run. +type RunStatus string + +const ( + RunStatusCanceled RunStatus = "Canceled" + RunStatusError RunStatus = "Error" + RunStatusFailed RunStatus = "Failed" + RunStatusQueued RunStatus = "Queued" + RunStatusRunning RunStatus = "Running" + RunStatusStarted RunStatus = "Started" + RunStatusSucceeded RunStatus = "Succeeded" + RunStatusTimeout RunStatus = "Timeout" +) + +// PossibleRunStatusValues returns the possible values for the RunStatus const type. +func PossibleRunStatusValues() []RunStatus { + return []RunStatus{ + RunStatusCanceled, + RunStatusError, + RunStatusFailed, + RunStatusQueued, + RunStatusRunning, + RunStatusStarted, + RunStatusSucceeded, + RunStatusTimeout, + } +} + +// RunType - The type of run. +type RunType string + +const ( + RunTypeAutoBuild RunType = "AutoBuild" + RunTypeAutoRun RunType = "AutoRun" + RunTypeQuickBuild RunType = "QuickBuild" + RunTypeQuickRun RunType = "QuickRun" +) + +// PossibleRunTypeValues returns the possible values for the RunType const type. +func PossibleRunTypeValues() []RunType { + return []RunType{ + RunTypeAutoBuild, + RunTypeAutoRun, + RunTypeQuickBuild, + RunTypeQuickRun, + } +} + +// SKUName - The SKU name of the container registry. Required for registry creation. +type SKUName string + +const ( + SKUNameBasic SKUName = "Basic" + SKUNameClassic SKUName = "Classic" + SKUNamePremium SKUName = "Premium" + SKUNameStandard SKUName = "Standard" +) + +// PossibleSKUNameValues returns the possible values for the SKUName const type. +func PossibleSKUNameValues() []SKUName { + return []SKUName{ + SKUNameBasic, + SKUNameClassic, + SKUNamePremium, + SKUNameStandard, + } +} + +// SKUTier - The SKU tier based on the SKU name. +type SKUTier string + +const ( + SKUTierBasic SKUTier = "Basic" + SKUTierClassic SKUTier = "Classic" + SKUTierPremium SKUTier = "Premium" + SKUTierStandard SKUTier = "Standard" +) + +// PossibleSKUTierValues returns the possible values for the SKUTier const type. +func PossibleSKUTierValues() []SKUTier { + return []SKUTier{ + SKUTierBasic, + SKUTierClassic, + SKUTierPremium, + SKUTierStandard, + } +} + +// SecretObjectType - The type of the secret object which determines how the value of the secret object has to be interpreted. +type SecretObjectType string + +const ( + SecretObjectTypeOpaque SecretObjectType = "Opaque" + SecretObjectTypeVaultsecret SecretObjectType = "Vaultsecret" +) + +// PossibleSecretObjectTypeValues returns the possible values for the SecretObjectType const type. +func PossibleSecretObjectTypeValues() []SecretObjectType { + return []SecretObjectType{ + SecretObjectTypeOpaque, + SecretObjectTypeVaultsecret, + } +} + +// SourceControlType - The type of source control service. +type SourceControlType string + +const ( + SourceControlTypeGithub SourceControlType = "Github" + SourceControlTypeVisualStudioTeamService SourceControlType = "VisualStudioTeamService" +) + +// PossibleSourceControlTypeValues returns the possible values for the SourceControlType const type. +func PossibleSourceControlTypeValues() []SourceControlType { + return []SourceControlType{ + SourceControlTypeGithub, + SourceControlTypeVisualStudioTeamService, + } +} + +// SourceRegistryLoginMode - The authentication mode which determines the source registry login scope. The credentials for +// the source registry will be generated using the given scope. These credentials will be used to login to +// the source registry during the run. +type SourceRegistryLoginMode string + +const ( + SourceRegistryLoginModeDefault SourceRegistryLoginMode = "Default" + SourceRegistryLoginModeNone SourceRegistryLoginMode = "None" +) + +// PossibleSourceRegistryLoginModeValues returns the possible values for the SourceRegistryLoginMode const type. +func PossibleSourceRegistryLoginModeValues() []SourceRegistryLoginMode { + return []SourceRegistryLoginMode{ + SourceRegistryLoginModeDefault, + SourceRegistryLoginModeNone, + } +} + +type SourceTriggerEvent string + +const ( + SourceTriggerEventCommit SourceTriggerEvent = "commit" + SourceTriggerEventPullrequest SourceTriggerEvent = "pullrequest" +) + +// PossibleSourceTriggerEventValues returns the possible values for the SourceTriggerEvent const type. +func PossibleSourceTriggerEventValues() []SourceTriggerEvent { + return []SourceTriggerEvent{ + SourceTriggerEventCommit, + SourceTriggerEventPullrequest, + } +} + +// StepType - The type of the step. +type StepType string + +const ( + StepTypeDocker StepType = "Docker" + StepTypeEncodedTask StepType = "EncodedTask" + StepTypeFileTask StepType = "FileTask" +) + +// PossibleStepTypeValues returns the possible values for the StepType const type. +func PossibleStepTypeValues() []StepType { + return []StepType{ + StepTypeDocker, + StepTypeEncodedTask, + StepTypeFileTask, + } +} + +// TaskStatus - The current status of task. +type TaskStatus string + +const ( + TaskStatusDisabled TaskStatus = "Disabled" + TaskStatusEnabled TaskStatus = "Enabled" +) + +// PossibleTaskStatusValues returns the possible values for the TaskStatus const type. +func PossibleTaskStatusValues() []TaskStatus { + return []TaskStatus{ + TaskStatusDisabled, + TaskStatusEnabled, + } +} + +type TokenCertificateName string + +const ( + TokenCertificateNameCertificate1 TokenCertificateName = "certificate1" + TokenCertificateNameCertificate2 TokenCertificateName = "certificate2" +) + +// PossibleTokenCertificateNameValues returns the possible values for the TokenCertificateName const type. +func PossibleTokenCertificateNameValues() []TokenCertificateName { + return []TokenCertificateName{ + TokenCertificateNameCertificate1, + TokenCertificateNameCertificate2, + } +} + +// TokenPasswordName - The password name "password1" or "password2" +type TokenPasswordName string + +const ( + TokenPasswordNamePassword1 TokenPasswordName = "password1" + TokenPasswordNamePassword2 TokenPasswordName = "password2" +) + +// PossibleTokenPasswordNameValues returns the possible values for the TokenPasswordName const type. +func PossibleTokenPasswordNameValues() []TokenPasswordName { + return []TokenPasswordName{ + TokenPasswordNamePassword1, + TokenPasswordNamePassword2, + } +} + +// TokenStatus - The status of the token example enabled or disabled. +type TokenStatus string + +const ( + TokenStatusDisabled TokenStatus = "disabled" + TokenStatusEnabled TokenStatus = "enabled" +) + +// PossibleTokenStatusValues returns the possible values for the TokenStatus const type. +func PossibleTokenStatusValues() []TokenStatus { + return []TokenStatus{ + TokenStatusDisabled, + TokenStatusEnabled, + } +} + +// TokenType - The type of Auth token. +type TokenType string + +const ( + TokenTypeOAuth TokenType = "OAuth" + TokenTypePAT TokenType = "PAT" +) + +// PossibleTokenTypeValues returns the possible values for the TokenType const type. +func PossibleTokenTypeValues() []TokenType { + return []TokenType{ + TokenTypeOAuth, + TokenTypePAT, + } +} + +// TriggerStatus - The current status of trigger. +type TriggerStatus string + +const ( + TriggerStatusDisabled TriggerStatus = "Disabled" + TriggerStatusEnabled TriggerStatus = "Enabled" +) + +// PossibleTriggerStatusValues returns the possible values for the TriggerStatus const type. +func PossibleTriggerStatusValues() []TriggerStatus { + return []TriggerStatus{ + TriggerStatusDisabled, + TriggerStatusEnabled, + } +} + +// TrustPolicyType - The type of trust policy. +type TrustPolicyType string + +const ( + TrustPolicyTypeNotary TrustPolicyType = "Notary" +) + +// PossibleTrustPolicyTypeValues returns the possible values for the TrustPolicyType const type. +func PossibleTrustPolicyTypeValues() []TrustPolicyType { + return []TrustPolicyType{ + TrustPolicyTypeNotary, + } +} + +// UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. +type UpdateTriggerPayloadType string + +const ( + UpdateTriggerPayloadTypeDefault UpdateTriggerPayloadType = "Default" + UpdateTriggerPayloadTypeToken UpdateTriggerPayloadType = "Token" +) + +// PossibleUpdateTriggerPayloadTypeValues returns the possible values for the UpdateTriggerPayloadType const type. +func PossibleUpdateTriggerPayloadTypeValues() []UpdateTriggerPayloadType { + return []UpdateTriggerPayloadType{ + UpdateTriggerPayloadTypeDefault, + UpdateTriggerPayloadTypeToken, + } +} + +// Variant - Variant of the CPU. +type Variant string + +const ( + VariantV6 Variant = "v6" + VariantV7 Variant = "v7" + VariantV8 Variant = "v8" +) + +// PossibleVariantValues returns the possible values for the Variant const type. +func PossibleVariantValues() []Variant { + return []Variant{ + VariantV6, + VariantV7, + VariantV8, + } +} + +type WebhookAction string + +const ( + WebhookActionChartDelete WebhookAction = "chart_delete" + WebhookActionChartPush WebhookAction = "chart_push" + WebhookActionDelete WebhookAction = "delete" + WebhookActionPush WebhookAction = "push" + WebhookActionQuarantine WebhookAction = "quarantine" +) + +// PossibleWebhookActionValues returns the possible values for the WebhookAction const type. +func PossibleWebhookActionValues() []WebhookAction { + return []WebhookAction{ + WebhookActionChartDelete, + WebhookActionChartPush, + WebhookActionDelete, + WebhookActionPush, + WebhookActionQuarantine, + } +} + +// WebhookStatus - The status of the webhook at the time the operation was called. +type WebhookStatus string + +const ( + WebhookStatusDisabled WebhookStatus = "disabled" + WebhookStatusEnabled WebhookStatus = "enabled" +) + +// PossibleWebhookStatusValues returns the possible values for the WebhookStatus const type. +func PossibleWebhookStatusValues() []WebhookStatus { + return []WebhookStatus{ + WebhookStatusDisabled, + WebhookStatusEnabled, + } +} + +// ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry +type ZoneRedundancy string + +const ( + ZoneRedundancyDisabled ZoneRedundancy = "Disabled" + ZoneRedundancyEnabled ZoneRedundancy = "Enabled" +) + +// PossibleZoneRedundancyValues returns the possible values for the ZoneRedundancy const type. +func PossibleZoneRedundancyValues() []ZoneRedundancy { + return []ZoneRedundancy{ + ZoneRedundancyDisabled, + ZoneRedundancyEnabled, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go new file mode 100644 index 000000000..b900f870d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go @@ -0,0 +1,431 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CredentialSetsClient contains the methods for the CredentialSets group. +// Don't use this type directly, use NewCredentialSetsClient() instead. +type CredentialSetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCredentialSetsClient creates a new instance of CredentialSetsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCredentialSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CredentialSetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CredentialSetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a credential set for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - credentialSetName - The name of the credential set. +// - credentialSetCreateParameters - The parameters for creating a credential set. +// - options - CredentialSetsClientBeginCreateOptions contains the optional parameters for the CredentialSetsClient.BeginCreate +// method. +func (client *CredentialSetsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters CredentialSet, options *CredentialSetsClientBeginCreateOptions) (*runtime.Poller[CredentialSetsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, credentialSetName, credentialSetCreateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CredentialSetsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CredentialSetsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a credential set for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *CredentialSetsClient) create(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters CredentialSet, options *CredentialSetsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "CredentialSetsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, credentialSetCreateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *CredentialSetsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters CredentialSet, options *CredentialSetsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if credentialSetName == "" { + return nil, errors.New("parameter credentialSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialSetName}", url.PathEscape(credentialSetName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, credentialSetCreateParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a credential set from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - credentialSetName - The name of the credential set. +// - options - CredentialSetsClientBeginDeleteOptions contains the optional parameters for the CredentialSetsClient.BeginDelete +// method. +func (client *CredentialSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientBeginDeleteOptions) (*runtime.Poller[CredentialSetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, credentialSetName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CredentialSetsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CredentialSetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a credential set from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *CredentialSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CredentialSetsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CredentialSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if credentialSetName == "" { + return nil, errors.New("parameter credentialSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialSetName}", url.PathEscape(credentialSetName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the properties of the specified credential set resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - credentialSetName - The name of the credential set. +// - options - CredentialSetsClientGetOptions contains the optional parameters for the CredentialSetsClient.Get method. +func (client *CredentialSetsClient) Get(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientGetOptions) (CredentialSetsClientGetResponse, error) { + var err error + const operationName = "CredentialSetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, options) + if err != nil { + return CredentialSetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CredentialSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CredentialSetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CredentialSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if credentialSetName == "" { + return nil, errors.New("parameter credentialSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialSetName}", url.PathEscape(credentialSetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CredentialSetsClient) getHandleResponse(resp *http.Response) (CredentialSetsClientGetResponse, error) { + result := CredentialSetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialSet); err != nil { + return CredentialSetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all credential set resources for the specified container registry. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - CredentialSetsClientListOptions contains the optional parameters for the CredentialSetsClient.NewListPager method. +func (client *CredentialSetsClient) NewListPager(resourceGroupName string, registryName string, options *CredentialSetsClientListOptions) *runtime.Pager[CredentialSetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CredentialSetsClientListResponse]{ + More: func(page CredentialSetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CredentialSetsClientListResponse) (CredentialSetsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CredentialSetsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return CredentialSetsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *CredentialSetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *CredentialSetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CredentialSetsClient) listHandleResponse(resp *http.Response) (CredentialSetsClientListResponse, error) { + result := CredentialSetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialSetListResult); err != nil { + return CredentialSetsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a credential set for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - credentialSetName - The name of the credential set. +// - credentialSetUpdateParameters - The parameters for updating a credential set. +// - options - CredentialSetsClientBeginUpdateOptions contains the optional parameters for the CredentialSetsClient.BeginUpdate +// method. +func (client *CredentialSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*runtime.Poller[CredentialSetsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, credentialSetName, credentialSetUpdateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CredentialSetsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CredentialSetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a credential set for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *CredentialSetsClient) update(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CredentialSetsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, credentialSetUpdateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *CredentialSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if credentialSetName == "" { + return nil, errors.New("parameter credentialSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialSetName}", url.PathEscape(credentialSetName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, credentialSetUpdateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/interfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/interfaces.go new file mode 100644 index 000000000..d1dddecae --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/interfaces.go @@ -0,0 +1,36 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +// RunRequestClassification provides polymorphic access to related types. +// Call the interface's GetRunRequest() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *DockerBuildRequest, *EncodedTaskRunRequest, *FileTaskRunRequest, *RunRequest, *TaskRunRequest +type RunRequestClassification interface { + // GetRunRequest returns the RunRequest content of the underlying type. + GetRunRequest() *RunRequest +} + +// TaskStepPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetTaskStepProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *DockerBuildStep, *EncodedTaskStep, *FileTaskStep, *TaskStepProperties +type TaskStepPropertiesClassification interface { + // GetTaskStepProperties returns the TaskStepProperties content of the underlying type. + GetTaskStepProperties() *TaskStepProperties +} + +// TaskStepUpdateParametersClassification provides polymorphic access to related types. +// Call the interface's GetTaskStepUpdateParameters() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *DockerBuildStepUpdateParameters, *EncodedTaskStepUpdateParameters, *FileTaskStepUpdateParameters, *TaskStepUpdateParameters +type TaskStepUpdateParametersClassification interface { + // GetTaskStepUpdateParameters returns the TaskStepUpdateParameters content of the underlying type. + GetTaskStepUpdateParameters() *TaskStepUpdateParameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go new file mode 100644 index 000000000..f5c28b280 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go @@ -0,0 +1,2495 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import "time" + +// Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. +type Actor struct { + // The subject or username associated with the request context that generated the event. + Name *string +} + +// AgentPool - The agentpool that has the ARM resource and properties. The agentpool will have all information to create an +// agent pool. +type AgentPool struct { + // REQUIRED; The location of the resource. This cannot be changed after the resource is created. + Location *string + + // The properties associated with the agent pool + Properties *AgentPoolProperties + + // The tags of the resource. + Tags map[string]*string + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// AgentPoolListResult - The collection of agent pools. +type AgentPoolListResult struct { + // The URI that can be used to request the next set of paged results. + NextLink *string + + // The collection value. + Value []*AgentPool +} + +// AgentPoolProperties - The properties of agent pool. +type AgentPoolProperties struct { + // The count of agent machine + Count *int32 + + // The OS of agent machine + OS *OS + + // The Tier of agent machine + Tier *string + + // The Virtual Network Subnet Resource Id of the agent machine + VirtualNetworkSubnetResourceID *string + + // READ-ONLY; The provisioning state of this agent pool + ProvisioningState *ProvisioningState +} + +type AgentPoolPropertiesUpdateParameters struct { + // The count of agent machine + Count *int32 +} + +// AgentPoolQueueStatus - The QueueStatus of Agent Pool +type AgentPoolQueueStatus struct { + // The number of pending runs in the queue + Count *int32 +} + +// AgentPoolUpdateParameters - The parameters for updating an agent pool. +type AgentPoolUpdateParameters struct { + // The properties associated with the agent pool + Properties *AgentPoolPropertiesUpdateParameters + + // The ARM resource tags. + Tags map[string]*string +} + +// AgentProperties - The properties that determine the run agent configuration. +type AgentProperties struct { + // The CPU configuration in terms of number of cores required for the run. + CPU *int32 +} + +// Argument - The properties of a run argument. +type Argument struct { + // REQUIRED; The name of the argument. + Name *string + + // REQUIRED; The value of the argument. + Value *string + + // Flag to indicate whether the argument represents a secret and want to be removed from build logs. + IsSecret *bool +} + +// AuthCredential - Authentication credential stored for an upstream. +type AuthCredential struct { + // The name of the credential. + Name *CredentialName + + // KeyVault Secret URI for accessing the password. + PasswordSecretIdentifier *string + + // KeyVault Secret URI for accessing the username. + UsernameSecretIdentifier *string + + // READ-ONLY; This provides data pertaining to the health of the auth credential. + CredentialHealth *CredentialHealth +} + +// AuthInfo - The authorization properties for accessing the source code repository. +type AuthInfo struct { + // REQUIRED; The access token used to access the source control provider. + Token *string + + // REQUIRED; The type of Auth token. + TokenType *TokenType + + // Time in seconds that the token remains valid + ExpiresIn *int32 + + // The refresh token used to refresh the access token. + RefreshToken *string + + // The scope of the access token. + Scope *string +} + +// AuthInfoUpdateParameters - The authorization properties for accessing the source code repository. +type AuthInfoUpdateParameters struct { + // Time in seconds that the token remains valid + ExpiresIn *int32 + + // The refresh token used to refresh the access token. + RefreshToken *string + + // The scope of the access token. + Scope *string + + // The access token used to access the source control provider. + Token *string + + // The type of Auth token. + TokenType *TokenType +} + +// BaseImageDependency - Properties that describe a base image dependency. +type BaseImageDependency struct { + // The sha256-based digest of the image manifest. + Digest *string + + // The registry login server. + Registry *string + + // The repository name. + Repository *string + + // The tag name. + Tag *string + + // The type of the base image dependency. + Type *BaseImageDependencyType +} + +// BaseImageTrigger - The trigger based on base image dependency. +type BaseImageTrigger struct { + // REQUIRED; The type of the auto trigger for base image dependency updates. + BaseImageTriggerType *BaseImageTriggerType + + // REQUIRED; The name of the trigger. + Name *string + + // The current status of trigger. + Status *TriggerStatus + + // The endpoint URL for receiving update triggers. + UpdateTriggerEndpoint *string + + // Type of Payload body for Base image update triggers. + UpdateTriggerPayloadType *UpdateTriggerPayloadType +} + +// BaseImageTriggerUpdateParameters - The properties for updating base image dependency trigger. +type BaseImageTriggerUpdateParameters struct { + // REQUIRED; The name of the trigger. + Name *string + + // The type of the auto trigger for base image dependency updates. + BaseImageTriggerType *BaseImageTriggerType + + // The current status of trigger. + Status *TriggerStatus + + // The endpoint URL for receiving update triggers. + UpdateTriggerEndpoint *string + + // Type of Payload body for Base image update triggers. + UpdateTriggerPayloadType *UpdateTriggerPayloadType +} + +// CacheRule - An object that represents a cache rule for a container registry. +type CacheRule struct { + // The properties of the cache rule. + Properties *CacheRuleProperties + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// CacheRuleProperties - The properties of a cache rule. +type CacheRuleProperties struct { + // The ARM resource ID of the credential store which is associated with the cache rule. + CredentialSetResourceID *string + + // Source repository pulled from upstream. + SourceRepository *string + + // Target repository specified in docker pull command. Eg: docker pull myregistry.azurecr.io/{targetRepository}:{tag} + TargetRepository *string + + // READ-ONLY; The creation date of the cache rule. + CreationDate *time.Time + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// CacheRuleUpdateParameters - The parameters for updating a cache rule. +type CacheRuleUpdateParameters struct { + // The properties of the cache rule update parameters. + Properties *CacheRuleUpdateProperties +} + +// CacheRuleUpdateProperties - The parameters for updating cache rule properties. +type CacheRuleUpdateProperties struct { + // The ARM resource ID of the credential store which is associated with the Cache rule. + CredentialSetResourceID *string +} + +// CacheRulesListResult - The result of a request to list cache rules for a container registry. +type CacheRulesListResult struct { + // If provided, client must use NextLink URI to request next list of cache rules. + NextLink *string + + // The list of cache rules. + Value []*CacheRule +} + +// CallbackConfig - The configuration of service URI and custom headers for the webhook. +type CallbackConfig struct { + // REQUIRED; The service URI for the webhook to post notifications. + ServiceURI *string + + // Custom headers that will be added to the webhook notifications. + CustomHeaders map[string]*string +} + +// CredentialHealth - The health of the auth credential. +type CredentialHealth struct { + // Error code representing the health check error. + ErrorCode *string + + // Descriptive message representing the health check error. + ErrorMessage *string + + // The health status of credential. + Status *CredentialHealthStatus +} + +// CredentialSet - An object that represents a credential set resource for a container registry. +type CredentialSet struct { + // Identities associated with the resource. This is used to access the KeyVault secrets. + Identity *IdentityProperties + + // The properties of the credential set. + Properties *CredentialSetProperties + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// CredentialSetListResult - The result of a request to list credential sets for a container registry. +type CredentialSetListResult struct { + // The URI that can be used to request the next list of credential sets. + NextLink *string + + // The list of credential sets. Since this list may be incomplete, the nextLink field should be used to request the next list + // of credential sets. + Value []*CredentialSet +} + +// CredentialSetProperties - The properties of a credential set resource. +type CredentialSetProperties struct { + // List of authentication credentials stored for an upstream. Usually consists of a primary and an optional secondary credential. + AuthCredentials []*AuthCredential + + // The credentials are stored for this upstream or login server. + LoginServer *string + + // READ-ONLY; The creation date of credential store resource. + CreationDate *time.Time + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// CredentialSetUpdateParameters - The parameters for updating a credential set +type CredentialSetUpdateParameters struct { + // Identities associated with the resource. This is used to access the KeyVault secrets. + Identity *IdentityProperties + + // The properties of the credential set update parameters + Properties *CredentialSetUpdateProperties +} + +// CredentialSetUpdateProperties - The parameters for updating credential set properties. +type CredentialSetUpdateProperties struct { + // List of authentication credentials stored for an upstream. Usually consists of a primary and an optional secondary credential. + AuthCredentials []*AuthCredential +} + +// Credentials - The parameters that describes a set of credentials that will be used when a run is invoked. +type Credentials struct { + // Describes the credential parameters for accessing other custom registries. The key for the dictionary item will be the + // registry login server (myregistry.azurecr.io) and the value of the item will be + // the registry credentials for accessing the registry. + CustomRegistries map[string]*CustomRegistryCredentials + + // Describes the credential parameters for accessing the source registry. + SourceRegistry *SourceRegistryCredentials +} + +// CustomRegistryCredentials - Describes the credentials that will be used to access a custom registry during a run. +type CustomRegistryCredentials struct { + // Indicates the managed identity assigned to the custom credential. If a user-assigned identity this value is the Client + // ID. If a system-assigned identity, the value will be system. In the case of a + // system-assigned identity, the Client ID will be determined by the runner. This identity may be used to authenticate to + // key vault to retrieve credentials or it may be the only source of authentication + // used for accessing the registry. + Identity *string + + // The password for logging into the custom registry. The password is a secret object that allows multiple ways of providing + // the value for it. + Password *SecretObject + + // The username for logging into the custom registry. + UserName *SecretObject +} + +// DockerBuildRequest - The parameters for a docker quick build. +type DockerBuildRequest struct { + // REQUIRED; The Docker file path relative to the source location. + DockerFilePath *string + + // REQUIRED; The platform properties against which the run has to happen. + Platform *PlatformProperties + + // REQUIRED; The type of the run request. + Type *string + + // The machine configuration of the run agent. + AgentConfiguration *AgentProperties + + // The dedicated agent pool for the run. + AgentPoolName *string + + // The collection of override arguments to be used when executing the run. + Arguments []*Argument + + // The properties that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials + + // The fully qualified image names including the repository and tag. + ImageNames []*string + + // The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool + + // The value of this property indicates whether the image built should be pushed to the registry or not. + IsPushEnabled *bool + + // The template that describes the repository and tag information for run log artifact. + LogTemplate *string + + // The value of this property indicates whether the image cache is enabled or not. + NoCache *bool + + // The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. If it is relative URL, + // the relative path should be obtained from calling listBuildSourceUploadUrl API. + SourceLocation *string + + // The name of the target build stage for the docker build. + Target *string + + // Run timeout in seconds. + Timeout *int32 +} + +// GetRunRequest implements the RunRequestClassification interface for type DockerBuildRequest. +func (d *DockerBuildRequest) GetRunRequest() *RunRequest { + return &RunRequest{ + AgentPoolName: d.AgentPoolName, + IsArchiveEnabled: d.IsArchiveEnabled, + LogTemplate: d.LogTemplate, + Type: d.Type, + } +} + +// DockerBuildStep - The Docker build step. +type DockerBuildStep struct { + // REQUIRED; The Docker file path relative to the source context. + DockerFilePath *string + + // REQUIRED; The type of the step. + Type *StepType + + // The collection of override arguments to be used when executing this build step. + Arguments []*Argument + + // The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string + + // The URL(absolute or relative) of the source context for the task step. + ContextPath *string + + // The fully qualified image names including the repository and tag. + ImageNames []*string + + // The value of this property indicates whether the image built should be pushed to the registry or not. + IsPushEnabled *bool + + // The value of this property indicates whether the image cache is enabled or not. + NoCache *bool + + // The name of the target build stage for the docker build. + Target *string + + // READ-ONLY; List of base image dependencies for a step. + BaseImageDependencies []*BaseImageDependency +} + +// GetTaskStepProperties implements the TaskStepPropertiesClassification interface for type DockerBuildStep. +func (d *DockerBuildStep) GetTaskStepProperties() *TaskStepProperties { + return &TaskStepProperties{ + BaseImageDependencies: d.BaseImageDependencies, + ContextAccessToken: d.ContextAccessToken, + ContextPath: d.ContextPath, + Type: d.Type, + } +} + +// DockerBuildStepUpdateParameters - The properties for updating a docker build step. +type DockerBuildStepUpdateParameters struct { + // REQUIRED; The type of the step. + Type *StepType + + // The collection of override arguments to be used when executing this build step. + Arguments []*Argument + + // The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string + + // The URL(absolute or relative) of the source context for the task step. + ContextPath *string + + // The Docker file path relative to the source context. + DockerFilePath *string + + // The fully qualified image names including the repository and tag. + ImageNames []*string + + // The value of this property indicates whether the image built should be pushed to the registry or not. + IsPushEnabled *bool + + // The value of this property indicates whether the image cache is enabled or not. + NoCache *bool + + // The name of the target build stage for the docker build. + Target *string +} + +// GetTaskStepUpdateParameters implements the TaskStepUpdateParametersClassification interface for type DockerBuildStepUpdateParameters. +func (d *DockerBuildStepUpdateParameters) GetTaskStepUpdateParameters() *TaskStepUpdateParameters { + return &TaskStepUpdateParameters{ + ContextAccessToken: d.ContextAccessToken, + ContextPath: d.ContextPath, + Type: d.Type, + } +} + +// EncodedTaskRunRequest - The parameters for a quick task run request. +type EncodedTaskRunRequest struct { + // REQUIRED; Base64 encoded value of the template/definition file content. + EncodedTaskContent *string + + // REQUIRED; The platform properties against which the run has to happen. + Platform *PlatformProperties + + // REQUIRED; The type of the run request. + Type *string + + // The machine configuration of the run agent. + AgentConfiguration *AgentProperties + + // The dedicated agent pool for the run. + AgentPoolName *string + + // The properties that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials + + // Base64 encoded value of the parameters/values file content. + EncodedValuesContent *string + + // The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool + + // The template that describes the repository and tag information for run log artifact. + LogTemplate *string + + // The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. If it is relative URL, + // the relative path should be obtained from calling listBuildSourceUploadUrl API. + SourceLocation *string + + // Run timeout in seconds. + Timeout *int32 + + // The collection of overridable values that can be passed when running a task. + Values []*SetValue +} + +// GetRunRequest implements the RunRequestClassification interface for type EncodedTaskRunRequest. +func (e *EncodedTaskRunRequest) GetRunRequest() *RunRequest { + return &RunRequest{ + AgentPoolName: e.AgentPoolName, + IsArchiveEnabled: e.IsArchiveEnabled, + LogTemplate: e.LogTemplate, + Type: e.Type, + } +} + +// EncodedTaskStep - The properties of a encoded task step. +type EncodedTaskStep struct { + // REQUIRED; Base64 encoded value of the template/definition file content. + EncodedTaskContent *string + + // REQUIRED; The type of the step. + Type *StepType + + // The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string + + // The URL(absolute or relative) of the source context for the task step. + ContextPath *string + + // Base64 encoded value of the parameters/values file content. + EncodedValuesContent *string + + // The collection of overridable values that can be passed when running a task. + Values []*SetValue + + // READ-ONLY; List of base image dependencies for a step. + BaseImageDependencies []*BaseImageDependency +} + +// GetTaskStepProperties implements the TaskStepPropertiesClassification interface for type EncodedTaskStep. +func (e *EncodedTaskStep) GetTaskStepProperties() *TaskStepProperties { + return &TaskStepProperties{ + BaseImageDependencies: e.BaseImageDependencies, + ContextAccessToken: e.ContextAccessToken, + ContextPath: e.ContextPath, + Type: e.Type, + } +} + +// EncodedTaskStepUpdateParameters - The properties for updating encoded task step. +type EncodedTaskStepUpdateParameters struct { + // REQUIRED; The type of the step. + Type *StepType + + // The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string + + // The URL(absolute or relative) of the source context for the task step. + ContextPath *string + + // Base64 encoded value of the template/definition file content. + EncodedTaskContent *string + + // Base64 encoded value of the parameters/values file content. + EncodedValuesContent *string + + // The collection of overridable values that can be passed when running a task. + Values []*SetValue +} + +// GetTaskStepUpdateParameters implements the TaskStepUpdateParametersClassification interface for type EncodedTaskStepUpdateParameters. +func (e *EncodedTaskStepUpdateParameters) GetTaskStepUpdateParameters() *TaskStepUpdateParameters { + return &TaskStepUpdateParameters{ + ContextAccessToken: e.ContextAccessToken, + ContextPath: e.ContextPath, + Type: e.Type, + } +} + +type EncryptionProperty struct { + // Key vault properties. + KeyVaultProperties *KeyVaultProperties + + // Indicates whether or not the encryption is enabled for container registry. + Status *EncryptionStatus +} + +// Event - The event for a webhook. +type Event struct { + // The event request message sent to the service URI. + EventRequestMessage *EventRequestMessage + + // The event response message received from the service URI. + EventResponseMessage *EventResponseMessage + + // The event ID. + ID *string +} + +// EventContent - The content of the event request message. +type EventContent struct { + // The action that encompasses the provided event. + Action *string + + // The agent that initiated the event. For most situations, this could be from the authorization context of the request. + Actor *Actor + + // The event ID. + ID *string + + // The request that generated the event. + Request *Request + + // The registry node that generated the event. Put differently, while the actor initiates the event, the source generates + // it. + Source *Source + + // The target of the event. + Target *Target + + // The time at which the event occurred. + Timestamp *time.Time +} + +// EventInfo - The basic information of an event. +type EventInfo struct { + // The event ID. + ID *string +} + +// EventListResult - The result of a request to list events for a webhook. +type EventListResult struct { + // The URI that can be used to request the next list of events. + NextLink *string + + // The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. + Value []*Event +} + +// EventRequestMessage - The event request message sent to the service URI. +type EventRequestMessage struct { + // The content of the event request message. + Content *EventContent + + // The headers of the event request message. + Headers map[string]*string + + // The HTTP method used to send the event request message. + Method *string + + // The URI used to send the event request message. + RequestURI *string + + // The HTTP message version. + Version *string +} + +// EventResponseMessage - The event response message received from the service URI. +type EventResponseMessage struct { + // The content of the event response message. + Content *string + + // The headers of the event response message. + Headers map[string]*string + + // The reason phrase of the event response message. + ReasonPhrase *string + + // The status code of the event response message. + StatusCode *string + + // The HTTP message version. + Version *string +} + +// ExportPolicy - The export policy for a container registry. +type ExportPolicy struct { + // The value that indicates whether the policy is enabled or not. + Status *ExportPolicyStatus +} + +// FileTaskRunRequest - The request parameters for a scheduling run against a task file. +type FileTaskRunRequest struct { + // REQUIRED; The platform properties against which the run has to happen. + Platform *PlatformProperties + + // REQUIRED; The template/definition file path relative to the source. + TaskFilePath *string + + // REQUIRED; The type of the run request. + Type *string + + // The machine configuration of the run agent. + AgentConfiguration *AgentProperties + + // The dedicated agent pool for the run. + AgentPoolName *string + + // The properties that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials + + // The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool + + // The template that describes the repository and tag information for run log artifact. + LogTemplate *string + + // The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. If it is relative URL, + // the relative path should be obtained from calling listBuildSourceUploadUrl API. + SourceLocation *string + + // Run timeout in seconds. + Timeout *int32 + + // The collection of overridable values that can be passed when running a task. + Values []*SetValue + + // The values/parameters file path relative to the source. + ValuesFilePath *string +} + +// GetRunRequest implements the RunRequestClassification interface for type FileTaskRunRequest. +func (f *FileTaskRunRequest) GetRunRequest() *RunRequest { + return &RunRequest{ + AgentPoolName: f.AgentPoolName, + IsArchiveEnabled: f.IsArchiveEnabled, + LogTemplate: f.LogTemplate, + Type: f.Type, + } +} + +// FileTaskStep - The properties of a task step. +type FileTaskStep struct { + // REQUIRED; The task template/definition file path relative to the source context. + TaskFilePath *string + + // REQUIRED; The type of the step. + Type *StepType + + // The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string + + // The URL(absolute or relative) of the source context for the task step. + ContextPath *string + + // The collection of overridable values that can be passed when running a task. + Values []*SetValue + + // The task values/parameters file path relative to the source context. + ValuesFilePath *string + + // READ-ONLY; List of base image dependencies for a step. + BaseImageDependencies []*BaseImageDependency +} + +// GetTaskStepProperties implements the TaskStepPropertiesClassification interface for type FileTaskStep. +func (f *FileTaskStep) GetTaskStepProperties() *TaskStepProperties { + return &TaskStepProperties{ + BaseImageDependencies: f.BaseImageDependencies, + ContextAccessToken: f.ContextAccessToken, + ContextPath: f.ContextPath, + Type: f.Type, + } +} + +// FileTaskStepUpdateParameters - The properties of updating a task step. +type FileTaskStepUpdateParameters struct { + // REQUIRED; The type of the step. + Type *StepType + + // The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string + + // The URL(absolute or relative) of the source context for the task step. + ContextPath *string + + // The task template/definition file path relative to the source context. + TaskFilePath *string + + // The collection of overridable values that can be passed when running a task. + Values []*SetValue + + // The values/parameters file path relative to the source context. + ValuesFilePath *string +} + +// GetTaskStepUpdateParameters implements the TaskStepUpdateParametersClassification interface for type FileTaskStepUpdateParameters. +func (f *FileTaskStepUpdateParameters) GetTaskStepUpdateParameters() *TaskStepUpdateParameters { + return &TaskStepUpdateParameters{ + ContextAccessToken: f.ContextAccessToken, + ContextPath: f.ContextPath, + Type: f.Type, + } +} + +// GenerateCredentialsParameters - The parameters used to generate credentials for a specified token or user of a container +// registry. +type GenerateCredentialsParameters struct { + // The expiry date of the generated credentials after which the credentials become invalid. + Expiry *time.Time + + // Specifies name of the password which should be regenerated if any -- password1 or password2. + Name *TokenPasswordName + + // The resource ID of the token for which credentials have to be generated. + TokenID *string +} + +// GenerateCredentialsResult - The response from the GenerateCredentials operation. +type GenerateCredentialsResult struct { + // The list of passwords for a container registry. + Passwords []*TokenPassword + + // The username for a container registry. + Username *string +} + +// IPRule - IP rule with specific IP or IP range in CIDR format. +type IPRule struct { + // REQUIRED; Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. + IPAddressOrRange *string + + // The action of IP ACL rule. + Action *Action +} + +// IdentityProperties - Managed identity for the resource. +type IdentityProperties struct { + // The identity type. + Type *ResourceIdentityType + + // 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]*UserIdentityProperties + + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of resource. + TenantID *string +} + +// ImageDescriptor - Properties for a registry image. +type ImageDescriptor struct { + // The sha256-based digest of the image manifest. + Digest *string + + // The registry login server. + Registry *string + + // The repository name. + Repository *string + + // The tag name. + Tag *string +} + +// ImageUpdateTrigger - The image update trigger that caused a build. +type ImageUpdateTrigger struct { + // The unique ID of the trigger. + ID *string + + // The list of image updates that caused the build. + Images []*ImageDescriptor + + // The timestamp when the image update happened. + Timestamp *time.Time +} + +type ImportImageParameters struct { + // REQUIRED; The source of the image. + Source *ImportSource + + // When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation + // before any copying begins. + Mode *ImportMode + + // List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also + // omitted). + TargetTags []*string + + // List of strings of repository names to do a manifest only copy. No tag will be created. + UntaggedTargetRepositories []*string +} + +type ImportSource struct { + // REQUIRED; Repository name of the source image. Specify an image by repository ('hello-world'). This will use the 'latest' + // tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based + // manifest digest ('hello-world@sha256:abc123'). + SourceImage *string + + // Credentials used when importing from a registry uri. + Credentials *ImportSourceCredentials + + // The address of the source registry (e.g. 'mcr.microsoft.com'). + RegistryURI *string + + // The resource identifier of the source Azure Container Registry. + ResourceID *string +} + +type ImportSourceCredentials struct { + // REQUIRED; The password used to authenticate with the source registry. + Password *string + + // The username to authenticate with the source registry. + Username *string +} + +type KeyVaultProperties struct { + // The client id of the identity which will be used to access key vault. + Identity *string + + // Key vault uri to access the encryption key. + KeyIdentifier *string + + // READ-ONLY; Auto key rotation status for a CMK enabled registry. + KeyRotationEnabled *bool + + // READ-ONLY; Timestamp of the last successful key rotation. + LastKeyRotationTimestamp *time.Time + + // READ-ONLY; The fully qualified key identifier that includes the version of the key that is actually used for encryption. + VersionedKeyIdentifier *string +} + +// NetworkRuleSet - The network rule set for a container registry. +type NetworkRuleSet struct { + // REQUIRED; The default action of allow or deny when no other rules match. + DefaultAction *DefaultAction + + // The IP ACL rules. + IPRules []*IPRule +} + +// OperationDefinition - The definition of a container registry operation. +type OperationDefinition struct { + // The display information for the container registry operation. + Display *OperationDisplayDefinition + + // This property indicates if the operation is an action or a data action ref: https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations + IsDataAction *bool + + // Operation name: {provider}/{resource}/{operation}. + Name *string + + // The origin information of the container registry operation. + Origin *string + + // The properties information for the container registry operation. + Properties *OperationPropertiesDefinition +} + +// OperationDisplayDefinition - The display information for a container registry operation. +type OperationDisplayDefinition struct { + // The description for the operation. + Description *string + + // The operation that users can perform. + Operation *string + + // The resource provider name: Microsoft.ContainerRegistry. + Provider *string + + // The resource on which the operation is performed. + Resource *string +} + +// OperationListResult - The result of a request to list container registry operations. +type OperationListResult struct { + // The URI that can be used to request the next list of container registry operations. + NextLink *string + + // The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request + // the next list of operations. + Value []*OperationDefinition +} + +// OperationLogSpecificationDefinition - The definition of Azure Monitoring log. +type OperationLogSpecificationDefinition struct { + // Log blob duration. + BlobDuration *string + + // Log display name. + DisplayName *string + + // Log name. + Name *string +} + +// OperationMetricSpecificationDefinition - The definition of Azure Monitoring metric. +type OperationMetricSpecificationDefinition struct { + // Metric aggregation type. + AggregationType *string + + // Metric description. + DisplayDescription *string + + // Metric display name. + DisplayName *string + + // Internal metric name. + InternalMetricName *string + + // Metric name. + Name *string + + // Metric unit. + Unit *string +} + +// OperationPropertiesDefinition - The definition of Azure Monitoring properties. +type OperationPropertiesDefinition struct { + // The definition of Azure Monitoring service. + ServiceSpecification *OperationServiceSpecificationDefinition +} + +// OperationServiceSpecificationDefinition - The definition of Azure Monitoring list. +type OperationServiceSpecificationDefinition struct { + // A list of Azure Monitoring log definitions. + LogSpecifications []*OperationLogSpecificationDefinition + + // A list of Azure Monitoring metrics definition. + MetricSpecifications []*OperationMetricSpecificationDefinition +} + +type OverrideTaskStepProperties struct { + // Gets or sets the collection of override arguments to be used when executing a build step. + Arguments []*Argument + + // The source context against which run has to be queued. + ContextPath *string + + // The file against which run has to be queued. + File *string + + // The name of the target build stage for the docker build. + Target *string + + // Base64 encoded update trigger token that will be attached with the base image trigger webhook. + UpdateTriggerToken *string + + // The collection of overridable values that can be passed when running a Task. + Values []*SetValue +} + +// PlatformProperties - The platform properties against which the run has to happen. +type PlatformProperties struct { + // REQUIRED; The operating system type required for the run. + OS *OS + + // The OS architecture. + Architecture *Architecture + + // Variant of the CPU. + Variant *Variant +} + +// PlatformUpdateParameters - The properties for updating the platform configuration. +type PlatformUpdateParameters struct { + // The OS architecture. + Architecture *Architecture + + // The operating system type required for the run. + OS *OS + + // Variant of the CPU. + Variant *Variant +} + +// Policies - The policies for a container registry. +type Policies struct { + // The export policy for a container registry. + ExportPolicy *ExportPolicy + + // The quarantine policy for a container registry. + QuarantinePolicy *QuarantinePolicy + + // The retention policy for a container registry. + RetentionPolicy *RetentionPolicy + + // The content trust policy for a container registry. + TrustPolicy *TrustPolicy +} + +// PrivateEndpoint - The Private Endpoint resource. +type PrivateEndpoint struct { + // This is private endpoint resource created with Microsoft.Network resource provider. + ID *string +} + +// PrivateEndpointConnection - An object that represents a private endpoint connection for a container registry. +type PrivateEndpointConnection struct { + // The properties of a private endpoint connection. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// PrivateEndpointConnectionListResult - The result of a request to list private endpoint connections for a container registry. +type PrivateEndpointConnectionListResult struct { + // The URI that can be used to request the next list of private endpoint connections. + NextLink *string + + // The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request + // the next list of private endpoint connections. + Value []*PrivateEndpointConnection +} + +// PrivateEndpointConnectionProperties - The properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // The resource of private endpoint. + PrivateEndpoint *PrivateEndpoint + + // A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // READ-ONLY; The provisioning state of private endpoint connection resource. + ProvisioningState *ProvisioningState +} + +// PrivateLinkResource - A resource that supports private link capabilities. +type PrivateLinkResource struct { + // The resource ID. + ID *string + + // The name of the resource. + Name *string + + // A resource that supports private link capabilities. + Properties *PrivateLinkResourceProperties + + // READ-ONLY; The resource type is private link resource. + Type *string +} + +// PrivateLinkResourceListResult - The result of a request to list private link resources for a container registry. +type PrivateLinkResourceListResult struct { + // The URI that can be used to request the next list of private link resources. + NextLink *string + + // The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the + // next list of private link resources. + Value []*PrivateLinkResource +} + +// PrivateLinkResourceProperties - The properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource group id. + GroupID *string + + // The private link resource required member names. + RequiredMembers []*string + + // The private link resource Private link DNS zone name. + RequiredZoneNames []*string +} + +// PrivateLinkServiceConnectionState - The state of a private link service connection. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *ActionsRequired + + // The description for connection status. For example if connection is rejected it can indicate reason for rejection. + Description *string + + // The private link service connection status. + Status *ConnectionStatus +} + +// QuarantinePolicy - The quarantine policy for a container registry. +type QuarantinePolicy struct { + // The value that indicates whether the policy is enabled or not. + Status *PolicyStatus +} + +// RegenerateCredentialParameters - The parameters used to regenerate the login credential. +type RegenerateCredentialParameters struct { + // REQUIRED; Specifies name of the password which should be regenerated -- password or password2. + Name *PasswordName +} + +// Registry - An object that represents a container registry. +type Registry struct { + // REQUIRED; The location of the resource. This cannot be changed after the resource is created. + Location *string + + // REQUIRED; The SKU of the container registry. + SKU *SKU + + // The identity of the container registry. + Identity *IdentityProperties + + // The properties of the container registry. + Properties *RegistryProperties + + // The tags of the resource. + Tags map[string]*string + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// RegistryListCredentialsResult - The response from the ListCredentials operation. +type RegistryListCredentialsResult struct { + // The list of passwords for a container registry. + Passwords []*RegistryPassword + + // The username for a container registry. + Username *string +} + +// RegistryListResult - The result of a request to list container registries. +type RegistryListResult struct { + // The URI that can be used to request the next list of container registries. + NextLink *string + + // The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next + // list of container registries. + Value []*Registry +} + +// RegistryNameCheckRequest - A request to check whether a container registry name is available. +type RegistryNameCheckRequest struct { + // REQUIRED; The name of the container registry. + Name *string + + // CONSTANT; The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. + // Field has constant value "Microsoft.ContainerRegistry/registries", any specified value is ignored. + Type *string +} + +// RegistryNameStatus - The result of a request to check the availability of a container registry name. +type RegistryNameStatus struct { + // If any, the error message that provides more detail for the reason that the name is not available. + Message *string + + // The value that indicates whether the name is available. + NameAvailable *bool + + // If any, the reason that the name is not available. + Reason *string +} + +// RegistryPassword - The login password for the container registry. +type RegistryPassword struct { + // The password name. + Name *PasswordName + + // The password value. + Value *string +} + +// RegistryProperties - The properties of a container registry. +type RegistryProperties struct { + // The value that indicates whether the admin user is enabled. + AdminUserEnabled *bool + + // Enable a single data endpoint per region for serving data. + DataEndpointEnabled *bool + + // The encryption settings of container registry. + Encryption *EncryptionProperty + + // Whether to allow trusted Azure services to access a network restricted registry. + NetworkRuleBypassOptions *NetworkRuleBypassOptions + + // The network rule set for a container registry. + NetworkRuleSet *NetworkRuleSet + + // The policies for a container registry. + Policies *Policies + + // Whether or not public network access is allowed for the container registry. + PublicNetworkAccess *PublicNetworkAccess + + // Whether or not zone redundancy is enabled for this container registry + ZoneRedundancy *ZoneRedundancy + + // READ-ONLY; The creation date of the container registry in ISO8601 format. + CreationDate *time.Time + + // READ-ONLY; List of host names that will serve data when dataEndpointEnabled is true. + DataEndpointHostNames []*string + + // READ-ONLY; The URL that can be used to log into the container registry. + LoginServer *string + + // READ-ONLY; List of private endpoint connections for a container registry. + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; The provisioning state of the container registry at the time the operation was called. + ProvisioningState *ProvisioningState + + // READ-ONLY; The status of the container registry at the time the operation was called. + Status *Status +} + +// RegistryPropertiesUpdateParameters - The parameters for updating the properties of a container registry. +type RegistryPropertiesUpdateParameters struct { + // The value that indicates whether the admin user is enabled. + AdminUserEnabled *bool + + // Enable a single data endpoint per region for serving data. + DataEndpointEnabled *bool + + // The encryption settings of container registry. + Encryption *EncryptionProperty + + // Whether to allow trusted Azure services to access a network restricted registry. + NetworkRuleBypassOptions *NetworkRuleBypassOptions + + // The network rule set for a container registry. + NetworkRuleSet *NetworkRuleSet + + // The policies for a container registry. + Policies *Policies + + // Whether or not public network access is allowed for the container registry. + PublicNetworkAccess *PublicNetworkAccess +} + +// RegistryUpdateParameters - The parameters for updating a container registry. +type RegistryUpdateParameters struct { + // The identity of the container registry. + Identity *IdentityProperties + + // The properties that the container registry will be updated with. + Properties *RegistryPropertiesUpdateParameters + + // The SKU of the container registry. + SKU *SKU + + // The tags for the container registry. + Tags map[string]*string +} + +// RegistryUsage - The quota usage for a container registry. +type RegistryUsage struct { + // The current value of the usage. + CurrentValue *int64 + + // The limit of the usage. + Limit *int64 + + // The name of the usage. + Name *string + + // The unit of measurement. + Unit *RegistryUsageUnit +} + +// RegistryUsageListResult - The result of a request to get container registry quota usages. +type RegistryUsageListResult struct { + // The list of container registry quota usages. + Value []*RegistryUsage +} + +// Replication - An object that represents a replication for a container registry. +type Replication struct { + // REQUIRED; The location of the resource. This cannot be changed after the resource is created. + Location *string + + // The properties of the replication. + Properties *ReplicationProperties + + // The tags of the resource. + Tags map[string]*string + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// ReplicationListResult - The result of a request to list replications for a container registry. +type ReplicationListResult struct { + // The URI that can be used to request the next list of replications. + NextLink *string + + // The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list + // of replications. + Value []*Replication +} + +// ReplicationProperties - The properties of a replication. +type ReplicationProperties struct { + // Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional + // endpoint is disabled, however its data will continue to be synced with + // other replications. + RegionEndpointEnabled *bool + + // Whether or not zone redundancy is enabled for this container registry replication + ZoneRedundancy *ZoneRedundancy + + // READ-ONLY; The provisioning state of the replication at the time the operation was called. + ProvisioningState *ProvisioningState + + // READ-ONLY; The status of the replication at the time the operation was called. + Status *Status +} + +// ReplicationUpdateParameters - The parameters for updating a replication. +type ReplicationUpdateParameters struct { + // The parameters for updating a replication's properties + Properties *ReplicationUpdateParametersProperties + + // The tags for the replication. + Tags map[string]*string +} + +type ReplicationUpdateParametersProperties struct { + // Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional + // endpoint is disabled, however its data will continue to be synced with + // other replications. + RegionEndpointEnabled *bool +} + +// Request - The request that generated the event. +type Request struct { + // The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the + // standard http request. + Addr *string + + // The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. + Host *string + + // The ID of the request that initiated the event. + ID *string + + // The request method that generated the event. + Method *string + + // The user agent header of the request. + Useragent *string +} + +// RetentionPolicy - The retention policy for a container registry. +type RetentionPolicy struct { + // The number of days to retain an untagged manifest after which it gets purged. + Days *int32 + + // The value that indicates whether the policy is enabled or not. + Status *PolicyStatus + + // READ-ONLY; The timestamp when the policy was last updated. + LastUpdatedTime *time.Time +} + +// Run resource properties +type Run struct { + // The properties of a run. + Properties *RunProperties + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// RunFilter - Properties that are enabled for Odata querying on runs. +type RunFilter struct { + // The name of the agent pool that the run corresponds to. + AgentPoolName *string + + // The create time for a run. + CreateTime *time.Time + + // The time the run finished. + FinishTime *time.Time + + // The value that indicates whether archiving is enabled or not. + IsArchiveEnabled *bool + + // The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of build + // type. + OutputImageManifests *string + + // The unique identifier for the run. + RunID *string + + // The type of run. + RunType *RunType + + // The current status of the run. + Status *RunStatus + + // The name of the task that the run corresponds to. + TaskName *string +} + +// RunGetLogResult - The result of get log link operation. +type RunGetLogResult struct { + // The link to logs in registry for a run on a azure container registry. + LogArtifactLink *string + + // The link to logs for a run on a azure container registry. + LogLink *string +} + +// RunListResult - Collection of runs. +type RunListResult struct { + // The URI that can be used to request the next set of paged results. + NextLink *string + + // The collection value. + Value []*Run +} + +// RunProperties - The properties for a run. +type RunProperties struct { + // The machine configuration of the run agent. + AgentConfiguration *AgentProperties + + // The dedicated agent pool for the run. + AgentPoolName *string + + // The time the run was scheduled. + CreateTime *time.Time + + // The list of custom registries that were logged in during this run. + CustomRegistries []*string + + // The time the run finished. + FinishTime *time.Time + + // The image update trigger that caused the run. This is applicable if the task has base image trigger configured. + ImageUpdateTrigger *ImageUpdateTrigger + + // The value that indicates whether archiving is enabled or not. + IsArchiveEnabled *bool + + // The last updated time for the run. + LastUpdatedTime *time.Time + + // The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. + OutputImages []*ImageDescriptor + + // The platform properties against which the run will happen. + Platform *PlatformProperties + + // The provisioning state of a run. + ProvisioningState *ProvisioningState + + // The unique identifier for the run. + RunID *string + + // The type of run. + RunType *RunType + + // The scope of the credentials that were used to login to the source registry during this run. + SourceRegistryAuth *string + + // The source trigger that caused the run. + SourceTrigger *SourceTriggerDescriptor + + // The time the run started. + StartTime *time.Time + + // The current status of the run. + Status *RunStatus + + // The task against which run was scheduled. + Task *string + + // The timer trigger that caused the run. + TimerTrigger *TimerTriggerDescriptor + + // The update trigger token passed for the Run. + UpdateTriggerToken *string + + // READ-ONLY; The image description for the log artifact. + LogArtifact *ImageDescriptor + + // READ-ONLY; The error message received from backend systems after the run is scheduled. + RunErrorMessage *string +} + +// RunRequest - The request parameters for scheduling a run. +type RunRequest struct { + // REQUIRED; The type of the run request. + Type *string + + // The dedicated agent pool for the run. + AgentPoolName *string + + // The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool + + // The template that describes the repository and tag information for run log artifact. + LogTemplate *string +} + +// GetRunRequest implements the RunRequestClassification interface for type RunRequest. +func (r *RunRequest) GetRunRequest() *RunRequest { return r } + +// RunUpdateParameters - The set of run properties that can be updated. +type RunUpdateParameters struct { + // The value that indicates whether archiving is enabled or not. + IsArchiveEnabled *bool +} + +// SKU - The SKU of a container registry. +type SKU struct { + // REQUIRED; The SKU name of the container registry. Required for registry creation. + Name *SKUName + + // READ-ONLY; The SKU tier based on the SKU name. + Tier *SKUTier +} + +// ScopeMap - An object that represents a scope map for a container registry. +type ScopeMap struct { + // The properties of the scope map. + Properties *ScopeMapProperties + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// ScopeMapListResult - The result of a request to list scope maps for a container registry. +type ScopeMapListResult struct { + // The URI that can be used to request the next list of scope maps. + NextLink *string + + // The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of + // scope maps. + Value []*ScopeMap +} + +// ScopeMapProperties - The properties of a scope map. +type ScopeMapProperties struct { + // REQUIRED; The list of scoped permissions for registry artifacts. E.g. repositories/repository-name/content/read, repositories/repository-name/metadata/write + Actions []*string + + // The user friendly description of the scope map. + Description *string + + // READ-ONLY; The creation date of scope map. + CreationDate *time.Time + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The type of the scope map. E.g. BuildIn scope map. + Type *string +} + +// ScopeMapPropertiesUpdateParameters - The update parameters for scope map properties. +type ScopeMapPropertiesUpdateParameters struct { + // The list of scope permissions for registry artifacts. E.g. repositories/repository-name/pull, repositories/repository-name/delete + Actions []*string + + // The user friendly description of the scope map. + Description *string +} + +// ScopeMapUpdateParameters - The properties for updating the scope map. +type ScopeMapUpdateParameters struct { + // The update parameters for scope map properties. + Properties *ScopeMapPropertiesUpdateParameters +} + +// SecretObject - Describes the properties of a secret object value. +type SecretObject struct { + // The type of the secret object which determines how the value of the secret object has to be interpreted. + Type *SecretObjectType + + // The value of the secret. The format of this value will be determined based on the type of the secret object. If the type + // is Opaque, the value will be used as is without any modification. + Value *string +} + +// SetValue - The properties of a overridable value that can be passed to a task template. +type SetValue struct { + // REQUIRED; The name of the overridable value. + Name *string + + // REQUIRED; The overridable value. + Value *string + + // Flag to indicate whether the value represents a secret or not. + IsSecret *bool +} + +// Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates +// it. +type Source struct { + // The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() + // along with the running port. + Addr *string + + // The running instance of an application. Changes after each restart. + InstanceID *string +} + +// SourceProperties - The properties of the source code repository. +type SourceProperties struct { + // REQUIRED; The full URL to the source code repository + RepositoryURL *string + + // REQUIRED; The type of source control service. + SourceControlType *SourceControlType + + // The branch name of the source code. + Branch *string + + // The authorization properties for accessing the source code repository and to set up webhooks for notifications. + SourceControlAuthProperties *AuthInfo +} + +// SourceRegistryCredentials - Describes the credential parameters for accessing the source registry. +type SourceRegistryCredentials struct { + // The authentication mode which determines the source registry login scope. The credentials for the source registry will + // be generated using the given scope. These credentials will be used to login to + // the source registry during the run. + LoginMode *SourceRegistryLoginMode +} + +// SourceTrigger - The properties of a source based trigger. +type SourceTrigger struct { + // REQUIRED; The name of the trigger. + Name *string + + // REQUIRED; The properties that describes the source(code) for the task. + SourceRepository *SourceProperties + + // REQUIRED; The source event corresponding to the trigger. + SourceTriggerEvents []*SourceTriggerEvent + + // The current status of trigger. + Status *TriggerStatus +} + +// SourceTriggerDescriptor - The source trigger that caused a run. +type SourceTriggerDescriptor struct { + // The branch name in the repository. + BranchName *string + + // The unique ID that identifies a commit. + CommitID *string + + // The event type of the trigger. + EventType *string + + // The unique ID of the trigger. + ID *string + + // The source control provider type. + ProviderType *string + + // The unique ID that identifies pull request. + PullRequestID *string + + // The repository URL. + RepositoryURL *string +} + +// SourceTriggerUpdateParameters - The properties for updating a source based trigger. +type SourceTriggerUpdateParameters struct { + // REQUIRED; The name of the trigger. + Name *string + + // The properties that describes the source(code) for the task. + SourceRepository *SourceUpdateParameters + + // The source event corresponding to the trigger. + SourceTriggerEvents []*SourceTriggerEvent + + // The current status of trigger. + Status *TriggerStatus +} + +// SourceUpdateParameters - The properties for updating the source code repository. +type SourceUpdateParameters struct { + // The branch name of the source code. + Branch *string + + // The full URL to the source code repository + RepositoryURL *string + + // The authorization properties for accessing the source code repository and to set up webhooks for notifications. + SourceControlAuthProperties *AuthInfoUpdateParameters + + // The type of source control service. + SourceControlType *SourceControlType +} + +// SourceUploadDefinition - The properties of a response to source upload request. +type SourceUploadDefinition struct { + // The relative path to the source. This is used to submit the subsequent queue build request. + RelativePath *string + + // The URL where the client can upload the source. + UploadURL *string +} + +// Status - The status of an Azure resource at the time the operation was called. +type Status struct { + // READ-ONLY; The short label for the status. + DisplayStatus *string + + // READ-ONLY; The detailed message for the status, including alerts and error messages. + Message *string + + // READ-ONLY; The timestamp when the status was changed to the current value. + Timestamp *time.Time +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource modification (UTC). + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *LastModifiedByType +} + +// Target - The target of the event. +type Target struct { + // The digest of the content, as defined by the Registry V2 HTTP API Specification. + Digest *string + + // The number of bytes of the content. Same as Size field. + Length *int64 + + // The MIME type of the referenced object. + MediaType *string + + // The name of the artifact. + Name *string + + // The repository name. + Repository *string + + // The number of bytes of the content. Same as Length field. + Size *int64 + + // The tag name. + Tag *string + + // The direct URL to the content. + URL *string + + // The version of the artifact. + Version *string +} + +// Task - The task that has the ARM resource and task properties. The task will have all information to schedule a run against +// it. +type Task struct { + // REQUIRED; The location of the resource. This cannot be changed after the resource is created. + Location *string + + // Identity for the resource. + Identity *IdentityProperties + + // The properties of a task. + Properties *TaskProperties + + // The tags of the resource. + Tags map[string]*string + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// TaskListResult - The collection of tasks. +type TaskListResult struct { + // The URI that can be used to request the next set of paged results. + NextLink *string + + // The collection value. + Value []*Task +} + +// TaskProperties - The properties of a task. +type TaskProperties struct { + // The machine configuration of the run agent. + AgentConfiguration *AgentProperties + + // The dedicated agent pool for the task. + AgentPoolName *string + + // The properties that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials + + // The value of this property indicates whether the task resource is system task or not. + IsSystemTask *bool + + // The template that describes the repository and tag information for run log artifact. + LogTemplate *string + + // The platform properties against which the run has to happen. + Platform *PlatformProperties + + // The current status of task. + Status *TaskStatus + + // The properties of a task step. + Step TaskStepPropertiesClassification + + // Run timeout in seconds. + Timeout *int32 + + // The properties that describe all triggers for the task. + Trigger *TriggerProperties + + // READ-ONLY; The creation date of task. + CreationDate *time.Time + + // READ-ONLY; The provisioning state of the task. + ProvisioningState *ProvisioningState +} + +// TaskPropertiesUpdateParameters - The properties for updating a task. +type TaskPropertiesUpdateParameters struct { + // The machine configuration of the run agent. + AgentConfiguration *AgentProperties + + // The dedicated agent pool for the task. + AgentPoolName *string + + // The parameters that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials + + // The template that describes the repository and tag information for run log artifact. + LogTemplate *string + + // The platform properties against which the run has to happen. + Platform *PlatformUpdateParameters + + // The current status of task. + Status *TaskStatus + + // The properties for updating a task step. + Step TaskStepUpdateParametersClassification + + // Run timeout in seconds. + Timeout *int32 + + // The properties for updating trigger properties. + Trigger *TriggerUpdateParameters +} + +// TaskRun - The task run that has the ARM resource and properties. The task run will have the information of request and +// result of a run. +type TaskRun struct { + // Identity for the resource. + Identity *IdentityProperties + + // The location of the resource + Location *string + + // The properties associated with the task run, i.e., request and result of the run + Properties *TaskRunProperties + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// TaskRunListResult - The collection of task runs. +type TaskRunListResult struct { + // The URI that can be used to request the next set of paged results. + NextLink *string + + // The collection value. + Value []*TaskRun +} + +// TaskRunProperties - The properties of task run. +type TaskRunProperties struct { + // How the run should be forced to rerun even if the run request configuration has not changed + ForceUpdateTag *string + + // The request (parameters) for the run + RunRequest RunRequestClassification + + // READ-ONLY; The provisioning state of this task run + ProvisioningState *ProvisioningState + + // READ-ONLY; The result of this task run + RunResult *Run +} + +// TaskRunPropertiesUpdateParameters - The properties of a task run update parameters. +type TaskRunPropertiesUpdateParameters struct { + // How the run should be forced to rerun even if the run request configuration has not changed + ForceUpdateTag *string + + // The request (parameters) for the new run + RunRequest RunRequestClassification +} + +// TaskRunRequest - The parameters for a task run request. +type TaskRunRequest struct { + // REQUIRED; The resource ID of task against which run has to be queued. + TaskID *string + + // REQUIRED; The type of the run request. + Type *string + + // The dedicated agent pool for the run. + AgentPoolName *string + + // The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool + + // The template that describes the repository and tag information for run log artifact. + LogTemplate *string + + // Set of overridable parameters that can be passed when running a Task. + OverrideTaskStepProperties *OverrideTaskStepProperties +} + +// GetRunRequest implements the RunRequestClassification interface for type TaskRunRequest. +func (t *TaskRunRequest) GetRunRequest() *RunRequest { + return &RunRequest{ + AgentPoolName: t.AgentPoolName, + IsArchiveEnabled: t.IsArchiveEnabled, + LogTemplate: t.LogTemplate, + Type: t.Type, + } +} + +// TaskRunUpdateParameters - The parameters for updating a task run. +type TaskRunUpdateParameters struct { + // Identity for the resource. + Identity *IdentityProperties + + // The location of the resource + Location *string + + // The properties for updating a task run. + Properties *TaskRunPropertiesUpdateParameters + + // The ARM resource tags. + Tags map[string]*string +} + +// TaskStepProperties - Base properties for any task step. +type TaskStepProperties struct { + // REQUIRED; The type of the step. + Type *StepType + + // The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string + + // The URL(absolute or relative) of the source context for the task step. + ContextPath *string + + // READ-ONLY; List of base image dependencies for a step. + BaseImageDependencies []*BaseImageDependency +} + +// GetTaskStepProperties implements the TaskStepPropertiesClassification interface for type TaskStepProperties. +func (t *TaskStepProperties) GetTaskStepProperties() *TaskStepProperties { return t } + +// TaskStepUpdateParameters - Base properties for updating any task step. +type TaskStepUpdateParameters struct { + // REQUIRED; The type of the step. + Type *StepType + + // The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string + + // The URL(absolute or relative) of the source context for the task step. + ContextPath *string +} + +// GetTaskStepUpdateParameters implements the TaskStepUpdateParametersClassification interface for type TaskStepUpdateParameters. +func (t *TaskStepUpdateParameters) GetTaskStepUpdateParameters() *TaskStepUpdateParameters { return t } + +// TaskUpdateParameters - The parameters for updating a task. +type TaskUpdateParameters struct { + // Identity for the resource. + Identity *IdentityProperties + + // The properties for updating a task. + Properties *TaskPropertiesUpdateParameters + + // The ARM resource tags. + Tags map[string]*string +} + +// TimerTrigger - The properties of a timer trigger. +type TimerTrigger struct { + // REQUIRED; The name of the trigger. + Name *string + + // REQUIRED; The CRON expression for the task schedule + Schedule *string + + // The current status of trigger. + Status *TriggerStatus +} + +type TimerTriggerDescriptor struct { + // The occurrence that triggered the run. + ScheduleOccurrence *string + + // The timer trigger name that caused the run. + TimerTriggerName *string +} + +// TimerTriggerUpdateParameters - The properties for updating a timer trigger. +type TimerTriggerUpdateParameters struct { + // REQUIRED; The name of the trigger. + Name *string + + // The CRON expression for the task schedule + Schedule *string + + // The current status of trigger. + Status *TriggerStatus +} + +// Token - An object that represents a token for a container registry. +type Token struct { + // The properties of the token. + Properties *TokenProperties + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// TokenCertificate - The properties of a certificate used for authenticating a token. +type TokenCertificate struct { + // Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. + EncodedPemCertificate *string + + // The expiry datetime of the certificate. + Expiry *time.Time + Name *TokenCertificateName + + // The thumbprint of the certificate. + Thumbprint *string +} + +// TokenCredentialsProperties - The properties of the credentials that can be used for authenticating the token. +type TokenCredentialsProperties struct { + Certificates []*TokenCertificate + Passwords []*TokenPassword +} + +// TokenListResult - The result of a request to list tokens for a container registry. +type TokenListResult struct { + // The URI that can be used to request the next list of tokens. + NextLink *string + + // The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. + Value []*Token +} + +// TokenPassword - The password that will be used for authenticating the token of a container registry. +type TokenPassword struct { + // The creation datetime of the password. + CreationTime *time.Time + + // The expiry datetime of the password. + Expiry *time.Time + + // The password name "password1" or "password2" + Name *TokenPasswordName + + // READ-ONLY; The password value. + Value *string +} + +// TokenProperties - The properties of a token. +type TokenProperties struct { + // The credentials that can be used for authenticating the token. + Credentials *TokenCredentialsProperties + + // The resource ID of the scope map to which the token will be associated with. + ScopeMapID *string + + // The status of the token example enabled or disabled. + Status *TokenStatus + + // READ-ONLY; The creation date of scope map. + CreationDate *time.Time + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// TokenUpdateParameters - The parameters for updating a token. +type TokenUpdateParameters struct { + // The properties of the token update parameters. + Properties *TokenUpdateProperties +} + +// TokenUpdateProperties - The parameters for updating token properties. +type TokenUpdateProperties struct { + // The credentials that can be used for authenticating the token. + Credentials *TokenCredentialsProperties + + // The resource ID of the scope map to which the token will be associated with. + ScopeMapID *string + + // The status of the token example enabled or disabled. + Status *TokenStatus +} + +// TriggerProperties - The properties of a trigger. +type TriggerProperties struct { + // The trigger based on base image dependencies. + BaseImageTrigger *BaseImageTrigger + + // The collection of triggers based on source code repository. + SourceTriggers []*SourceTrigger + + // The collection of timer triggers. + TimerTriggers []*TimerTrigger +} + +// TriggerUpdateParameters - The properties for updating triggers. +type TriggerUpdateParameters struct { + // The trigger based on base image dependencies. + BaseImageTrigger *BaseImageTriggerUpdateParameters + + // The collection of triggers based on source code repository. + SourceTriggers []*SourceTriggerUpdateParameters + + // The collection of timer triggers. + TimerTriggers []*TimerTriggerUpdateParameters +} + +// TrustPolicy - The content trust policy for a container registry. +type TrustPolicy struct { + // The value that indicates whether the policy is enabled or not. + Status *PolicyStatus + + // The type of trust policy. + Type *TrustPolicyType +} + +type UserIdentityProperties struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string +} + +// Webhook - An object that represents a webhook for a container registry. +type Webhook struct { + // REQUIRED; The location of the resource. This cannot be changed after the resource is created. + Location *string + + // The properties of the webhook. + Properties *WebhookProperties + + // The tags of the resource. + Tags map[string]*string + + // READ-ONLY; The resource ID. + ID *string + + // READ-ONLY; The name of the resource. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. + Type *string +} + +// WebhookCreateParameters - The parameters for creating a webhook. +type WebhookCreateParameters struct { + // REQUIRED; The location of the webhook. This cannot be changed after the resource is created. + Location *string + + // The properties that the webhook will be created with. + Properties *WebhookPropertiesCreateParameters + + // The tags for the webhook. + Tags map[string]*string +} + +// WebhookListResult - The result of a request to list webhooks for a container registry. +type WebhookListResult struct { + // The URI that can be used to request the next list of webhooks. + NextLink *string + + // The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of + // webhooks. + Value []*Webhook +} + +// WebhookProperties - The properties of a webhook. +type WebhookProperties struct { + // REQUIRED; The list of actions that trigger the webhook to post notifications. + Actions []*WebhookAction + + // The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository + // 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to + // 'foo:latest'. Empty means all events. + Scope *string + + // The status of the webhook at the time the operation was called. + Status *WebhookStatus + + // READ-ONLY; The provisioning state of the webhook at the time the operation was called. + ProvisioningState *ProvisioningState +} + +// WebhookPropertiesCreateParameters - The parameters for creating the properties of a webhook. +type WebhookPropertiesCreateParameters struct { + // REQUIRED; The list of actions that trigger the webhook to post notifications. + Actions []*WebhookAction + + // REQUIRED; The service URI for the webhook to post notifications. + ServiceURI *string + + // Custom headers that will be added to the webhook notifications. + CustomHeaders map[string]*string + + // The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository + // 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to + // 'foo:latest'. Empty means all events. + Scope *string + + // The status of the webhook at the time the operation was called. + Status *WebhookStatus +} + +// WebhookPropertiesUpdateParameters - The parameters for updating the properties of a webhook. +type WebhookPropertiesUpdateParameters struct { + // The list of actions that trigger the webhook to post notifications. + Actions []*WebhookAction + + // Custom headers that will be added to the webhook notifications. + CustomHeaders map[string]*string + + // The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository + // 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to + // 'foo:latest'. Empty means all events. + Scope *string + + // The service URI for the webhook to post notifications. + ServiceURI *string + + // The status of the webhook at the time the operation was called. + Status *WebhookStatus +} + +// WebhookUpdateParameters - The parameters for updating a webhook. +type WebhookUpdateParameters struct { + // The properties that the webhook will be updated with. + Properties *WebhookPropertiesUpdateParameters + + // The tags for the webhook. + Tags map[string]*string +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go new file mode 100644 index 000000000..19e9b7a57 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go @@ -0,0 +1,6147 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Actor. +func (a Actor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Actor. +func (a *Actor) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgentPool. +func (a AgentPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPool. +func (a *AgentPool) UnmarshalJSON(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 "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + 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 AgentPoolListResult. +func (a AgentPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolListResult. +func (a *AgentPoolListResult) UnmarshalJSON(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 AgentPoolProperties. +func (a AgentPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", a.Count) + populate(objectMap, "os", a.OS) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "tier", a.Tier) + populate(objectMap, "virtualNetworkSubnetResourceId", a.VirtualNetworkSubnetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProperties. +func (a *AgentPoolProperties) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &a.Count) + delete(rawMsg, key) + case "os": + err = unpopulate(val, "OS", &a.OS) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &a.Tier) + delete(rawMsg, key) + case "virtualNetworkSubnetResourceId": + err = unpopulate(val, "VirtualNetworkSubnetResourceID", &a.VirtualNetworkSubnetResourceID) + 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 AgentPoolPropertiesUpdateParameters. +func (a AgentPoolPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", a.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolPropertiesUpdateParameters. +func (a *AgentPoolPropertiesUpdateParameters) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &a.Count) + 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 AgentPoolQueueStatus. +func (a AgentPoolQueueStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", a.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolQueueStatus. +func (a *AgentPoolQueueStatus) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &a.Count) + 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 AgentPoolUpdateParameters. +func (a AgentPoolUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolUpdateParameters. +func (a *AgentPoolUpdateParameters) UnmarshalJSON(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 "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 AgentProperties. +func (a AgentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cpu", a.CPU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentProperties. +func (a *AgentProperties) UnmarshalJSON(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 "cpu": + err = unpopulate(val, "CPU", &a.CPU) + 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 Argument. +func (a Argument) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isSecret", a.IsSecret) + populate(objectMap, "name", a.Name) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Argument. +func (a *Argument) UnmarshalJSON(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 "isSecret": + err = unpopulate(val, "IsSecret", &a.IsSecret) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + 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 AuthCredential. +func (a AuthCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "credentialHealth", a.CredentialHealth) + populate(objectMap, "name", a.Name) + populate(objectMap, "passwordSecretIdentifier", a.PasswordSecretIdentifier) + populate(objectMap, "usernameSecretIdentifier", a.UsernameSecretIdentifier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthCredential. +func (a *AuthCredential) UnmarshalJSON(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 "credentialHealth": + err = unpopulate(val, "CredentialHealth", &a.CredentialHealth) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "passwordSecretIdentifier": + err = unpopulate(val, "PasswordSecretIdentifier", &a.PasswordSecretIdentifier) + delete(rawMsg, key) + case "usernameSecretIdentifier": + err = unpopulate(val, "UsernameSecretIdentifier", &a.UsernameSecretIdentifier) + 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 AuthInfo. +func (a AuthInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "expiresIn", a.ExpiresIn) + populate(objectMap, "refreshToken", a.RefreshToken) + populate(objectMap, "scope", a.Scope) + populate(objectMap, "token", a.Token) + populate(objectMap, "tokenType", a.TokenType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthInfo. +func (a *AuthInfo) UnmarshalJSON(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 "expiresIn": + err = unpopulate(val, "ExpiresIn", &a.ExpiresIn) + delete(rawMsg, key) + case "refreshToken": + err = unpopulate(val, "RefreshToken", &a.RefreshToken) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + delete(rawMsg, key) + case "token": + err = unpopulate(val, "Token", &a.Token) + delete(rawMsg, key) + case "tokenType": + err = unpopulate(val, "TokenType", &a.TokenType) + 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 AuthInfoUpdateParameters. +func (a AuthInfoUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "expiresIn", a.ExpiresIn) + populate(objectMap, "refreshToken", a.RefreshToken) + populate(objectMap, "scope", a.Scope) + populate(objectMap, "token", a.Token) + populate(objectMap, "tokenType", a.TokenType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthInfoUpdateParameters. +func (a *AuthInfoUpdateParameters) UnmarshalJSON(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 "expiresIn": + err = unpopulate(val, "ExpiresIn", &a.ExpiresIn) + delete(rawMsg, key) + case "refreshToken": + err = unpopulate(val, "RefreshToken", &a.RefreshToken) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + delete(rawMsg, key) + case "token": + err = unpopulate(val, "Token", &a.Token) + delete(rawMsg, key) + case "tokenType": + err = unpopulate(val, "TokenType", &a.TokenType) + 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 BaseImageDependency. +func (b BaseImageDependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "digest", b.Digest) + populate(objectMap, "registry", b.Registry) + populate(objectMap, "repository", b.Repository) + populate(objectMap, "tag", b.Tag) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseImageDependency. +func (b *BaseImageDependency) UnmarshalJSON(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 "digest": + err = unpopulate(val, "Digest", &b.Digest) + delete(rawMsg, key) + case "registry": + err = unpopulate(val, "Registry", &b.Registry) + delete(rawMsg, key) + case "repository": + err = unpopulate(val, "Repository", &b.Repository) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &b.Tag) + 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 BaseImageTrigger. +func (b BaseImageTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseImageTriggerType", b.BaseImageTriggerType) + populate(objectMap, "name", b.Name) + populate(objectMap, "status", b.Status) + populate(objectMap, "updateTriggerEndpoint", b.UpdateTriggerEndpoint) + populate(objectMap, "updateTriggerPayloadType", b.UpdateTriggerPayloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseImageTrigger. +func (b *BaseImageTrigger) UnmarshalJSON(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 "baseImageTriggerType": + err = unpopulate(val, "BaseImageTriggerType", &b.BaseImageTriggerType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + case "updateTriggerEndpoint": + err = unpopulate(val, "UpdateTriggerEndpoint", &b.UpdateTriggerEndpoint) + delete(rawMsg, key) + case "updateTriggerPayloadType": + err = unpopulate(val, "UpdateTriggerPayloadType", &b.UpdateTriggerPayloadType) + 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 BaseImageTriggerUpdateParameters. +func (b BaseImageTriggerUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseImageTriggerType", b.BaseImageTriggerType) + populate(objectMap, "name", b.Name) + populate(objectMap, "status", b.Status) + populate(objectMap, "updateTriggerEndpoint", b.UpdateTriggerEndpoint) + populate(objectMap, "updateTriggerPayloadType", b.UpdateTriggerPayloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseImageTriggerUpdateParameters. +func (b *BaseImageTriggerUpdateParameters) UnmarshalJSON(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 "baseImageTriggerType": + err = unpopulate(val, "BaseImageTriggerType", &b.BaseImageTriggerType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + case "updateTriggerEndpoint": + err = unpopulate(val, "UpdateTriggerEndpoint", &b.UpdateTriggerEndpoint) + delete(rawMsg, key) + case "updateTriggerPayloadType": + err = unpopulate(val, "UpdateTriggerPayloadType", &b.UpdateTriggerPayloadType) + 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 CacheRule. +func (c CacheRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 CacheRule. +func (c *CacheRule) UnmarshalJSON(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 "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 CacheRuleProperties. +func (c CacheRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "creationDate", c.CreationDate) + populate(objectMap, "credentialSetResourceId", c.CredentialSetResourceID) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sourceRepository", c.SourceRepository) + populate(objectMap, "targetRepository", c.TargetRepository) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleProperties. +func (c *CacheRuleProperties) UnmarshalJSON(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 "creationDate": + err = unpopulateDateTimeRFC3339(val, "CreationDate", &c.CreationDate) + delete(rawMsg, key) + case "credentialSetResourceId": + err = unpopulate(val, "CredentialSetResourceID", &c.CredentialSetResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "sourceRepository": + err = unpopulate(val, "SourceRepository", &c.SourceRepository) + delete(rawMsg, key) + case "targetRepository": + err = unpopulate(val, "TargetRepository", &c.TargetRepository) + 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 CacheRuleUpdateParameters. +func (c CacheRuleUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleUpdateParameters. +func (c *CacheRuleUpdateParameters) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheRuleUpdateProperties. +func (c CacheRuleUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "credentialSetResourceId", c.CredentialSetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleUpdateProperties. +func (c *CacheRuleUpdateProperties) UnmarshalJSON(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 "credentialSetResourceId": + err = unpopulate(val, "CredentialSetResourceID", &c.CredentialSetResourceID) + 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 CacheRulesListResult. +func (c CacheRulesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRulesListResult. +func (c *CacheRulesListResult) UnmarshalJSON(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 CallbackConfig. +func (c CallbackConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customHeaders", c.CustomHeaders) + populate(objectMap, "serviceUri", c.ServiceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CallbackConfig. +func (c *CallbackConfig) UnmarshalJSON(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 "customHeaders": + err = unpopulate(val, "CustomHeaders", &c.CustomHeaders) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &c.ServiceURI) + 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 CredentialHealth. +func (c CredentialHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", c.ErrorCode) + populate(objectMap, "errorMessage", c.ErrorMessage) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialHealth. +func (c *CredentialHealth) UnmarshalJSON(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) + case "status": + err = unpopulate(val, "Status", &c.Status) + 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 CredentialSet. +func (c CredentialSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + 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 CredentialSet. +func (c *CredentialSet) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &c.Identity) + 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 CredentialSetListResult. +func (c CredentialSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetListResult. +func (c *CredentialSetListResult) UnmarshalJSON(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 CredentialSetProperties. +func (c CredentialSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authCredentials", c.AuthCredentials) + populateDateTimeRFC3339(objectMap, "creationDate", c.CreationDate) + populate(objectMap, "loginServer", c.LoginServer) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetProperties. +func (c *CredentialSetProperties) UnmarshalJSON(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 "authCredentials": + err = unpopulate(val, "AuthCredentials", &c.AuthCredentials) + delete(rawMsg, key) + case "creationDate": + err = unpopulateDateTimeRFC3339(val, "CreationDate", &c.CreationDate) + delete(rawMsg, key) + case "loginServer": + err = unpopulate(val, "LoginServer", &c.LoginServer) + 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 CredentialSetUpdateParameters. +func (c CredentialSetUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetUpdateParameters. +func (c *CredentialSetUpdateParameters) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &c.Identity) + 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 CredentialSetUpdateProperties. +func (c CredentialSetUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authCredentials", c.AuthCredentials) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetUpdateProperties. +func (c *CredentialSetUpdateProperties) UnmarshalJSON(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 "authCredentials": + err = unpopulate(val, "AuthCredentials", &c.AuthCredentials) + 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 Credentials. +func (c Credentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customRegistries", c.CustomRegistries) + populate(objectMap, "sourceRegistry", c.SourceRegistry) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Credentials. +func (c *Credentials) UnmarshalJSON(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 "customRegistries": + err = unpopulate(val, "CustomRegistries", &c.CustomRegistries) + delete(rawMsg, key) + case "sourceRegistry": + err = unpopulate(val, "SourceRegistry", &c.SourceRegistry) + 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 CustomRegistryCredentials. +func (c CustomRegistryCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "password", c.Password) + populate(objectMap, "userName", c.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomRegistryCredentials. +func (c *CustomRegistryCredentials) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &c.UserName) + 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 DockerBuildRequest. +func (d DockerBuildRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentConfiguration", d.AgentConfiguration) + populate(objectMap, "agentPoolName", d.AgentPoolName) + populate(objectMap, "arguments", d.Arguments) + populate(objectMap, "credentials", d.Credentials) + populate(objectMap, "dockerFilePath", d.DockerFilePath) + populate(objectMap, "imageNames", d.ImageNames) + populate(objectMap, "isArchiveEnabled", d.IsArchiveEnabled) + populate(objectMap, "isPushEnabled", d.IsPushEnabled) + populate(objectMap, "logTemplate", d.LogTemplate) + populate(objectMap, "noCache", d.NoCache) + populate(objectMap, "platform", d.Platform) + populate(objectMap, "sourceLocation", d.SourceLocation) + populate(objectMap, "target", d.Target) + populate(objectMap, "timeout", d.Timeout) + objectMap["type"] = "DockerBuildRequest" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildRequest. +func (d *DockerBuildRequest) UnmarshalJSON(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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &d.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &d.AgentPoolName) + delete(rawMsg, key) + case "arguments": + err = unpopulate(val, "Arguments", &d.Arguments) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &d.Credentials) + delete(rawMsg, key) + case "dockerFilePath": + err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) + delete(rawMsg, key) + case "imageNames": + err = unpopulate(val, "ImageNames", &d.ImageNames) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &d.IsArchiveEnabled) + delete(rawMsg, key) + case "isPushEnabled": + err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &d.LogTemplate) + delete(rawMsg, key) + case "noCache": + err = unpopulate(val, "NoCache", &d.NoCache) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &d.Platform) + delete(rawMsg, key) + case "sourceLocation": + err = unpopulate(val, "SourceLocation", &d.SourceLocation) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &d.Timeout) + 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 DockerBuildStep. +func (d DockerBuildStep) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arguments", d.Arguments) + populate(objectMap, "baseImageDependencies", d.BaseImageDependencies) + populate(objectMap, "contextAccessToken", d.ContextAccessToken) + populate(objectMap, "contextPath", d.ContextPath) + populate(objectMap, "dockerFilePath", d.DockerFilePath) + populate(objectMap, "imageNames", d.ImageNames) + populate(objectMap, "isPushEnabled", d.IsPushEnabled) + populate(objectMap, "noCache", d.NoCache) + populate(objectMap, "target", d.Target) + objectMap["type"] = StepTypeDocker + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildStep. +func (d *DockerBuildStep) UnmarshalJSON(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 "arguments": + err = unpopulate(val, "Arguments", &d.Arguments) + delete(rawMsg, key) + case "baseImageDependencies": + err = unpopulate(val, "BaseImageDependencies", &d.BaseImageDependencies) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &d.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &d.ContextPath) + delete(rawMsg, key) + case "dockerFilePath": + err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) + delete(rawMsg, key) + case "imageNames": + err = unpopulate(val, "ImageNames", &d.ImageNames) + delete(rawMsg, key) + case "isPushEnabled": + err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) + delete(rawMsg, key) + case "noCache": + err = unpopulate(val, "NoCache", &d.NoCache) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + 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 DockerBuildStepUpdateParameters. +func (d DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arguments", d.Arguments) + populate(objectMap, "contextAccessToken", d.ContextAccessToken) + populate(objectMap, "contextPath", d.ContextPath) + populate(objectMap, "dockerFilePath", d.DockerFilePath) + populate(objectMap, "imageNames", d.ImageNames) + populate(objectMap, "isPushEnabled", d.IsPushEnabled) + populate(objectMap, "noCache", d.NoCache) + populate(objectMap, "target", d.Target) + objectMap["type"] = StepTypeDocker + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildStepUpdateParameters. +func (d *DockerBuildStepUpdateParameters) UnmarshalJSON(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 "arguments": + err = unpopulate(val, "Arguments", &d.Arguments) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &d.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &d.ContextPath) + delete(rawMsg, key) + case "dockerFilePath": + err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) + delete(rawMsg, key) + case "imageNames": + err = unpopulate(val, "ImageNames", &d.ImageNames) + delete(rawMsg, key) + case "isPushEnabled": + err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) + delete(rawMsg, key) + case "noCache": + err = unpopulate(val, "NoCache", &d.NoCache) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + 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 EncodedTaskRunRequest. +func (e EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentConfiguration", e.AgentConfiguration) + populate(objectMap, "agentPoolName", e.AgentPoolName) + populate(objectMap, "credentials", e.Credentials) + populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) + populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) + populate(objectMap, "isArchiveEnabled", e.IsArchiveEnabled) + populate(objectMap, "logTemplate", e.LogTemplate) + populate(objectMap, "platform", e.Platform) + populate(objectMap, "sourceLocation", e.SourceLocation) + populate(objectMap, "timeout", e.Timeout) + objectMap["type"] = "EncodedTaskRunRequest" + populate(objectMap, "values", e.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskRunRequest. +func (e *EncodedTaskRunRequest) UnmarshalJSON(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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &e.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &e.AgentPoolName) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &e.Credentials) + delete(rawMsg, key) + case "encodedTaskContent": + err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) + delete(rawMsg, key) + case "encodedValuesContent": + err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &e.IsArchiveEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &e.LogTemplate) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &e.Platform) + delete(rawMsg, key) + case "sourceLocation": + err = unpopulate(val, "SourceLocation", &e.SourceLocation) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &e.Timeout) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &e.Values) + 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 EncodedTaskStep. +func (e EncodedTaskStep) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseImageDependencies", e.BaseImageDependencies) + populate(objectMap, "contextAccessToken", e.ContextAccessToken) + populate(objectMap, "contextPath", e.ContextPath) + populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) + populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) + objectMap["type"] = StepTypeEncodedTask + populate(objectMap, "values", e.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskStep. +func (e *EncodedTaskStep) UnmarshalJSON(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 "baseImageDependencies": + err = unpopulate(val, "BaseImageDependencies", &e.BaseImageDependencies) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &e.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &e.ContextPath) + delete(rawMsg, key) + case "encodedTaskContent": + err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) + delete(rawMsg, key) + case "encodedValuesContent": + err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &e.Values) + 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 EncodedTaskStepUpdateParameters. +func (e EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contextAccessToken", e.ContextAccessToken) + populate(objectMap, "contextPath", e.ContextPath) + populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) + populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) + objectMap["type"] = StepTypeEncodedTask + populate(objectMap, "values", e.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskStepUpdateParameters. +func (e *EncodedTaskStepUpdateParameters) UnmarshalJSON(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 "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &e.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &e.ContextPath) + delete(rawMsg, key) + case "encodedTaskContent": + err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) + delete(rawMsg, key) + case "encodedValuesContent": + err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &e.Values) + 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 EncryptionProperty. +func (e EncryptionProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperty. +func (e *EncryptionProperty) UnmarshalJSON(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 "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + 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 Event. +func (e Event) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventRequestMessage", e.EventRequestMessage) + populate(objectMap, "eventResponseMessage", e.EventResponseMessage) + populate(objectMap, "id", e.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Event. +func (e *Event) UnmarshalJSON(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 "eventRequestMessage": + err = unpopulate(val, "EventRequestMessage", &e.EventRequestMessage) + delete(rawMsg, key) + case "eventResponseMessage": + err = unpopulate(val, "EventResponseMessage", &e.EventResponseMessage) + delete(rawMsg, 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 EventContent. +func (e EventContent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", e.Action) + populate(objectMap, "actor", e.Actor) + populate(objectMap, "id", e.ID) + populate(objectMap, "request", e.Request) + populate(objectMap, "source", e.Source) + populate(objectMap, "target", e.Target) + populateDateTimeRFC3339(objectMap, "timestamp", e.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventContent. +func (e *EventContent) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &e.Action) + delete(rawMsg, key) + case "actor": + err = unpopulate(val, "Actor", &e.Actor) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "request": + err = unpopulate(val, "Request", &e.Request) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &e.Source) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &e.Timestamp) + 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 EventInfo. +func (e EventInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventInfo. +func (e *EventInfo) UnmarshalJSON(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 EventListResult. +func (e EventListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventListResult. +func (e *EventListResult) UnmarshalJSON(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 EventRequestMessage. +func (e EventRequestMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "content", e.Content) + populate(objectMap, "headers", e.Headers) + populate(objectMap, "method", e.Method) + populate(objectMap, "requestUri", e.RequestURI) + populate(objectMap, "version", e.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventRequestMessage. +func (e *EventRequestMessage) UnmarshalJSON(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 "content": + err = unpopulate(val, "Content", &e.Content) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &e.Headers) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &e.Method) + delete(rawMsg, key) + case "requestUri": + err = unpopulate(val, "RequestURI", &e.RequestURI) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &e.Version) + 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 EventResponseMessage. +func (e EventResponseMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "content", e.Content) + populate(objectMap, "headers", e.Headers) + populate(objectMap, "reasonPhrase", e.ReasonPhrase) + populate(objectMap, "statusCode", e.StatusCode) + populate(objectMap, "version", e.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventResponseMessage. +func (e *EventResponseMessage) UnmarshalJSON(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 "content": + err = unpopulate(val, "Content", &e.Content) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &e.Headers) + delete(rawMsg, key) + case "reasonPhrase": + err = unpopulate(val, "ReasonPhrase", &e.ReasonPhrase) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &e.StatusCode) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &e.Version) + 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 ExportPolicy. +func (e ExportPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPolicy. +func (e *ExportPolicy) UnmarshalJSON(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 "status": + err = unpopulate(val, "Status", &e.Status) + 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 FileTaskRunRequest. +func (f FileTaskRunRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentConfiguration", f.AgentConfiguration) + populate(objectMap, "agentPoolName", f.AgentPoolName) + populate(objectMap, "credentials", f.Credentials) + populate(objectMap, "isArchiveEnabled", f.IsArchiveEnabled) + populate(objectMap, "logTemplate", f.LogTemplate) + populate(objectMap, "platform", f.Platform) + populate(objectMap, "sourceLocation", f.SourceLocation) + populate(objectMap, "taskFilePath", f.TaskFilePath) + populate(objectMap, "timeout", f.Timeout) + objectMap["type"] = "FileTaskRunRequest" + populate(objectMap, "values", f.Values) + populate(objectMap, "valuesFilePath", f.ValuesFilePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskRunRequest. +func (f *FileTaskRunRequest) UnmarshalJSON(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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &f.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &f.AgentPoolName) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &f.Credentials) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &f.IsArchiveEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &f.LogTemplate) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &f.Platform) + delete(rawMsg, key) + case "sourceLocation": + err = unpopulate(val, "SourceLocation", &f.SourceLocation) + delete(rawMsg, key) + case "taskFilePath": + err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &f.Timeout) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &f.Values) + delete(rawMsg, key) + case "valuesFilePath": + err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) + 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 FileTaskStep. +func (f FileTaskStep) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseImageDependencies", f.BaseImageDependencies) + populate(objectMap, "contextAccessToken", f.ContextAccessToken) + populate(objectMap, "contextPath", f.ContextPath) + populate(objectMap, "taskFilePath", f.TaskFilePath) + objectMap["type"] = StepTypeFileTask + populate(objectMap, "values", f.Values) + populate(objectMap, "valuesFilePath", f.ValuesFilePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskStep. +func (f *FileTaskStep) UnmarshalJSON(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 "baseImageDependencies": + err = unpopulate(val, "BaseImageDependencies", &f.BaseImageDependencies) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &f.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &f.ContextPath) + delete(rawMsg, key) + case "taskFilePath": + err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &f.Values) + delete(rawMsg, key) + case "valuesFilePath": + err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) + 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 FileTaskStepUpdateParameters. +func (f FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contextAccessToken", f.ContextAccessToken) + populate(objectMap, "contextPath", f.ContextPath) + populate(objectMap, "taskFilePath", f.TaskFilePath) + objectMap["type"] = StepTypeFileTask + populate(objectMap, "values", f.Values) + populate(objectMap, "valuesFilePath", f.ValuesFilePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskStepUpdateParameters. +func (f *FileTaskStepUpdateParameters) UnmarshalJSON(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 "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &f.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &f.ContextPath) + delete(rawMsg, key) + case "taskFilePath": + err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &f.Values) + delete(rawMsg, key) + case "valuesFilePath": + err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) + 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 GenerateCredentialsParameters. +func (g GenerateCredentialsParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "expiry", g.Expiry) + populate(objectMap, "name", g.Name) + populate(objectMap, "tokenId", g.TokenID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCredentialsParameters. +func (g *GenerateCredentialsParameters) UnmarshalJSON(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 "expiry": + err = unpopulateDateTimeRFC3339(val, "Expiry", &g.Expiry) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "tokenId": + err = unpopulate(val, "TokenID", &g.TokenID) + 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 GenerateCredentialsResult. +func (g GenerateCredentialsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "passwords", g.Passwords) + populate(objectMap, "username", g.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCredentialsResult. +func (g *GenerateCredentialsResult) UnmarshalJSON(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 "passwords": + err = unpopulate(val, "Passwords", &g.Passwords) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &g.Username) + 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 IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", i.Action) + populate(objectMap, "value", i.IPAddressOrRange) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "IPAddressOrRange", &i.IPAddressOrRange) + 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 IdentityProperties. +func (i IdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProperties. +func (i *IdentityProperties) UnmarshalJSON(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 "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + 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 ImageDescriptor. +func (i ImageDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "digest", i.Digest) + populate(objectMap, "registry", i.Registry) + populate(objectMap, "repository", i.Repository) + populate(objectMap, "tag", i.Tag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDescriptor. +func (i *ImageDescriptor) UnmarshalJSON(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 "digest": + err = unpopulate(val, "Digest", &i.Digest) + delete(rawMsg, key) + case "registry": + err = unpopulate(val, "Registry", &i.Registry) + delete(rawMsg, key) + case "repository": + err = unpopulate(val, "Repository", &i.Repository) + 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 ImageUpdateTrigger. +func (i ImageUpdateTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "images", i.Images) + populateDateTimeRFC3339(objectMap, "timestamp", i.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageUpdateTrigger. +func (i *ImageUpdateTrigger) UnmarshalJSON(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 "images": + err = unpopulate(val, "Images", &i.Images) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &i.Timestamp) + 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 ImportImageParameters. +func (i ImportImageParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mode", i.Mode) + populate(objectMap, "source", i.Source) + populate(objectMap, "targetTags", i.TargetTags) + populate(objectMap, "untaggedTargetRepositories", i.UntaggedTargetRepositories) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportImageParameters. +func (i *ImportImageParameters) UnmarshalJSON(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 "mode": + err = unpopulate(val, "Mode", &i.Mode) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &i.Source) + delete(rawMsg, key) + case "targetTags": + err = unpopulate(val, "TargetTags", &i.TargetTags) + delete(rawMsg, key) + case "untaggedTargetRepositories": + err = unpopulate(val, "UntaggedTargetRepositories", &i.UntaggedTargetRepositories) + 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 ImportSource. +func (i ImportSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "credentials", i.Credentials) + populate(objectMap, "registryUri", i.RegistryURI) + populate(objectMap, "resourceId", i.ResourceID) + populate(objectMap, "sourceImage", i.SourceImage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSource. +func (i *ImportSource) UnmarshalJSON(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 "credentials": + err = unpopulate(val, "Credentials", &i.Credentials) + delete(rawMsg, key) + case "registryUri": + err = unpopulate(val, "RegistryURI", &i.RegistryURI) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &i.ResourceID) + delete(rawMsg, key) + case "sourceImage": + err = unpopulate(val, "SourceImage", &i.SourceImage) + 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 ImportSourceCredentials. +func (i ImportSourceCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "password", i.Password) + populate(objectMap, "username", i.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSourceCredentials. +func (i *ImportSourceCredentials) UnmarshalJSON(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 "password": + err = unpopulate(val, "Password", &i.Password) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &i.Username) + 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 KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", k.Identity) + populate(objectMap, "keyIdentifier", k.KeyIdentifier) + populate(objectMap, "keyRotationEnabled", k.KeyRotationEnabled) + populateDateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp) + populate(objectMap, "versionedKeyIdentifier", k.VersionedKeyIdentifier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &k.Identity) + delete(rawMsg, key) + case "keyIdentifier": + err = unpopulate(val, "KeyIdentifier", &k.KeyIdentifier) + delete(rawMsg, key) + case "keyRotationEnabled": + err = unpopulate(val, "KeyRotationEnabled", &k.KeyRotationEnabled) + delete(rawMsg, key) + case "lastKeyRotationTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastKeyRotationTimestamp", &k.LastKeyRotationTimestamp) + delete(rawMsg, key) + case "versionedKeyIdentifier": + err = unpopulate(val, "VersionedKeyIdentifier", &k.VersionedKeyIdentifier) + 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 NetworkRuleSet. +func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. +func (n *NetworkRuleSet) UnmarshalJSON(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 "defaultAction": + err = unpopulate(val, "DefaultAction", &n.DefaultAction) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + 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 OperationDefinition. +func (o OperationDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + 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 OperationDefinition. +func (o *OperationDefinition) UnmarshalJSON(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 "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + 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 OperationDisplayDefinition. +func (o OperationDisplayDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 OperationDisplayDefinition. +func (o *OperationDisplayDefinition) UnmarshalJSON(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]any) + 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 OperationLogSpecificationDefinition. +func (o OperationLogSpecificationDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobDuration", o.BlobDuration) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationLogSpecificationDefinition. +func (o *OperationLogSpecificationDefinition) UnmarshalJSON(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 "blobDuration": + err = unpopulate(val, "BlobDuration", &o.BlobDuration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + 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 OperationMetricSpecificationDefinition. +func (o OperationMetricSpecificationDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregationType", o.AggregationType) + populate(objectMap, "displayDescription", o.DisplayDescription) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "internalMetricName", o.InternalMetricName) + populate(objectMap, "name", o.Name) + populate(objectMap, "unit", o.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationMetricSpecificationDefinition. +func (o *OperationMetricSpecificationDefinition) UnmarshalJSON(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 "aggregationType": + err = unpopulate(val, "AggregationType", &o.AggregationType) + delete(rawMsg, key) + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &o.DisplayDescription) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) + delete(rawMsg, key) + case "internalMetricName": + err = unpopulate(val, "InternalMetricName", &o.InternalMetricName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &o.Unit) + 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 OperationPropertiesDefinition. +func (o OperationPropertiesDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serviceSpecification", o.ServiceSpecification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationPropertiesDefinition. +func (o *OperationPropertiesDefinition) UnmarshalJSON(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 OperationServiceSpecificationDefinition. +func (o OperationServiceSpecificationDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logSpecifications", o.LogSpecifications) + populate(objectMap, "metricSpecifications", o.MetricSpecifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationServiceSpecificationDefinition. +func (o *OperationServiceSpecificationDefinition) UnmarshalJSON(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 OverrideTaskStepProperties. +func (o OverrideTaskStepProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arguments", o.Arguments) + populate(objectMap, "contextPath", o.ContextPath) + populate(objectMap, "file", o.File) + populate(objectMap, "target", o.Target) + populate(objectMap, "updateTriggerToken", o.UpdateTriggerToken) + populate(objectMap, "values", o.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OverrideTaskStepProperties. +func (o *OverrideTaskStepProperties) UnmarshalJSON(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 "arguments": + err = unpopulate(val, "Arguments", &o.Arguments) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &o.ContextPath) + delete(rawMsg, key) + case "file": + err = unpopulate(val, "File", &o.File) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &o.Target) + delete(rawMsg, key) + case "updateTriggerToken": + err = unpopulate(val, "UpdateTriggerToken", &o.UpdateTriggerToken) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &o.Values) + 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 PlatformProperties. +func (p PlatformProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "architecture", p.Architecture) + populate(objectMap, "os", p.OS) + populate(objectMap, "variant", p.Variant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlatformProperties. +func (p *PlatformProperties) UnmarshalJSON(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 "architecture": + err = unpopulate(val, "Architecture", &p.Architecture) + delete(rawMsg, key) + case "os": + err = unpopulate(val, "OS", &p.OS) + delete(rawMsg, key) + case "variant": + err = unpopulate(val, "Variant", &p.Variant) + 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 PlatformUpdateParameters. +func (p PlatformUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "architecture", p.Architecture) + populate(objectMap, "os", p.OS) + populate(objectMap, "variant", p.Variant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlatformUpdateParameters. +func (p *PlatformUpdateParameters) UnmarshalJSON(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 "architecture": + err = unpopulate(val, "Architecture", &p.Architecture) + delete(rawMsg, key) + case "os": + err = unpopulate(val, "OS", &p.OS) + delete(rawMsg, key) + case "variant": + err = unpopulate(val, "Variant", &p.Variant) + 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 Policies. +func (p Policies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exportPolicy", p.ExportPolicy) + populate(objectMap, "quarantinePolicy", p.QuarantinePolicy) + populate(objectMap, "retentionPolicy", p.RetentionPolicy) + populate(objectMap, "trustPolicy", p.TrustPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Policies. +func (p *Policies) UnmarshalJSON(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 "exportPolicy": + err = unpopulate(val, "ExportPolicy", &p.ExportPolicy) + delete(rawMsg, key) + case "quarantinePolicy": + err = unpopulate(val, "QuarantinePolicy", &p.QuarantinePolicy) + delete(rawMsg, key) + case "retentionPolicy": + err = unpopulate(val, "RetentionPolicy", &p.RetentionPolicy) + delete(rawMsg, key) + case "trustPolicy": + err = unpopulate(val, "TrustPolicy", &p.TrustPolicy) + 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]any) + 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]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + 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 "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "nextLink", p.NextLink) + 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 "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 PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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 QuarantinePolicy. +func (q QuarantinePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "status", q.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuarantinePolicy. +func (q *QuarantinePolicy) UnmarshalJSON(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 "status": + err = unpopulate(val, "Status", &q.Status) + 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 RegenerateCredentialParameters. +func (r RegenerateCredentialParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegenerateCredentialParameters. +func (r *RegenerateCredentialParameters) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Registry. +func (r Registry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Registry. +func (r *Registry) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &r.Identity) + 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 "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + 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 RegistryListCredentialsResult. +func (r RegistryListCredentialsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "passwords", r.Passwords) + populate(objectMap, "username", r.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryListCredentialsResult. +func (r *RegistryListCredentialsResult) UnmarshalJSON(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 "passwords": + err = unpopulate(val, "Passwords", &r.Passwords) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &r.Username) + 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 RegistryListResult. +func (r RegistryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryListResult. +func (r *RegistryListResult) UnmarshalJSON(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 RegistryNameCheckRequest. +func (r RegistryNameCheckRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + objectMap["type"] = "Microsoft.ContainerRegistry/registries" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryNameCheckRequest. +func (r *RegistryNameCheckRequest) UnmarshalJSON(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 "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 RegistryNameStatus. +func (r RegistryNameStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", r.Message) + populate(objectMap, "nameAvailable", r.NameAvailable) + populate(objectMap, "reason", r.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryNameStatus. +func (r *RegistryNameStatus) UnmarshalJSON(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 "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &r.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &r.Reason) + 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 RegistryPassword. +func (r RegistryPassword) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryPassword. +func (r *RegistryPassword) UnmarshalJSON(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 RegistryProperties. +func (r RegistryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) + populateDateTimeRFC3339(objectMap, "creationDate", r.CreationDate) + populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) + populate(objectMap, "dataEndpointHostNames", r.DataEndpointHostNames) + populate(objectMap, "encryption", r.Encryption) + populate(objectMap, "loginServer", r.LoginServer) + populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) + populate(objectMap, "networkRuleSet", r.NetworkRuleSet) + populate(objectMap, "policies", r.Policies) + populate(objectMap, "privateEndpointConnections", r.PrivateEndpointConnections) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "publicNetworkAccess", r.PublicNetworkAccess) + populate(objectMap, "status", r.Status) + populate(objectMap, "zoneRedundancy", r.ZoneRedundancy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryProperties. +func (r *RegistryProperties) UnmarshalJSON(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 "adminUserEnabled": + err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) + delete(rawMsg, key) + case "creationDate": + err = unpopulateDateTimeRFC3339(val, "CreationDate", &r.CreationDate) + delete(rawMsg, key) + case "dataEndpointEnabled": + err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) + delete(rawMsg, key) + case "dataEndpointHostNames": + err = unpopulate(val, "DataEndpointHostNames", &r.DataEndpointHostNames) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &r.Encryption) + delete(rawMsg, key) + case "loginServer": + err = unpopulate(val, "LoginServer", &r.LoginServer) + delete(rawMsg, key) + case "networkRuleBypassOptions": + err = unpopulate(val, "NetworkRuleBypassOptions", &r.NetworkRuleBypassOptions) + delete(rawMsg, key) + case "networkRuleSet": + err = unpopulate(val, "NetworkRuleSet", &r.NetworkRuleSet) + delete(rawMsg, key) + case "policies": + err = unpopulate(val, "Policies", &r.Policies) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &r.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &r.PublicNetworkAccess) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "zoneRedundancy": + err = unpopulate(val, "ZoneRedundancy", &r.ZoneRedundancy) + 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 RegistryPropertiesUpdateParameters. +func (r RegistryPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) + populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) + populate(objectMap, "encryption", r.Encryption) + populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) + populate(objectMap, "networkRuleSet", r.NetworkRuleSet) + populate(objectMap, "policies", r.Policies) + populate(objectMap, "publicNetworkAccess", r.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryPropertiesUpdateParameters. +func (r *RegistryPropertiesUpdateParameters) UnmarshalJSON(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 "adminUserEnabled": + err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) + delete(rawMsg, key) + case "dataEndpointEnabled": + err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &r.Encryption) + delete(rawMsg, key) + case "networkRuleBypassOptions": + err = unpopulate(val, "NetworkRuleBypassOptions", &r.NetworkRuleBypassOptions) + delete(rawMsg, key) + case "networkRuleSet": + err = unpopulate(val, "NetworkRuleSet", &r.NetworkRuleSet) + delete(rawMsg, key) + case "policies": + err = unpopulate(val, "Policies", &r.Policies) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &r.PublicNetworkAccess) + 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 RegistryUpdateParameters. +func (r RegistryUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUpdateParameters. +func (r *RegistryUpdateParameters) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &r.Identity) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryUsage. +func (r RegistryUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentValue", r.CurrentValue) + populate(objectMap, "limit", r.Limit) + populate(objectMap, "name", r.Name) + populate(objectMap, "unit", r.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUsage. +func (r *RegistryUsage) UnmarshalJSON(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 "currentValue": + err = unpopulate(val, "CurrentValue", &r.CurrentValue) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &r.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &r.Unit) + 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 RegistryUsageListResult. +func (r RegistryUsageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUsageListResult. +func (r *RegistryUsageListResult) UnmarshalJSON(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 Replication. +func (r Replication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Replication. +func (r *Replication) UnmarshalJSON(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 "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + 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 ReplicationListResult. +func (r ReplicationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationListResult. +func (r *ReplicationListResult) UnmarshalJSON(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 ReplicationProperties. +func (r ReplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) + populate(objectMap, "status", r.Status) + populate(objectMap, "zoneRedundancy", r.ZoneRedundancy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationProperties. +func (r *ReplicationProperties) UnmarshalJSON(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 "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "zoneRedundancy": + err = unpopulate(val, "ZoneRedundancy", &r.ZoneRedundancy) + 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 ReplicationUpdateParameters. +func (r ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationUpdateParameters. +func (r *ReplicationUpdateParameters) UnmarshalJSON(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 ReplicationUpdateParametersProperties. +func (r ReplicationUpdateParametersProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationUpdateParametersProperties. +func (r *ReplicationUpdateParametersProperties) UnmarshalJSON(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 "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) + 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 Request. +func (r Request) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addr", r.Addr) + populate(objectMap, "host", r.Host) + populate(objectMap, "id", r.ID) + populate(objectMap, "method", r.Method) + populate(objectMap, "useragent", r.Useragent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Request. +func (r *Request) UnmarshalJSON(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 "addr": + err = unpopulate(val, "Addr", &r.Addr) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &r.Host) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &r.Method) + delete(rawMsg, key) + case "useragent": + err = unpopulate(val, "Useragent", &r.Useragent) + 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 RetentionPolicy. +func (r RetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "days", r.Days) + populateDateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. +func (r *RetentionPolicy) UnmarshalJSON(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 "lastUpdatedTime": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &r.LastUpdatedTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + 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 Run. +func (r Run) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Run. +func (r *Run) UnmarshalJSON(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 "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + 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 RunFilter. +func (r RunFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentPoolName", r.AgentPoolName) + populateDateTimeRFC3339(objectMap, "createTime", r.CreateTime) + populateDateTimeRFC3339(objectMap, "finishTime", r.FinishTime) + populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) + populate(objectMap, "outputImageManifests", r.OutputImageManifests) + populate(objectMap, "runId", r.RunID) + populate(objectMap, "runType", r.RunType) + populate(objectMap, "status", r.Status) + populate(objectMap, "taskName", r.TaskName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunFilter. +func (r *RunFilter) UnmarshalJSON(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 "agentPoolName": + err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) + delete(rawMsg, key) + case "createTime": + err = unpopulateDateTimeRFC3339(val, "CreateTime", &r.CreateTime) + delete(rawMsg, key) + case "finishTime": + err = unpopulateDateTimeRFC3339(val, "FinishTime", &r.FinishTime) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + delete(rawMsg, key) + case "outputImageManifests": + err = unpopulate(val, "OutputImageManifests", &r.OutputImageManifests) + delete(rawMsg, key) + case "runId": + err = unpopulate(val, "RunID", &r.RunID) + delete(rawMsg, key) + case "runType": + err = unpopulate(val, "RunType", &r.RunType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "taskName": + err = unpopulate(val, "TaskName", &r.TaskName) + 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 RunGetLogResult. +func (r RunGetLogResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logArtifactLink", r.LogArtifactLink) + populate(objectMap, "logLink", r.LogLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunGetLogResult. +func (r *RunGetLogResult) UnmarshalJSON(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 "logArtifactLink": + err = unpopulate(val, "LogArtifactLink", &r.LogArtifactLink) + delete(rawMsg, key) + case "logLink": + err = unpopulate(val, "LogLink", &r.LogLink) + 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 RunListResult. +func (r RunListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunListResult. +func (r *RunListResult) UnmarshalJSON(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 RunProperties. +func (r RunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentConfiguration", r.AgentConfiguration) + populate(objectMap, "agentPoolName", r.AgentPoolName) + populateDateTimeRFC3339(objectMap, "createTime", r.CreateTime) + populate(objectMap, "customRegistries", r.CustomRegistries) + populateDateTimeRFC3339(objectMap, "finishTime", r.FinishTime) + populate(objectMap, "imageUpdateTrigger", r.ImageUpdateTrigger) + populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) + populateDateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) + populate(objectMap, "logArtifact", r.LogArtifact) + populate(objectMap, "outputImages", r.OutputImages) + populate(objectMap, "platform", r.Platform) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "runErrorMessage", r.RunErrorMessage) + populate(objectMap, "runId", r.RunID) + populate(objectMap, "runType", r.RunType) + populate(objectMap, "sourceRegistryAuth", r.SourceRegistryAuth) + populate(objectMap, "sourceTrigger", r.SourceTrigger) + populateDateTimeRFC3339(objectMap, "startTime", r.StartTime) + populate(objectMap, "status", r.Status) + populate(objectMap, "task", r.Task) + populate(objectMap, "timerTrigger", r.TimerTrigger) + populate(objectMap, "updateTriggerToken", r.UpdateTriggerToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunProperties. +func (r *RunProperties) UnmarshalJSON(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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &r.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) + delete(rawMsg, key) + case "createTime": + err = unpopulateDateTimeRFC3339(val, "CreateTime", &r.CreateTime) + delete(rawMsg, key) + case "customRegistries": + err = unpopulate(val, "CustomRegistries", &r.CustomRegistries) + delete(rawMsg, key) + case "finishTime": + err = unpopulateDateTimeRFC3339(val, "FinishTime", &r.FinishTime) + delete(rawMsg, key) + case "imageUpdateTrigger": + err = unpopulate(val, "ImageUpdateTrigger", &r.ImageUpdateTrigger) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + delete(rawMsg, key) + case "lastUpdatedTime": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &r.LastUpdatedTime) + delete(rawMsg, key) + case "logArtifact": + err = unpopulate(val, "LogArtifact", &r.LogArtifact) + delete(rawMsg, key) + case "outputImages": + err = unpopulate(val, "OutputImages", &r.OutputImages) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &r.Platform) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "runErrorMessage": + err = unpopulate(val, "RunErrorMessage", &r.RunErrorMessage) + delete(rawMsg, key) + case "runId": + err = unpopulate(val, "RunID", &r.RunID) + delete(rawMsg, key) + case "runType": + err = unpopulate(val, "RunType", &r.RunType) + delete(rawMsg, key) + case "sourceRegistryAuth": + err = unpopulate(val, "SourceRegistryAuth", &r.SourceRegistryAuth) + delete(rawMsg, key) + case "sourceTrigger": + err = unpopulate(val, "SourceTrigger", &r.SourceTrigger) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &r.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "task": + err = unpopulate(val, "Task", &r.Task) + delete(rawMsg, key) + case "timerTrigger": + err = unpopulate(val, "TimerTrigger", &r.TimerTrigger) + delete(rawMsg, key) + case "updateTriggerToken": + err = unpopulate(val, "UpdateTriggerToken", &r.UpdateTriggerToken) + 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 RunRequest. +func (r RunRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentPoolName", r.AgentPoolName) + populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) + populate(objectMap, "logTemplate", r.LogTemplate) + objectMap["type"] = r.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunRequest. +func (r *RunRequest) UnmarshalJSON(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 "agentPoolName": + err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &r.LogTemplate) + 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 RunUpdateParameters. +func (r RunUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunUpdateParameters. +func (r *RunUpdateParameters) UnmarshalJSON(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 "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + 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]any) + 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 "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 ScopeMap. +func (s ScopeMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 ScopeMap. +func (s *ScopeMap) UnmarshalJSON(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 "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 ScopeMapListResult. +func (s ScopeMapListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapListResult. +func (s *ScopeMapListResult) UnmarshalJSON(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 ScopeMapProperties. +func (s ScopeMapProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", s.Actions) + populateDateTimeRFC3339(objectMap, "creationDate", s.CreationDate) + populate(objectMap, "description", s.Description) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapProperties. +func (s *ScopeMapProperties) UnmarshalJSON(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 "creationDate": + err = unpopulateDateTimeRFC3339(val, "CreationDate", &s.CreationDate) + 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) + 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 ScopeMapPropertiesUpdateParameters. +func (s ScopeMapPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", s.Actions) + populate(objectMap, "description", s.Description) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapPropertiesUpdateParameters. +func (s *ScopeMapPropertiesUpdateParameters) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &s.Description) + 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 ScopeMapUpdateParameters. +func (s ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapUpdateParameters. +func (s *ScopeMapUpdateParameters) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretObject. +func (s SecretObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", s.Type) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretObject. +func (s *SecretObject) UnmarshalJSON(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 "type": + err = unpopulate(val, "Type", &s.Type) + 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 SetValue. +func (s SetValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isSecret", s.IsSecret) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SetValue. +func (s *SetValue) UnmarshalJSON(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 "isSecret": + err = unpopulate(val, "IsSecret", &s.IsSecret) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + 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 Source. +func (s Source) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addr", s.Addr) + populate(objectMap, "instanceID", s.InstanceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Source. +func (s *Source) UnmarshalJSON(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 "addr": + err = unpopulate(val, "Addr", &s.Addr) + delete(rawMsg, key) + case "instanceID": + err = unpopulate(val, "InstanceID", &s.InstanceID) + 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 SourceProperties. +func (s SourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "branch", s.Branch) + populate(objectMap, "repositoryUrl", s.RepositoryURL) + populate(objectMap, "sourceControlAuthProperties", s.SourceControlAuthProperties) + populate(objectMap, "sourceControlType", s.SourceControlType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceProperties. +func (s *SourceProperties) UnmarshalJSON(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 "branch": + err = unpopulate(val, "Branch", &s.Branch) + delete(rawMsg, key) + case "repositoryUrl": + err = unpopulate(val, "RepositoryURL", &s.RepositoryURL) + delete(rawMsg, key) + case "sourceControlAuthProperties": + err = unpopulate(val, "SourceControlAuthProperties", &s.SourceControlAuthProperties) + delete(rawMsg, key) + case "sourceControlType": + err = unpopulate(val, "SourceControlType", &s.SourceControlType) + 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 SourceRegistryCredentials. +func (s SourceRegistryCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "loginMode", s.LoginMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceRegistryCredentials. +func (s *SourceRegistryCredentials) UnmarshalJSON(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 "loginMode": + err = unpopulate(val, "LoginMode", &s.LoginMode) + 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 SourceTrigger. +func (s SourceTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "sourceRepository", s.SourceRepository) + populate(objectMap, "sourceTriggerEvents", s.SourceTriggerEvents) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceTrigger. +func (s *SourceTrigger) UnmarshalJSON(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 "sourceRepository": + err = unpopulate(val, "SourceRepository", &s.SourceRepository) + delete(rawMsg, key) + case "sourceTriggerEvents": + err = unpopulate(val, "SourceTriggerEvents", &s.SourceTriggerEvents) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 SourceTriggerDescriptor. +func (s SourceTriggerDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "branchName", s.BranchName) + populate(objectMap, "commitId", s.CommitID) + populate(objectMap, "eventType", s.EventType) + populate(objectMap, "id", s.ID) + populate(objectMap, "providerType", s.ProviderType) + populate(objectMap, "pullRequestId", s.PullRequestID) + populate(objectMap, "repositoryUrl", s.RepositoryURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceTriggerDescriptor. +func (s *SourceTriggerDescriptor) UnmarshalJSON(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 "branchName": + err = unpopulate(val, "BranchName", &s.BranchName) + delete(rawMsg, key) + case "commitId": + err = unpopulate(val, "CommitID", &s.CommitID) + delete(rawMsg, key) + case "eventType": + err = unpopulate(val, "EventType", &s.EventType) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &s.ProviderType) + delete(rawMsg, key) + case "pullRequestId": + err = unpopulate(val, "PullRequestID", &s.PullRequestID) + delete(rawMsg, key) + case "repositoryUrl": + err = unpopulate(val, "RepositoryURL", &s.RepositoryURL) + 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 SourceTriggerUpdateParameters. +func (s SourceTriggerUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "sourceRepository", s.SourceRepository) + populate(objectMap, "sourceTriggerEvents", s.SourceTriggerEvents) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceTriggerUpdateParameters. +func (s *SourceTriggerUpdateParameters) UnmarshalJSON(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 "sourceRepository": + err = unpopulate(val, "SourceRepository", &s.SourceRepository) + delete(rawMsg, key) + case "sourceTriggerEvents": + err = unpopulate(val, "SourceTriggerEvents", &s.SourceTriggerEvents) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 SourceUpdateParameters. +func (s SourceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "branch", s.Branch) + populate(objectMap, "repositoryUrl", s.RepositoryURL) + populate(objectMap, "sourceControlAuthProperties", s.SourceControlAuthProperties) + populate(objectMap, "sourceControlType", s.SourceControlType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceUpdateParameters. +func (s *SourceUpdateParameters) UnmarshalJSON(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 "branch": + err = unpopulate(val, "Branch", &s.Branch) + delete(rawMsg, key) + case "repositoryUrl": + err = unpopulate(val, "RepositoryURL", &s.RepositoryURL) + delete(rawMsg, key) + case "sourceControlAuthProperties": + err = unpopulate(val, "SourceControlAuthProperties", &s.SourceControlAuthProperties) + delete(rawMsg, key) + case "sourceControlType": + err = unpopulate(val, "SourceControlType", &s.SourceControlType) + 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 SourceUploadDefinition. +func (s SourceUploadDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "relativePath", s.RelativePath) + populate(objectMap, "uploadUrl", s.UploadURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceUploadDefinition. +func (s *SourceUploadDefinition) UnmarshalJSON(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 "relativePath": + err = unpopulate(val, "RelativePath", &s.RelativePath) + delete(rawMsg, key) + case "uploadUrl": + err = unpopulate(val, "UploadURL", &s.UploadURL) + 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 Status. +func (s Status) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayStatus", s.DisplayStatus) + populate(objectMap, "message", s.Message) + populateDateTimeRFC3339(objectMap, "timestamp", s.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Status. +func (s *Status) UnmarshalJSON(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 "displayStatus": + err = unpopulate(val, "DisplayStatus", &s.DisplayStatus) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &s.Timestamp) + 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]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 Target. +func (t Target) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "digest", t.Digest) + populate(objectMap, "length", t.Length) + populate(objectMap, "mediaType", t.MediaType) + populate(objectMap, "name", t.Name) + populate(objectMap, "repository", t.Repository) + populate(objectMap, "size", t.Size) + populate(objectMap, "tag", t.Tag) + populate(objectMap, "url", t.URL) + populate(objectMap, "version", t.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Target. +func (t *Target) UnmarshalJSON(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 "digest": + err = unpopulate(val, "Digest", &t.Digest) + delete(rawMsg, key) + case "length": + err = unpopulate(val, "Length", &t.Length) + delete(rawMsg, key) + case "mediaType": + err = unpopulate(val, "MediaType", &t.MediaType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "repository": + err = unpopulate(val, "Repository", &t.Repository) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &t.Size) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &t.Tag) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &t.URL) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &t.Version) + 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 Task. +func (t Task) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Task. +func (t *Task) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &t.Identity) + 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) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TaskListResult. +func (t TaskListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskListResult. +func (t *TaskListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TaskProperties. +func (t TaskProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentConfiguration", t.AgentConfiguration) + populate(objectMap, "agentPoolName", t.AgentPoolName) + populateDateTimeRFC3339(objectMap, "creationDate", t.CreationDate) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "isSystemTask", t.IsSystemTask) + populate(objectMap, "logTemplate", t.LogTemplate) + populate(objectMap, "platform", t.Platform) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "status", t.Status) + populate(objectMap, "step", t.Step) + populate(objectMap, "timeout", t.Timeout) + populate(objectMap, "trigger", t.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskProperties. +func (t *TaskProperties) UnmarshalJSON(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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &t.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) + delete(rawMsg, key) + case "creationDate": + err = unpopulateDateTimeRFC3339(val, "CreationDate", &t.CreationDate) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &t.Credentials) + delete(rawMsg, key) + case "isSystemTask": + err = unpopulate(val, "IsSystemTask", &t.IsSystemTask) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &t.LogTemplate) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &t.Platform) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + delete(rawMsg, key) + case "step": + t.Step, err = unmarshalTaskStepPropertiesClassification(val) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &t.Timeout) + delete(rawMsg, key) + case "trigger": + err = unpopulate(val, "Trigger", &t.Trigger) + 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 TaskPropertiesUpdateParameters. +func (t TaskPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentConfiguration", t.AgentConfiguration) + populate(objectMap, "agentPoolName", t.AgentPoolName) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "logTemplate", t.LogTemplate) + populate(objectMap, "platform", t.Platform) + populate(objectMap, "status", t.Status) + populate(objectMap, "step", t.Step) + populate(objectMap, "timeout", t.Timeout) + populate(objectMap, "trigger", t.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskPropertiesUpdateParameters. +func (t *TaskPropertiesUpdateParameters) UnmarshalJSON(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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &t.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &t.Credentials) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &t.LogTemplate) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &t.Platform) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + delete(rawMsg, key) + case "step": + t.Step, err = unmarshalTaskStepUpdateParametersClassification(val) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &t.Timeout) + delete(rawMsg, key) + case "trigger": + err = unpopulate(val, "Trigger", &t.Trigger) + 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 TaskRun. +func (t TaskRun) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRun. +func (t *TaskRun) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &t.Identity) + 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) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TaskRunListResult. +func (t TaskRunListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunListResult. +func (t *TaskRunListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TaskRunProperties. +func (t TaskRunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "forceUpdateTag", t.ForceUpdateTag) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "runRequest", t.RunRequest) + populate(objectMap, "runResult", t.RunResult) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunProperties. +func (t *TaskRunProperties) UnmarshalJSON(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 "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &t.ForceUpdateTag) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "runRequest": + t.RunRequest, err = unmarshalRunRequestClassification(val) + delete(rawMsg, key) + case "runResult": + err = unpopulate(val, "RunResult", &t.RunResult) + 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 TaskRunPropertiesUpdateParameters. +func (t TaskRunPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "forceUpdateTag", t.ForceUpdateTag) + populate(objectMap, "runRequest", t.RunRequest) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunPropertiesUpdateParameters. +func (t *TaskRunPropertiesUpdateParameters) UnmarshalJSON(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 "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &t.ForceUpdateTag) + delete(rawMsg, key) + case "runRequest": + t.RunRequest, err = unmarshalRunRequestClassification(val) + 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 TaskRunRequest. +func (t TaskRunRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentPoolName", t.AgentPoolName) + populate(objectMap, "isArchiveEnabled", t.IsArchiveEnabled) + populate(objectMap, "logTemplate", t.LogTemplate) + populate(objectMap, "overrideTaskStepProperties", t.OverrideTaskStepProperties) + populate(objectMap, "taskId", t.TaskID) + objectMap["type"] = "TaskRunRequest" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunRequest. +func (t *TaskRunRequest) UnmarshalJSON(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 "agentPoolName": + err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &t.IsArchiveEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &t.LogTemplate) + delete(rawMsg, key) + case "overrideTaskStepProperties": + err = unpopulate(val, "OverrideTaskStepProperties", &t.OverrideTaskStepProperties) + delete(rawMsg, key) + case "taskId": + err = unpopulate(val, "TaskID", &t.TaskID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TaskRunUpdateParameters. +func (t TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "location", t.Location) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunUpdateParameters. +func (t *TaskRunUpdateParameters) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, 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 TaskStepProperties. +func (t TaskStepProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseImageDependencies", t.BaseImageDependencies) + populate(objectMap, "contextAccessToken", t.ContextAccessToken) + populate(objectMap, "contextPath", t.ContextPath) + objectMap["type"] = t.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskStepProperties. +func (t *TaskStepProperties) UnmarshalJSON(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 "baseImageDependencies": + err = unpopulate(val, "BaseImageDependencies", &t.BaseImageDependencies) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &t.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &t.ContextPath) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TaskStepUpdateParameters. +func (t TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contextAccessToken", t.ContextAccessToken) + populate(objectMap, "contextPath", t.ContextPath) + objectMap["type"] = t.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskStepUpdateParameters. +func (t *TaskStepUpdateParameters) UnmarshalJSON(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 "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &t.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &t.ContextPath) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TaskUpdateParameters. +func (t TaskUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskUpdateParameters. +func (t *TaskUpdateParameters) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, 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 TimerTrigger. +func (t TimerTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", t.Name) + populate(objectMap, "schedule", t.Schedule) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimerTrigger. +func (t *TimerTrigger) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &t.Schedule) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + 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 TimerTriggerDescriptor. +func (t TimerTriggerDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scheduleOccurrence", t.ScheduleOccurrence) + populate(objectMap, "timerTriggerName", t.TimerTriggerName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimerTriggerDescriptor. +func (t *TimerTriggerDescriptor) UnmarshalJSON(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 "scheduleOccurrence": + err = unpopulate(val, "ScheduleOccurrence", &t.ScheduleOccurrence) + delete(rawMsg, key) + case "timerTriggerName": + err = unpopulate(val, "TimerTriggerName", &t.TimerTriggerName) + 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 TimerTriggerUpdateParameters. +func (t TimerTriggerUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", t.Name) + populate(objectMap, "schedule", t.Schedule) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimerTriggerUpdateParameters. +func (t *TimerTriggerUpdateParameters) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &t.Schedule) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + 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 Token. +func (t Token) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Token. +func (t *Token) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TokenCertificate. +func (t TokenCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "encodedPemCertificate", t.EncodedPemCertificate) + populateDateTimeRFC3339(objectMap, "expiry", t.Expiry) + populate(objectMap, "name", t.Name) + populate(objectMap, "thumbprint", t.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenCertificate. +func (t *TokenCertificate) UnmarshalJSON(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 "encodedPemCertificate": + err = unpopulate(val, "EncodedPemCertificate", &t.EncodedPemCertificate) + delete(rawMsg, key) + case "expiry": + err = unpopulateDateTimeRFC3339(val, "Expiry", &t.Expiry) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &t.Thumbprint) + 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 TokenCredentialsProperties. +func (t TokenCredentialsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificates", t.Certificates) + populate(objectMap, "passwords", t.Passwords) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenCredentialsProperties. +func (t *TokenCredentialsProperties) UnmarshalJSON(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 "certificates": + err = unpopulate(val, "Certificates", &t.Certificates) + delete(rawMsg, key) + case "passwords": + err = unpopulate(val, "Passwords", &t.Passwords) + 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 TokenListResult. +func (t TokenListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenListResult. +func (t *TokenListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TokenPassword. +func (t TokenPassword) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "creationTime", t.CreationTime) + populateDateTimeRFC3339(objectMap, "expiry", t.Expiry) + populate(objectMap, "name", t.Name) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenPassword. +func (t *TokenPassword) UnmarshalJSON(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 "creationTime": + err = unpopulateDateTimeRFC3339(val, "CreationTime", &t.CreationTime) + delete(rawMsg, key) + case "expiry": + err = unpopulateDateTimeRFC3339(val, "Expiry", &t.Expiry) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TokenProperties. +func (t TokenProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "creationDate", t.CreationDate) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "scopeMapId", t.ScopeMapID) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenProperties. +func (t *TokenProperties) UnmarshalJSON(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 "creationDate": + err = unpopulateDateTimeRFC3339(val, "CreationDate", &t.CreationDate) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &t.Credentials) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "scopeMapId": + err = unpopulate(val, "ScopeMapID", &t.ScopeMapID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + 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 TokenUpdateParameters. +func (t TokenUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenUpdateParameters. +func (t *TokenUpdateParameters) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TokenUpdateProperties. +func (t TokenUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "scopeMapId", t.ScopeMapID) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenUpdateProperties. +func (t *TokenUpdateProperties) UnmarshalJSON(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 "credentials": + err = unpopulate(val, "Credentials", &t.Credentials) + delete(rawMsg, key) + case "scopeMapId": + err = unpopulate(val, "ScopeMapID", &t.ScopeMapID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + 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 TriggerProperties. +func (t TriggerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseImageTrigger", t.BaseImageTrigger) + populate(objectMap, "sourceTriggers", t.SourceTriggers) + populate(objectMap, "timerTriggers", t.TimerTriggers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerProperties. +func (t *TriggerProperties) UnmarshalJSON(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 "baseImageTrigger": + err = unpopulate(val, "BaseImageTrigger", &t.BaseImageTrigger) + delete(rawMsg, key) + case "sourceTriggers": + err = unpopulate(val, "SourceTriggers", &t.SourceTriggers) + delete(rawMsg, key) + case "timerTriggers": + err = unpopulate(val, "TimerTriggers", &t.TimerTriggers) + 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 TriggerUpdateParameters. +func (t TriggerUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseImageTrigger", t.BaseImageTrigger) + populate(objectMap, "sourceTriggers", t.SourceTriggers) + populate(objectMap, "timerTriggers", t.TimerTriggers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerUpdateParameters. +func (t *TriggerUpdateParameters) UnmarshalJSON(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 "baseImageTrigger": + err = unpopulate(val, "BaseImageTrigger", &t.BaseImageTrigger) + delete(rawMsg, key) + case "sourceTriggers": + err = unpopulate(val, "SourceTriggers", &t.SourceTriggers) + delete(rawMsg, key) + case "timerTriggers": + err = unpopulate(val, "TimerTriggers", &t.TimerTriggers) + 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 TrustPolicy. +func (t TrustPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "status", t.Status) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustPolicy. +func (t *TrustPolicy) UnmarshalJSON(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 "status": + err = unpopulate(val, "Status", &t.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 UserIdentityProperties. +func (u UserIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentityProperties. +func (u *UserIdentityProperties) UnmarshalJSON(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 Webhook. +func (w Webhook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Webhook. +func (w *Webhook) UnmarshalJSON(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 "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 "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + 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 WebhookCreateParameters. +func (w WebhookCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", w.Location) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookCreateParameters. +func (w *WebhookCreateParameters) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &w.Location) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebhookListResult. +func (w WebhookListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookListResult. +func (w *WebhookListResult) UnmarshalJSON(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 WebhookProperties. +func (w WebhookProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", w.Actions) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "scope", w.Scope) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookProperties. +func (w *WebhookProperties) UnmarshalJSON(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 "actions": + err = unpopulate(val, "Actions", &w.Actions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &w.Scope) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + 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 WebhookPropertiesCreateParameters. +func (w WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", w.Actions) + populate(objectMap, "customHeaders", w.CustomHeaders) + populate(objectMap, "scope", w.Scope) + populate(objectMap, "serviceUri", w.ServiceURI) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookPropertiesCreateParameters. +func (w *WebhookPropertiesCreateParameters) UnmarshalJSON(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 "actions": + err = unpopulate(val, "Actions", &w.Actions) + delete(rawMsg, key) + case "customHeaders": + err = unpopulate(val, "CustomHeaders", &w.CustomHeaders) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &w.Scope) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &w.ServiceURI) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + 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 WebhookPropertiesUpdateParameters. +func (w WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", w.Actions) + populate(objectMap, "customHeaders", w.CustomHeaders) + populate(objectMap, "scope", w.Scope) + populate(objectMap, "serviceUri", w.ServiceURI) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookPropertiesUpdateParameters. +func (w *WebhookPropertiesUpdateParameters) UnmarshalJSON(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 "actions": + err = unpopulate(val, "Actions", &w.Actions) + delete(rawMsg, key) + case "customHeaders": + err = unpopulate(val, "CustomHeaders", &w.CustomHeaders) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &w.Scope) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &w.ServiceURI) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + 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 WebhookUpdateParameters. +func (w WebhookUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookUpdateParameters. +func (w *WebhookUpdateParameters) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + 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 any) 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/containerregistry/armcontainerregistry/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go new file mode 100644 index 000000000..fb9d98347 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go @@ -0,0 +1,88 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "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/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 { + internal *arm.Client +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all of the available Azure Container Registry REST API operations. +// +// Generated from API version 2023-07-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ContainerRegistry/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-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/containerregistry/armcontainerregistry/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go new file mode 100644 index 000000000..8571ed3a4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go @@ -0,0 +1,447 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +// AgentPoolsClientBeginCreateOptions contains the optional parameters for the AgentPoolsClient.BeginCreate method. +type AgentPoolsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolsClientBeginDeleteOptions contains the optional parameters for the AgentPoolsClient.BeginDelete method. +type AgentPoolsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolsClientBeginUpdateOptions contains the optional parameters for the AgentPoolsClient.BeginUpdate method. +type AgentPoolsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolsClientGetOptions contains the optional parameters for the AgentPoolsClient.Get method. +type AgentPoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AgentPoolsClientGetQueueStatusOptions contains the optional parameters for the AgentPoolsClient.GetQueueStatus method. +type AgentPoolsClientGetQueueStatusOptions struct { + // placeholder for future optional parameters +} + +// AgentPoolsClientListOptions contains the optional parameters for the AgentPoolsClient.NewListPager method. +type AgentPoolsClientListOptions struct { + // placeholder for future optional parameters +} + +// CacheRulesClientBeginCreateOptions contains the optional parameters for the CacheRulesClient.BeginCreate method. +type CacheRulesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CacheRulesClientBeginDeleteOptions contains the optional parameters for the CacheRulesClient.BeginDelete method. +type CacheRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CacheRulesClientBeginUpdateOptions contains the optional parameters for the CacheRulesClient.BeginUpdate method. +type CacheRulesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CacheRulesClientGetOptions contains the optional parameters for the CacheRulesClient.Get method. +type CacheRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CacheRulesClientListOptions contains the optional parameters for the CacheRulesClient.NewListPager method. +type CacheRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// CredentialSetsClientBeginCreateOptions contains the optional parameters for the CredentialSetsClient.BeginCreate method. +type CredentialSetsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CredentialSetsClientBeginDeleteOptions contains the optional parameters for the CredentialSetsClient.BeginDelete method. +type CredentialSetsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CredentialSetsClientBeginUpdateOptions contains the optional parameters for the CredentialSetsClient.BeginUpdate method. +type CredentialSetsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CredentialSetsClientGetOptions contains the optional parameters for the CredentialSetsClient.Get method. +type CredentialSetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CredentialSetsClientListOptions contains the optional parameters for the CredentialSetsClient.NewListPager method. +type CredentialSetsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientBeginCreateOptions contains the optional parameters for the RegistriesClient.BeginCreate method. +type RegistriesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RegistriesClientBeginDeleteOptions contains the optional parameters for the RegistriesClient.BeginDelete method. +type RegistriesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RegistriesClientBeginGenerateCredentialsOptions contains the optional parameters for the RegistriesClient.BeginGenerateCredentials +// method. +type RegistriesClientBeginGenerateCredentialsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RegistriesClientBeginImportImageOptions contains the optional parameters for the RegistriesClient.BeginImportImage method. +type RegistriesClientBeginImportImageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RegistriesClientBeginScheduleRunOptions contains the optional parameters for the RegistriesClient.BeginScheduleRun method. +type RegistriesClientBeginScheduleRunOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RegistriesClientBeginUpdateOptions contains the optional parameters for the RegistriesClient.BeginUpdate method. +type RegistriesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RegistriesClientCheckNameAvailabilityOptions contains the optional parameters for the RegistriesClient.CheckNameAvailability +// method. +type RegistriesClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientGetBuildSourceUploadURLOptions contains the optional parameters for the RegistriesClient.GetBuildSourceUploadURL +// method. +type RegistriesClientGetBuildSourceUploadURLOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientGetOptions contains the optional parameters for the RegistriesClient.Get method. +type RegistriesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientGetPrivateLinkResourceOptions contains the optional parameters for the RegistriesClient.GetPrivateLinkResource +// method. +type RegistriesClientGetPrivateLinkResourceOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientListByResourceGroupOptions contains the optional parameters for the RegistriesClient.NewListByResourceGroupPager +// method. +type RegistriesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientListCredentialsOptions contains the optional parameters for the RegistriesClient.ListCredentials method. +type RegistriesClientListCredentialsOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientListOptions contains the optional parameters for the RegistriesClient.NewListPager method. +type RegistriesClientListOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientListPrivateLinkResourcesOptions contains the optional parameters for the RegistriesClient.NewListPrivateLinkResourcesPager +// method. +type RegistriesClientListPrivateLinkResourcesOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientListUsagesOptions contains the optional parameters for the RegistriesClient.ListUsages method. +type RegistriesClientListUsagesOptions struct { + // placeholder for future optional parameters +} + +// RegistriesClientRegenerateCredentialOptions contains the optional parameters for the RegistriesClient.RegenerateCredential +// method. +type RegistriesClientRegenerateCredentialOptions struct { + // placeholder for future optional parameters +} + +// ReplicationsClientBeginCreateOptions contains the optional parameters for the ReplicationsClient.BeginCreate method. +type ReplicationsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicationsClientBeginDeleteOptions contains the optional parameters for the ReplicationsClient.BeginDelete method. +type ReplicationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicationsClientBeginUpdateOptions contains the optional parameters for the ReplicationsClient.BeginUpdate method. +type ReplicationsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicationsClientGetOptions contains the optional parameters for the ReplicationsClient.Get method. +type ReplicationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ReplicationsClientListOptions contains the optional parameters for the ReplicationsClient.NewListPager method. +type ReplicationsClientListOptions struct { + // placeholder for future optional parameters +} + +// RunsClientBeginCancelOptions contains the optional parameters for the RunsClient.BeginCancel method. +type RunsClientBeginCancelOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RunsClientBeginUpdateOptions contains the optional parameters for the RunsClient.BeginUpdate method. +type RunsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RunsClientGetLogSasURLOptions contains the optional parameters for the RunsClient.GetLogSasURL method. +type RunsClientGetLogSasURLOptions struct { + // placeholder for future optional parameters +} + +// RunsClientGetOptions contains the optional parameters for the RunsClient.Get method. +type RunsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RunsClientListOptions contains the optional parameters for the RunsClient.NewListPager method. +type RunsClientListOptions struct { + // The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed string function is 'contains'. + // All logical operators except 'Not', 'Has', 'All' are allowed. + Filter *string + + // $top is supported for get list of runs, which limits the maximum number of runs to return. + Top *int32 +} + +// ScopeMapsClientBeginCreateOptions contains the optional parameters for the ScopeMapsClient.BeginCreate method. +type ScopeMapsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ScopeMapsClientBeginDeleteOptions contains the optional parameters for the ScopeMapsClient.BeginDelete method. +type ScopeMapsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ScopeMapsClientBeginUpdateOptions contains the optional parameters for the ScopeMapsClient.BeginUpdate method. +type ScopeMapsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ScopeMapsClientGetOptions contains the optional parameters for the ScopeMapsClient.Get method. +type ScopeMapsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ScopeMapsClientListOptions contains the optional parameters for the ScopeMapsClient.NewListPager method. +type ScopeMapsClientListOptions struct { + // placeholder for future optional parameters +} + +// TaskRunsClientBeginCreateOptions contains the optional parameters for the TaskRunsClient.BeginCreate method. +type TaskRunsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TaskRunsClientBeginDeleteOptions contains the optional parameters for the TaskRunsClient.BeginDelete method. +type TaskRunsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TaskRunsClientBeginUpdateOptions contains the optional parameters for the TaskRunsClient.BeginUpdate method. +type TaskRunsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TaskRunsClientGetDetailsOptions contains the optional parameters for the TaskRunsClient.GetDetails method. +type TaskRunsClientGetDetailsOptions struct { + // placeholder for future optional parameters +} + +// TaskRunsClientGetOptions contains the optional parameters for the TaskRunsClient.Get method. +type TaskRunsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TaskRunsClientListOptions contains the optional parameters for the TaskRunsClient.NewListPager method. +type TaskRunsClientListOptions struct { + // placeholder for future optional parameters +} + +// TasksClientBeginCreateOptions contains the optional parameters for the TasksClient.BeginCreate method. +type TasksClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TasksClientBeginDeleteOptions contains the optional parameters for the TasksClient.BeginDelete method. +type TasksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TasksClientBeginUpdateOptions contains the optional parameters for the TasksClient.BeginUpdate method. +type TasksClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TasksClientGetDetailsOptions contains the optional parameters for the TasksClient.GetDetails method. +type TasksClientGetDetailsOptions struct { + // placeholder for future optional parameters +} + +// TasksClientGetOptions contains the optional parameters for the TasksClient.Get method. +type TasksClientGetOptions struct { + // placeholder for future optional parameters +} + +// TasksClientListOptions contains the optional parameters for the TasksClient.NewListPager method. +type TasksClientListOptions struct { + // placeholder for future optional parameters +} + +// TokensClientBeginCreateOptions contains the optional parameters for the TokensClient.BeginCreate method. +type TokensClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TokensClientBeginDeleteOptions contains the optional parameters for the TokensClient.BeginDelete method. +type TokensClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TokensClientBeginUpdateOptions contains the optional parameters for the TokensClient.BeginUpdate method. +type TokensClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TokensClientGetOptions contains the optional parameters for the TokensClient.Get method. +type TokensClientGetOptions struct { + // placeholder for future optional parameters +} + +// TokensClientListOptions contains the optional parameters for the TokensClient.NewListPager method. +type TokensClientListOptions struct { + // placeholder for future optional parameters +} + +// WebhooksClientBeginCreateOptions contains the optional parameters for the WebhooksClient.BeginCreate method. +type WebhooksClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebhooksClientBeginDeleteOptions contains the optional parameters for the WebhooksClient.BeginDelete method. +type WebhooksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebhooksClientBeginUpdateOptions contains the optional parameters for the WebhooksClient.BeginUpdate method. +type WebhooksClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebhooksClientGetCallbackConfigOptions contains the optional parameters for the WebhooksClient.GetCallbackConfig method. +type WebhooksClientGetCallbackConfigOptions struct { + // placeholder for future optional parameters +} + +// WebhooksClientGetOptions contains the optional parameters for the WebhooksClient.Get method. +type WebhooksClientGetOptions struct { + // placeholder for future optional parameters +} + +// WebhooksClientListEventsOptions contains the optional parameters for the WebhooksClient.NewListEventsPager method. +type WebhooksClientListEventsOptions struct { + // placeholder for future optional parameters +} + +// WebhooksClientListOptions contains the optional parameters for the WebhooksClient.NewListPager method. +type WebhooksClientListOptions struct { + // placeholder for future optional parameters +} + +// WebhooksClientPingOptions contains the optional parameters for the WebhooksClient.Ping method. +type WebhooksClientPingOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.go new file mode 100644 index 000000000..bdd88e76d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.go @@ -0,0 +1,88 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import "encoding/json" + +func unmarshalRunRequestClassification(rawMsg json.RawMessage) (RunRequestClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b RunRequestClassification + switch m["type"] { + case "DockerBuildRequest": + b = &DockerBuildRequest{} + case "EncodedTaskRunRequest": + b = &EncodedTaskRunRequest{} + case "FileTaskRunRequest": + b = &FileTaskRunRequest{} + case "TaskRunRequest": + b = &TaskRunRequest{} + default: + b = &RunRequest{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalTaskStepPropertiesClassification(rawMsg json.RawMessage) (TaskStepPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b TaskStepPropertiesClassification + switch m["type"] { + case string(StepTypeDocker): + b = &DockerBuildStep{} + case string(StepTypeEncodedTask): + b = &EncodedTaskStep{} + case string(StepTypeFileTask): + b = &FileTaskStep{} + default: + b = &TaskStepProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalTaskStepUpdateParametersClassification(rawMsg json.RawMessage) (TaskStepUpdateParametersClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b TaskStepUpdateParametersClassification + switch m["type"] { + case string(StepTypeDocker): + b = &DockerBuildStepUpdateParameters{} + case string(StepTypeEncodedTask): + b = &EncodedTaskStepUpdateParameters{} + case string(StepTypeFileTask): + b = &FileTaskStepUpdateParameters{} + default: + b = &TaskStepUpdateParameters{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go new file mode 100644 index 000000000..695290cc9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Update the state of specified private endpoint connection associated with the container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - privateEndpointConnection - The parameters for creating a private endpoint connection. +// - options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, registryName, privateEndpointConnectionName, privateEndpointConnection, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Update the state of specified private endpoint connection associated with the container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, registryName, privateEndpointConnectionName, privateEndpointConnection, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, privateEndpointConnection); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified private endpoint connection associated with the container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the specified private endpoint connection associated with the container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get the specified private endpoint connection associated with the container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all private endpoint connections in a container registry. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, registryName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListResponse]{ + More: func(page PrivateEndpointConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { + result := PrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go new file mode 100644 index 000000000..d33c46433 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go @@ -0,0 +1,1156 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RegistriesClient contains the methods for the Registries group. +// Don't use this type directly, use NewRegistriesClient() instead. +type RegistriesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRegistriesClient creates a new instance of RegistriesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRegistriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RegistriesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RegistriesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Checks whether the container registry name is available for use. The name must contain only alphanumeric +// characters, be globally unique, and between 5 and 50 characters in length. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - registryNameCheckRequest - The object containing information for the availability request. +// - options - RegistriesClientCheckNameAvailabilityOptions contains the optional parameters for the RegistriesClient.CheckNameAvailability +// method. +func (client *RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest, options *RegistriesClientCheckNameAvailabilityOptions) (RegistriesClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "RegistriesClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, registryNameCheckRequest, options) + if err != nil { + return RegistriesClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RegistriesClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RegistriesClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *RegistriesClient) checkNameAvailabilityCreateRequest(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest, options *RegistriesClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability" + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, registryNameCheckRequest); err != nil { + return nil, err + } + return req, nil +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *RegistriesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (RegistriesClientCheckNameAvailabilityResponse, error) { + result := RegistriesClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegistryNameStatus); err != nil { + return RegistriesClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreate - Creates a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - registry - The parameters for creating a container registry. +// - options - RegistriesClientBeginCreateOptions contains the optional parameters for the RegistriesClient.BeginCreate method. +func (client *RegistriesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, registry Registry, options *RegistriesClientBeginCreateOptions) (*runtime.Poller[RegistriesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, registry, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RegistriesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RegistriesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *RegistriesClient) create(ctx context.Context, resourceGroupName string, registryName string, registry Registry, options *RegistriesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "RegistriesClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, registry, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *RegistriesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, registry Registry, options *RegistriesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, registry); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - RegistriesClientBeginDeleteOptions contains the optional parameters for the RegistriesClient.BeginDelete method. +func (client *RegistriesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientBeginDeleteOptions) (*runtime.Poller[RegistriesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RegistriesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RegistriesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *RegistriesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "RegistriesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RegistriesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// BeginGenerateCredentials - Generate keys for a token of a specified container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - generateCredentialsParameters - The parameters for generating credentials. +// - options - RegistriesClientBeginGenerateCredentialsOptions contains the optional parameters for the RegistriesClient.BeginGenerateCredentials +// method. +func (client *RegistriesClient) BeginGenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters, options *RegistriesClientBeginGenerateCredentialsOptions) (*runtime.Poller[RegistriesClientGenerateCredentialsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateCredentials(ctx, resourceGroupName, registryName, generateCredentialsParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RegistriesClientGenerateCredentialsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RegistriesClientGenerateCredentialsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GenerateCredentials - Generate keys for a token of a specified container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *RegistriesClient) generateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters, options *RegistriesClientBeginGenerateCredentialsOptions) (*http.Response, error) { + var err error + const operationName = "RegistriesClient.BeginGenerateCredentials" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateCredentialsCreateRequest(ctx, resourceGroupName, registryName, generateCredentialsParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// generateCredentialsCreateRequest creates the GenerateCredentials request. +func (client *RegistriesClient) generateCredentialsCreateRequest(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters, options *RegistriesClientBeginGenerateCredentialsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, generateCredentialsParameters); err != nil { + return nil, err + } + return req, nil +} + +// Get - Gets the properties of the specified container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - RegistriesClientGetOptions contains the optional parameters for the RegistriesClient.Get method. +func (client *RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientGetOptions) (RegistriesClientGetResponse, error) { + var err error + const operationName = "RegistriesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, options) + if err != nil { + return RegistriesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RegistriesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RegistriesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RegistriesClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RegistriesClient) getHandleResponse(resp *http.Response) (RegistriesClientGetResponse, error) { + result := RegistriesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Registry); err != nil { + return RegistriesClientGetResponse{}, err + } + return result, nil +} + +// GetBuildSourceUploadURL - Get the upload location for the user to be able to upload the source. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - options - RegistriesClientGetBuildSourceUploadURLOptions contains the optional parameters for the RegistriesClient.GetBuildSourceUploadURL +// method. +func (client *RegistriesClient) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientGetBuildSourceUploadURLOptions) (RegistriesClientGetBuildSourceUploadURLResponse, error) { + var err error + const operationName = "RegistriesClient.GetBuildSourceUploadURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getBuildSourceUploadURLCreateRequest(ctx, resourceGroupName, registryName, options) + if err != nil { + return RegistriesClientGetBuildSourceUploadURLResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RegistriesClientGetBuildSourceUploadURLResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RegistriesClientGetBuildSourceUploadURLResponse{}, err + } + resp, err := client.getBuildSourceUploadURLHandleResponse(httpResp) + return resp, err +} + +// getBuildSourceUploadURLCreateRequest creates the GetBuildSourceUploadURL request. +func (client *RegistriesClient) getBuildSourceUploadURLCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientGetBuildSourceUploadURLOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getBuildSourceUploadURLHandleResponse handles the GetBuildSourceUploadURL response. +func (client *RegistriesClient) getBuildSourceUploadURLHandleResponse(resp *http.Response) (RegistriesClientGetBuildSourceUploadURLResponse, error) { + result := RegistriesClientGetBuildSourceUploadURLResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SourceUploadDefinition); err != nil { + return RegistriesClientGetBuildSourceUploadURLResponse{}, err + } + return result, nil +} + +// GetPrivateLinkResource - Gets a private link resource by a specified group name for a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - groupName - The name of the private link resource. +// - options - RegistriesClientGetPrivateLinkResourceOptions contains the optional parameters for the RegistriesClient.GetPrivateLinkResource +// method. +func (client *RegistriesClient) GetPrivateLinkResource(ctx context.Context, resourceGroupName string, registryName string, groupName string, options *RegistriesClientGetPrivateLinkResourceOptions) (RegistriesClientGetPrivateLinkResourceResponse, error) { + var err error + const operationName = "RegistriesClient.GetPrivateLinkResource" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getPrivateLinkResourceCreateRequest(ctx, resourceGroupName, registryName, groupName, options) + if err != nil { + return RegistriesClientGetPrivateLinkResourceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RegistriesClientGetPrivateLinkResourceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RegistriesClientGetPrivateLinkResourceResponse{}, err + } + resp, err := client.getPrivateLinkResourceHandleResponse(httpResp) + return resp, err +} + +// getPrivateLinkResourceCreateRequest creates the GetPrivateLinkResource request. +func (client *RegistriesClient) getPrivateLinkResourceCreateRequest(ctx context.Context, resourceGroupName string, registryName string, groupName string, options *RegistriesClientGetPrivateLinkResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources/{groupName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getPrivateLinkResourceHandleResponse handles the GetPrivateLinkResource response. +func (client *RegistriesClient) getPrivateLinkResourceHandleResponse(resp *http.Response) (RegistriesClientGetPrivateLinkResourceResponse, error) { + result := RegistriesClientGetPrivateLinkResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return RegistriesClientGetPrivateLinkResourceResponse{}, err + } + return result, nil +} + +// BeginImportImage - Copies an image to this container registry from the specified container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - parameters - The parameters specifying the image to copy and the source container registry. +// - options - RegistriesClientBeginImportImageOptions contains the optional parameters for the RegistriesClient.BeginImportImage +// method. +func (client *RegistriesClient) BeginImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters, options *RegistriesClientBeginImportImageOptions) (*runtime.Poller[RegistriesClientImportImageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.importImage(ctx, resourceGroupName, registryName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RegistriesClientImportImageResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RegistriesClientImportImageResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ImportImage - Copies an image to this container registry from the specified container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *RegistriesClient) importImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters, options *RegistriesClientBeginImportImageOptions) (*http.Response, error) { + var err error + const operationName = "RegistriesClient.BeginImportImage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.importImageCreateRequest(ctx, resourceGroupName, registryName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// importImageCreateRequest creates the ImportImage request. +func (client *RegistriesClient) importImageCreateRequest(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters, options *RegistriesClientBeginImportImageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// NewListPager - Lists all the container registries under the specified subscription. +// +// Generated from API version 2023-07-01 +// - options - RegistriesClientListOptions contains the optional parameters for the RegistriesClient.NewListPager method. +func (client *RegistriesClient) NewListPager(options *RegistriesClientListOptions) *runtime.Pager[RegistriesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RegistriesClientListResponse]{ + More: func(page RegistriesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RegistriesClientListResponse) (RegistriesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegistriesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return RegistriesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *RegistriesClient) listCreateRequest(ctx context.Context, options *RegistriesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RegistriesClient) listHandleResponse(resp *http.Response) (RegistriesClientListResponse, error) { + result := RegistriesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegistryListResult); err != nil { + return RegistriesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the container registries under the specified resource group. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - RegistriesClientListByResourceGroupOptions contains the optional parameters for the RegistriesClient.NewListByResourceGroupPager +// method. +func (client *RegistriesClient) NewListByResourceGroupPager(resourceGroupName string, options *RegistriesClientListByResourceGroupOptions) *runtime.Pager[RegistriesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[RegistriesClientListByResourceGroupResponse]{ + More: func(page RegistriesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RegistriesClientListByResourceGroupResponse) (RegistriesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegistriesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return RegistriesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *RegistriesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *RegistriesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *RegistriesClient) listByResourceGroupHandleResponse(resp *http.Response) (RegistriesClientListByResourceGroupResponse, error) { + result := RegistriesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegistryListResult); err != nil { + return RegistriesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// ListCredentials - Lists the login credentials for the specified container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - RegistriesClientListCredentialsOptions contains the optional parameters for the RegistriesClient.ListCredentials +// method. +func (client *RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientListCredentialsOptions) (RegistriesClientListCredentialsResponse, error) { + var err error + const operationName = "RegistriesClient.ListCredentials" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCredentialsCreateRequest(ctx, resourceGroupName, registryName, options) + if err != nil { + return RegistriesClientListCredentialsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RegistriesClientListCredentialsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RegistriesClientListCredentialsResponse{}, err + } + resp, err := client.listCredentialsHandleResponse(httpResp) + return resp, err +} + +// listCredentialsCreateRequest creates the ListCredentials request. +func (client *RegistriesClient) listCredentialsCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientListCredentialsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCredentialsHandleResponse handles the ListCredentials response. +func (client *RegistriesClient) listCredentialsHandleResponse(resp *http.Response) (RegistriesClientListCredentialsResponse, error) { + result := RegistriesClientListCredentialsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegistryListCredentialsResult); err != nil { + return RegistriesClientListCredentialsResponse{}, err + } + return result, nil +} + +// NewListPrivateLinkResourcesPager - Lists the private link resources for a container registry. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - RegistriesClientListPrivateLinkResourcesOptions contains the optional parameters for the RegistriesClient.NewListPrivateLinkResourcesPager +// method. +func (client *RegistriesClient) NewListPrivateLinkResourcesPager(resourceGroupName string, registryName string, options *RegistriesClientListPrivateLinkResourcesOptions) *runtime.Pager[RegistriesClientListPrivateLinkResourcesResponse] { + return runtime.NewPager(runtime.PagingHandler[RegistriesClientListPrivateLinkResourcesResponse]{ + More: func(page RegistriesClientListPrivateLinkResourcesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RegistriesClientListPrivateLinkResourcesResponse) (RegistriesClientListPrivateLinkResourcesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegistriesClient.NewListPrivateLinkResourcesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listPrivateLinkResourcesCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return RegistriesClientListPrivateLinkResourcesResponse{}, err + } + return client.listPrivateLinkResourcesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listPrivateLinkResourcesCreateRequest creates the ListPrivateLinkResources request. +func (client *RegistriesClient) listPrivateLinkResourcesCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientListPrivateLinkResourcesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listPrivateLinkResourcesHandleResponse handles the ListPrivateLinkResources response. +func (client *RegistriesClient) listPrivateLinkResourcesHandleResponse(resp *http.Response) (RegistriesClientListPrivateLinkResourcesResponse, error) { + result := RegistriesClientListPrivateLinkResourcesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return RegistriesClientListPrivateLinkResourcesResponse{}, err + } + return result, nil +} + +// ListUsages - Gets the quota usages for the specified container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - RegistriesClientListUsagesOptions contains the optional parameters for the RegistriesClient.ListUsages method. +func (client *RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientListUsagesOptions) (RegistriesClientListUsagesResponse, error) { + var err error + const operationName = "RegistriesClient.ListUsages" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listUsagesCreateRequest(ctx, resourceGroupName, registryName, options) + if err != nil { + return RegistriesClientListUsagesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RegistriesClientListUsagesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RegistriesClientListUsagesResponse{}, err + } + resp, err := client.listUsagesHandleResponse(httpResp) + return resp, err +} + +// listUsagesCreateRequest creates the ListUsages request. +func (client *RegistriesClient) listUsagesCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientListUsagesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listUsagesHandleResponse handles the ListUsages response. +func (client *RegistriesClient) listUsagesHandleResponse(resp *http.Response) (RegistriesClientListUsagesResponse, error) { + result := RegistriesClientListUsagesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegistryUsageListResult); err != nil { + return RegistriesClientListUsagesResponse{}, err + } + return result, nil +} + +// RegenerateCredential - Regenerates one of the login credentials for the specified container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - regenerateCredentialParameters - Specifies name of the password which should be regenerated -- password or password2. +// - options - RegistriesClientRegenerateCredentialOptions contains the optional parameters for the RegistriesClient.RegenerateCredential +// method. +func (client *RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters, options *RegistriesClientRegenerateCredentialOptions) (RegistriesClientRegenerateCredentialResponse, error) { + var err error + const operationName = "RegistriesClient.RegenerateCredential" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.regenerateCredentialCreateRequest(ctx, resourceGroupName, registryName, regenerateCredentialParameters, options) + if err != nil { + return RegistriesClientRegenerateCredentialResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RegistriesClientRegenerateCredentialResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RegistriesClientRegenerateCredentialResponse{}, err + } + resp, err := client.regenerateCredentialHandleResponse(httpResp) + return resp, err +} + +// regenerateCredentialCreateRequest creates the RegenerateCredential request. +func (client *RegistriesClient) regenerateCredentialCreateRequest(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters, options *RegistriesClientRegenerateCredentialOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, regenerateCredentialParameters); err != nil { + return nil, err + } + return req, nil +} + +// regenerateCredentialHandleResponse handles the RegenerateCredential response. +func (client *RegistriesClient) regenerateCredentialHandleResponse(resp *http.Response) (RegistriesClientRegenerateCredentialResponse, error) { + result := RegistriesClientRegenerateCredentialResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegistryListCredentialsResult); err != nil { + return RegistriesClientRegenerateCredentialResponse{}, err + } + return result, nil +} + +// BeginScheduleRun - Schedules a new run based on the request parameters and add it to the run queue. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - runRequest - The parameters of a run that needs to scheduled. +// - options - RegistriesClientBeginScheduleRunOptions contains the optional parameters for the RegistriesClient.BeginScheduleRun +// method. +func (client *RegistriesClient) BeginScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest RunRequestClassification, options *RegistriesClientBeginScheduleRunOptions) (*runtime.Poller[RegistriesClientScheduleRunResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.scheduleRun(ctx, resourceGroupName, registryName, runRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RegistriesClientScheduleRunResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RegistriesClientScheduleRunResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ScheduleRun - Schedules a new run based on the request parameters and add it to the run queue. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *RegistriesClient) scheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest RunRequestClassification, options *RegistriesClientBeginScheduleRunOptions) (*http.Response, error) { + var err error + const operationName = "RegistriesClient.BeginScheduleRun" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.scheduleRunCreateRequest(ctx, resourceGroupName, registryName, runRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// scheduleRunCreateRequest creates the ScheduleRun request. +func (client *RegistriesClient) scheduleRunCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runRequest RunRequestClassification, options *RegistriesClientBeginScheduleRunOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, runRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdate - Updates a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - registryUpdateParameters - The parameters for updating a container registry. +// - options - RegistriesClientBeginUpdateOptions contains the optional parameters for the RegistriesClient.BeginUpdate method. +func (client *RegistriesClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters, options *RegistriesClientBeginUpdateOptions) (*runtime.Poller[RegistriesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, registryUpdateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RegistriesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RegistriesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *RegistriesClient) update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters, options *RegistriesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "RegistriesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, registryUpdateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *RegistriesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters, options *RegistriesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, registryUpdateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go new file mode 100644 index 000000000..abefe243b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go @@ -0,0 +1,430 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReplicationsClient contains the methods for the Replications group. +// Don't use this type directly, use NewReplicationsClient() instead. +type ReplicationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewReplicationsClient creates a new instance of ReplicationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ReplicationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a replication for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - replicationName - The name of the replication. +// - replication - The parameters for creating a replication. +// - options - ReplicationsClientBeginCreateOptions contains the optional parameters for the ReplicationsClient.BeginCreate +// method. +func (client *ReplicationsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication, options *ReplicationsClientBeginCreateOptions) (*runtime.Poller[ReplicationsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, replicationName, replication, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicationsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a replication for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *ReplicationsClient) create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication, options *ReplicationsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ReplicationsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, replicationName, replication, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *ReplicationsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication, options *ReplicationsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if replicationName == "" { + return nil, errors.New("parameter replicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicationName}", url.PathEscape(replicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, replication); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a replication from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - replicationName - The name of the replication. +// - options - ReplicationsClientBeginDeleteOptions contains the optional parameters for the ReplicationsClient.BeginDelete +// method. +func (client *ReplicationsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientBeginDeleteOptions) (*runtime.Poller[ReplicationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, replicationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a replication from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *ReplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ReplicationsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, replicationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ReplicationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if replicationName == "" { + return nil, errors.New("parameter replicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicationName}", url.PathEscape(replicationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets the properties of the specified replication. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - replicationName - The name of the replication. +// - options - ReplicationsClientGetOptions contains the optional parameters for the ReplicationsClient.Get method. +func (client *ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientGetOptions) (ReplicationsClientGetResponse, error) { + var err error + const operationName = "ReplicationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, replicationName, options) + if err != nil { + return ReplicationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ReplicationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ReplicationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ReplicationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if replicationName == "" { + return nil, errors.New("parameter replicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicationName}", url.PathEscape(replicationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ReplicationsClient) getHandleResponse(resp *http.Response) (ReplicationsClientGetResponse, error) { + result := ReplicationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Replication); err != nil { + return ReplicationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the replications for the specified container registry. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - ReplicationsClientListOptions contains the optional parameters for the ReplicationsClient.NewListPager method. +func (client *ReplicationsClient) NewListPager(resourceGroupName string, registryName string, options *ReplicationsClientListOptions) *runtime.Pager[ReplicationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ReplicationsClientListResponse]{ + More: func(page ReplicationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ReplicationsClientListResponse) (ReplicationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ReplicationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return ReplicationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ReplicationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *ReplicationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ReplicationsClient) listHandleResponse(resp *http.Response) (ReplicationsClientListResponse, error) { + result := ReplicationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationListResult); err != nil { + return ReplicationsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a replication for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - replicationName - The name of the replication. +// - replicationUpdateParameters - The parameters for updating a replication. +// - options - ReplicationsClientBeginUpdateOptions contains the optional parameters for the ReplicationsClient.BeginUpdate +// method. +func (client *ReplicationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters, options *ReplicationsClientBeginUpdateOptions) (*runtime.Poller[ReplicationsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a replication for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *ReplicationsClient) update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters, options *ReplicationsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ReplicationsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ReplicationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters, options *ReplicationsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if replicationName == "" { + return nil, errors.New("parameter replicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicationName}", url.PathEscape(replicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, replicationUpdateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go new file mode 100644 index 000000000..08ed39340 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go @@ -0,0 +1,469 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +// AgentPoolsClientCreateResponse contains the response from method AgentPoolsClient.BeginCreate. +type AgentPoolsClientCreateResponse struct { + // The agentpool that has the ARM resource and properties. + // The agentpool will have all information to create an agent pool. + AgentPool +} + +// AgentPoolsClientDeleteResponse contains the response from method AgentPoolsClient.BeginDelete. +type AgentPoolsClientDeleteResponse struct { + // placeholder for future response values +} + +// AgentPoolsClientGetQueueStatusResponse contains the response from method AgentPoolsClient.GetQueueStatus. +type AgentPoolsClientGetQueueStatusResponse struct { + // The QueueStatus of Agent Pool + AgentPoolQueueStatus +} + +// AgentPoolsClientGetResponse contains the response from method AgentPoolsClient.Get. +type AgentPoolsClientGetResponse struct { + // The agentpool that has the ARM resource and properties. + // The agentpool will have all information to create an agent pool. + AgentPool +} + +// AgentPoolsClientListResponse contains the response from method AgentPoolsClient.NewListPager. +type AgentPoolsClientListResponse struct { + // The collection of agent pools. + AgentPoolListResult +} + +// AgentPoolsClientUpdateResponse contains the response from method AgentPoolsClient.BeginUpdate. +type AgentPoolsClientUpdateResponse struct { + // The agentpool that has the ARM resource and properties. + // The agentpool will have all information to create an agent pool. + AgentPool +} + +// CacheRulesClientCreateResponse contains the response from method CacheRulesClient.BeginCreate. +type CacheRulesClientCreateResponse struct { + // An object that represents a cache rule for a container registry. + CacheRule +} + +// CacheRulesClientDeleteResponse contains the response from method CacheRulesClient.BeginDelete. +type CacheRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// CacheRulesClientGetResponse contains the response from method CacheRulesClient.Get. +type CacheRulesClientGetResponse struct { + // An object that represents a cache rule for a container registry. + CacheRule +} + +// CacheRulesClientListResponse contains the response from method CacheRulesClient.NewListPager. +type CacheRulesClientListResponse struct { + // The result of a request to list cache rules for a container registry. + CacheRulesListResult +} + +// CacheRulesClientUpdateResponse contains the response from method CacheRulesClient.BeginUpdate. +type CacheRulesClientUpdateResponse struct { + // An object that represents a cache rule for a container registry. + CacheRule +} + +// CredentialSetsClientCreateResponse contains the response from method CredentialSetsClient.BeginCreate. +type CredentialSetsClientCreateResponse struct { + // An object that represents a credential set resource for a container registry. + CredentialSet +} + +// CredentialSetsClientDeleteResponse contains the response from method CredentialSetsClient.BeginDelete. +type CredentialSetsClientDeleteResponse struct { + // placeholder for future response values +} + +// CredentialSetsClientGetResponse contains the response from method CredentialSetsClient.Get. +type CredentialSetsClientGetResponse struct { + // An object that represents a credential set resource for a container registry. + CredentialSet +} + +// CredentialSetsClientListResponse contains the response from method CredentialSetsClient.NewListPager. +type CredentialSetsClientListResponse struct { + // The result of a request to list credential sets for a container registry. + CredentialSetListResult +} + +// CredentialSetsClientUpdateResponse contains the response from method CredentialSetsClient.BeginUpdate. +type CredentialSetsClientUpdateResponse struct { + // An object that represents a credential set resource for a container registry. + CredentialSet +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // The result of a request to list container registry operations. + OperationListResult +} + +// PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. +type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // An object that represents a private endpoint connection for a container registry. + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + // An object that represents a private endpoint connection for a container registry. + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. +type PrivateEndpointConnectionsClientListResponse struct { + // The result of a request to list private endpoint connections for a container registry. + PrivateEndpointConnectionListResult +} + +// RegistriesClientCheckNameAvailabilityResponse contains the response from method RegistriesClient.CheckNameAvailability. +type RegistriesClientCheckNameAvailabilityResponse struct { + // The result of a request to check the availability of a container registry name. + RegistryNameStatus +} + +// RegistriesClientCreateResponse contains the response from method RegistriesClient.BeginCreate. +type RegistriesClientCreateResponse struct { + // An object that represents a container registry. + Registry +} + +// RegistriesClientDeleteResponse contains the response from method RegistriesClient.BeginDelete. +type RegistriesClientDeleteResponse struct { + // placeholder for future response values +} + +// RegistriesClientGenerateCredentialsResponse contains the response from method RegistriesClient.BeginGenerateCredentials. +type RegistriesClientGenerateCredentialsResponse struct { + // The response from the GenerateCredentials operation. + GenerateCredentialsResult +} + +// RegistriesClientGetBuildSourceUploadURLResponse contains the response from method RegistriesClient.GetBuildSourceUploadURL. +type RegistriesClientGetBuildSourceUploadURLResponse struct { + // The properties of a response to source upload request. + SourceUploadDefinition +} + +// RegistriesClientGetPrivateLinkResourceResponse contains the response from method RegistriesClient.GetPrivateLinkResource. +type RegistriesClientGetPrivateLinkResourceResponse struct { + // A resource that supports private link capabilities. + PrivateLinkResource +} + +// RegistriesClientGetResponse contains the response from method RegistriesClient.Get. +type RegistriesClientGetResponse struct { + // An object that represents a container registry. + Registry +} + +// RegistriesClientImportImageResponse contains the response from method RegistriesClient.BeginImportImage. +type RegistriesClientImportImageResponse struct { + // placeholder for future response values +} + +// RegistriesClientListByResourceGroupResponse contains the response from method RegistriesClient.NewListByResourceGroupPager. +type RegistriesClientListByResourceGroupResponse struct { + // The result of a request to list container registries. + RegistryListResult +} + +// RegistriesClientListCredentialsResponse contains the response from method RegistriesClient.ListCredentials. +type RegistriesClientListCredentialsResponse struct { + // The response from the ListCredentials operation. + RegistryListCredentialsResult +} + +// RegistriesClientListPrivateLinkResourcesResponse contains the response from method RegistriesClient.NewListPrivateLinkResourcesPager. +type RegistriesClientListPrivateLinkResourcesResponse struct { + // The result of a request to list private link resources for a container registry. + PrivateLinkResourceListResult +} + +// RegistriesClientListResponse contains the response from method RegistriesClient.NewListPager. +type RegistriesClientListResponse struct { + // The result of a request to list container registries. + RegistryListResult +} + +// RegistriesClientListUsagesResponse contains the response from method RegistriesClient.ListUsages. +type RegistriesClientListUsagesResponse struct { + // The result of a request to get container registry quota usages. + RegistryUsageListResult +} + +// RegistriesClientRegenerateCredentialResponse contains the response from method RegistriesClient.RegenerateCredential. +type RegistriesClientRegenerateCredentialResponse struct { + // The response from the ListCredentials operation. + RegistryListCredentialsResult +} + +// RegistriesClientScheduleRunResponse contains the response from method RegistriesClient.BeginScheduleRun. +type RegistriesClientScheduleRunResponse struct { + // Run resource properties + Run +} + +// RegistriesClientUpdateResponse contains the response from method RegistriesClient.BeginUpdate. +type RegistriesClientUpdateResponse struct { + // An object that represents a container registry. + Registry +} + +// ReplicationsClientCreateResponse contains the response from method ReplicationsClient.BeginCreate. +type ReplicationsClientCreateResponse struct { + // An object that represents a replication for a container registry. + Replication +} + +// ReplicationsClientDeleteResponse contains the response from method ReplicationsClient.BeginDelete. +type ReplicationsClientDeleteResponse struct { + // placeholder for future response values +} + +// ReplicationsClientGetResponse contains the response from method ReplicationsClient.Get. +type ReplicationsClientGetResponse struct { + // An object that represents a replication for a container registry. + Replication +} + +// ReplicationsClientListResponse contains the response from method ReplicationsClient.NewListPager. +type ReplicationsClientListResponse struct { + // The result of a request to list replications for a container registry. + ReplicationListResult +} + +// ReplicationsClientUpdateResponse contains the response from method ReplicationsClient.BeginUpdate. +type ReplicationsClientUpdateResponse struct { + // An object that represents a replication for a container registry. + Replication +} + +// RunsClientCancelResponse contains the response from method RunsClient.BeginCancel. +type RunsClientCancelResponse struct { + // placeholder for future response values +} + +// RunsClientGetLogSasURLResponse contains the response from method RunsClient.GetLogSasURL. +type RunsClientGetLogSasURLResponse struct { + // The result of get log link operation. + RunGetLogResult +} + +// RunsClientGetResponse contains the response from method RunsClient.Get. +type RunsClientGetResponse struct { + // Run resource properties + Run +} + +// RunsClientListResponse contains the response from method RunsClient.NewListPager. +type RunsClientListResponse struct { + // Collection of runs. + RunListResult +} + +// RunsClientUpdateResponse contains the response from method RunsClient.BeginUpdate. +type RunsClientUpdateResponse struct { + // Run resource properties + Run +} + +// ScopeMapsClientCreateResponse contains the response from method ScopeMapsClient.BeginCreate. +type ScopeMapsClientCreateResponse struct { + // An object that represents a scope map for a container registry. + ScopeMap +} + +// ScopeMapsClientDeleteResponse contains the response from method ScopeMapsClient.BeginDelete. +type ScopeMapsClientDeleteResponse struct { + // placeholder for future response values +} + +// ScopeMapsClientGetResponse contains the response from method ScopeMapsClient.Get. +type ScopeMapsClientGetResponse struct { + // An object that represents a scope map for a container registry. + ScopeMap +} + +// ScopeMapsClientListResponse contains the response from method ScopeMapsClient.NewListPager. +type ScopeMapsClientListResponse struct { + // The result of a request to list scope maps for a container registry. + ScopeMapListResult +} + +// ScopeMapsClientUpdateResponse contains the response from method ScopeMapsClient.BeginUpdate. +type ScopeMapsClientUpdateResponse struct { + // An object that represents a scope map for a container registry. + ScopeMap +} + +// TaskRunsClientCreateResponse contains the response from method TaskRunsClient.BeginCreate. +type TaskRunsClientCreateResponse struct { + // The task run that has the ARM resource and properties. + // The task run will have the information of request and result of a run. + TaskRun +} + +// TaskRunsClientDeleteResponse contains the response from method TaskRunsClient.BeginDelete. +type TaskRunsClientDeleteResponse struct { + // placeholder for future response values +} + +// TaskRunsClientGetDetailsResponse contains the response from method TaskRunsClient.GetDetails. +type TaskRunsClientGetDetailsResponse struct { + // The task run that has the ARM resource and properties. + // The task run will have the information of request and result of a run. + TaskRun +} + +// TaskRunsClientGetResponse contains the response from method TaskRunsClient.Get. +type TaskRunsClientGetResponse struct { + // The task run that has the ARM resource and properties. + // The task run will have the information of request and result of a run. + TaskRun +} + +// TaskRunsClientListResponse contains the response from method TaskRunsClient.NewListPager. +type TaskRunsClientListResponse struct { + // The collection of task runs. + TaskRunListResult +} + +// TaskRunsClientUpdateResponse contains the response from method TaskRunsClient.BeginUpdate. +type TaskRunsClientUpdateResponse struct { + // The task run that has the ARM resource and properties. + // The task run will have the information of request and result of a run. + TaskRun +} + +// TasksClientCreateResponse contains the response from method TasksClient.BeginCreate. +type TasksClientCreateResponse struct { + // The task that has the ARM resource and task properties. + // The task will have all information to schedule a run against it. + Task +} + +// TasksClientDeleteResponse contains the response from method TasksClient.BeginDelete. +type TasksClientDeleteResponse struct { + // placeholder for future response values +} + +// TasksClientGetDetailsResponse contains the response from method TasksClient.GetDetails. +type TasksClientGetDetailsResponse struct { + // The task that has the ARM resource and task properties. + // The task will have all information to schedule a run against it. + Task +} + +// TasksClientGetResponse contains the response from method TasksClient.Get. +type TasksClientGetResponse struct { + // The task that has the ARM resource and task properties. + // The task will have all information to schedule a run against it. + Task +} + +// TasksClientListResponse contains the response from method TasksClient.NewListPager. +type TasksClientListResponse struct { + // The collection of tasks. + TaskListResult +} + +// TasksClientUpdateResponse contains the response from method TasksClient.BeginUpdate. +type TasksClientUpdateResponse struct { + // The task that has the ARM resource and task properties. + // The task will have all information to schedule a run against it. + Task +} + +// TokensClientCreateResponse contains the response from method TokensClient.BeginCreate. +type TokensClientCreateResponse struct { + // An object that represents a token for a container registry. + Token +} + +// TokensClientDeleteResponse contains the response from method TokensClient.BeginDelete. +type TokensClientDeleteResponse struct { + // placeholder for future response values +} + +// TokensClientGetResponse contains the response from method TokensClient.Get. +type TokensClientGetResponse struct { + // An object that represents a token for a container registry. + Token +} + +// TokensClientListResponse contains the response from method TokensClient.NewListPager. +type TokensClientListResponse struct { + // The result of a request to list tokens for a container registry. + TokenListResult +} + +// TokensClientUpdateResponse contains the response from method TokensClient.BeginUpdate. +type TokensClientUpdateResponse struct { + // An object that represents a token for a container registry. + Token +} + +// WebhooksClientCreateResponse contains the response from method WebhooksClient.BeginCreate. +type WebhooksClientCreateResponse struct { + // An object that represents a webhook for a container registry. + Webhook +} + +// WebhooksClientDeleteResponse contains the response from method WebhooksClient.BeginDelete. +type WebhooksClientDeleteResponse struct { + // placeholder for future response values +} + +// WebhooksClientGetCallbackConfigResponse contains the response from method WebhooksClient.GetCallbackConfig. +type WebhooksClientGetCallbackConfigResponse struct { + // The configuration of service URI and custom headers for the webhook. + CallbackConfig +} + +// WebhooksClientGetResponse contains the response from method WebhooksClient.Get. +type WebhooksClientGetResponse struct { + // An object that represents a webhook for a container registry. + Webhook +} + +// WebhooksClientListEventsResponse contains the response from method WebhooksClient.NewListEventsPager. +type WebhooksClientListEventsResponse struct { + // The result of a request to list events for a webhook. + EventListResult +} + +// WebhooksClientListResponse contains the response from method WebhooksClient.NewListPager. +type WebhooksClientListResponse struct { + // The result of a request to list webhooks for a container registry. + WebhookListResult +} + +// WebhooksClientPingResponse contains the response from method WebhooksClient.Ping. +type WebhooksClientPingResponse struct { + // The basic information of an event. + EventInfo +} + +// WebhooksClientUpdateResponse contains the response from method WebhooksClient.BeginUpdate. +type WebhooksClientUpdateResponse struct { + // An object that represents a webhook for a container registry. + Webhook +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go new file mode 100644 index 000000000..a76c96305 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// RunsClient contains the methods for the Runs group. +// Don't use this type directly, use NewRunsClient() instead. +type RunsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRunsClient creates a new instance of RunsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RunsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RunsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCancel - Cancel an existing run. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - runID - The run ID. +// - options - RunsClientBeginCancelOptions contains the optional parameters for the RunsClient.BeginCancel method. +func (client *RunsClient) BeginCancel(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientBeginCancelOptions) (*runtime.Poller[RunsClientCancelResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.cancel(ctx, resourceGroupName, registryName, runID, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RunsClientCancelResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RunsClientCancelResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Cancel - Cancel an existing run. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *RunsClient) cancel(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientBeginCancelOptions) (*http.Response, error) { + var err error + const operationName = "RunsClient.BeginCancel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelCreateRequest(ctx, resourceGroupName, registryName, runID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// cancelCreateRequest creates the Cancel request. +func (client *RunsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientBeginCancelOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if runID == "" { + return nil, errors.New("parameter runID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runId}", url.PathEscape(runID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the detailed information for a given run. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - runID - The run ID. +// - options - RunsClientGetOptions contains the optional parameters for the RunsClient.Get method. +func (client *RunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetOptions) (RunsClientGetResponse, error) { + var err error + const operationName = "RunsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, runID, options) + if err != nil { + return RunsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RunsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RunsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if runID == "" { + return nil, errors.New("parameter runID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runId}", url.PathEscape(runID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RunsClient) getHandleResponse(resp *http.Response) (RunsClientGetResponse, error) { + result := RunsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Run); err != nil { + return RunsClientGetResponse{}, err + } + return result, nil +} + +// GetLogSasURL - Gets a link to download the run logs. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - runID - The run ID. +// - options - RunsClientGetLogSasURLOptions contains the optional parameters for the RunsClient.GetLogSasURL method. +func (client *RunsClient) GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetLogSasURLOptions) (RunsClientGetLogSasURLResponse, error) { + var err error + const operationName = "RunsClient.GetLogSasURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getLogSasURLCreateRequest(ctx, resourceGroupName, registryName, runID, options) + if err != nil { + return RunsClientGetLogSasURLResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RunsClientGetLogSasURLResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RunsClientGetLogSasURLResponse{}, err + } + resp, err := client.getLogSasURLHandleResponse(httpResp) + return resp, err +} + +// getLogSasURLCreateRequest creates the GetLogSasURL request. +func (client *RunsClient) getLogSasURLCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetLogSasURLOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if runID == "" { + return nil, errors.New("parameter runID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runId}", url.PathEscape(runID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getLogSasURLHandleResponse handles the GetLogSasURL response. +func (client *RunsClient) getLogSasURLHandleResponse(resp *http.Response) (RunsClientGetLogSasURLResponse, error) { + result := RunsClientGetLogSasURLResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RunGetLogResult); err != nil { + return RunsClientGetLogSasURLResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the runs for a registry. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - options - RunsClientListOptions contains the optional parameters for the RunsClient.NewListPager method. +func (client *RunsClient) NewListPager(resourceGroupName string, registryName string, options *RunsClientListOptions) *runtime.Pager[RunsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RunsClientListResponse]{ + More: func(page RunsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RunsClientListResponse) (RunsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RunsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return RunsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *RunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RunsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + 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)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RunsClient) listHandleResponse(resp *http.Response) (RunsClientListResponse, error) { + result := RunsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RunListResult); err != nil { + return RunsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Patch the run properties. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - runID - The run ID. +// - runUpdateParameters - The run update properties. +// - options - RunsClientBeginUpdateOptions contains the optional parameters for the RunsClient.BeginUpdate method. +func (client *RunsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters, options *RunsClientBeginUpdateOptions) (*runtime.Poller[RunsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, runID, runUpdateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RunsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RunsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Patch the run properties. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *RunsClient) update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters, options *RunsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "RunsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, runID, runUpdateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *RunsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters, options *RunsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if runID == "" { + return nil, errors.New("parameter runID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runId}", url.PathEscape(runID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, runUpdateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go new file mode 100644 index 000000000..cff215097 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeMapsClient contains the methods for the ScopeMaps group. +// Don't use this type directly, use NewScopeMapsClient() instead. +type ScopeMapsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewScopeMapsClient creates a new instance of ScopeMapsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeMapsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeMapsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeMapsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a scope map for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - scopeMapName - The name of the scope map. +// - scopeMapCreateParameters - The parameters for creating a scope map. +// - options - ScopeMapsClientBeginCreateOptions contains the optional parameters for the ScopeMapsClient.BeginCreate method. +func (client *ScopeMapsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap, options *ScopeMapsClientBeginCreateOptions) (*runtime.Poller[ScopeMapsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, scopeMapName, scopeMapCreateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ScopeMapsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ScopeMapsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a scope map for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *ScopeMapsClient) create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap, options *ScopeMapsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ScopeMapsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, scopeMapCreateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *ScopeMapsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap, options *ScopeMapsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if scopeMapName == "" { + return nil, errors.New("parameter scopeMapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scopeMapName}", url.PathEscape(scopeMapName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, scopeMapCreateParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a scope map from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - scopeMapName - The name of the scope map. +// - options - ScopeMapsClientBeginDeleteOptions contains the optional parameters for the ScopeMapsClient.BeginDelete method. +func (client *ScopeMapsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientBeginDeleteOptions) (*runtime.Poller[ScopeMapsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, scopeMapName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ScopeMapsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ScopeMapsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a scope map from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *ScopeMapsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ScopeMapsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ScopeMapsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if scopeMapName == "" { + return nil, errors.New("parameter scopeMapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scopeMapName}", url.PathEscape(scopeMapName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the properties of the specified scope map. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - scopeMapName - The name of the scope map. +// - options - ScopeMapsClientGetOptions contains the optional parameters for the ScopeMapsClient.Get method. +func (client *ScopeMapsClient) Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientGetOptions) (ScopeMapsClientGetResponse, error) { + var err error + const operationName = "ScopeMapsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, options) + if err != nil { + return ScopeMapsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeMapsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScopeMapsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ScopeMapsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if scopeMapName == "" { + return nil, errors.New("parameter scopeMapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scopeMapName}", url.PathEscape(scopeMapName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ScopeMapsClient) getHandleResponse(resp *http.Response) (ScopeMapsClientGetResponse, error) { + result := ScopeMapsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScopeMap); err != nil { + return ScopeMapsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the scope maps for the specified container registry. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - ScopeMapsClientListOptions contains the optional parameters for the ScopeMapsClient.NewListPager method. +func (client *ScopeMapsClient) NewListPager(resourceGroupName string, registryName string, options *ScopeMapsClientListOptions) *runtime.Pager[ScopeMapsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeMapsClientListResponse]{ + More: func(page ScopeMapsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeMapsClientListResponse) (ScopeMapsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ScopeMapsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return ScopeMapsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeMapsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *ScopeMapsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeMapsClient) listHandleResponse(resp *http.Response) (ScopeMapsClientListResponse, error) { + result := ScopeMapsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScopeMapListResult); err != nil { + return ScopeMapsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a scope map with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - scopeMapName - The name of the scope map. +// - scopeMapUpdateParameters - The parameters for updating a scope map. +// - options - ScopeMapsClientBeginUpdateOptions contains the optional parameters for the ScopeMapsClient.BeginUpdate method. +func (client *ScopeMapsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters, options *ScopeMapsClientBeginUpdateOptions) (*runtime.Poller[ScopeMapsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, scopeMapName, scopeMapUpdateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ScopeMapsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ScopeMapsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a scope map with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *ScopeMapsClient) update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters, options *ScopeMapsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ScopeMapsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, scopeMapUpdateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ScopeMapsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters, options *ScopeMapsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if scopeMapName == "" { + return nil, errors.New("parameter scopeMapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scopeMapName}", url.PathEscape(scopeMapName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, scopeMapUpdateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go new file mode 100644 index 000000000..16f8e5d74 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go @@ -0,0 +1,494 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TaskRunsClient contains the methods for the TaskRuns group. +// Don't use this type directly, use NewTaskRunsClient() instead. +type TaskRunsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTaskRunsClient creates a new instance of TaskRunsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTaskRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TaskRunsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TaskRunsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a task run for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskRunName - The name of the task run. +// - taskRun - The parameters of a run that needs to scheduled. +// - options - TaskRunsClientBeginCreateOptions contains the optional parameters for the TaskRunsClient.BeginCreate method. +func (client *TaskRunsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun, options *TaskRunsClientBeginCreateOptions) (*runtime.Poller[TaskRunsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, taskRunName, taskRun, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TaskRunsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TaskRunsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a task run for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *TaskRunsClient) create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun, options *TaskRunsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "TaskRunsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, taskRunName, taskRun, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *TaskRunsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun, options *TaskRunsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskRunName == "" { + return nil, errors.New("parameter taskRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, taskRun); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a specified task run resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskRunName - The name of the task run. +// - options - TaskRunsClientBeginDeleteOptions contains the optional parameters for the TaskRunsClient.BeginDelete method. +func (client *TaskRunsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientBeginDeleteOptions) (*runtime.Poller[TaskRunsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, taskRunName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TaskRunsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TaskRunsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a specified task run resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *TaskRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "TaskRunsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, taskRunName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TaskRunsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskRunName == "" { + return nil, errors.New("parameter taskRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the detailed information for a given task run. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskRunName - The name of the task run. +// - options - TaskRunsClientGetOptions contains the optional parameters for the TaskRunsClient.Get method. +func (client *TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetOptions) (TaskRunsClientGetResponse, error) { + var err error + const operationName = "TaskRunsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, taskRunName, options) + if err != nil { + return TaskRunsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TaskRunsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TaskRunsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TaskRunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskRunName == "" { + return nil, errors.New("parameter taskRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TaskRunsClient) getHandleResponse(resp *http.Response) (TaskRunsClientGetResponse, error) { + result := TaskRunsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TaskRun); err != nil { + return TaskRunsClientGetResponse{}, err + } + return result, nil +} + +// GetDetails - Gets the detailed information for a given task run that includes all secrets. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskRunName - The name of the task run. +// - options - TaskRunsClientGetDetailsOptions contains the optional parameters for the TaskRunsClient.GetDetails method. +func (client *TaskRunsClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetDetailsOptions) (TaskRunsClientGetDetailsResponse, error) { + var err error + const operationName = "TaskRunsClient.GetDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getDetailsCreateRequest(ctx, resourceGroupName, registryName, taskRunName, options) + if err != nil { + return TaskRunsClientGetDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TaskRunsClientGetDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TaskRunsClientGetDetailsResponse{}, err + } + resp, err := client.getDetailsHandleResponse(httpResp) + return resp, err +} + +// getDetailsCreateRequest creates the GetDetails request. +func (client *TaskRunsClient) getDetailsCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskRunName == "" { + return nil, errors.New("parameter taskRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDetailsHandleResponse handles the GetDetails response. +func (client *TaskRunsClient) getDetailsHandleResponse(resp *http.Response) (TaskRunsClientGetDetailsResponse, error) { + result := TaskRunsClientGetDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TaskRun); err != nil { + return TaskRunsClientGetDetailsResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the task runs for a specified container registry. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - options - TaskRunsClientListOptions contains the optional parameters for the TaskRunsClient.NewListPager method. +func (client *TaskRunsClient) NewListPager(resourceGroupName string, registryName string, options *TaskRunsClientListOptions) *runtime.Pager[TaskRunsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TaskRunsClientListResponse]{ + More: func(page TaskRunsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TaskRunsClientListResponse) (TaskRunsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TaskRunsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return TaskRunsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TaskRunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *TaskRunsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TaskRunsClient) listHandleResponse(resp *http.Response) (TaskRunsClientListResponse, error) { + result := TaskRunsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TaskRunListResult); err != nil { + return TaskRunsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a task run with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskRunName - The name of the task run. +// - updateParameters - The parameters for updating a task run. +// - options - TaskRunsClientBeginUpdateOptions contains the optional parameters for the TaskRunsClient.BeginUpdate method. +func (client *TaskRunsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters, options *TaskRunsClientBeginUpdateOptions) (*runtime.Poller[TaskRunsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, taskRunName, updateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TaskRunsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TaskRunsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a task run with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *TaskRunsClient) update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters, options *TaskRunsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TaskRunsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, taskRunName, updateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *TaskRunsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters, options *TaskRunsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskRunName == "" { + return nil, errors.New("parameter taskRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go new file mode 100644 index 000000000..29aaec5a1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go @@ -0,0 +1,494 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TasksClient contains the methods for the Tasks group. +// Don't use this type directly, use NewTasksClient() instead. +type TasksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTasksClient creates a new instance of TasksClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTasksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TasksClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TasksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a task for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskName - The name of the container registry task. +// - taskCreateParameters - The parameters for creating a task. +// - options - TasksClientBeginCreateOptions contains the optional parameters for the TasksClient.BeginCreate method. +func (client *TasksClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task, options *TasksClientBeginCreateOptions) (*runtime.Poller[TasksClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, taskName, taskCreateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TasksClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TasksClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a task for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *TasksClient) create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task, options *TasksClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "TasksClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, taskName, taskCreateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *TasksClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task, options *TasksClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskName == "" { + return nil, errors.New("parameter taskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, taskCreateParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a specified task. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskName - The name of the container registry task. +// - options - TasksClientBeginDeleteOptions contains the optional parameters for the TasksClient.BeginDelete method. +func (client *TasksClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientBeginDeleteOptions) (*runtime.Poller[TasksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, taskName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TasksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TasksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a specified task. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *TasksClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "TasksClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, taskName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TasksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskName == "" { + return nil, errors.New("parameter taskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the properties of a specified task. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskName - The name of the container registry task. +// - options - TasksClientGetOptions contains the optional parameters for the TasksClient.Get method. +func (client *TasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetOptions) (TasksClientGetResponse, error) { + var err error + const operationName = "TasksClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, taskName, options) + if err != nil { + return TasksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TasksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TasksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TasksClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskName == "" { + return nil, errors.New("parameter taskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TasksClient) getHandleResponse(resp *http.Response) (TasksClientGetResponse, error) { + result := TasksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Task); err != nil { + return TasksClientGetResponse{}, err + } + return result, nil +} + +// GetDetails - Returns a task with extended information that includes all secrets. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskName - The name of the container registry task. +// - options - TasksClientGetDetailsOptions contains the optional parameters for the TasksClient.GetDetails method. +func (client *TasksClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetDetailsOptions) (TasksClientGetDetailsResponse, error) { + var err error + const operationName = "TasksClient.GetDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getDetailsCreateRequest(ctx, resourceGroupName, registryName, taskName, options) + if err != nil { + return TasksClientGetDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TasksClientGetDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TasksClientGetDetailsResponse{}, err + } + resp, err := client.getDetailsHandleResponse(httpResp) + return resp, err +} + +// getDetailsCreateRequest creates the GetDetails request. +func (client *TasksClient) getDetailsCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskName == "" { + return nil, errors.New("parameter taskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDetailsHandleResponse handles the GetDetails response. +func (client *TasksClient) getDetailsHandleResponse(resp *http.Response) (TasksClientGetDetailsResponse, error) { + result := TasksClientGetDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Task); err != nil { + return TasksClientGetDetailsResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the tasks for a specified container registry. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - options - TasksClientListOptions contains the optional parameters for the TasksClient.NewListPager method. +func (client *TasksClient) NewListPager(resourceGroupName string, registryName string, options *TasksClientListOptions) *runtime.Pager[TasksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TasksClientListResponse]{ + More: func(page TasksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TasksClientListResponse) (TasksClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TasksClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return TasksClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TasksClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *TasksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TasksClient) listHandleResponse(resp *http.Response) (TasksClientListResponse, error) { + result := TasksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TaskListResult); err != nil { + return TasksClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a task with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +// - resourceGroupName - The name of the resource group to which the container registry belongs. +// - registryName - The name of the container registry. +// - taskName - The name of the container registry task. +// - taskUpdateParameters - The parameters for updating a task. +// - options - TasksClientBeginUpdateOptions contains the optional parameters for the TasksClient.BeginUpdate method. +func (client *TasksClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters, options *TasksClientBeginUpdateOptions) (*runtime.Poller[TasksClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TasksClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TasksClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a task with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2019-06-01-preview +func (client *TasksClient) update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters, options *TasksClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TasksClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *TasksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters, options *TasksClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if taskName == "" { + return nil, errors.New("parameter taskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, taskUpdateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/time_rfc3339.go new file mode 100644 index 000000000..7d52c939b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// 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+)*"*$`) + +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func populateDateTimeRFC3339(m map[string]any, 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] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateTimeRFC3339 + 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/containerregistry/armcontainerregistry/tokens_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go new file mode 100644 index 000000000..27274babc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TokensClient contains the methods for the Tokens group. +// Don't use this type directly, use NewTokensClient() instead. +type TokensClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTokensClient creates a new instance of TokensClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTokensClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TokensClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TokensClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a token for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - tokenName - The name of the token. +// - tokenCreateParameters - The parameters for creating a token. +// - options - TokensClientBeginCreateOptions contains the optional parameters for the TokensClient.BeginCreate method. +func (client *TokensClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token, options *TokensClientBeginCreateOptions) (*runtime.Poller[TokensClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, tokenName, tokenCreateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TokensClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TokensClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a token for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *TokensClient) create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token, options *TokensClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "TokensClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, tokenName, tokenCreateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *TokensClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token, options *TokensClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if tokenName == "" { + return nil, errors.New("parameter tokenName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tokenName}", url.PathEscape(tokenName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, tokenCreateParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a token from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - tokenName - The name of the token. +// - options - TokensClientBeginDeleteOptions contains the optional parameters for the TokensClient.BeginDelete method. +func (client *TokensClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientBeginDeleteOptions) (*runtime.Poller[TokensClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, tokenName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TokensClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TokensClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a token from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *TokensClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "TokensClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, tokenName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TokensClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if tokenName == "" { + return nil, errors.New("parameter tokenName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tokenName}", url.PathEscape(tokenName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the properties of the specified token. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - tokenName - The name of the token. +// - options - TokensClientGetOptions contains the optional parameters for the TokensClient.Get method. +func (client *TokensClient) Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientGetOptions) (TokensClientGetResponse, error) { + var err error + const operationName = "TokensClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, tokenName, options) + if err != nil { + return TokensClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TokensClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TokensClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TokensClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if tokenName == "" { + return nil, errors.New("parameter tokenName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tokenName}", url.PathEscape(tokenName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TokensClient) getHandleResponse(resp *http.Response) (TokensClientGetResponse, error) { + result := TokensClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Token); err != nil { + return TokensClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the tokens for the specified container registry. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - TokensClientListOptions contains the optional parameters for the TokensClient.NewListPager method. +func (client *TokensClient) NewListPager(resourceGroupName string, registryName string, options *TokensClientListOptions) *runtime.Pager[TokensClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TokensClientListResponse]{ + More: func(page TokensClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TokensClientListResponse) (TokensClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TokensClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return TokensClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TokensClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *TokensClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TokensClient) listHandleResponse(resp *http.Response) (TokensClientListResponse, error) { + result := TokensClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TokenListResult); err != nil { + return TokensClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a token with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - tokenName - The name of the token. +// - tokenUpdateParameters - The parameters for updating a token. +// - options - TokensClientBeginUpdateOptions contains the optional parameters for the TokensClient.BeginUpdate method. +func (client *TokensClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters, options *TokensClientBeginUpdateOptions) (*runtime.Poller[TokensClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, tokenName, tokenUpdateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TokensClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TokensClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a token with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *TokensClient) update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters, options *TokensClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TokensClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, tokenName, tokenUpdateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *TokensClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters, options *TokensClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if tokenName == "" { + return nil, errors.New("parameter tokenName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tokenName}", url.PathEscape(tokenName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, tokenUpdateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go new file mode 100644 index 000000000..9ee0845d2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go @@ -0,0 +1,635 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerregistry + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WebhooksClient contains the methods for the Webhooks group. +// Don't use this type directly, use NewWebhooksClient() instead. +type WebhooksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWebhooksClient creates a new instance of WebhooksClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWebhooksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebhooksClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebhooksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a webhook for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - webhookName - The name of the webhook. +// - webhookCreateParameters - The parameters for creating a webhook. +// - options - WebhooksClientBeginCreateOptions contains the optional parameters for the WebhooksClient.BeginCreate method. +func (client *WebhooksClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters, options *WebhooksClientBeginCreateOptions) (*runtime.Poller[WebhooksClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebhooksClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebhooksClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a webhook for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *WebhooksClient) create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters, options *WebhooksClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "WebhooksClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *WebhooksClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters, options *WebhooksClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if webhookName == "" { + return nil, errors.New("parameter webhookName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webhookName}", url.PathEscape(webhookName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, webhookCreateParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a webhook from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - webhookName - The name of the webhook. +// - options - WebhooksClientBeginDeleteOptions contains the optional parameters for the WebhooksClient.BeginDelete method. +func (client *WebhooksClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientBeginDeleteOptions) (*runtime.Poller[WebhooksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, webhookName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebhooksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebhooksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a webhook from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *WebhooksClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "WebhooksClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WebhooksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if webhookName == "" { + return nil, errors.New("parameter webhookName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webhookName}", url.PathEscape(webhookName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets the properties of the specified webhook. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - webhookName - The name of the webhook. +// - options - WebhooksClientGetOptions contains the optional parameters for the WebhooksClient.Get method. +func (client *WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientGetOptions) (WebhooksClientGetResponse, error) { + var err error + const operationName = "WebhooksClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) + if err != nil { + return WebhooksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebhooksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebhooksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *WebhooksClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if webhookName == "" { + return nil, errors.New("parameter webhookName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webhookName}", url.PathEscape(webhookName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WebhooksClient) getHandleResponse(resp *http.Response) (WebhooksClientGetResponse, error) { + result := WebhooksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Webhook); err != nil { + return WebhooksClientGetResponse{}, err + } + return result, nil +} + +// GetCallbackConfig - Gets the configuration of service URI and custom headers for the webhook. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - webhookName - The name of the webhook. +// - options - WebhooksClientGetCallbackConfigOptions contains the optional parameters for the WebhooksClient.GetCallbackConfig +// method. +func (client *WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientGetCallbackConfigOptions) (WebhooksClientGetCallbackConfigResponse, error) { + var err error + const operationName = "WebhooksClient.GetCallbackConfig" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCallbackConfigCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) + if err != nil { + return WebhooksClientGetCallbackConfigResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebhooksClientGetCallbackConfigResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebhooksClientGetCallbackConfigResponse{}, err + } + resp, err := client.getCallbackConfigHandleResponse(httpResp) + return resp, err +} + +// getCallbackConfigCreateRequest creates the GetCallbackConfig request. +func (client *WebhooksClient) getCallbackConfigCreateRequest(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientGetCallbackConfigOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if webhookName == "" { + return nil, errors.New("parameter webhookName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webhookName}", url.PathEscape(webhookName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCallbackConfigHandleResponse handles the GetCallbackConfig response. +func (client *WebhooksClient) getCallbackConfigHandleResponse(resp *http.Response) (WebhooksClientGetCallbackConfigResponse, error) { + result := WebhooksClientGetCallbackConfigResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CallbackConfig); err != nil { + return WebhooksClientGetCallbackConfigResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the webhooks for the specified container registry. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - options - WebhooksClientListOptions contains the optional parameters for the WebhooksClient.NewListPager method. +func (client *WebhooksClient) NewListPager(resourceGroupName string, registryName string, options *WebhooksClientListOptions) *runtime.Pager[WebhooksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[WebhooksClientListResponse]{ + More: func(page WebhooksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebhooksClientListResponse) (WebhooksClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebhooksClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, registryName, options) + }, nil) + if err != nil { + return WebhooksClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *WebhooksClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *WebhooksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *WebhooksClient) listHandleResponse(resp *http.Response) (WebhooksClientListResponse, error) { + result := WebhooksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebhookListResult); err != nil { + return WebhooksClientListResponse{}, err + } + return result, nil +} + +// NewListEventsPager - Lists recent events for the specified webhook. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - webhookName - The name of the webhook. +// - options - WebhooksClientListEventsOptions contains the optional parameters for the WebhooksClient.NewListEventsPager method. +func (client *WebhooksClient) NewListEventsPager(resourceGroupName string, registryName string, webhookName string, options *WebhooksClientListEventsOptions) *runtime.Pager[WebhooksClientListEventsResponse] { + return runtime.NewPager(runtime.PagingHandler[WebhooksClientListEventsResponse]{ + More: func(page WebhooksClientListEventsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebhooksClientListEventsResponse) (WebhooksClientListEventsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebhooksClient.NewListEventsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listEventsCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) + }, nil) + if err != nil { + return WebhooksClientListEventsResponse{}, err + } + return client.listEventsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listEventsCreateRequest creates the ListEvents request. +func (client *WebhooksClient) listEventsCreateRequest(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientListEventsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if webhookName == "" { + return nil, errors.New("parameter webhookName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webhookName}", url.PathEscape(webhookName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listEventsHandleResponse handles the ListEvents response. +func (client *WebhooksClient) listEventsHandleResponse(resp *http.Response) (WebhooksClientListEventsResponse, error) { + result := WebhooksClientListEventsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventListResult); err != nil { + return WebhooksClientListEventsResponse{}, err + } + return result, nil +} + +// Ping - Triggers a ping event to be sent to the webhook. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - webhookName - The name of the webhook. +// - options - WebhooksClientPingOptions contains the optional parameters for the WebhooksClient.Ping method. +func (client *WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientPingOptions) (WebhooksClientPingResponse, error) { + var err error + const operationName = "WebhooksClient.Ping" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.pingCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) + if err != nil { + return WebhooksClientPingResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebhooksClientPingResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebhooksClientPingResponse{}, err + } + resp, err := client.pingHandleResponse(httpResp) + return resp, err +} + +// pingCreateRequest creates the Ping request. +func (client *WebhooksClient) pingCreateRequest(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientPingOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if webhookName == "" { + return nil, errors.New("parameter webhookName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webhookName}", url.PathEscape(webhookName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// pingHandleResponse handles the Ping response. +func (client *WebhooksClient) pingHandleResponse(resp *http.Response) (WebhooksClientPingResponse, error) { + result := WebhooksClientPingResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EventInfo); err != nil { + return WebhooksClientPingResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a webhook with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - webhookName - The name of the webhook. +// - webhookUpdateParameters - The parameters for updating a webhook. +// - options - WebhooksClientBeginUpdateOptions contains the optional parameters for the WebhooksClient.BeginUpdate method. +func (client *WebhooksClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters, options *WebhooksClientBeginUpdateOptions) (*runtime.Poller[WebhooksClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebhooksClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WebhooksClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a webhook with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01 +func (client *WebhooksClient) update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters, options *WebhooksClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "WebhooksClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *WebhooksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters, options *WebhooksClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if webhookName == "" { + return nil, errors.New("parameter webhookName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{webhookName}", url.PathEscape(webhookName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, webhookUpdateParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/CHANGELOG.md new file mode 100644 index 000000000..837482870 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/CHANGELOG.md @@ -0,0 +1,517 @@ +# Release History + +## 4.6.0 (2023-11-24) +### Features Added + +- New enum type `BackendPoolType` with values `BackendPoolTypeNodeIP`, `BackendPoolTypeNodeIPConfiguration` +- New enum type `Protocol` with values `ProtocolTCP`, `ProtocolUDP` +- New struct `AgentPoolNetworkProfile` +- New struct `IPTag` +- New struct `PortRange` +- New field `CapacityReservationGroupID`, `NetworkProfile` in struct `ManagedClusterAgentPoolProfile` +- New field `CapacityReservationGroupID`, `NetworkProfile` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `BackendPoolType` in struct `ManagedClusterLoadBalancerProfile` + + +## 4.6.0-beta.1 (2023-11-24) +### Features Added + +- New value `AgentPoolTypeVirtualMachines` added to enum type `AgentPoolType` +- New value `NetworkPolicyNone` added to enum type `NetworkPolicy` +- New value `NodeOSUpgradeChannelSecurityPatch` added to enum type `NodeOSUpgradeChannel` +- New value `OSSKUMariner`, `OSSKUWindowsAnnual` added to enum type `OSSKU` +- New value `PublicNetworkAccessSecuredByPerimeter` added to enum type `PublicNetworkAccess` +- New value `SnapshotTypeManagedCluster` added to enum type `SnapshotType` +- New value `WorkloadRuntimeKataMshvVMIsolation` added to enum type `WorkloadRuntime` +- New enum type `AddonAutoscaling` with values `AddonAutoscalingDisabled`, `AddonAutoscalingEnabled` +- New enum type `AgentPoolSSHAccess` with values `AgentPoolSSHAccessDisabled`, `AgentPoolSSHAccessLocalUser` +- New enum type `BackendPoolType` with values `BackendPoolTypeNodeIP`, `BackendPoolTypeNodeIPConfiguration` +- New enum type `GuardrailsSupport` with values `GuardrailsSupportPreview`, `GuardrailsSupportStable` +- New enum type `IpvsScheduler` with values `IpvsSchedulerLeastConnection`, `IpvsSchedulerRoundRobin` +- New enum type `Level` with values `LevelEnforcement`, `LevelOff`, `LevelWarning` +- New enum type `Mode` with values `ModeIPTABLES`, `ModeIPVS` +- New enum type `NodeProvisioningMode` with values `NodeProvisioningModeAuto`, `NodeProvisioningModeManual` +- New enum type `Protocol` with values `ProtocolTCP`, `ProtocolUDP` +- New enum type `RestrictionLevel` with values `RestrictionLevelReadOnly`, `RestrictionLevelUnrestricted` +- New function `*ClientFactory.NewMachinesClient() *MachinesClient` +- New function `*ClientFactory.NewManagedClusterSnapshotsClient() *ManagedClusterSnapshotsClient` +- New function `NewMachinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MachinesClient, error)` +- New function `*MachinesClient.Get(context.Context, string, string, string, string, *MachinesClientGetOptions) (MachinesClientGetResponse, error)` +- New function `*MachinesClient.NewListPager(string, string, string, *MachinesClientListOptions) *runtime.Pager[MachinesClientListResponse]` +- New function `NewManagedClusterSnapshotsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedClusterSnapshotsClient, error)` +- New function `*ManagedClusterSnapshotsClient.CreateOrUpdate(context.Context, string, string, ManagedClusterSnapshot, *ManagedClusterSnapshotsClientCreateOrUpdateOptions) (ManagedClusterSnapshotsClientCreateOrUpdateResponse, error)` +- New function `*ManagedClusterSnapshotsClient.Delete(context.Context, string, string, *ManagedClusterSnapshotsClientDeleteOptions) (ManagedClusterSnapshotsClientDeleteResponse, error)` +- New function `*ManagedClusterSnapshotsClient.Get(context.Context, string, string, *ManagedClusterSnapshotsClientGetOptions) (ManagedClusterSnapshotsClientGetResponse, error)` +- New function `*ManagedClusterSnapshotsClient.NewListByResourceGroupPager(string, *ManagedClusterSnapshotsClientListByResourceGroupOptions) *runtime.Pager[ManagedClusterSnapshotsClientListByResourceGroupResponse]` +- New function `*ManagedClusterSnapshotsClient.NewListPager(*ManagedClusterSnapshotsClientListOptions) *runtime.Pager[ManagedClusterSnapshotsClientListResponse]` +- New function `*ManagedClusterSnapshotsClient.UpdateTags(context.Context, string, string, TagsObject, *ManagedClusterSnapshotsClientUpdateTagsOptions) (ManagedClusterSnapshotsClientUpdateTagsResponse, error)` +- New function `*ManagedClustersClient.GetGuardrailsVersions(context.Context, string, string, *ManagedClustersClientGetGuardrailsVersionsOptions) (ManagedClustersClientGetGuardrailsVersionsResponse, error)` +- New function `*ManagedClustersClient.NewListGuardrailsVersionsPager(string, *ManagedClustersClientListGuardrailsVersionsOptions) *runtime.Pager[ManagedClustersClientListGuardrailsVersionsResponse]` +- New struct `AgentPoolArtifactStreamingProfile` +- New struct `AgentPoolGPUProfile` +- New struct `AgentPoolNetworkProfile` +- New struct `AgentPoolSecurityProfile` +- New struct `AgentPoolWindowsProfile` +- New struct `GuardrailsAvailableVersion` +- New struct `GuardrailsAvailableVersionsList` +- New struct `GuardrailsAvailableVersionsProperties` +- New struct `GuardrailsProfile` +- New struct `IPTag` +- New struct `Machine` +- New struct `MachineIPAddress` +- New struct `MachineListResult` +- New struct `MachineNetworkProperties` +- New struct `MachineProperties` +- New struct `ManagedClusterAIToolchainOperatorProfile` +- New struct `ManagedClusterAzureMonitorProfileAppMonitoring` +- New struct `ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics` +- New struct `ManagedClusterAzureMonitorProfileContainerInsights` +- New struct `ManagedClusterAzureMonitorProfileLogs` +- New struct `ManagedClusterAzureMonitorProfileWindowsHostLogs` +- New struct `ManagedClusterCostAnalysis` +- New struct `ManagedClusterIngressProfile` +- New struct `ManagedClusterIngressProfileWebAppRouting` +- New struct `ManagedClusterMetricsProfile` +- New struct `ManagedClusterNodeProvisioningProfile` +- New struct `ManagedClusterNodeResourceGroupProfile` +- New struct `ManagedClusterPropertiesForSnapshot` +- New struct `ManagedClusterSecurityProfileImageIntegrity` +- New struct `ManagedClusterSecurityProfileNodeRestriction` +- New struct `ManagedClusterSnapshot` +- New struct `ManagedClusterSnapshotListResult` +- New struct `ManagedClusterSnapshotProperties` +- New struct `NetworkMonitoring` +- New struct `NetworkProfileForSnapshot` +- New struct `NetworkProfileKubeProxyConfig` +- New struct `NetworkProfileKubeProxyConfigIpvsConfig` +- New struct `PortRange` +- New field `NodeSoakDurationInMinutes` in struct `AgentPoolUpgradeSettings` +- New field `IgnorePodDisruptionBudget` in struct `AgentPoolsClientBeginDeleteOptions` +- New field `EnableVnetIntegration`, `SubnetID` in struct `ManagedClusterAPIServerAccessProfile` +- New field `ArtifactStreamingProfile`, `CapacityReservationGroupID`, `EnableCustomCATrust`, `GpuProfile`, `MessageOfTheDay`, `NetworkProfile`, `SecurityProfile`, `WindowsProfile` in struct `ManagedClusterAgentPoolProfile` +- New field `ArtifactStreamingProfile`, `CapacityReservationGroupID`, `EnableCustomCATrust`, `GpuProfile`, `MessageOfTheDay`, `NetworkProfile`, `SecurityProfile`, `WindowsProfile` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `Logs` in struct `ManagedClusterAzureMonitorProfile` +- New field `AppMonitoringOpenTelemetryMetrics` in struct `ManagedClusterAzureMonitorProfileMetrics` +- New field `EffectiveNoProxy` in struct `ManagedClusterHTTPProxyConfig` +- New field `BackendPoolType` in struct `ManagedClusterLoadBalancerProfile` +- New field `AiToolchainOperatorProfile`, `CreationData`, `EnableNamespaceResources`, `GuardrailsProfile`, `IngressProfile`, `MetricsProfile`, `NodeProvisioningProfile`, `NodeResourceGroupProfile` in struct `ManagedClusterProperties` +- New field `DaemonsetEvictionForEmptyNodes`, `DaemonsetEvictionForOccupiedNodes`, `Expanders`, `IgnoreDaemonsetsUtilization` in struct `ManagedClusterPropertiesAutoScalerProfile` +- New field `CustomCATrustCertificates`, `ImageIntegrity`, `NodeRestriction` in struct `ManagedClusterSecurityProfile` +- New field `Version` in struct `ManagedClusterStorageProfileDiskCSIDriver` +- New field `AddonAutoscaling` in struct `ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler` +- New field `IgnorePodDisruptionBudget` in struct `ManagedClustersClientBeginDeleteOptions` +- New field `KubeProxyConfig`, `Monitoring` in struct `NetworkProfile` + + +## 4.5.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. +- New enum type `TrustedAccessRoleBindingProvisioningState` with values `TrustedAccessRoleBindingProvisioningStateCanceled`, `TrustedAccessRoleBindingProvisioningStateDeleting`, `TrustedAccessRoleBindingProvisioningStateFailed`, `TrustedAccessRoleBindingProvisioningStateSucceeded`, `TrustedAccessRoleBindingProvisioningStateUpdating` +- New function `*ClientFactory.NewTrustedAccessRoleBindingsClient() *TrustedAccessRoleBindingsClient` +- New function `*ClientFactory.NewTrustedAccessRolesClient() *TrustedAccessRolesClient` +- New function `NewTrustedAccessRoleBindingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRoleBindingsClient, error)` +- New function `*TrustedAccessRoleBindingsClient.BeginCreateOrUpdate(context.Context, string, string, string, TrustedAccessRoleBinding, *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientCreateOrUpdateResponse], error)` +- New function `*TrustedAccessRoleBindingsClient.BeginDelete(context.Context, string, string, string, *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientDeleteResponse], error)` +- New function `*TrustedAccessRoleBindingsClient.Get(context.Context, string, string, string, *TrustedAccessRoleBindingsClientGetOptions) (TrustedAccessRoleBindingsClientGetResponse, error)` +- New function `*TrustedAccessRoleBindingsClient.NewListPager(string, string, *TrustedAccessRoleBindingsClientListOptions) *runtime.Pager[TrustedAccessRoleBindingsClientListResponse]` +- New function `NewTrustedAccessRolesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRolesClient, error)` +- New function `*TrustedAccessRolesClient.NewListPager(string, *TrustedAccessRolesClientListOptions) *runtime.Pager[TrustedAccessRolesClientListResponse]` +- New struct `TrustedAccessRole` +- New struct `TrustedAccessRoleBinding` +- New struct `TrustedAccessRoleBindingListResult` +- New struct `TrustedAccessRoleBindingProperties` +- New struct `TrustedAccessRoleListResult` +- New struct `TrustedAccessRoleRule` + + +## 4.5.0-beta.1 (2023-10-27) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. +- New value `NetworkPolicyNone` added to enum type `NetworkPolicy` +- New value `NodeOSUpgradeChannelSecurityPatch` added to enum type `NodeOSUpgradeChannel` +- New value `OSSKUMariner` added to enum type `OSSKU` +- New value `PublicNetworkAccessSecuredByPerimeter` added to enum type `PublicNetworkAccess` +- New value `SnapshotTypeManagedCluster` added to enum type `SnapshotType` +- New value `WorkloadRuntimeKataMshvVMIsolation` added to enum type `WorkloadRuntime` +- New enum type `AddonAutoscaling` with values `AddonAutoscalingDisabled`, `AddonAutoscalingEnabled` +- New enum type `AgentPoolSSHAccess` with values `AgentPoolSSHAccessDisabled`, `AgentPoolSSHAccessLocalUser` +- New enum type `BackendPoolType` with values `BackendPoolTypeNodeIP`, `BackendPoolTypeNodeIPConfiguration` +- New enum type `GuardrailsSupport` with values `GuardrailsSupportPreview`, `GuardrailsSupportStable` +- New enum type `IpvsScheduler` with values `IpvsSchedulerLeastConnection`, `IpvsSchedulerRoundRobin` +- New enum type `Level` with values `LevelEnforcement`, `LevelOff`, `LevelWarning` +- New enum type `Mode` with values `ModeIPTABLES`, `ModeIPVS` +- New enum type `Protocol` with values `ProtocolTCP`, `ProtocolUDP` +- New enum type `RestrictionLevel` with values `RestrictionLevelReadOnly`, `RestrictionLevelUnrestricted` +- New enum type `TrustedAccessRoleBindingProvisioningState` with values `TrustedAccessRoleBindingProvisioningStateCanceled`, `TrustedAccessRoleBindingProvisioningStateDeleting`, `TrustedAccessRoleBindingProvisioningStateFailed`, `TrustedAccessRoleBindingProvisioningStateSucceeded`, `TrustedAccessRoleBindingProvisioningStateUpdating` +- New function `*ClientFactory.NewMachinesClient() *MachinesClient` +- New function `*ClientFactory.NewManagedClusterSnapshotsClient() *ManagedClusterSnapshotsClient` +- New function `*ClientFactory.NewTrustedAccessRoleBindingsClient() *TrustedAccessRoleBindingsClient` +- New function `*ClientFactory.NewTrustedAccessRolesClient() *TrustedAccessRolesClient` +- New function `NewMachinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MachinesClient, error)` +- New function `*MachinesClient.Get(context.Context, string, string, string, string, *MachinesClientGetOptions) (MachinesClientGetResponse, error)` +- New function `*MachinesClient.NewListPager(string, string, string, *MachinesClientListOptions) *runtime.Pager[MachinesClientListResponse]` +- New function `NewManagedClusterSnapshotsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedClusterSnapshotsClient, error)` +- New function `*ManagedClusterSnapshotsClient.CreateOrUpdate(context.Context, string, string, ManagedClusterSnapshot, *ManagedClusterSnapshotsClientCreateOrUpdateOptions) (ManagedClusterSnapshotsClientCreateOrUpdateResponse, error)` +- New function `*ManagedClusterSnapshotsClient.Delete(context.Context, string, string, *ManagedClusterSnapshotsClientDeleteOptions) (ManagedClusterSnapshotsClientDeleteResponse, error)` +- New function `*ManagedClusterSnapshotsClient.Get(context.Context, string, string, *ManagedClusterSnapshotsClientGetOptions) (ManagedClusterSnapshotsClientGetResponse, error)` +- New function `*ManagedClusterSnapshotsClient.NewListByResourceGroupPager(string, *ManagedClusterSnapshotsClientListByResourceGroupOptions) *runtime.Pager[ManagedClusterSnapshotsClientListByResourceGroupResponse]` +- New function `*ManagedClusterSnapshotsClient.NewListPager(*ManagedClusterSnapshotsClientListOptions) *runtime.Pager[ManagedClusterSnapshotsClientListResponse]` +- New function `*ManagedClusterSnapshotsClient.UpdateTags(context.Context, string, string, TagsObject, *ManagedClusterSnapshotsClientUpdateTagsOptions) (ManagedClusterSnapshotsClientUpdateTagsResponse, error)` +- New function `*ManagedClustersClient.GetGuardrailsVersions(context.Context, string, string, *ManagedClustersClientGetGuardrailsVersionsOptions) (ManagedClustersClientGetGuardrailsVersionsResponse, error)` +- New function `*ManagedClustersClient.NewListGuardrailsVersionsPager(string, *ManagedClustersClientListGuardrailsVersionsOptions) *runtime.Pager[ManagedClustersClientListGuardrailsVersionsResponse]` +- New function `NewTrustedAccessRoleBindingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRoleBindingsClient, error)` +- New function `*TrustedAccessRoleBindingsClient.BeginCreateOrUpdate(context.Context, string, string, string, TrustedAccessRoleBinding, *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientCreateOrUpdateResponse], error)` +- New function `*TrustedAccessRoleBindingsClient.BeginDelete(context.Context, string, string, string, *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientDeleteResponse], error)` +- New function `*TrustedAccessRoleBindingsClient.Get(context.Context, string, string, string, *TrustedAccessRoleBindingsClientGetOptions) (TrustedAccessRoleBindingsClientGetResponse, error)` +- New function `*TrustedAccessRoleBindingsClient.NewListPager(string, string, *TrustedAccessRoleBindingsClientListOptions) *runtime.Pager[TrustedAccessRoleBindingsClientListResponse]` +- New function `NewTrustedAccessRolesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRolesClient, error)` +- New function `*TrustedAccessRolesClient.NewListPager(string, *TrustedAccessRolesClientListOptions) *runtime.Pager[TrustedAccessRolesClientListResponse]` +- New struct `AgentPoolNetworkProfile` +- New struct `AgentPoolSecurityProfile` +- New struct `AgentPoolWindowsProfile` +- New struct `GuardrailsAvailableVersion` +- New struct `GuardrailsAvailableVersionsList` +- New struct `GuardrailsAvailableVersionsProperties` +- New struct `GuardrailsProfile` +- New struct `IPTag` +- New struct `Machine` +- New struct `MachineIPAddress` +- New struct `MachineListResult` +- New struct `MachineNetworkProperties` +- New struct `MachineProperties` +- New struct `ManagedClusterAzureMonitorProfileAppMonitoring` +- New struct `ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics` +- New struct `ManagedClusterAzureMonitorProfileContainerInsights` +- New struct `ManagedClusterAzureMonitorProfileLogs` +- New struct `ManagedClusterAzureMonitorProfileWindowsHostLogs` +- New struct `ManagedClusterCostAnalysis` +- New struct `ManagedClusterIngressProfile` +- New struct `ManagedClusterIngressProfileWebAppRouting` +- New struct `ManagedClusterMetricsProfile` +- New struct `ManagedClusterNodeResourceGroupProfile` +- New struct `ManagedClusterPropertiesForSnapshot` +- New struct `ManagedClusterSecurityProfileImageIntegrity` +- New struct `ManagedClusterSecurityProfileNodeRestriction` +- New struct `ManagedClusterSnapshot` +- New struct `ManagedClusterSnapshotListResult` +- New struct `ManagedClusterSnapshotProperties` +- New struct `NetworkMonitoring` +- New struct `NetworkProfileForSnapshot` +- New struct `NetworkProfileKubeProxyConfig` +- New struct `NetworkProfileKubeProxyConfigIpvsConfig` +- New struct `PortRange` +- New struct `TrustedAccessRole` +- New struct `TrustedAccessRoleBinding` +- New struct `TrustedAccessRoleBindingListResult` +- New struct `TrustedAccessRoleBindingProperties` +- New struct `TrustedAccessRoleListResult` +- New struct `TrustedAccessRoleRule` +- New field `IgnorePodDisruptionBudget` in struct `AgentPoolsClientBeginDeleteOptions` +- New field `EnableVnetIntegration`, `SubnetID` in struct `ManagedClusterAPIServerAccessProfile` +- New field `CapacityReservationGroupID`, `EnableCustomCATrust`, `MessageOfTheDay`, `NetworkProfile`, `SecurityProfile`, `WindowsProfile` in struct `ManagedClusterAgentPoolProfile` +- New field `CapacityReservationGroupID`, `EnableCustomCATrust`, `MessageOfTheDay`, `NetworkProfile`, `SecurityProfile`, `WindowsProfile` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `Logs` in struct `ManagedClusterAzureMonitorProfile` +- New field `AppMonitoringOpenTelemetryMetrics` in struct `ManagedClusterAzureMonitorProfileMetrics` +- New field `EffectiveNoProxy` in struct `ManagedClusterHTTPProxyConfig` +- New field `BackendPoolType` in struct `ManagedClusterLoadBalancerProfile` +- New field `CreationData`, `EnableNamespaceResources`, `GuardrailsProfile`, `IngressProfile`, `MetricsProfile`, `NodeResourceGroupProfile` in struct `ManagedClusterProperties` +- New field `DaemonsetEvictionForEmptyNodes`, `DaemonsetEvictionForOccupiedNodes`, `Expanders`, `IgnoreDaemonsetsUtilization` in struct `ManagedClusterPropertiesAutoScalerProfile` +- New field `CustomCATrustCertificates`, `ImageIntegrity`, `NodeRestriction` in struct `ManagedClusterSecurityProfile` +- New field `Version` in struct `ManagedClusterStorageProfileDiskCSIDriver` +- New field `AddonAutoscaling` in struct `ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler` +- New field `IgnorePodDisruptionBudget` in struct `ManagedClustersClientBeginDeleteOptions` +- New field `KubeProxyConfig`, `Monitoring` in struct `NetworkProfile` + + +## 4.4.0 (2023-10-27) +### Features Added + +- New enum type `IstioIngressGatewayMode` with values `IstioIngressGatewayModeExternal`, `IstioIngressGatewayModeInternal` +- New enum type `ServiceMeshMode` with values `ServiceMeshModeDisabled`, `ServiceMeshModeIstio` +- New function `*ManagedClustersClient.GetMeshRevisionProfile(context.Context, string, string, *ManagedClustersClientGetMeshRevisionProfileOptions) (ManagedClustersClientGetMeshRevisionProfileResponse, error)` +- New function `*ManagedClustersClient.GetMeshUpgradeProfile(context.Context, string, string, string, *ManagedClustersClientGetMeshUpgradeProfileOptions) (ManagedClustersClientGetMeshUpgradeProfileResponse, error)` +- New function `*ManagedClustersClient.NewListMeshRevisionProfilesPager(string, *ManagedClustersClientListMeshRevisionProfilesOptions) *runtime.Pager[ManagedClustersClientListMeshRevisionProfilesResponse]` +- New function `*ManagedClustersClient.NewListMeshUpgradeProfilesPager(string, string, *ManagedClustersClientListMeshUpgradeProfilesOptions) *runtime.Pager[ManagedClustersClientListMeshUpgradeProfilesResponse]` +- New struct `CompatibleVersions` +- New struct `IstioCertificateAuthority` +- New struct `IstioComponents` +- New struct `IstioEgressGateway` +- New struct `IstioIngressGateway` +- New struct `IstioPluginCertificateAuthority` +- New struct `IstioServiceMesh` +- New struct `MeshRevision` +- New struct `MeshRevisionProfile` +- New struct `MeshRevisionProfileList` +- New struct `MeshRevisionProfileProperties` +- New struct `MeshUpgradeProfile` +- New struct `MeshUpgradeProfileList` +- New struct `MeshUpgradeProfileProperties` +- New struct `ServiceMeshProfile` +- New field `ResourceUID`, `ServiceMeshProfile` in struct `ManagedClusterProperties` + + +## 4.4.0-beta.2 (2023-10-09) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + +## 4.4.0-beta.1 (2023-09-22) +### Features Added + +- New value `NodeOSUpgradeChannelSecurityPatch` added to enum type `NodeOSUpgradeChannel` +- New value `OSSKUMariner` added to enum type `OSSKU` +- New value `PublicNetworkAccessSecuredByPerimeter` added to enum type `PublicNetworkAccess` +- New value `SnapshotTypeManagedCluster` added to enum type `SnapshotType` +- New value `WorkloadRuntimeKataMshvVMIsolation` added to enum type `WorkloadRuntime` +- New enum type `AgentPoolSSHAccess` with values `AgentPoolSSHAccessDisabled`, `AgentPoolSSHAccessLocalUser` +- New enum type `BackendPoolType` with values `BackendPoolTypeNodeIP`, `BackendPoolTypeNodeIPConfiguration` +- New enum type `GuardrailsSupport` with values `GuardrailsSupportPreview`, `GuardrailsSupportStable` +- New enum type `IpvsScheduler` with values `IpvsSchedulerLeastConnection`, `IpvsSchedulerRoundRobin` +- New enum type `IstioIngressGatewayMode` with values `IstioIngressGatewayModeExternal`, `IstioIngressGatewayModeInternal` +- New enum type `Level` with values `LevelEnforcement`, `LevelOff`, `LevelWarning` +- New enum type `Mode` with values `ModeIPTABLES`, `ModeIPVS` +- New enum type `Protocol` with values `ProtocolTCP`, `ProtocolUDP` +- New enum type `RestrictionLevel` with values `RestrictionLevelReadOnly`, `RestrictionLevelUnrestricted` +- New enum type `ServiceMeshMode` with values `ServiceMeshModeDisabled`, `ServiceMeshModeIstio` +- New enum type `TrustedAccessRoleBindingProvisioningState` with values `TrustedAccessRoleBindingProvisioningStateCanceled`, `TrustedAccessRoleBindingProvisioningStateDeleting`, `TrustedAccessRoleBindingProvisioningStateFailed`, `TrustedAccessRoleBindingProvisioningStateSucceeded`, `TrustedAccessRoleBindingProvisioningStateUpdating` +- New function `*ClientFactory.NewMachinesClient() *MachinesClient` +- New function `*ClientFactory.NewManagedClusterSnapshotsClient() *ManagedClusterSnapshotsClient` +- New function `*ClientFactory.NewTrustedAccessRoleBindingsClient() *TrustedAccessRoleBindingsClient` +- New function `*ClientFactory.NewTrustedAccessRolesClient() *TrustedAccessRolesClient` +- New function `NewMachinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MachinesClient, error)` +- New function `*MachinesClient.Get(context.Context, string, string, string, string, *MachinesClientGetOptions) (MachinesClientGetResponse, error)` +- New function `*MachinesClient.NewListPager(string, string, string, *MachinesClientListOptions) *runtime.Pager[MachinesClientListResponse]` +- New function `NewManagedClusterSnapshotsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedClusterSnapshotsClient, error)` +- New function `*ManagedClusterSnapshotsClient.CreateOrUpdate(context.Context, string, string, ManagedClusterSnapshot, *ManagedClusterSnapshotsClientCreateOrUpdateOptions) (ManagedClusterSnapshotsClientCreateOrUpdateResponse, error)` +- New function `*ManagedClusterSnapshotsClient.Delete(context.Context, string, string, *ManagedClusterSnapshotsClientDeleteOptions) (ManagedClusterSnapshotsClientDeleteResponse, error)` +- New function `*ManagedClusterSnapshotsClient.Get(context.Context, string, string, *ManagedClusterSnapshotsClientGetOptions) (ManagedClusterSnapshotsClientGetResponse, error)` +- New function `*ManagedClusterSnapshotsClient.NewListByResourceGroupPager(string, *ManagedClusterSnapshotsClientListByResourceGroupOptions) *runtime.Pager[ManagedClusterSnapshotsClientListByResourceGroupResponse]` +- New function `*ManagedClusterSnapshotsClient.NewListPager(*ManagedClusterSnapshotsClientListOptions) *runtime.Pager[ManagedClusterSnapshotsClientListResponse]` +- New function `*ManagedClusterSnapshotsClient.UpdateTags(context.Context, string, string, TagsObject, *ManagedClusterSnapshotsClientUpdateTagsOptions) (ManagedClusterSnapshotsClientUpdateTagsResponse, error)` +- New function `*ManagedClustersClient.GetGuardrailsVersions(context.Context, string, string, *ManagedClustersClientGetGuardrailsVersionsOptions) (ManagedClustersClientGetGuardrailsVersionsResponse, error)` +- New function `*ManagedClustersClient.GetMeshRevisionProfile(context.Context, string, string, *ManagedClustersClientGetMeshRevisionProfileOptions) (ManagedClustersClientGetMeshRevisionProfileResponse, error)` +- New function `*ManagedClustersClient.GetMeshUpgradeProfile(context.Context, string, string, string, *ManagedClustersClientGetMeshUpgradeProfileOptions) (ManagedClustersClientGetMeshUpgradeProfileResponse, error)` +- New function `*ManagedClustersClient.NewListGuardrailsVersionsPager(string, *ManagedClustersClientListGuardrailsVersionsOptions) *runtime.Pager[ManagedClustersClientListGuardrailsVersionsResponse]` +- New function `*ManagedClustersClient.NewListMeshRevisionProfilesPager(string, *ManagedClustersClientListMeshRevisionProfilesOptions) *runtime.Pager[ManagedClustersClientListMeshRevisionProfilesResponse]` +- New function `*ManagedClustersClient.NewListMeshUpgradeProfilesPager(string, string, *ManagedClustersClientListMeshUpgradeProfilesOptions) *runtime.Pager[ManagedClustersClientListMeshUpgradeProfilesResponse]` +- New function `NewTrustedAccessRoleBindingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRoleBindingsClient, error)` +- New function `*TrustedAccessRoleBindingsClient.CreateOrUpdate(context.Context, string, string, string, TrustedAccessRoleBinding, *TrustedAccessRoleBindingsClientCreateOrUpdateOptions) (TrustedAccessRoleBindingsClientCreateOrUpdateResponse, error)` +- New function `*TrustedAccessRoleBindingsClient.Delete(context.Context, string, string, string, *TrustedAccessRoleBindingsClientDeleteOptions) (TrustedAccessRoleBindingsClientDeleteResponse, error)` +- New function `*TrustedAccessRoleBindingsClient.Get(context.Context, string, string, string, *TrustedAccessRoleBindingsClientGetOptions) (TrustedAccessRoleBindingsClientGetResponse, error)` +- New function `*TrustedAccessRoleBindingsClient.NewListPager(string, string, *TrustedAccessRoleBindingsClientListOptions) *runtime.Pager[TrustedAccessRoleBindingsClientListResponse]` +- New function `NewTrustedAccessRolesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRolesClient, error)` +- New function `*TrustedAccessRolesClient.NewListPager(string, *TrustedAccessRolesClientListOptions) *runtime.Pager[TrustedAccessRolesClientListResponse]` +- New struct `AgentPoolNetworkProfile` +- New struct `AgentPoolSecurityProfile` +- New struct `AgentPoolWindowsProfile` +- New struct `CompatibleVersions` +- New struct `GuardrailsAvailableVersion` +- New struct `GuardrailsAvailableVersionsList` +- New struct `GuardrailsAvailableVersionsProperties` +- New struct `GuardrailsProfile` +- New struct `IPTag` +- New struct `IstioCertificateAuthority` +- New struct `IstioComponents` +- New struct `IstioIngressGateway` +- New struct `IstioPluginCertificateAuthority` +- New struct `IstioServiceMesh` +- New struct `Machine` +- New struct `MachineIPAddress` +- New struct `MachineListResult` +- New struct `MachineNetworkProperties` +- New struct `MachineProperties` +- New struct `ManagedClusterAzureMonitorProfileAppMonitoring` +- New struct `ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics` +- New struct `ManagedClusterAzureMonitorProfileContainerInsights` +- New struct `ManagedClusterAzureMonitorProfileLogs` +- New struct `ManagedClusterAzureMonitorProfileWindowsHostLogs` +- New struct `ManagedClusterCostAnalysis` +- New struct `ManagedClusterIngressProfile` +- New struct `ManagedClusterIngressProfileWebAppRouting` +- New struct `ManagedClusterMetricsProfile` +- New struct `ManagedClusterNodeResourceGroupProfile` +- New struct `ManagedClusterPropertiesForSnapshot` +- New struct `ManagedClusterSecurityProfileImageIntegrity` +- New struct `ManagedClusterSecurityProfileNodeRestriction` +- New struct `ManagedClusterSnapshot` +- New struct `ManagedClusterSnapshotListResult` +- New struct `ManagedClusterSnapshotProperties` +- New struct `MeshRevision` +- New struct `MeshRevisionProfile` +- New struct `MeshRevisionProfileList` +- New struct `MeshRevisionProfileProperties` +- New struct `MeshUpgradeProfile` +- New struct `MeshUpgradeProfileList` +- New struct `MeshUpgradeProfileProperties` +- New struct `NetworkMonitoring` +- New struct `NetworkProfileForSnapshot` +- New struct `NetworkProfileKubeProxyConfig` +- New struct `NetworkProfileKubeProxyConfigIpvsConfig` +- New struct `PortRange` +- New struct `ServiceMeshProfile` +- New struct `TrustedAccessRole` +- New struct `TrustedAccessRoleBinding` +- New struct `TrustedAccessRoleBindingListResult` +- New struct `TrustedAccessRoleBindingProperties` +- New struct `TrustedAccessRoleListResult` +- New struct `TrustedAccessRoleRule` +- New field `IgnorePodDisruptionBudget` in struct `AgentPoolsClientBeginDeleteOptions` +- New field `EnableVnetIntegration`, `SubnetID` in struct `ManagedClusterAPIServerAccessProfile` +- New field `CapacityReservationGroupID`, `EnableCustomCATrust`, `MessageOfTheDay`, `NetworkProfile`, `SecurityProfile`, `WindowsProfile` in struct `ManagedClusterAgentPoolProfile` +- New field `CapacityReservationGroupID`, `EnableCustomCATrust`, `MessageOfTheDay`, `NetworkProfile`, `SecurityProfile`, `WindowsProfile` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `Logs` in struct `ManagedClusterAzureMonitorProfile` +- New field `AppMonitoringOpenTelemetryMetrics` in struct `ManagedClusterAzureMonitorProfileMetrics` +- New field `EffectiveNoProxy` in struct `ManagedClusterHTTPProxyConfig` +- New field `BackendPoolType` in struct `ManagedClusterLoadBalancerProfile` +- New field `CreationData`, `EnableNamespaceResources`, `GuardrailsProfile`, `IngressProfile`, `MetricsProfile`, `NodeResourceGroupProfile`, `ResourceUID`, `ServiceMeshProfile` in struct `ManagedClusterProperties` +- New field `CustomCATrustCertificates`, `ImageIntegrity`, `NodeRestriction` in struct `ManagedClusterSecurityProfile` +- New field `Version` in struct `ManagedClusterStorageProfileDiskCSIDriver` +- New field `IgnorePodDisruptionBudget` in struct `ManagedClustersClientBeginDeleteOptions` +- New field `KubeProxyConfig`, `Monitoring` in struct `NetworkProfile` + + +## 4.3.0 (2023-08-25) +### Features Added + +- New struct `ClusterUpgradeSettings` +- New struct `UpgradeOverrideSettings` +- New field `UpgradeSettings` in struct `ManagedClusterProperties` + + +## 4.2.0 (2023-08-25) +### Features Added + +- New enum type `NodeOSUpgradeChannel` with values `NodeOSUpgradeChannelNodeImage`, `NodeOSUpgradeChannelNone`, `NodeOSUpgradeChannelUnmanaged` +- New struct `DelegatedResource` +- New struct `ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler` +- New field `DrainTimeoutInMinutes` in struct `AgentPoolUpgradeSettings` +- New field `NodeOSUpgradeChannel` in struct `ManagedClusterAutoUpgradeProfile` +- New field `DelegatedResources` in struct `ManagedClusterIdentity` +- New field `VerticalPodAutoscaler` in struct `ManagedClusterWorkloadAutoScalerProfile` + + +## 4.1.0 (2023-07-28) +### Features Added + +- New enum type `Type` with values `TypeFirst`, `TypeFourth`, `TypeLast`, `TypeSecond`, `TypeThird` +- New struct `AbsoluteMonthlySchedule` +- New struct `DailySchedule` +- New struct `DateSpan` +- New struct `MaintenanceWindow` +- New struct `RelativeMonthlySchedule` +- New struct `Schedule` +- New struct `WeeklySchedule` +- New field `MaintenanceWindow` in struct `MaintenanceConfigurationProperties` + + +## 4.0.0 (2023-05-26) +### Breaking Changes + +- Field `DockerBridgeCidr` of struct `NetworkProfile` has been removed + +### Features Added + +- New value `OSSKUAzureLinux` added to enum type `OSSKU` + + +## 3.0.0 (2023-04-28) +### Breaking Changes + +- Const `ManagedClusterSKUNameBasic` from type alias `ManagedClusterSKUName` has been removed +- Const `ManagedClusterSKUTierPaid` from type alias `ManagedClusterSKUTier` has been removed + +### Features Added + +- New value `ManagedClusterSKUTierPremium` added to enum type `ManagedClusterSKUTier` +- New value `NetworkPolicyCilium` added to enum type `NetworkPolicy` +- New enum type `KubernetesSupportPlan` with values `KubernetesSupportPlanAKSLongTermSupport`, `KubernetesSupportPlanKubernetesOfficial` +- New enum type `NetworkDataplane` with values `NetworkDataplaneAzure`, `NetworkDataplaneCilium` +- New enum type `NetworkPluginMode` with values `NetworkPluginModeOverlay` +- New function `*ManagedClustersClient.ListKubernetesVersions(context.Context, string, *ManagedClustersClientListKubernetesVersionsOptions) (ManagedClustersClientListKubernetesVersionsResponse, error)` +- New struct `KubernetesPatchVersion` +- New struct `KubernetesVersion` +- New struct `KubernetesVersionCapabilities` +- New struct `KubernetesVersionListResult` +- New struct `ManagedClusterSecurityProfileImageCleaner` +- New struct `ManagedClusterSecurityProfileWorkloadIdentity` +- New field `SupportPlan` in struct `ManagedClusterProperties` +- New field `ImageCleaner` in struct `ManagedClusterSecurityProfile` +- New field `WorkloadIdentity` in struct `ManagedClusterSecurityProfile` +- New field `NetworkDataplane` in struct `NetworkProfile` +- New field `NetworkPluginMode` in struct `NetworkProfile` + + +## 2.4.0 (2023-03-24) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module +- New value `ManagedClusterSKUNameBase` added to enum type `ManagedClusterSKUName` +- New value `ManagedClusterSKUTierStandard` added to enum type `ManagedClusterSKUTier` +- New function `*AgentPoolsClient.BeginAbortLatestOperation(context.Context, string, string, string, *AgentPoolsClientBeginAbortLatestOperationOptions) (*runtime.Poller[AgentPoolsClientAbortLatestOperationResponse], error)` +- New function `*ManagedClustersClient.BeginAbortLatestOperation(context.Context, string, string, *ManagedClustersClientBeginAbortLatestOperationOptions) (*runtime.Poller[ManagedClustersClientAbortLatestOperationResponse], error)` +- New struct `ManagedClusterAzureMonitorProfile` +- New struct `ManagedClusterAzureMonitorProfileKubeStateMetrics` +- New struct `ManagedClusterAzureMonitorProfileMetrics` +- New field `AzureMonitorProfile` in struct `ManagedClusterProperties` + + +## 2.3.0 (2023-01-27) +### Features Added + +- New value `ManagedClusterPodIdentityProvisioningStateCanceled`, `ManagedClusterPodIdentityProvisioningStateSucceeded` added to type alias `ManagedClusterPodIdentityProvisioningState` +- New value `PrivateEndpointConnectionProvisioningStateCanceled` added to type alias `PrivateEndpointConnectionProvisioningState` +- New struct `ManagedClusterWorkloadAutoScalerProfile` +- New struct `ManagedClusterWorkloadAutoScalerProfileKeda` +- New field `WorkloadAutoScalerProfile` in struct `ManagedClusterProperties` +- New field `Location` in struct `ManagedClustersClientGetCommandResultResponse` + + +## 2.2.0 (2022-10-26) +### Features Added + +- New function `*ManagedClustersClient.BeginRotateServiceAccountSigningKeys(context.Context, string, string, *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*runtime.Poller[ManagedClustersClientRotateServiceAccountSigningKeysResponse], error)` +- New struct `ManagedClusterOIDCIssuerProfile` +- New struct `ManagedClusterStorageProfileBlobCSIDriver` +- New struct `ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions` +- New struct `ManagedClustersClientRotateServiceAccountSigningKeysResponse` +- New field `BlobCSIDriver` in struct `ManagedClusterStorageProfile` +- New field `OidcIssuerProfile` in struct `ManagedClusterProperties` + + +## 2.1.0 (2022-08-25) +### Features Added + +- New const `OSSKUWindows2019` +- New const `OSSKUWindows2022` + + +## 2.0.0 (2022-07-22) +### Breaking Changes + +- Struct `ManagedClusterSecurityProfileAzureDefender` has been removed +- Field `AzureDefender` of struct `ManagedClusterSecurityProfile` has been removed + +### Features Added + +- New const `KeyVaultNetworkAccessTypesPrivate` +- New const `NetworkPluginNone` +- New const `KeyVaultNetworkAccessTypesPublic` +- New function `PossibleKeyVaultNetworkAccessTypesValues() []KeyVaultNetworkAccessTypes` +- New struct `AzureKeyVaultKms` +- New struct `ManagedClusterSecurityProfileDefender` +- New struct `ManagedClusterSecurityProfileDefenderSecurityMonitoring` +- New field `HostGroupID` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `HostGroupID` in struct `ManagedClusterAgentPoolProfile` +- New field `AzureKeyVaultKms` in struct `ManagedClusterSecurityProfile` +- New field `Defender` in struct `ManagedClusterSecurityProfile` + + +## 1.0.0 (2022-05-16) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice` 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/containerservice/armcontainerservice/v4/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/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/containerservice/armcontainerservice/v4/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/README.md new file mode 100644 index 000000000..7cdd0c92e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/README.md @@ -0,0 +1,108 @@ +# Azure Container Service Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2) + +The `armcontainerservice` module provides operations for working with Azure Container Service. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/containerservice/armcontainerservice) + +# 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 Container Service module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2 +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Container Service. 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). + +## Client Factory + +Azure Container Service module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armcontainerservice.NewClientFactory(, 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, + }, +} +clientFactory, err := armcontainerservice.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewSnapshotsClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## More sample code + +- [Agent Pool](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerservice/agent_pool) +- [Creating a Fake](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/containerservice/armcontainerservice/fake_example_test.go) +- [Maintenance Configuration](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerservice/maintenance_configurations) +- [Managed Clusters](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerservice/managed_clusters) + +## 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 `Container Service` 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/containerservice/armcontainerservice/v4/agentpools_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/agentpools_client.go new file mode 100644 index 000000000..bf2e9c712 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/agentpools_client.go @@ -0,0 +1,650 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AgentPoolsClient contains the methods for the AgentPools group. +// Don't use this type directly, use NewAgentPoolsClient() instead. +type AgentPoolsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAgentPoolsClient creates a new instance of AgentPoolsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAgentPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AgentPoolsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AgentPoolsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginAbortLatestOperation - Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a +// Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes +// before cancellation can take place, a 409 error code is returned. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - agentPoolName - The name of the agent pool. +// - options - AgentPoolsClientBeginAbortLatestOperationOptions contains the optional parameters for the AgentPoolsClient.BeginAbortLatestOperation +// method. +func (client *AgentPoolsClient) BeginAbortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginAbortLatestOperationOptions) (*runtime.Poller[AgentPoolsClientAbortLatestOperationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.abortLatestOperation(ctx, resourceGroupName, resourceName, agentPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolsClientAbortLatestOperationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolsClientAbortLatestOperationResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// AbortLatestOperation - Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling +// state and eventually to a Canceled state when cancellation finishes. If the operation completes +// before cancellation can take place, a 409 error code is returned. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *AgentPoolsClient) abortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginAbortLatestOperationOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolsClient.BeginAbortLatestOperation" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.abortLatestOperationCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// abortLatestOperationCreateRequest creates the AbortLatestOperation request. +func (client *AgentPoolsClient) abortLatestOperationCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginAbortLatestOperationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - Creates or updates an agent pool in the specified managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - agentPoolName - The name of the agent pool. +// - parameters - The agent pool to create or update. +// - options - AgentPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the AgentPoolsClient.BeginCreateOrUpdate +// method. +func (client *AgentPoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool, options *AgentPoolsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AgentPoolsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, agentPoolName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates an agent pool in the specified managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *AgentPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool, options *AgentPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AgentPoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool, options *AgentPoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes an agent pool in the specified managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - agentPoolName - The name of the agent pool. +// - options - AgentPoolsClientBeginDeleteOptions contains the optional parameters for the AgentPoolsClient.BeginDelete method. +func (client *AgentPoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*runtime.Poller[AgentPoolsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, agentPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes an agent pool in the specified managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *AgentPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified managed cluster agent pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - agentPoolName - The name of the agent pool. +// - options - AgentPoolsClientGetOptions contains the optional parameters for the AgentPoolsClient.Get method. +func (client *AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientGetOptions) (AgentPoolsClientGetResponse, error) { + var err error + const operationName = "AgentPoolsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) + if err != nil { + return AgentPoolsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentPoolsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentPoolsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AgentPoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AgentPoolsClient) getHandleResponse(resp *http.Response) (AgentPoolsClientGetResponse, error) { + result := AgentPoolsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentPool); err != nil { + return AgentPoolsClientGetResponse{}, err + } + return result, nil +} + +// GetAvailableAgentPoolVersions - See supported Kubernetes versions [https://docs.microsoft.com/azure/aks/supported-kubernetes-versions] +// for more details about the version lifecycle. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - AgentPoolsClientGetAvailableAgentPoolVersionsOptions contains the optional parameters for the AgentPoolsClient.GetAvailableAgentPoolVersions +// method. +func (client *AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string, options *AgentPoolsClientGetAvailableAgentPoolVersionsOptions) (AgentPoolsClientGetAvailableAgentPoolVersionsResponse, error) { + var err error + const operationName = "AgentPoolsClient.GetAvailableAgentPoolVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAvailableAgentPoolVersionsCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return AgentPoolsClientGetAvailableAgentPoolVersionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentPoolsClientGetAvailableAgentPoolVersionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentPoolsClientGetAvailableAgentPoolVersionsResponse{}, err + } + resp, err := client.getAvailableAgentPoolVersionsHandleResponse(httpResp) + return resp, err +} + +// getAvailableAgentPoolVersionsCreateRequest creates the GetAvailableAgentPoolVersions request. +func (client *AgentPoolsClient) getAvailableAgentPoolVersionsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *AgentPoolsClientGetAvailableAgentPoolVersionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAvailableAgentPoolVersionsHandleResponse handles the GetAvailableAgentPoolVersions response. +func (client *AgentPoolsClient) getAvailableAgentPoolVersionsHandleResponse(resp *http.Response) (AgentPoolsClientGetAvailableAgentPoolVersionsResponse, error) { + result := AgentPoolsClientGetAvailableAgentPoolVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolAvailableVersions); err != nil { + return AgentPoolsClientGetAvailableAgentPoolVersionsResponse{}, err + } + return result, nil +} + +// GetUpgradeProfile - Gets the upgrade profile for an agent pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - agentPoolName - The name of the agent pool. +// - options - AgentPoolsClientGetUpgradeProfileOptions contains the optional parameters for the AgentPoolsClient.GetUpgradeProfile +// method. +func (client *AgentPoolsClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientGetUpgradeProfileOptions) (AgentPoolsClientGetUpgradeProfileResponse, error) { + var err error + const operationName = "AgentPoolsClient.GetUpgradeProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getUpgradeProfileCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) + if err != nil { + return AgentPoolsClientGetUpgradeProfileResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentPoolsClientGetUpgradeProfileResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentPoolsClientGetUpgradeProfileResponse{}, err + } + resp, err := client.getUpgradeProfileHandleResponse(httpResp) + return resp, err +} + +// getUpgradeProfileCreateRequest creates the GetUpgradeProfile request. +func (client *AgentPoolsClient) getUpgradeProfileCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientGetUpgradeProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getUpgradeProfileHandleResponse handles the GetUpgradeProfile response. +func (client *AgentPoolsClient) getUpgradeProfileHandleResponse(resp *http.Response) (AgentPoolsClientGetUpgradeProfileResponse, error) { + result := AgentPoolsClientGetUpgradeProfileResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolUpgradeProfile); err != nil { + return AgentPoolsClientGetUpgradeProfileResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of agent pools in the specified managed cluster. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - AgentPoolsClientListOptions contains the optional parameters for the AgentPoolsClient.NewListPager method. +func (client *AgentPoolsClient) NewListPager(resourceGroupName string, resourceName string, options *AgentPoolsClientListOptions) *runtime.Pager[AgentPoolsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AgentPoolsClientListResponse]{ + More: func(page AgentPoolsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AgentPoolsClientListResponse) (AgentPoolsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AgentPoolsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, nil) + if err != nil { + return AgentPoolsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *AgentPoolsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *AgentPoolsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AgentPoolsClient) listHandleResponse(resp *http.Response) (AgentPoolsClientListResponse, error) { + result := AgentPoolsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolListResult); err != nil { + return AgentPoolsClientListResponse{}, err + } + return result, nil +} + +// BeginUpgradeNodeImageVersion - Upgrading the node image version of an agent pool applies the newest OS and runtime updates +// to the nodes. AKS provides one new image per week with the latest updates. For more details on node image +// versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - agentPoolName - The name of the agent pool. +// - options - AgentPoolsClientBeginUpgradeNodeImageVersionOptions contains the optional parameters for the AgentPoolsClient.BeginUpgradeNodeImageVersion +// method. +func (client *AgentPoolsClient) BeginUpgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginUpgradeNodeImageVersionOptions) (*runtime.Poller[AgentPoolsClientUpgradeNodeImageVersionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.upgradeNodeImageVersion(ctx, resourceGroupName, resourceName, agentPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolsClientUpgradeNodeImageVersionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolsClientUpgradeNodeImageVersionResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpgradeNodeImageVersion - Upgrading the node image version of an agent pool applies the newest OS and runtime updates to +// the nodes. AKS provides one new image per week with the latest updates. For more details on node image +// versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *AgentPoolsClient) upgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginUpgradeNodeImageVersionOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolsClient.BeginUpgradeNodeImageVersion" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.upgradeNodeImageVersionCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// upgradeNodeImageVersionCreateRequest creates the UpgradeNodeImageVersion request. +func (client *AgentPoolsClient) upgradeNodeImageVersionCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginUpgradeNodeImageVersionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-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/containerservice/armcontainerservice/v4/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/assets.json new file mode 100644 index 000000000..f0727b781 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "go", + "TagPrefix": "go/resourcemanager/containerservice/armcontainerservice", + "Tag": "go/resourcemanager/containerservice/armcontainerservice_2822db81dc" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/autorest.md new file mode 100644 index 000000000..9fccdcc2c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/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/c1ba9df47907f9012ae14ca4616aed9e5665f9e5/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/c1ba9df47907f9012ae14ca4616aed9e5665f9e5/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 4.6.0 +tag: package-2023-10 +``` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/build.go new file mode 100644 index 000000000..70432c343 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/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 -removeUnreferencedTypes resourcemanager/containerservice/armcontainerservice + +package armcontainerservice diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/ci.yml new file mode 100644 index 000000000..1c3615696 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/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/containerservice/armcontainerservice/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/containerservice/armcontainerservice/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/containerservice/armcontainerservice' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/client_factory.go new file mode 100644 index 000000000..996d5cb69 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/client_factory.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +// NewAgentPoolsClient creates a new instance of AgentPoolsClient. +func (c *ClientFactory) NewAgentPoolsClient() *AgentPoolsClient { + subClient, _ := NewAgentPoolsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewMaintenanceConfigurationsClient creates a new instance of MaintenanceConfigurationsClient. +func (c *ClientFactory) NewMaintenanceConfigurationsClient() *MaintenanceConfigurationsClient { + subClient, _ := NewMaintenanceConfigurationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewManagedClustersClient creates a new instance of ManagedClustersClient. +func (c *ClientFactory) NewManagedClustersClient() *ManagedClustersClient { + subClient, _ := NewManagedClustersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewResolvePrivateLinkServiceIDClient creates a new instance of ResolvePrivateLinkServiceIDClient. +func (c *ClientFactory) NewResolvePrivateLinkServiceIDClient() *ResolvePrivateLinkServiceIDClient { + subClient, _ := NewResolvePrivateLinkServiceIDClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSnapshotsClient creates a new instance of SnapshotsClient. +func (c *ClientFactory) NewSnapshotsClient() *SnapshotsClient { + subClient, _ := NewSnapshotsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTrustedAccessRoleBindingsClient creates a new instance of TrustedAccessRoleBindingsClient. +func (c *ClientFactory) NewTrustedAccessRoleBindingsClient() *TrustedAccessRoleBindingsClient { + subClient, _ := NewTrustedAccessRoleBindingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTrustedAccessRolesClient creates a new instance of TrustedAccessRolesClient. +func (c *ClientFactory) NewTrustedAccessRolesClient() *TrustedAccessRolesClient { + subClient, _ := NewTrustedAccessRolesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/constants.go new file mode 100644 index 000000000..23f7875b1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/constants.go @@ -0,0 +1,941 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + moduleVersion = "v4.6.0" +) + +// AgentPoolMode - A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent +// pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools +type AgentPoolMode string + +const ( + // AgentPoolModeSystem - System agent pools are primarily for hosting critical system pods such as CoreDNS and metrics-server. + // System agent pools osType must be Linux. System agent pools VM SKU must have at least 2vCPUs and 4GB of memory. + AgentPoolModeSystem AgentPoolMode = "System" + // AgentPoolModeUser - User agent pools are primarily for hosting your application pods. + AgentPoolModeUser AgentPoolMode = "User" +) + +// PossibleAgentPoolModeValues returns the possible values for the AgentPoolMode const type. +func PossibleAgentPoolModeValues() []AgentPoolMode { + return []AgentPoolMode{ + AgentPoolModeSystem, + AgentPoolModeUser, + } +} + +// AgentPoolType - The type of Agent Pool. +type AgentPoolType string + +const ( + // AgentPoolTypeAvailabilitySet - Use of this is strongly discouraged. + AgentPoolTypeAvailabilitySet AgentPoolType = "AvailabilitySet" + // AgentPoolTypeVirtualMachineScaleSets - Create an Agent Pool backed by a Virtual Machine Scale Set. + AgentPoolTypeVirtualMachineScaleSets AgentPoolType = "VirtualMachineScaleSets" +) + +// PossibleAgentPoolTypeValues returns the possible values for the AgentPoolType const type. +func PossibleAgentPoolTypeValues() []AgentPoolType { + return []AgentPoolType{ + AgentPoolTypeAvailabilitySet, + AgentPoolTypeVirtualMachineScaleSets, + } +} + +// BackendPoolType - The type of the managed inbound Load Balancer BackendPool. +type BackendPoolType string + +const ( + // BackendPoolTypeNodeIP - The type of the managed inbound Load Balancer BackendPool. https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. + BackendPoolTypeNodeIP BackendPoolType = "NodeIP" + // BackendPoolTypeNodeIPConfiguration - The type of the managed inbound Load Balancer BackendPool. https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. + BackendPoolTypeNodeIPConfiguration BackendPoolType = "NodeIPConfiguration" +) + +// PossibleBackendPoolTypeValues returns the possible values for the BackendPoolType const type. +func PossibleBackendPoolTypeValues() []BackendPoolType { + return []BackendPoolType{ + BackendPoolTypeNodeIP, + BackendPoolTypeNodeIPConfiguration, + } +} + +// Code - Tells whether the cluster is Running or Stopped +type Code string + +const ( + // CodeRunning - The cluster is running. + CodeRunning Code = "Running" + // CodeStopped - The cluster is stopped. + CodeStopped Code = "Stopped" +) + +// PossibleCodeValues returns the possible values for the Code const type. +func PossibleCodeValues() []Code { + return []Code{ + CodeRunning, + CodeStopped, + } +} + +// ConnectionStatus - The private link service connection status. +type ConnectionStatus string + +const ( + ConnectionStatusApproved ConnectionStatus = "Approved" + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + ConnectionStatusPending ConnectionStatus = "Pending" + ConnectionStatusRejected ConnectionStatus = "Rejected" +) + +// PossibleConnectionStatusValues returns the possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ + ConnectionStatusApproved, + ConnectionStatusDisconnected, + ConnectionStatusPending, + ConnectionStatusRejected, + } +} + +// 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, + } +} + +// Expander - If not specified, the default is 'random'. See expanders [https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders] +// for more information. +type Expander string + +const ( + // ExpanderLeastWaste - Selects the node group that will have the least idle CPU (if tied, unused memory) after scale-up. + // This is useful when you have different classes of nodes, for example, high CPU or high memory nodes, and only want to expand + // those when there are pending pods that need a lot of those resources. + ExpanderLeastWaste Expander = "least-waste" + // ExpanderMostPods - Selects the node group that would be able to schedule the most pods when scaling up. This is useful + // when you are using nodeSelector to make sure certain pods land on certain nodes. Note that this won't cause the autoscaler + // to select bigger nodes vs. smaller, as it can add multiple smaller nodes at once. + ExpanderMostPods Expander = "most-pods" + // ExpanderPriority - Selects the node group that has the highest priority assigned by the user. It's configuration is described + // in more details [here](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md). + ExpanderPriority Expander = "priority" + // ExpanderRandom - Used when you don't have a particular need for the node groups to scale differently. + ExpanderRandom Expander = "random" +) + +// PossibleExpanderValues returns the possible values for the Expander const type. +func PossibleExpanderValues() []Expander { + return []Expander{ + ExpanderLeastWaste, + ExpanderMostPods, + ExpanderPriority, + ExpanderRandom, + } +} + +// 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, + } +} + +type Format string + +const ( + // FormatAzure - Return azure auth-provider kubeconfig. This format is deprecated in v1.22 and will be fully removed in v1.26. + // See: https://aka.ms/k8s/changes-1-26. + FormatAzure Format = "azure" + // FormatExec - Return exec format kubeconfig. This format requires kubelogin binary in the path. + FormatExec Format = "exec" +) + +// PossibleFormatValues returns the possible values for the Format const type. +func PossibleFormatValues() []Format { + return []Format{ + FormatAzure, + FormatExec, + } +} + +// GPUInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. +type GPUInstanceProfile string + +const ( + GPUInstanceProfileMIG1G GPUInstanceProfile = "MIG1g" + GPUInstanceProfileMIG2G GPUInstanceProfile = "MIG2g" + GPUInstanceProfileMIG3G GPUInstanceProfile = "MIG3g" + GPUInstanceProfileMIG4G GPUInstanceProfile = "MIG4g" + GPUInstanceProfileMIG7G GPUInstanceProfile = "MIG7g" +) + +// PossibleGPUInstanceProfileValues returns the possible values for the GPUInstanceProfile const type. +func PossibleGPUInstanceProfileValues() []GPUInstanceProfile { + return []GPUInstanceProfile{ + GPUInstanceProfileMIG1G, + GPUInstanceProfileMIG2G, + GPUInstanceProfileMIG3G, + GPUInstanceProfileMIG4G, + GPUInstanceProfileMIG7G, + } +} + +// IPFamily - The IP version to use for cluster networking and IP assignment. +type IPFamily string + +const ( + IPFamilyIPv4 IPFamily = "IPv4" + IPFamilyIPv6 IPFamily = "IPv6" +) + +// PossibleIPFamilyValues returns the possible values for the IPFamily const type. +func PossibleIPFamilyValues() []IPFamily { + return []IPFamily{ + IPFamilyIPv4, + IPFamilyIPv6, + } +} + +// IstioIngressGatewayMode - Mode of an ingress gateway. +type IstioIngressGatewayMode string + +const ( + // IstioIngressGatewayModeExternal - The ingress gateway is assigned a public IP address and is publicly accessible. + IstioIngressGatewayModeExternal IstioIngressGatewayMode = "External" + // IstioIngressGatewayModeInternal - The ingress gateway is assigned an internal IP address and cannot is accessed publicly. + IstioIngressGatewayModeInternal IstioIngressGatewayMode = "Internal" +) + +// PossibleIstioIngressGatewayModeValues returns the possible values for the IstioIngressGatewayMode const type. +func PossibleIstioIngressGatewayModeValues() []IstioIngressGatewayMode { + return []IstioIngressGatewayMode{ + IstioIngressGatewayModeExternal, + IstioIngressGatewayModeInternal, + } +} + +// KeyVaultNetworkAccessTypes - Network access of key vault. The possible values are Public and Private. Public means the +// key vault allows public access from all networks. Private means the key vault disables public access and +// enables private link. The default value is Public. +type KeyVaultNetworkAccessTypes string + +const ( + KeyVaultNetworkAccessTypesPrivate KeyVaultNetworkAccessTypes = "Private" + KeyVaultNetworkAccessTypesPublic KeyVaultNetworkAccessTypes = "Public" +) + +// PossibleKeyVaultNetworkAccessTypesValues returns the possible values for the KeyVaultNetworkAccessTypes const type. +func PossibleKeyVaultNetworkAccessTypesValues() []KeyVaultNetworkAccessTypes { + return []KeyVaultNetworkAccessTypes{ + KeyVaultNetworkAccessTypesPrivate, + KeyVaultNetworkAccessTypesPublic, + } +} + +// KubeletDiskType - Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. +type KubeletDiskType string + +const ( + // KubeletDiskTypeOS - Kubelet will use the OS disk for its data. + KubeletDiskTypeOS KubeletDiskType = "OS" + // KubeletDiskTypeTemporary - Kubelet will use the temporary disk for its data. + KubeletDiskTypeTemporary KubeletDiskType = "Temporary" +) + +// PossibleKubeletDiskTypeValues returns the possible values for the KubeletDiskType const type. +func PossibleKubeletDiskTypeValues() []KubeletDiskType { + return []KubeletDiskType{ + KubeletDiskTypeOS, + KubeletDiskTypeTemporary, + } +} + +// KubernetesSupportPlan - Different support tiers for AKS managed clusters +type KubernetesSupportPlan string + +const ( + // KubernetesSupportPlanAKSLongTermSupport - Support for the version extended past the KubernetesOfficial support of 1 year. + // AKS continues to patch CVEs for another 1 year, for a total of 2 years of support. + KubernetesSupportPlanAKSLongTermSupport KubernetesSupportPlan = "AKSLongTermSupport" + // KubernetesSupportPlanKubernetesOfficial - Support for the version is the same as for the open source Kubernetes offering. + // Official Kubernetes open source community support versions for 1 year after release. + KubernetesSupportPlanKubernetesOfficial KubernetesSupportPlan = "KubernetesOfficial" +) + +// PossibleKubernetesSupportPlanValues returns the possible values for the KubernetesSupportPlan const type. +func PossibleKubernetesSupportPlanValues() []KubernetesSupportPlan { + return []KubernetesSupportPlan{ + KubernetesSupportPlanAKSLongTermSupport, + KubernetesSupportPlanKubernetesOfficial, + } +} + +// LicenseType - The license type to use for Windows VMs. See Azure Hybrid User Benefits [https://azure.microsoft.com/pricing/hybrid-benefit/faq/] +// for more details. +type LicenseType string + +const ( + // LicenseTypeNone - No additional licensing is applied. + LicenseTypeNone LicenseType = "None" + // LicenseTypeWindowsServer - Enables Azure Hybrid User Benefits for Windows VMs. + LicenseTypeWindowsServer LicenseType = "Windows_Server" +) + +// PossibleLicenseTypeValues returns the possible values for the LicenseType const type. +func PossibleLicenseTypeValues() []LicenseType { + return []LicenseType{ + LicenseTypeNone, + LicenseTypeWindowsServer, + } +} + +// LoadBalancerSKU - The default is 'standard'. See Azure Load Balancer SKUs [https://docs.microsoft.com/azure/load-balancer/skus] +// for more information about the differences between load balancer SKUs. +type LoadBalancerSKU string + +const ( + // LoadBalancerSKUBasic - Use a basic Load Balancer with limited functionality. + LoadBalancerSKUBasic LoadBalancerSKU = "basic" + // LoadBalancerSKUStandard - Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For more information + // about on working with the load balancer in the managed cluster, see the [standard Load Balancer](https://docs.microsoft.com/azure/aks/load-balancer-standard) + // article. + LoadBalancerSKUStandard LoadBalancerSKU = "standard" +) + +// PossibleLoadBalancerSKUValues returns the possible values for the LoadBalancerSKU const type. +func PossibleLoadBalancerSKUValues() []LoadBalancerSKU { + return []LoadBalancerSKU{ + LoadBalancerSKUBasic, + LoadBalancerSKUStandard, + } +} + +// ManagedClusterPodIdentityProvisioningState - The current provisioning state of the pod identity. +type ManagedClusterPodIdentityProvisioningState string + +const ( + ManagedClusterPodIdentityProvisioningStateAssigned ManagedClusterPodIdentityProvisioningState = "Assigned" + ManagedClusterPodIdentityProvisioningStateCanceled ManagedClusterPodIdentityProvisioningState = "Canceled" + ManagedClusterPodIdentityProvisioningStateDeleting ManagedClusterPodIdentityProvisioningState = "Deleting" + ManagedClusterPodIdentityProvisioningStateFailed ManagedClusterPodIdentityProvisioningState = "Failed" + ManagedClusterPodIdentityProvisioningStateSucceeded ManagedClusterPodIdentityProvisioningState = "Succeeded" + ManagedClusterPodIdentityProvisioningStateUpdating ManagedClusterPodIdentityProvisioningState = "Updating" +) + +// PossibleManagedClusterPodIdentityProvisioningStateValues returns the possible values for the ManagedClusterPodIdentityProvisioningState const type. +func PossibleManagedClusterPodIdentityProvisioningStateValues() []ManagedClusterPodIdentityProvisioningState { + return []ManagedClusterPodIdentityProvisioningState{ + ManagedClusterPodIdentityProvisioningStateAssigned, + ManagedClusterPodIdentityProvisioningStateCanceled, + ManagedClusterPodIdentityProvisioningStateDeleting, + ManagedClusterPodIdentityProvisioningStateFailed, + ManagedClusterPodIdentityProvisioningStateSucceeded, + ManagedClusterPodIdentityProvisioningStateUpdating, + } +} + +// ManagedClusterSKUName - The name of a managed cluster SKU. +type ManagedClusterSKUName string + +const ( + // ManagedClusterSKUNameBase - Base option for the AKS control plane. + ManagedClusterSKUNameBase ManagedClusterSKUName = "Base" +) + +// PossibleManagedClusterSKUNameValues returns the possible values for the ManagedClusterSKUName const type. +func PossibleManagedClusterSKUNameValues() []ManagedClusterSKUName { + return []ManagedClusterSKUName{ + ManagedClusterSKUNameBase, + } +} + +// ManagedClusterSKUTier - If not specified, the default is 'Free'. See AKS Pricing Tier [https://learn.microsoft.com/azure/aks/free-standard-pricing-tiers] +// for more details. +type ManagedClusterSKUTier string + +const ( + // ManagedClusterSKUTierFree - The cluster management is free, but charged for VM, storage, and networking usage. Best for + // experimenting, learning, simple testing, or workloads with fewer than 10 nodes. Not recommended for production use cases. + ManagedClusterSKUTierFree ManagedClusterSKUTier = "Free" + // ManagedClusterSKUTierPremium - Cluster has premium capabilities in addition to all of the capabilities included in 'Standard'. + // Premium enables selection of LongTermSupport (aka.ms/aks/lts) for certain Kubernetes versions. + ManagedClusterSKUTierPremium ManagedClusterSKUTier = "Premium" + // ManagedClusterSKUTierStandard - Recommended for mission-critical and production workloads. Includes Kubernetes control + // plane autoscaling, workload-intensive testing, and up to 5,000 nodes per cluster. Guarantees 99.95% availability of the + // Kubernetes API server endpoint for clusters that use Availability Zones and 99.9% of availability for clusters that don't + // use Availability Zones. + ManagedClusterSKUTierStandard ManagedClusterSKUTier = "Standard" +) + +// PossibleManagedClusterSKUTierValues returns the possible values for the ManagedClusterSKUTier const type. +func PossibleManagedClusterSKUTierValues() []ManagedClusterSKUTier { + return []ManagedClusterSKUTier{ + ManagedClusterSKUTierFree, + ManagedClusterSKUTierPremium, + ManagedClusterSKUTierStandard, + } +} + +// NetworkDataplane - Network dataplane used in the Kubernetes cluster. +type NetworkDataplane string + +const ( + // NetworkDataplaneAzure - Use Azure network dataplane. + NetworkDataplaneAzure NetworkDataplane = "azure" + // NetworkDataplaneCilium - Use Cilium network dataplane. See [Azure CNI Powered by Cilium](https://learn.microsoft.com/azure/aks/azure-cni-powered-by-cilium) + // for more information. + NetworkDataplaneCilium NetworkDataplane = "cilium" +) + +// PossibleNetworkDataplaneValues returns the possible values for the NetworkDataplane const type. +func PossibleNetworkDataplaneValues() []NetworkDataplane { + return []NetworkDataplane{ + NetworkDataplaneAzure, + NetworkDataplaneCilium, + } +} + +// NetworkMode - This cannot be specified if networkPlugin is anything other than 'azure'. +type NetworkMode string + +const ( + // NetworkModeBridge - This is no longer supported + NetworkModeBridge NetworkMode = "bridge" + // NetworkModeTransparent - No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure + // CNI. See [Transparent Mode](https://docs.microsoft.com/azure/aks/faq#transparent-mode) for more information. + NetworkModeTransparent NetworkMode = "transparent" +) + +// PossibleNetworkModeValues returns the possible values for the NetworkMode const type. +func PossibleNetworkModeValues() []NetworkMode { + return []NetworkMode{ + NetworkModeBridge, + NetworkModeTransparent, + } +} + +// NetworkPlugin - Network plugin used for building the Kubernetes network. +type NetworkPlugin string + +const ( + // NetworkPluginAzure - Use the Azure CNI network plugin. See [Azure CNI (advanced) networking](https://docs.microsoft.com/azure/aks/concepts-network#azure-cni-advanced-networking) + // for more information. + NetworkPluginAzure NetworkPlugin = "azure" + // NetworkPluginKubenet - Use the Kubenet network plugin. See [Kubenet (basic) networking](https://docs.microsoft.com/azure/aks/concepts-network#kubenet-basic-networking) + // for more information. + NetworkPluginKubenet NetworkPlugin = "kubenet" + // NetworkPluginNone - No CNI plugin is pre-installed. See [BYO CNI](https://docs.microsoft.com/en-us/azure/aks/use-byo-cni) + // for more information. + NetworkPluginNone NetworkPlugin = "none" +) + +// PossibleNetworkPluginValues returns the possible values for the NetworkPlugin const type. +func PossibleNetworkPluginValues() []NetworkPlugin { + return []NetworkPlugin{ + NetworkPluginAzure, + NetworkPluginKubenet, + NetworkPluginNone, + } +} + +// NetworkPluginMode - The mode the network plugin should use. +type NetworkPluginMode string + +const ( + // NetworkPluginModeOverlay - Used with networkPlugin=azure, pods are given IPs from the PodCIDR address space but use Azure + // Routing Domains rather than Kubenet's method of route tables. For more information visit https://aka.ms/aks/azure-cni-overlay. + NetworkPluginModeOverlay NetworkPluginMode = "overlay" +) + +// PossibleNetworkPluginModeValues returns the possible values for the NetworkPluginMode const type. +func PossibleNetworkPluginModeValues() []NetworkPluginMode { + return []NetworkPluginMode{ + NetworkPluginModeOverlay, + } +} + +// NetworkPolicy - Network policy used for building the Kubernetes network. +type NetworkPolicy string + +const ( + // NetworkPolicyAzure - Use Azure network policies. See [differences between Azure and Calico policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyAzure NetworkPolicy = "azure" + // NetworkPolicyCalico - Use Calico network policies. See [differences between Azure and Calico policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyCalico NetworkPolicy = "calico" + // NetworkPolicyCilium - Use Cilium to enforce network policies. This requires networkDataplane to be 'cilium'. + NetworkPolicyCilium NetworkPolicy = "cilium" +) + +// PossibleNetworkPolicyValues returns the possible values for the NetworkPolicy const type. +func PossibleNetworkPolicyValues() []NetworkPolicy { + return []NetworkPolicy{ + NetworkPolicyAzure, + NetworkPolicyCalico, + NetworkPolicyCilium, + } +} + +// NodeOSUpgradeChannel - Manner in which the OS on your nodes is updated. The default is NodeImage. +type NodeOSUpgradeChannel string + +const ( + // NodeOSUpgradeChannelNodeImage - AKS will update the nodes with a newly patched VHD containing security fixes and bugfixes + // on a weekly cadence. With the VHD update machines will be rolling reimaged to that VHD following maintenance windows and + // surge settings. No extra VHD cost is incurred when choosing this option as AKS hosts the images. + NodeOSUpgradeChannelNodeImage NodeOSUpgradeChannel = "NodeImage" + // NodeOSUpgradeChannelNone - No attempt to update your machines OS will be made either by OS or by rolling VHDs. This means + // you are responsible for your security updates + NodeOSUpgradeChannelNone NodeOSUpgradeChannel = "None" + // NodeOSUpgradeChannelUnmanaged - OS updates will be applied automatically through the OS built-in patching infrastructure. + // Newly scaled in machines will be unpatched initially and will be patched at some point by the OS's infrastructure. Behavior + // of this option depends on the OS in question. Ubuntu and Mariner apply security patches through unattended upgrade roughly + // once a day around 06:00 UTC. Windows does not apply security patches automatically and so for them this option is equivalent + // to None till further notice + NodeOSUpgradeChannelUnmanaged NodeOSUpgradeChannel = "Unmanaged" +) + +// PossibleNodeOSUpgradeChannelValues returns the possible values for the NodeOSUpgradeChannel const type. +func PossibleNodeOSUpgradeChannelValues() []NodeOSUpgradeChannel { + return []NodeOSUpgradeChannel{ + NodeOSUpgradeChannelNodeImage, + NodeOSUpgradeChannelNone, + NodeOSUpgradeChannelUnmanaged, + } +} + +// OSDiskType - The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. +// Otherwise, defaults to 'Managed'. May not be changed after creation. For more information +// see Ephemeral OS [https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os]. +type OSDiskType string + +const ( + // OSDiskTypeEphemeral - Ephemeral OS disks are stored only on the host machine, just like a temporary disk. This provides + // lower read/write latency, along with faster node scaling and cluster upgrades. + OSDiskTypeEphemeral OSDiskType = "Ephemeral" + // OSDiskTypeManaged - Azure replicates the operating system disk for a virtual machine to Azure storage to avoid data loss + // should the VM need to be relocated to another host. Since containers aren't designed to have local state persisted, this + // behavior offers limited value while providing some drawbacks, including slower node provisioning and higher read/write + // latency. + OSDiskTypeManaged OSDiskType = "Managed" +) + +// PossibleOSDiskTypeValues returns the possible values for the OSDiskType const type. +func PossibleOSDiskTypeValues() []OSDiskType { + return []OSDiskType{ + OSDiskTypeEphemeral, + OSDiskTypeManaged, + } +} + +// OSSKU - Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 +// when Kubernetes = 1.25 if OSType is Windows. +type OSSKU string + +const ( + // OSSKUAzureLinux - Use AzureLinux as the OS for node images. Azure Linux is a container-optimized Linux distro built by + // Microsoft, visit https://aka.ms/azurelinux for more information. + OSSKUAzureLinux OSSKU = "AzureLinux" + // OSSKUCBLMariner - Deprecated OSSKU. Microsoft recommends that new deployments choose 'AzureLinux' instead. + OSSKUCBLMariner OSSKU = "CBLMariner" + // OSSKUUbuntu - Use Ubuntu as the OS for node images. + OSSKUUbuntu OSSKU = "Ubuntu" + // OSSKUWindows2019 - Use Windows2019 as the OS for node images. Unsupported for system node pools. Windows2019 only supports + // Windows2019 containers; it cannot run Windows2022 containers and vice versa. + OSSKUWindows2019 OSSKU = "Windows2019" + // OSSKUWindows2022 - Use Windows2022 as the OS for node images. Unsupported for system node pools. Windows2022 only supports + // Windows2022 containers; it cannot run Windows2019 containers and vice versa. + OSSKUWindows2022 OSSKU = "Windows2022" +) + +// PossibleOSSKUValues returns the possible values for the OSSKU const type. +func PossibleOSSKUValues() []OSSKU { + return []OSSKU{ + OSSKUAzureLinux, + OSSKUCBLMariner, + OSSKUUbuntu, + OSSKUWindows2019, + OSSKUWindows2022, + } +} + +// OSType - The operating system type. The default is Linux. +type OSType string + +const ( + // OSTypeLinux - Use Linux. + OSTypeLinux OSType = "Linux" + // OSTypeWindows - Use Windows. + OSTypeWindows OSType = "Windows" +) + +// PossibleOSTypeValues returns the possible values for the OSType const type. +func PossibleOSTypeValues() []OSType { + return []OSType{ + OSTypeLinux, + OSTypeWindows, + } +} + +// OutboundType - This can only be set at cluster creation time and cannot be changed later. For more information see egress +// outbound type [https://docs.microsoft.com/azure/aks/egress-outboundtype]. +type OutboundType string + +const ( + // OutboundTypeLoadBalancer - The load balancer is used for egress through an AKS assigned public IP. This supports Kubernetes + // services of type 'loadBalancer'. For more information see [outbound type loadbalancer](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-loadbalancer). + OutboundTypeLoadBalancer OutboundType = "loadBalancer" + // OutboundTypeManagedNATGateway - The AKS-managed NAT gateway is used for egress. + OutboundTypeManagedNATGateway OutboundType = "managedNATGateway" + // OutboundTypeUserAssignedNATGateway - The user-assigned NAT gateway associated to the cluster subnet is used for egress. + // This is an advanced scenario and requires proper network configuration. + OutboundTypeUserAssignedNATGateway OutboundType = "userAssignedNATGateway" + // OutboundTypeUserDefinedRouting - Egress paths must be defined by the user. This is an advanced scenario and requires proper + // network configuration. For more information see [outbound type userDefinedRouting](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-userdefinedrouting). + OutboundTypeUserDefinedRouting OutboundType = "userDefinedRouting" +) + +// PossibleOutboundTypeValues returns the possible values for the OutboundType const type. +func PossibleOutboundTypeValues() []OutboundType { + return []OutboundType{ + OutboundTypeLoadBalancer, + OutboundTypeManagedNATGateway, + OutboundTypeUserAssignedNATGateway, + OutboundTypeUserDefinedRouting, + } +} + +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCanceled PrivateEndpointConnectionProvisioningState = "Canceled" + 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{ + PrivateEndpointConnectionProvisioningStateCanceled, + PrivateEndpointConnectionProvisioningStateCreating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateSucceeded, + } +} + +// Protocol - The network protocol of the port. +type Protocol string + +const ( + // ProtocolTCP - TCP protocol. + ProtocolTCP Protocol = "TCP" + // ProtocolUDP - UDP protocol. + ProtocolUDP Protocol = "UDP" +) + +// PossibleProtocolValues returns the possible values for the Protocol const type. +func PossibleProtocolValues() []Protocol { + return []Protocol{ + ProtocolTCP, + ProtocolUDP, + } +} + +// PublicNetworkAccess - Allow or deny public network access for AKS +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + +// ResourceIdentityType - For more information see use managed identities in AKS [https://docs.microsoft.com/azure/aks/use-managed-identity]. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone - Do not use a managed identity for the Managed Cluster, service principal will be used instead. + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned - Use an implicitly created system assigned managed identity to manage cluster resources. + // Master components in the control plane such as kube-controller-manager will use the system assigned managed identity to + // manipulate Azure resources. + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeUserAssigned - Use a user-specified identity to manage cluster resources. Master components in the + // control plane such as kube-controller-manager will use the specified user assigned managed identity to manipulate Azure + // resources. + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeNone, + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeUserAssigned, + } +} + +// ScaleDownMode - Describes how VMs are added to or removed from Agent Pools. See billing states [https://docs.microsoft.com/azure/virtual-machines/states-billing]. +type ScaleDownMode string + +const ( + // ScaleDownModeDeallocate - Attempt to start deallocated instances (if they exist) during scale up and deallocate instances + // during scale down. + ScaleDownModeDeallocate ScaleDownMode = "Deallocate" + // ScaleDownModeDelete - Create new instances during scale up and remove instances during scale down. + ScaleDownModeDelete ScaleDownMode = "Delete" +) + +// PossibleScaleDownModeValues returns the possible values for the ScaleDownMode const type. +func PossibleScaleDownModeValues() []ScaleDownMode { + return []ScaleDownMode{ + ScaleDownModeDeallocate, + ScaleDownModeDelete, + } +} + +// ScaleSetEvictionPolicy - The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. +// For more information about eviction see spot VMs +// [https://docs.microsoft.com/azure/virtual-machines/spot-vms] +type ScaleSetEvictionPolicy string + +const ( + // ScaleSetEvictionPolicyDeallocate - Nodes in the underlying Scale Set of the node pool are set to the stopped-deallocated + // state upon eviction. Nodes in the stopped-deallocated state count against your compute quota and can cause issues with + // cluster scaling or upgrading. + ScaleSetEvictionPolicyDeallocate ScaleSetEvictionPolicy = "Deallocate" + // ScaleSetEvictionPolicyDelete - Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. + ScaleSetEvictionPolicyDelete ScaleSetEvictionPolicy = "Delete" +) + +// PossibleScaleSetEvictionPolicyValues returns the possible values for the ScaleSetEvictionPolicy const type. +func PossibleScaleSetEvictionPolicyValues() []ScaleSetEvictionPolicy { + return []ScaleSetEvictionPolicy{ + ScaleSetEvictionPolicyDeallocate, + ScaleSetEvictionPolicyDelete, + } +} + +// ScaleSetPriority - The Virtual Machine Scale Set priority. +type ScaleSetPriority string + +const ( + // ScaleSetPriorityRegular - Regular VMs will be used. + ScaleSetPriorityRegular ScaleSetPriority = "Regular" + // ScaleSetPrioritySpot - Spot priority VMs will be used. There is no SLA for spot nodes. See [spot on AKS](https://docs.microsoft.com/azure/aks/spot-node-pool) + // for more information. + ScaleSetPrioritySpot ScaleSetPriority = "Spot" +) + +// PossibleScaleSetPriorityValues returns the possible values for the ScaleSetPriority const type. +func PossibleScaleSetPriorityValues() []ScaleSetPriority { + return []ScaleSetPriority{ + ScaleSetPriorityRegular, + ScaleSetPrioritySpot, + } +} + +// ServiceMeshMode - Mode of the service mesh. +type ServiceMeshMode string + +const ( + // ServiceMeshModeDisabled - Mesh is disabled. + ServiceMeshModeDisabled ServiceMeshMode = "Disabled" + // ServiceMeshModeIstio - Istio deployed as an AKS addon. + ServiceMeshModeIstio ServiceMeshMode = "Istio" +) + +// PossibleServiceMeshModeValues returns the possible values for the ServiceMeshMode const type. +func PossibleServiceMeshModeValues() []ServiceMeshMode { + return []ServiceMeshMode{ + ServiceMeshModeDisabled, + ServiceMeshModeIstio, + } +} + +// SnapshotType - The type of a snapshot. The default is NodePool. +type SnapshotType string + +const ( + // SnapshotTypeNodePool - The snapshot is a snapshot of a node pool. + SnapshotTypeNodePool SnapshotType = "NodePool" +) + +// PossibleSnapshotTypeValues returns the possible values for the SnapshotType const type. +func PossibleSnapshotTypeValues() []SnapshotType { + return []SnapshotType{ + SnapshotTypeNodePool, + } +} + +// TrustedAccessRoleBindingProvisioningState - The current provisioning state of trusted access role binding. +type TrustedAccessRoleBindingProvisioningState string + +const ( + TrustedAccessRoleBindingProvisioningStateCanceled TrustedAccessRoleBindingProvisioningState = "Canceled" + TrustedAccessRoleBindingProvisioningStateDeleting TrustedAccessRoleBindingProvisioningState = "Deleting" + TrustedAccessRoleBindingProvisioningStateFailed TrustedAccessRoleBindingProvisioningState = "Failed" + TrustedAccessRoleBindingProvisioningStateSucceeded TrustedAccessRoleBindingProvisioningState = "Succeeded" + TrustedAccessRoleBindingProvisioningStateUpdating TrustedAccessRoleBindingProvisioningState = "Updating" +) + +// PossibleTrustedAccessRoleBindingProvisioningStateValues returns the possible values for the TrustedAccessRoleBindingProvisioningState const type. +func PossibleTrustedAccessRoleBindingProvisioningStateValues() []TrustedAccessRoleBindingProvisioningState { + return []TrustedAccessRoleBindingProvisioningState{ + TrustedAccessRoleBindingProvisioningStateCanceled, + TrustedAccessRoleBindingProvisioningStateDeleting, + TrustedAccessRoleBindingProvisioningStateFailed, + TrustedAccessRoleBindingProvisioningStateSucceeded, + TrustedAccessRoleBindingProvisioningStateUpdating, + } +} + +// Type - Specifies on which week of the month the dayOfWeek applies. +type Type string + +const ( + // TypeFirst - First week of the month. + TypeFirst Type = "First" + // TypeFourth - Fourth week of the month. + TypeFourth Type = "Fourth" + // TypeLast - Last week of the month. + TypeLast Type = "Last" + // TypeSecond - Second week of the month. + TypeSecond Type = "Second" + // TypeThird - Third week of the month. + TypeThird Type = "Third" +) + +// PossibleTypeValues returns the possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{ + TypeFirst, + TypeFourth, + TypeLast, + TypeSecond, + TypeThird, + } +} + +// UpgradeChannel - For more information see setting the AKS cluster auto-upgrade channel [https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel]. +type UpgradeChannel string + +const ( + // UpgradeChannelNodeImage - Automatically upgrade the node image to the latest version available. Consider using nodeOSUpgradeChannel + // instead as that allows you to configure node OS patching separate from Kubernetes version patching + UpgradeChannelNodeImage UpgradeChannel = "node-image" + // UpgradeChannelNone - Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. + UpgradeChannelNone UpgradeChannel = "none" + // UpgradeChannelPatch - Automatically upgrade the cluster to the latest supported patch version when it becomes available + // while keeping the minor version the same. For example, if a cluster is running version 1.17.7 and versions 1.17.9, 1.18.4, + // 1.18.6, and 1.19.1 are available, your cluster is upgraded to 1.17.9. + UpgradeChannelPatch UpgradeChannel = "patch" + // UpgradeChannelRapid - Automatically upgrade the cluster to the latest supported patch release on the latest supported minor + // version. In cases where the cluster is at a version of Kubernetes that is at an N-2 minor version where N is the latest + // supported minor version, the cluster first upgrades to the latest supported patch version on N-1 minor version. For example, + // if a cluster is running version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first + // is upgraded to 1.18.6, then is upgraded to 1.19.1. + UpgradeChannelRapid UpgradeChannel = "rapid" + // UpgradeChannelStable - Automatically upgrade the cluster to the latest supported patch release on minor version N-1, where + // N is the latest supported minor version. For example, if a cluster is running version 1.17.7 and versions 1.17.9, 1.18.4, + // 1.18.6, and 1.19.1 are available, your cluster is upgraded to 1.18.6. + UpgradeChannelStable UpgradeChannel = "stable" +) + +// PossibleUpgradeChannelValues returns the possible values for the UpgradeChannel const type. +func PossibleUpgradeChannelValues() []UpgradeChannel { + return []UpgradeChannel{ + UpgradeChannelNodeImage, + UpgradeChannelNone, + UpgradeChannelPatch, + UpgradeChannelRapid, + UpgradeChannelStable, + } +} + +// WeekDay - The weekday enum. +type WeekDay string + +const ( + WeekDayFriday WeekDay = "Friday" + WeekDayMonday WeekDay = "Monday" + WeekDaySaturday WeekDay = "Saturday" + WeekDaySunday WeekDay = "Sunday" + WeekDayThursday WeekDay = "Thursday" + WeekDayTuesday WeekDay = "Tuesday" + WeekDayWednesday WeekDay = "Wednesday" +) + +// PossibleWeekDayValues returns the possible values for the WeekDay const type. +func PossibleWeekDayValues() []WeekDay { + return []WeekDay{ + WeekDayFriday, + WeekDayMonday, + WeekDaySaturday, + WeekDaySunday, + WeekDayThursday, + WeekDayTuesday, + WeekDayWednesday, + } +} + +// WorkloadRuntime - Determines the type of workload a node can run. +type WorkloadRuntime string + +const ( + // WorkloadRuntimeOCIContainer - Nodes will use Kubelet to run standard OCI container workloads. + WorkloadRuntimeOCIContainer WorkloadRuntime = "OCIContainer" + // WorkloadRuntimeWasmWasi - Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). + WorkloadRuntimeWasmWasi WorkloadRuntime = "WasmWasi" +) + +// PossibleWorkloadRuntimeValues returns the possible values for the WorkloadRuntime const type. +func PossibleWorkloadRuntimeValues() []WorkloadRuntime { + return []WorkloadRuntime{ + WorkloadRuntimeOCIContainer, + WorkloadRuntimeWasmWasi, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/date_type.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/date_type.go new file mode 100644 index 000000000..64a96c1d0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/date_type.go @@ -0,0 +1,59 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "strings" + "time" +) + +const ( + fullDateJSON = `"2006-01-02"` + jsonFormat = `"%04d-%02d-%02d"` +) + +type dateType time.Time + +func (t dateType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf(jsonFormat, time.Time(t).Year(), time.Time(t).Month(), time.Time(t).Day())), nil +} + +func (d *dateType) UnmarshalJSON(data []byte) (err error) { + t, err := time.Parse(fullDateJSON, string(data)) + *d = (dateType)(t) + return err +} + +func populateDateType(m map[string]any, 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] = (*dateType)(t) +} + +func unpopulateDateType(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateType + 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/containerservice/armcontainerservice/v4/maintenanceconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/maintenanceconfigurations_client.go new file mode 100644 index 000000000..6eb21b54b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/maintenanceconfigurations_client.go @@ -0,0 +1,313 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MaintenanceConfigurationsClient contains the methods for the MaintenanceConfigurations group. +// Don't use this type directly, use NewMaintenanceConfigurationsClient() instead. +type MaintenanceConfigurationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMaintenanceConfigurationsClient creates a new instance of MaintenanceConfigurationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMaintenanceConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MaintenanceConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MaintenanceConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a maintenance configuration in the specified managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - configName - The name of the maintenance configuration. +// - parameters - The maintenance configuration to create or update. +// - options - MaintenanceConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the MaintenanceConfigurationsClient.CreateOrUpdate +// method. +func (client *MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters MaintenanceConfiguration, options *MaintenanceConfigurationsClientCreateOrUpdateOptions) (MaintenanceConfigurationsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "MaintenanceConfigurationsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, configName, parameters, options) + if err != nil { + return MaintenanceConfigurationsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MaintenanceConfigurationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return MaintenanceConfigurationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *MaintenanceConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters MaintenanceConfiguration, options *MaintenanceConfigurationsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if configName == "" { + return nil, errors.New("parameter configName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configName}", url.PathEscape(configName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *MaintenanceConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (MaintenanceConfigurationsClientCreateOrUpdateResponse, error) { + result := MaintenanceConfigurationsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceConfiguration); err != nil { + return MaintenanceConfigurationsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a maintenance configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - configName - The name of the maintenance configuration. +// - options - MaintenanceConfigurationsClientDeleteOptions contains the optional parameters for the MaintenanceConfigurationsClient.Delete +// method. +func (client *MaintenanceConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, configName string, options *MaintenanceConfigurationsClientDeleteOptions) (MaintenanceConfigurationsClientDeleteResponse, error) { + var err error + const operationName = "MaintenanceConfigurationsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, configName, options) + if err != nil { + return MaintenanceConfigurationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MaintenanceConfigurationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return MaintenanceConfigurationsClientDeleteResponse{}, err + } + return MaintenanceConfigurationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, configName string, options *MaintenanceConfigurationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if configName == "" { + return nil, errors.New("parameter configName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configName}", url.PathEscape(configName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified maintenance configuration of a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - configName - The name of the maintenance configuration. +// - options - MaintenanceConfigurationsClientGetOptions contains the optional parameters for the MaintenanceConfigurationsClient.Get +// method. +func (client *MaintenanceConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configName string, options *MaintenanceConfigurationsClientGetOptions) (MaintenanceConfigurationsClientGetResponse, error) { + var err error + const operationName = "MaintenanceConfigurationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, configName, options) + if err != nil { + return MaintenanceConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MaintenanceConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MaintenanceConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MaintenanceConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, configName string, options *MaintenanceConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if configName == "" { + return nil, errors.New("parameter configName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configName}", url.PathEscape(configName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MaintenanceConfigurationsClient) getHandleResponse(resp *http.Response) (MaintenanceConfigurationsClientGetResponse, error) { + result := MaintenanceConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceConfiguration); err != nil { + return MaintenanceConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByManagedClusterPager - Gets a list of maintenance configurations in the specified managed cluster. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - MaintenanceConfigurationsClientListByManagedClusterOptions contains the optional parameters for the MaintenanceConfigurationsClient.NewListByManagedClusterPager +// method. +func (client *MaintenanceConfigurationsClient) NewListByManagedClusterPager(resourceGroupName string, resourceName string, options *MaintenanceConfigurationsClientListByManagedClusterOptions) *runtime.Pager[MaintenanceConfigurationsClientListByManagedClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[MaintenanceConfigurationsClientListByManagedClusterResponse]{ + More: func(page MaintenanceConfigurationsClientListByManagedClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MaintenanceConfigurationsClientListByManagedClusterResponse) (MaintenanceConfigurationsClientListByManagedClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MaintenanceConfigurationsClient.NewListByManagedClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByManagedClusterCreateRequest(ctx, resourceGroupName, resourceName, options) + }, nil) + if err != nil { + return MaintenanceConfigurationsClientListByManagedClusterResponse{}, err + } + return client.listByManagedClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByManagedClusterCreateRequest creates the ListByManagedCluster request. +func (client *MaintenanceConfigurationsClient) listByManagedClusterCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *MaintenanceConfigurationsClientListByManagedClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagedClusterHandleResponse handles the ListByManagedCluster response. +func (client *MaintenanceConfigurationsClient) listByManagedClusterHandleResponse(resp *http.Response) (MaintenanceConfigurationsClientListByManagedClusterResponse, error) { + result := MaintenanceConfigurationsClientListByManagedClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceConfigurationListResult); err != nil { + return MaintenanceConfigurationsClientListByManagedClusterResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/managedclusters_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/managedclusters_client.go new file mode 100644 index 000000000..04dfeda1c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/managedclusters_client.go @@ -0,0 +1,1976 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedClustersClient contains the methods for the ManagedClusters group. +// Don't use this type directly, use NewManagedClustersClient() instead. +type ManagedClustersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedClustersClient creates a new instance of ManagedClustersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedClustersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedClustersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginAbortLatestOperation - Aborts the currently running operation on the managed cluster. The Managed Cluster will be +// moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation +// completes before cancellation can take place, a 409 error code is returned. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientBeginAbortLatestOperationOptions contains the optional parameters for the ManagedClustersClient.BeginAbortLatestOperation +// method. +func (client *ManagedClustersClient) BeginAbortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginAbortLatestOperationOptions) (*runtime.Poller[ManagedClustersClientAbortLatestOperationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.abortLatestOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientAbortLatestOperationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientAbortLatestOperationResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// AbortLatestOperation - Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved +// to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation +// completes before cancellation can take place, a 409 error code is returned. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) abortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginAbortLatestOperationOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginAbortLatestOperation" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.abortLatestOperationCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// abortLatestOperationCreateRequest creates the AbortLatestOperation request. +func (client *ManagedClustersClient) abortLatestOperationCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginAbortLatestOperationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - Creates or updates a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - parameters - The managed cluster to create or update. +// - options - ManagedClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedClustersClient.BeginCreateOrUpdate +// method. +func (client *ManagedClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster, options *ManagedClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedClustersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster, options *ManagedClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster, options *ManagedClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientBeginDeleteOptions contains the optional parameters for the ManagedClustersClient.BeginDelete +// method. +func (client *ManagedClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginDeleteOptions) (*runtime.Poller[ManagedClustersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientGetOptions contains the optional parameters for the ManagedClustersClient.Get method. +func (client *ManagedClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientGetOptions) (ManagedClustersClientGetResponse, error) { + var err error + const operationName = "ManagedClustersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ManagedClustersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedClustersClient) getHandleResponse(resp *http.Response) (ManagedClustersClientGetResponse, error) { + result := ManagedClustersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedCluster); err != nil { + return ManagedClustersClientGetResponse{}, err + } + return result, nil +} + +// GetAccessProfile - WARNING: This API will be deprecated. Instead use ListClusterUserCredentials [https://docs.microsoft.com/rest/api/aks/managedclusters/listclusterusercredentials] +// or ListClusterAdminCredentials +// [https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials] . +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - roleName - The name of the role for managed cluster accessProfile resource. +// - options - ManagedClustersClientGetAccessProfileOptions contains the optional parameters for the ManagedClustersClient.GetAccessProfile +// method. +func (client *ManagedClustersClient) GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string, options *ManagedClustersClientGetAccessProfileOptions) (ManagedClustersClientGetAccessProfileResponse, error) { + var err error + const operationName = "ManagedClustersClient.GetAccessProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAccessProfileCreateRequest(ctx, resourceGroupName, resourceName, roleName, options) + if err != nil { + return ManagedClustersClientGetAccessProfileResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientGetAccessProfileResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientGetAccessProfileResponse{}, err + } + resp, err := client.getAccessProfileHandleResponse(httpResp) + return resp, err +} + +// getAccessProfileCreateRequest creates the GetAccessProfile request. +func (client *ManagedClustersClient) getAccessProfileCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, roleName string, options *ManagedClustersClientGetAccessProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAccessProfileHandleResponse handles the GetAccessProfile response. +func (client *ManagedClustersClient) getAccessProfileHandleResponse(resp *http.Response) (ManagedClustersClientGetAccessProfileResponse, error) { + result := ManagedClustersClientGetAccessProfileResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterAccessProfile); err != nil { + return ManagedClustersClientGetAccessProfileResponse{}, err + } + return result, nil +} + +// GetCommandResult - Gets the results of a command which has been run on the Managed Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - commandID - Id of the command. +// - options - ManagedClustersClientGetCommandResultOptions contains the optional parameters for the ManagedClustersClient.GetCommandResult +// method. +func (client *ManagedClustersClient) GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string, options *ManagedClustersClientGetCommandResultOptions) (ManagedClustersClientGetCommandResultResponse, error) { + var err error + const operationName = "ManagedClustersClient.GetCommandResult" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCommandResultCreateRequest(ctx, resourceGroupName, resourceName, commandID, options) + if err != nil { + return ManagedClustersClientGetCommandResultResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientGetCommandResultResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientGetCommandResultResponse{}, err + } + resp, err := client.getCommandResultHandleResponse(httpResp) + return resp, err +} + +// getCommandResultCreateRequest creates the GetCommandResult request. +func (client *ManagedClustersClient) getCommandResultCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, commandID string, options *ManagedClustersClientGetCommandResultOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if commandID == "" { + return nil, errors.New("parameter commandID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{commandId}", url.PathEscape(commandID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCommandResultHandleResponse handles the GetCommandResult response. +func (client *ManagedClustersClient) getCommandResultHandleResponse(resp *http.Response) (ManagedClustersClientGetCommandResultResponse, error) { + result := ManagedClustersClientGetCommandResultResponse{} + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.RunCommandResult); err != nil { + return ManagedClustersClientGetCommandResultResponse{}, err + } + return result, nil +} + +// GetMeshRevisionProfile - Contains extra metadata on the revision, including supported revisions, cluster compatibility +// and available upgrades +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - location - The name of the Azure region. +// - mode - The mode of the mesh. +// - options - ManagedClustersClientGetMeshRevisionProfileOptions contains the optional parameters for the ManagedClustersClient.GetMeshRevisionProfile +// method. +func (client *ManagedClustersClient) GetMeshRevisionProfile(ctx context.Context, location string, mode string, options *ManagedClustersClientGetMeshRevisionProfileOptions) (ManagedClustersClientGetMeshRevisionProfileResponse, error) { + var err error + const operationName = "ManagedClustersClient.GetMeshRevisionProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getMeshRevisionProfileCreateRequest(ctx, location, mode, options) + if err != nil { + return ManagedClustersClientGetMeshRevisionProfileResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientGetMeshRevisionProfileResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientGetMeshRevisionProfileResponse{}, err + } + resp, err := client.getMeshRevisionProfileHandleResponse(httpResp) + return resp, err +} + +// getMeshRevisionProfileCreateRequest creates the GetMeshRevisionProfile request. +func (client *ManagedClustersClient) getMeshRevisionProfileCreateRequest(ctx context.Context, location string, mode string, options *ManagedClustersClientGetMeshRevisionProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode}" + 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 mode == "" { + return nil, errors.New("parameter mode cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mode}", url.PathEscape(mode)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getMeshRevisionProfileHandleResponse handles the GetMeshRevisionProfile response. +func (client *ManagedClustersClient) getMeshRevisionProfileHandleResponse(resp *http.Response) (ManagedClustersClientGetMeshRevisionProfileResponse, error) { + result := ManagedClustersClientGetMeshRevisionProfileResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MeshRevisionProfile); err != nil { + return ManagedClustersClientGetMeshRevisionProfileResponse{}, err + } + return result, nil +} + +// GetMeshUpgradeProfile - Gets available upgrades for a service mesh in a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - mode - The mode of the mesh. +// - options - ManagedClustersClientGetMeshUpgradeProfileOptions contains the optional parameters for the ManagedClustersClient.GetMeshUpgradeProfile +// method. +func (client *ManagedClustersClient) GetMeshUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, mode string, options *ManagedClustersClientGetMeshUpgradeProfileOptions) (ManagedClustersClientGetMeshUpgradeProfileResponse, error) { + var err error + const operationName = "ManagedClustersClient.GetMeshUpgradeProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getMeshUpgradeProfileCreateRequest(ctx, resourceGroupName, resourceName, mode, options) + if err != nil { + return ManagedClustersClientGetMeshUpgradeProfileResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientGetMeshUpgradeProfileResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientGetMeshUpgradeProfileResponse{}, err + } + resp, err := client.getMeshUpgradeProfileHandleResponse(httpResp) + return resp, err +} + +// getMeshUpgradeProfileCreateRequest creates the GetMeshUpgradeProfile request. +func (client *ManagedClustersClient) getMeshUpgradeProfileCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, mode string, options *ManagedClustersClientGetMeshUpgradeProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if mode == "" { + return nil, errors.New("parameter mode cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{mode}", url.PathEscape(mode)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getMeshUpgradeProfileHandleResponse handles the GetMeshUpgradeProfile response. +func (client *ManagedClustersClient) getMeshUpgradeProfileHandleResponse(resp *http.Response) (ManagedClustersClientGetMeshUpgradeProfileResponse, error) { + result := ManagedClustersClientGetMeshUpgradeProfileResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MeshUpgradeProfile); err != nil { + return ManagedClustersClientGetMeshUpgradeProfileResponse{}, err + } + return result, nil +} + +// GetOSOptions - Gets supported OS options in the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - location - The name of the Azure region. +// - options - ManagedClustersClientGetOSOptionsOptions contains the optional parameters for the ManagedClustersClient.GetOSOptions +// method. +func (client *ManagedClustersClient) GetOSOptions(ctx context.Context, location string, options *ManagedClustersClientGetOSOptionsOptions) (ManagedClustersClientGetOSOptionsResponse, error) { + var err error + const operationName = "ManagedClustersClient.GetOSOptions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getOSOptionsCreateRequest(ctx, location, options) + if err != nil { + return ManagedClustersClientGetOSOptionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientGetOSOptionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientGetOSOptionsResponse{}, err + } + resp, err := client.getOSOptionsHandleResponse(httpResp) + return resp, err +} + +// getOSOptionsCreateRequest creates the GetOSOptions request. +func (client *ManagedClustersClient) getOSOptionsCreateRequest(ctx context.Context, location string, options *ManagedClustersClientGetOSOptionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + if options != nil && options.ResourceType != nil { + reqQP.Set("resource-type", *options.ResourceType) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOSOptionsHandleResponse handles the GetOSOptions response. +func (client *ManagedClustersClient) getOSOptionsHandleResponse(resp *http.Response) (ManagedClustersClientGetOSOptionsResponse, error) { + result := ManagedClustersClientGetOSOptionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OSOptionProfile); err != nil { + return ManagedClustersClientGetOSOptionsResponse{}, err + } + return result, nil +} + +// GetUpgradeProfile - Gets the upgrade profile of a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientGetUpgradeProfileOptions contains the optional parameters for the ManagedClustersClient.GetUpgradeProfile +// method. +func (client *ManagedClustersClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientGetUpgradeProfileOptions) (ManagedClustersClientGetUpgradeProfileResponse, error) { + var err error + const operationName = "ManagedClustersClient.GetUpgradeProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getUpgradeProfileCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ManagedClustersClientGetUpgradeProfileResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientGetUpgradeProfileResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientGetUpgradeProfileResponse{}, err + } + resp, err := client.getUpgradeProfileHandleResponse(httpResp) + return resp, err +} + +// getUpgradeProfileCreateRequest creates the GetUpgradeProfile request. +func (client *ManagedClustersClient) getUpgradeProfileCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientGetUpgradeProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getUpgradeProfileHandleResponse handles the GetUpgradeProfile response. +func (client *ManagedClustersClient) getUpgradeProfileHandleResponse(resp *http.Response) (ManagedClustersClientGetUpgradeProfileResponse, error) { + result := ManagedClustersClientGetUpgradeProfileResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterUpgradeProfile); err != nil { + return ManagedClustersClientGetUpgradeProfileResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of managed clusters in the specified subscription. +// +// Generated from API version 2023-10-01 +// - options - ManagedClustersClientListOptions contains the optional parameters for the ManagedClustersClient.NewListPager +// method. +func (client *ManagedClustersClient) NewListPager(options *ManagedClustersClientListOptions) *runtime.Pager[ManagedClustersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClustersClientListResponse]{ + More: func(page ManagedClustersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClustersClientListResponse) (ManagedClustersClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return ManagedClustersClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedClustersClient) listCreateRequest(ctx context.Context, options *ManagedClustersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagedClustersClient) listHandleResponse(resp *http.Response) (ManagedClustersClientListResponse, error) { + result := ManagedClustersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterListResult); err != nil { + return ManagedClustersClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists managed clusters in the specified subscription and resource group. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ManagedClustersClientListByResourceGroupOptions contains the optional parameters for the ManagedClustersClient.NewListByResourceGroupPager +// method. +func (client *ManagedClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *ManagedClustersClientListByResourceGroupOptions) *runtime.Pager[ManagedClustersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClustersClientListByResourceGroupResponse]{ + More: func(page ManagedClustersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClustersClientListByResourceGroupResponse) (ManagedClustersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return ManagedClustersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ManagedClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ManagedClustersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ManagedClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagedClustersClientListByResourceGroupResponse, error) { + result := ManagedClustersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterListResult); err != nil { + return ManagedClustersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// ListClusterAdminCredentials - Lists the admin credentials of a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientListClusterAdminCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterAdminCredentials +// method. +func (client *ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListClusterAdminCredentialsOptions) (ManagedClustersClientListClusterAdminCredentialsResponse, error) { + var err error + const operationName = "ManagedClustersClient.ListClusterAdminCredentials" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listClusterAdminCredentialsCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ManagedClustersClientListClusterAdminCredentialsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientListClusterAdminCredentialsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientListClusterAdminCredentialsResponse{}, err + } + resp, err := client.listClusterAdminCredentialsHandleResponse(httpResp) + return resp, err +} + +// listClusterAdminCredentialsCreateRequest creates the ListClusterAdminCredentials request. +func (client *ManagedClustersClient) listClusterAdminCredentialsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListClusterAdminCredentialsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + if options != nil && options.ServerFqdn != nil { + reqQP.Set("server-fqdn", *options.ServerFqdn) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listClusterAdminCredentialsHandleResponse handles the ListClusterAdminCredentials response. +func (client *ManagedClustersClient) listClusterAdminCredentialsHandleResponse(resp *http.Response) (ManagedClustersClientListClusterAdminCredentialsResponse, error) { + result := ManagedClustersClientListClusterAdminCredentialsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialResults); err != nil { + return ManagedClustersClientListClusterAdminCredentialsResponse{}, err + } + return result, nil +} + +// ListClusterMonitoringUserCredentials - Lists the cluster monitoring user credentials of a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientListClusterMonitoringUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterMonitoringUserCredentials +// method. +func (client *ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListClusterMonitoringUserCredentialsOptions) (ManagedClustersClientListClusterMonitoringUserCredentialsResponse, error) { + var err error + const operationName = "ManagedClustersClient.ListClusterMonitoringUserCredentials" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listClusterMonitoringUserCredentialsCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ManagedClustersClientListClusterMonitoringUserCredentialsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientListClusterMonitoringUserCredentialsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientListClusterMonitoringUserCredentialsResponse{}, err + } + resp, err := client.listClusterMonitoringUserCredentialsHandleResponse(httpResp) + return resp, err +} + +// listClusterMonitoringUserCredentialsCreateRequest creates the ListClusterMonitoringUserCredentials request. +func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListClusterMonitoringUserCredentialsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + if options != nil && options.ServerFqdn != nil { + reqQP.Set("server-fqdn", *options.ServerFqdn) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listClusterMonitoringUserCredentialsHandleResponse handles the ListClusterMonitoringUserCredentials response. +func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsHandleResponse(resp *http.Response) (ManagedClustersClientListClusterMonitoringUserCredentialsResponse, error) { + result := ManagedClustersClientListClusterMonitoringUserCredentialsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialResults); err != nil { + return ManagedClustersClientListClusterMonitoringUserCredentialsResponse{}, err + } + return result, nil +} + +// ListClusterUserCredentials - Lists the user credentials of a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientListClusterUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterUserCredentials +// method. +func (client *ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListClusterUserCredentialsOptions) (ManagedClustersClientListClusterUserCredentialsResponse, error) { + var err error + const operationName = "ManagedClustersClient.ListClusterUserCredentials" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listClusterUserCredentialsCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ManagedClustersClientListClusterUserCredentialsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientListClusterUserCredentialsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientListClusterUserCredentialsResponse{}, err + } + resp, err := client.listClusterUserCredentialsHandleResponse(httpResp) + return resp, err +} + +// listClusterUserCredentialsCreateRequest creates the ListClusterUserCredentials request. +func (client *ManagedClustersClient) listClusterUserCredentialsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListClusterUserCredentialsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + if options != nil && options.ServerFqdn != nil { + reqQP.Set("server-fqdn", *options.ServerFqdn) + } + if options != nil && options.Format != nil { + reqQP.Set("format", string(*options.Format)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listClusterUserCredentialsHandleResponse handles the ListClusterUserCredentials response. +func (client *ManagedClustersClient) listClusterUserCredentialsHandleResponse(resp *http.Response) (ManagedClustersClientListClusterUserCredentialsResponse, error) { + result := ManagedClustersClientListClusterUserCredentialsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialResults); err != nil { + return ManagedClustersClientListClusterUserCredentialsResponse{}, err + } + return result, nil +} + +// ListKubernetesVersions - Contains extra metadata on the version, including supported patch versions, capabilities, available +// upgrades, and details on preview status of the version +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - location - The name of the Azure region. +// - options - ManagedClustersClientListKubernetesVersionsOptions contains the optional parameters for the ManagedClustersClient.ListKubernetesVersions +// method. +func (client *ManagedClustersClient) ListKubernetesVersions(ctx context.Context, location string, options *ManagedClustersClientListKubernetesVersionsOptions) (ManagedClustersClientListKubernetesVersionsResponse, error) { + var err error + const operationName = "ManagedClustersClient.ListKubernetesVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listKubernetesVersionsCreateRequest(ctx, location, options) + if err != nil { + return ManagedClustersClientListKubernetesVersionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientListKubernetesVersionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientListKubernetesVersionsResponse{}, err + } + resp, err := client.listKubernetesVersionsHandleResponse(httpResp) + return resp, err +} + +// listKubernetesVersionsCreateRequest creates the ListKubernetesVersions request. +func (client *ManagedClustersClient) listKubernetesVersionsCreateRequest(ctx context.Context, location string, options *ManagedClustersClientListKubernetesVersionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/kubernetesVersions" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listKubernetesVersionsHandleResponse handles the ListKubernetesVersions response. +func (client *ManagedClustersClient) listKubernetesVersionsHandleResponse(resp *http.Response) (ManagedClustersClientListKubernetesVersionsResponse, error) { + result := ManagedClustersClientListKubernetesVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.KubernetesVersionListResult); err != nil { + return ManagedClustersClientListKubernetesVersionsResponse{}, err + } + return result, nil +} + +// NewListMeshRevisionProfilesPager - Contains extra metadata on each revision, including supported revisions, cluster compatibility +// and available upgrades +// +// Generated from API version 2023-10-01 +// - location - The name of the Azure region. +// - options - ManagedClustersClientListMeshRevisionProfilesOptions contains the optional parameters for the ManagedClustersClient.NewListMeshRevisionProfilesPager +// method. +func (client *ManagedClustersClient) NewListMeshRevisionProfilesPager(location string, options *ManagedClustersClientListMeshRevisionProfilesOptions) *runtime.Pager[ManagedClustersClientListMeshRevisionProfilesResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClustersClientListMeshRevisionProfilesResponse]{ + More: func(page ManagedClustersClientListMeshRevisionProfilesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClustersClientListMeshRevisionProfilesResponse) (ManagedClustersClientListMeshRevisionProfilesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListMeshRevisionProfilesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listMeshRevisionProfilesCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return ManagedClustersClientListMeshRevisionProfilesResponse{}, err + } + return client.listMeshRevisionProfilesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listMeshRevisionProfilesCreateRequest creates the ListMeshRevisionProfiles request. +func (client *ManagedClustersClient) listMeshRevisionProfilesCreateRequest(ctx context.Context, location string, options *ManagedClustersClientListMeshRevisionProfilesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMeshRevisionProfilesHandleResponse handles the ListMeshRevisionProfiles response. +func (client *ManagedClustersClient) listMeshRevisionProfilesHandleResponse(resp *http.Response) (ManagedClustersClientListMeshRevisionProfilesResponse, error) { + result := ManagedClustersClientListMeshRevisionProfilesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MeshRevisionProfileList); err != nil { + return ManagedClustersClientListMeshRevisionProfilesResponse{}, err + } + return result, nil +} + +// NewListMeshUpgradeProfilesPager - Lists available upgrades for all service meshes in a specific cluster. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientListMeshUpgradeProfilesOptions contains the optional parameters for the ManagedClustersClient.NewListMeshUpgradeProfilesPager +// method. +func (client *ManagedClustersClient) NewListMeshUpgradeProfilesPager(resourceGroupName string, resourceName string, options *ManagedClustersClientListMeshUpgradeProfilesOptions) *runtime.Pager[ManagedClustersClientListMeshUpgradeProfilesResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClustersClientListMeshUpgradeProfilesResponse]{ + More: func(page ManagedClustersClientListMeshUpgradeProfilesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClustersClientListMeshUpgradeProfilesResponse) (ManagedClustersClientListMeshUpgradeProfilesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListMeshUpgradeProfilesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listMeshUpgradeProfilesCreateRequest(ctx, resourceGroupName, resourceName, options) + }, nil) + if err != nil { + return ManagedClustersClientListMeshUpgradeProfilesResponse{}, err + } + return client.listMeshUpgradeProfilesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listMeshUpgradeProfilesCreateRequest creates the ListMeshUpgradeProfiles request. +func (client *ManagedClustersClient) listMeshUpgradeProfilesCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListMeshUpgradeProfilesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listMeshUpgradeProfilesHandleResponse handles the ListMeshUpgradeProfiles response. +func (client *ManagedClustersClient) listMeshUpgradeProfilesHandleResponse(resp *http.Response) (ManagedClustersClientListMeshUpgradeProfilesResponse, error) { + result := ManagedClustersClientListMeshUpgradeProfilesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MeshUpgradeProfileList); err != nil { + return ManagedClustersClientListMeshUpgradeProfilesResponse{}, err + } + return result, nil +} + +// NewListOutboundNetworkDependenciesEndpointsPager - Gets a list of egress endpoints (network endpoints of all outbound dependencies) +// in the specified managed cluster. The operation returns properties of each egress endpoint. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the +// ManagedClustersClient.NewListOutboundNetworkDependenciesEndpointsPager method. +func (client *ManagedClustersClient) NewListOutboundNetworkDependenciesEndpointsPager(resourceGroupName string, resourceName string, options *ManagedClustersClientListOutboundNetworkDependenciesEndpointsOptions) *runtime.Pager[ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse]{ + More: func(page ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse) (ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListOutboundNetworkDependenciesEndpointsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listOutboundNetworkDependenciesEndpointsCreateRequest(ctx, resourceGroupName, resourceName, options) + }, nil) + if err != nil { + return ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse{}, err + } + return client.listOutboundNetworkDependenciesEndpointsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listOutboundNetworkDependenciesEndpointsCreateRequest creates the ListOutboundNetworkDependenciesEndpoints request. +func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListOutboundNetworkDependenciesEndpointsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listOutboundNetworkDependenciesEndpointsHandleResponse handles the ListOutboundNetworkDependenciesEndpoints response. +func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsHandleResponse(resp *http.Response) (ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse, error) { + result := ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OutboundEnvironmentEndpointCollection); err != nil { + return ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse{}, err + } + return result, nil +} + +// BeginResetAADProfile - WARNING: This API will be deprecated. Please see AKS-managed Azure Active Directory integration +// [https://aka.ms/aks-managed-aad] to update your cluster with AKS-managed Azure AD. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - parameters - The AAD profile to set on the Managed Cluster +// - options - ManagedClustersClientBeginResetAADProfileOptions contains the optional parameters for the ManagedClustersClient.BeginResetAADProfile +// method. +func (client *ManagedClustersClient) BeginResetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile, options *ManagedClustersClientBeginResetAADProfileOptions) (*runtime.Poller[ManagedClustersClientResetAADProfileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resetAADProfile(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientResetAADProfileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientResetAADProfileResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ResetAADProfile - WARNING: This API will be deprecated. Please see AKS-managed Azure Active Directory integration [https://aka.ms/aks-managed-aad] +// to update your cluster with AKS-managed Azure AD. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) resetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile, options *ManagedClustersClientBeginResetAADProfileOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginResetAADProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.resetAADProfileCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// resetAADProfileCreateRequest creates the ResetAADProfile request. +func (client *ManagedClustersClient) resetAADProfileCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile, options *ManagedClustersClientBeginResetAADProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginResetServicePrincipalProfile - This action cannot be performed on a cluster that is not using a service principal +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - parameters - The service principal profile to set on the managed cluster. +// - options - ManagedClustersClientBeginResetServicePrincipalProfileOptions contains the optional parameters for the ManagedClustersClient.BeginResetServicePrincipalProfile +// method. +func (client *ManagedClustersClient) BeginResetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile, options *ManagedClustersClientBeginResetServicePrincipalProfileOptions) (*runtime.Poller[ManagedClustersClientResetServicePrincipalProfileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resetServicePrincipalProfile(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientResetServicePrincipalProfileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientResetServicePrincipalProfileResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ResetServicePrincipalProfile - This action cannot be performed on a cluster that is not using a service principal +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) resetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile, options *ManagedClustersClientBeginResetServicePrincipalProfileOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginResetServicePrincipalProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.resetServicePrincipalProfileCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// resetServicePrincipalProfileCreateRequest creates the ResetServicePrincipalProfile request. +func (client *ManagedClustersClient) resetServicePrincipalProfileCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile, options *ManagedClustersClientBeginResetServicePrincipalProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginRotateClusterCertificates - See Certificate rotation [https://docs.microsoft.com/azure/aks/certificate-rotation] for +// more details about rotating managed cluster certificates. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientBeginRotateClusterCertificatesOptions contains the optional parameters for the ManagedClustersClient.BeginRotateClusterCertificates +// method. +func (client *ManagedClustersClient) BeginRotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateClusterCertificatesOptions) (*runtime.Poller[ManagedClustersClientRotateClusterCertificatesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.rotateClusterCertificates(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientRotateClusterCertificatesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientRotateClusterCertificatesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RotateClusterCertificates - See Certificate rotation [https://docs.microsoft.com/azure/aks/certificate-rotation] for more +// details about rotating managed cluster certificates. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) rotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateClusterCertificatesOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginRotateClusterCertificates" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.rotateClusterCertificatesCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// rotateClusterCertificatesCreateRequest creates the RotateClusterCertificates request. +func (client *ManagedClustersClient) rotateClusterCertificatesCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateClusterCertificatesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRotateServiceAccountSigningKeys - Rotates the service account signing keys of a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions contains the optional parameters for the ManagedClustersClient.BeginRotateServiceAccountSigningKeys +// method. +func (client *ManagedClustersClient) BeginRotateServiceAccountSigningKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*runtime.Poller[ManagedClustersClientRotateServiceAccountSigningKeysResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.rotateServiceAccountSigningKeys(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientRotateServiceAccountSigningKeysResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientRotateServiceAccountSigningKeysResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RotateServiceAccountSigningKeys - Rotates the service account signing keys of a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) rotateServiceAccountSigningKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginRotateServiceAccountSigningKeys" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.rotateServiceAccountSigningKeysCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// rotateServiceAccountSigningKeysCreateRequest creates the RotateServiceAccountSigningKeys request. +func (client *ManagedClustersClient) rotateServiceAccountSigningKeysCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRunCommand - AKS will create a pod to run the command. This is primarily useful for private clusters. For more information +// see AKS Run Command +// [https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview]. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - requestPayload - The run command request +// - options - ManagedClustersClientBeginRunCommandOptions contains the optional parameters for the ManagedClustersClient.BeginRunCommand +// method. +func (client *ManagedClustersClient) BeginRunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest, options *ManagedClustersClientBeginRunCommandOptions) (*runtime.Poller[ManagedClustersClientRunCommandResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.runCommand(ctx, resourceGroupName, resourceName, requestPayload, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientRunCommandResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientRunCommandResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RunCommand - AKS will create a pod to run the command. This is primarily useful for private clusters. For more information +// see AKS Run Command +// [https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview]. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) runCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest, options *ManagedClustersClientBeginRunCommandOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginRunCommand" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.runCommandCreateRequest(ctx, resourceGroupName, resourceName, requestPayload, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// runCommandCreateRequest creates the RunCommand request. +func (client *ManagedClustersClient) runCommandCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest, options *ManagedClustersClientBeginRunCommandOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestPayload); err != nil { + return nil, err + } + return req, nil +} + +// BeginStart - See starting a cluster [https://docs.microsoft.com/azure/aks/start-stop-cluster] for more details about starting +// a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientBeginStartOptions contains the optional parameters for the ManagedClustersClient.BeginStart +// method. +func (client *ManagedClustersClient) BeginStart(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStartOptions) (*runtime.Poller[ManagedClustersClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Start - See starting a cluster [https://docs.microsoft.com/azure/aks/start-stop-cluster] for more details about starting +// a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) start(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStartOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// startCreateRequest creates the Start request. +func (client *ManagedClustersClient) startCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStop - This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the +// control plane and agent nodes entirely, while maintaining all object and cluster state. A +// cluster does not accrue charges while it is stopped. See stopping a cluster [https://docs.microsoft.com/azure/aks/start-stop-cluster] +// for more details about stopping a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClustersClientBeginStopOptions contains the optional parameters for the ManagedClustersClient.BeginStop +// method. +func (client *ManagedClustersClient) BeginStop(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStopOptions) (*runtime.Poller[ManagedClustersClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientStopResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Stop - This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control +// plane and agent nodes entirely, while maintaining all object and cluster state. A +// cluster does not accrue charges while it is stopped. See stopping a cluster [https://docs.microsoft.com/azure/aks/start-stop-cluster] +// for more details about stopping a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) stop(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStopOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginStop" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.stopCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ManagedClustersClient) stopCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdateTags - Updates tags on a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - parameters - Parameters supplied to the Update Managed Cluster Tags operation. +// - options - ManagedClustersClientBeginUpdateTagsOptions contains the optional parameters for the ManagedClustersClient.BeginUpdateTags +// method. +func (client *ManagedClustersClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClustersClientBeginUpdateTagsOptions) (*runtime.Poller[ManagedClustersClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedClustersClientUpdateTagsResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedClustersClientUpdateTagsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateTags - Updates tags on a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *ManagedClustersClient) updateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClustersClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + const operationName = "ManagedClustersClient.BeginUpdateTags" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ManagedClustersClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClustersClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/models.go new file mode 100644 index 000000000..53ce459f7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/models.go @@ -0,0 +1,2365 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import "time" + +// AbsoluteMonthlySchedule - For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'. +type AbsoluteMonthlySchedule struct { + // REQUIRED; The date of the month. + DayOfMonth *int32 + + // REQUIRED; Specifies the number of months between each set of occurrences. + IntervalMonths *int32 +} + +// AccessProfile - Profile for enabling a user to access a managed cluster. +type AccessProfile struct { + // Base64-encoded Kubernetes configuration file. + KubeConfig []byte +} + +// AgentPool - Agent Pool. +type AgentPool struct { + // Properties of an agent pool. + Properties *ManagedClusterAgentPoolProfileProperties + + // READ-ONLY; Resource ID. + ID *string + + // 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 + + // READ-ONLY; Resource type + Type *string +} + +// AgentPoolAvailableVersions - The list of available versions for an agent pool. +type AgentPoolAvailableVersions struct { + // REQUIRED; Properties of agent pool available versions. + Properties *AgentPoolAvailableVersionsProperties + + // READ-ONLY; The ID of the agent pool version list. + ID *string + + // READ-ONLY; The name of the agent pool version list. + Name *string + + // READ-ONLY; Type of the agent pool version list. + Type *string +} + +// AgentPoolAvailableVersionsProperties - The list of available agent pool versions. +type AgentPoolAvailableVersionsProperties struct { + // List of versions available for agent pool. + AgentPoolVersions []*AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem +} + +type AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem struct { + // Whether this version is the default agent pool version. + Default *bool + + // Whether Kubernetes version is currently in preview. + IsPreview *bool + + // The Kubernetes version (major.minor.patch). + KubernetesVersion *string +} + +// AgentPoolListResult - The response from the List Agent Pools operation. +type AgentPoolListResult struct { + // The list of agent pools. + Value []*AgentPool + + // READ-ONLY; The URL to get the next set of agent pool results. + NextLink *string +} + +// AgentPoolNetworkProfile - Network settings of an agent pool. +type AgentPoolNetworkProfile struct { + // The port ranges that are allowed to access. The specified ranges are allowed to overlap. + AllowedHostPorts []*PortRange + + // The IDs of the application security groups which agent pool will associate when created. + ApplicationSecurityGroups []*string + + // IPTags of instance-level public IPs. + NodePublicIPTags []*IPTag +} + +// AgentPoolUpgradeProfile - The list of available upgrades for an agent pool. +type AgentPoolUpgradeProfile struct { + // REQUIRED; The properties of the agent pool upgrade profile. + Properties *AgentPoolUpgradeProfileProperties + + // READ-ONLY; The ID of the agent pool upgrade profile. + ID *string + + // READ-ONLY; The name of the agent pool upgrade profile. + Name *string + + // READ-ONLY; The type of the agent pool upgrade profile. + Type *string +} + +// AgentPoolUpgradeProfileProperties - The list of available upgrade versions. +type AgentPoolUpgradeProfileProperties struct { + // REQUIRED; The Kubernetes version (major.minor.patch). + KubernetesVersion *string + + // REQUIRED; The operating system type. The default is Linux. + OSType *OSType + + // The latest AKS supported node image version. + LatestNodeImageVersion *string + + // List of orchestrator types and versions available for upgrade. + Upgrades []*AgentPoolUpgradeProfilePropertiesUpgradesItem +} + +type AgentPoolUpgradeProfilePropertiesUpgradesItem struct { + // Whether the Kubernetes version is currently in preview. + IsPreview *bool + + // The Kubernetes version (major.minor.patch). + KubernetesVersion *string +} + +// AgentPoolUpgradeSettings - Settings for upgrading an agentpool +type AgentPoolUpgradeSettings struct { + // The amount of time (in minutes) to wait on eviction of pods and graceful termination per node. This eviction wait time + // honors waiting on pod disruption budgets. If this time is exceeded, the upgrade + // fails. If not specified, the default is 30 minutes. + DrainTimeoutInMinutes *int32 + + // This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage + // of the total agent pool size at the time of the upgrade. For + // percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best + // practices, see: + // https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade + MaxSurge *string +} + +// AzureKeyVaultKms - Azure Key Vault key management service settings for the security profile. +type AzureKeyVaultKms struct { + // Whether to enable Azure Key Vault key management service. The default is false. + Enabled *bool + + // Identifier of Azure Key Vault key. See key identifier format [https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name] + // for more details. + // When Azure Key Vault key management service is enabled, this field is required and must be a valid key identifier. When + // Azure Key Vault key management service is disabled, leave the field empty. + KeyID *string + + // Network access of key vault. The possible values are Public and Private. Public means the key vault allows public access + // from all networks. Private means the key vault disables public access and + // enables private link. The default value is Public. + KeyVaultNetworkAccess *KeyVaultNetworkAccessTypes + + // Resource ID of key vault. When keyVaultNetworkAccess is Private, this field is required and must be a valid resource ID. + // When keyVaultNetworkAccess is Public, leave the field empty. + KeyVaultResourceID *string +} + +// ClusterUpgradeSettings - Settings for upgrading a cluster. +type ClusterUpgradeSettings struct { + // Settings for overrides. + OverrideSettings *UpgradeOverrideSettings +} + +// CommandResultProperties - The results of a run command +type CommandResultProperties struct { + // READ-ONLY; The exit code of the command + ExitCode *int32 + + // READ-ONLY; The time when the command finished. + FinishedAt *time.Time + + // READ-ONLY; The command output. + Logs *string + + // READ-ONLY; provisioning State + ProvisioningState *string + + // READ-ONLY; An explanation of why provisioningState is set to failed (if so). + Reason *string + + // READ-ONLY; The time when the command started. + StartedAt *time.Time +} + +// CompatibleVersions - Version information about a product/service that is compatible with a service mesh revision. +type CompatibleVersions struct { + // The product/service name. + Name *string + + // Product/service versions compatible with a service mesh add-on revision. + Versions []*string +} + +// CreationData - Data used when creating a target resource from a source resource. +type CreationData struct { + // This is the ARM ID of the source object to be used to create the target object. + SourceResourceID *string +} + +// CredentialResult - The credential result response. +type CredentialResult struct { + // READ-ONLY; The name of the credential. + Name *string + + // READ-ONLY; Base64-encoded Kubernetes configuration file. + Value []byte +} + +// CredentialResults - The list credential result response. +type CredentialResults struct { + // READ-ONLY; Base64-encoded Kubernetes configuration file. + Kubeconfigs []*CredentialResult +} + +// DailySchedule - For schedules like: 'recur every day' or 'recur every 3 days'. +type DailySchedule struct { + // REQUIRED; Specifies the number of days between each set of occurrences. + IntervalDays *int32 +} + +// DateSpan - For example, between '2022-12-23' and '2023-01-05'. +type DateSpan struct { + // REQUIRED; The end date of the date span. + End *time.Time + + // REQUIRED; The start date of the date span. + Start *time.Time +} + +// DelegatedResource - Delegated resource properties - internal use only. +type DelegatedResource struct { + // The source resource location - internal use only. + Location *string + + // The delegation id of the referral delegation (optional) - internal use only. + ReferralResource *string + + // The ARM resource id of the delegated resource - internal use only. + ResourceID *string + + // The tenant id of the delegated resource - internal use only. + TenantID *string +} + +// EndpointDependency - A domain name that AKS agent nodes are reaching at. +type EndpointDependency struct { + // The domain name of the dependency. + DomainName *string + + // The Ports and Protocols used when connecting to domainName. + EndpointDetails []*EndpointDetail +} + +// EndpointDetail - connect information from the AKS agent nodes to a single endpoint. +type EndpointDetail struct { + // Description of the detail + Description *string + + // An IP Address that Domain Name currently resolves to. + IPAddress *string + + // The port an endpoint is connected to. + Port *int32 + + // The protocol used for connection + Protocol *string +} + +// ExtendedLocation - The complex type of the extended location. +type ExtendedLocation struct { + // The name of the extended location. + Name *string + + // The type of the extended location. + Type *ExtendedLocationTypes +} + +// IPTag - Contains the IPTag associated with the object. +type IPTag struct { + // The IP tag type. Example: RoutingPreference. + IPTagType *string + + // The value of the IP tag associated with the public IP. Example: Internet. + Tag *string +} + +// IstioCertificateAuthority - Istio Service Mesh Certificate Authority (CA) configuration. For now, we only support plugin +// certificates as described here https://aka.ms/asm-plugin-ca +type IstioCertificateAuthority struct { + // Plugin certificates information for Service Mesh. + Plugin *IstioPluginCertificateAuthority +} + +// IstioComponents - Istio components configuration. +type IstioComponents struct { + // Istio egress gateways. + EgressGateways []*IstioEgressGateway + + // Istio ingress gateways. + IngressGateways []*IstioIngressGateway +} + +// IstioEgressGateway - Istio egress gateway configuration. +type IstioEgressGateway struct { + // REQUIRED; Whether to enable the egress gateway. + Enabled *bool + + // NodeSelector for scheduling the egress gateway. + NodeSelector map[string]*string +} + +// IstioIngressGateway - Istio ingress gateway configuration. For now, we support up to one external ingress gateway named +// aks-istio-ingressgateway-external and one internal ingress gateway named +// aks-istio-ingressgateway-internal. +type IstioIngressGateway struct { + // REQUIRED; Whether to enable the ingress gateway. + Enabled *bool + + // REQUIRED; Mode of an ingress gateway. + Mode *IstioIngressGatewayMode +} + +// IstioPluginCertificateAuthority - Plugin certificates information for Service Mesh. +type IstioPluginCertificateAuthority struct { + // Certificate chain object name in Azure Key Vault. + CertChainObjectName *string + + // Intermediate certificate object name in Azure Key Vault. + CertObjectName *string + + // Intermediate certificate private key object name in Azure Key Vault. + KeyObjectName *string + + // The resource ID of the Key Vault. + KeyVaultID *string + + // Root certificate object name in Azure Key Vault. + RootCertObjectName *string +} + +// IstioServiceMesh - Istio service mesh configuration. +type IstioServiceMesh struct { + // Istio Service Mesh Certificate Authority (CA) configuration. For now, we only support plugin certificates as described + // here https://aka.ms/asm-plugin-ca + CertificateAuthority *IstioCertificateAuthority + + // Istio components configuration. + Components *IstioComponents + + // The list of revisions of the Istio control plane. When an upgrade is not in progress, this holds one value. When canary + // upgrade is in progress, this can only hold two consecutive values. For more + // information, see: https://learn.microsoft.com/en-us/azure/aks/istio-upgrade + Revisions []*string +} + +// KubeletConfig - See AKS custom node configuration [https://docs.microsoft.com/azure/aks/custom-node-configuration] for +// more details. +type KubeletConfig struct { + // Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in *). + AllowedUnsafeSysctls []*string + + // The default is true. + CPUCfsQuota *bool + + // The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For + // example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and + // 'h'. + CPUCfsQuotaPeriod *string + + // The default is 'none'. See Kubernetes CPU management policies [https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies] + // for more information. Allowed + // values are 'none' and 'static'. + CPUManagerPolicy *string + + // The maximum number of container log files that can be present for a container. The number must be ≥ 2. + ContainerLogMaxFiles *int32 + + // The maximum size (e.g. 10Mi) of container log file before it is rotated. + ContainerLogMaxSizeMB *int32 + + // If set to true it will make the Kubelet fail to start if swap is enabled on the node. + FailSwapOn *bool + + // To disable image garbage collection, set to 100. The default is 85% + ImageGcHighThreshold *int32 + + // This cannot be set higher than imageGcHighThreshold. The default is 80% + ImageGcLowThreshold *int32 + + // The maximum number of processes per pod. + PodMaxPids *int32 + + // For more information see Kubernetes Topology Manager [https://kubernetes.io/docs/tasks/administer-cluster/topology-manager]. + // The default is 'none'. Allowed values are 'none', 'best-effort', + // 'restricted', and 'single-numa-node'. + TopologyManagerPolicy *string +} + +// KubernetesPatchVersion - Kubernetes patch version profile +type KubernetesPatchVersion struct { + // Possible upgrade path for given patch version + Upgrades []*string +} + +// KubernetesVersion - Kubernetes version profile for given major.minor release. +type KubernetesVersion struct { + // Capabilities on this Kubernetes version. + Capabilities *KubernetesVersionCapabilities + + // Whether this version is in preview mode. + IsPreview *bool + + // Patch versions of Kubernetes release + PatchVersions map[string]*KubernetesPatchVersion + + // major.minor version of Kubernetes release + Version *string +} + +// KubernetesVersionCapabilities - Capabilities on this Kubernetes version. +type KubernetesVersionCapabilities struct { + SupportPlan []*KubernetesSupportPlan +} + +// KubernetesVersionListResult - Hold values properties, which is array of KubernetesVersion +type KubernetesVersionListResult struct { + // Array of AKS supported Kubernetes versions. + Values []*KubernetesVersion +} + +// LinuxOSConfig - See AKS custom node configuration [https://docs.microsoft.com/azure/aks/custom-node-configuration] for +// more details. +type LinuxOSConfig struct { + // The size in MB of a swap file that will be created on each node. + SwapFileSizeMB *int32 + + // Sysctl settings for Linux agent nodes. + Sysctls *SysctlConfig + + // Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information + // see Transparent Hugepages + // [https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge]. + TransparentHugePageDefrag *string + + // Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see Transparent Hugepages + // [https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge]. + TransparentHugePageEnabled *string +} + +// LinuxProfile - Profile for Linux VMs in the container service cluster. +type LinuxProfile struct { + // REQUIRED; The administrator username to use for Linux VMs. + AdminUsername *string + + // REQUIRED; The SSH configuration for Linux-based VMs running on Azure. + SSH *SSHConfiguration +} + +// MaintenanceConfiguration - See planned maintenance [https://docs.microsoft.com/azure/aks/planned-maintenance] for more +// information about planned maintenance. +type MaintenanceConfiguration struct { + // Properties of a default maintenance configuration. + Properties *MaintenanceConfigurationProperties + + // READ-ONLY; Resource ID. + ID *string + + // 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 + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type + Type *string +} + +// MaintenanceConfigurationListResult - The response from the List maintenance configurations operation. +type MaintenanceConfigurationListResult struct { + // The list of maintenance configurations. + Value []*MaintenanceConfiguration + + // READ-ONLY; The URL to get the next set of maintenance configuration results. + NextLink *string +} + +// MaintenanceConfigurationProperties - Properties used to configure planned maintenance for a Managed Cluster. +type MaintenanceConfigurationProperties struct { + // Maintenance window for the maintenance configuration. + MaintenanceWindow *MaintenanceWindow + + // Time slots on which upgrade is not allowed. + NotAllowedTime []*TimeSpan + + // If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. + TimeInWeek []*TimeInWeek +} + +// MaintenanceWindow - Maintenance window used to configure scheduled auto-upgrade for a Managed Cluster. +type MaintenanceWindow struct { + // REQUIRED; Length of maintenance window range from 4 to 24 hours. + DurationHours *int32 + + // REQUIRED; Recurrence schedule for the maintenance window. + Schedule *Schedule + + // REQUIRED; The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. 'utcOffset' applies to + // this field. For example: '02:00' with 'utcOffset: +02:00' means UTC time '00:00'. + StartTime *string + + // Date ranges on which upgrade is not allowed. 'utcOffset' applies to this field. For example, with 'utcOffset: +02:00' and + // 'dateSpan' being '2022-12-23' to '2023-01-03', maintenance will be blocked + // from '2022-12-22 22:00' to '2023-01-03 22:00' in UTC time. + NotAllowedDates []*DateSpan + + // The date the maintenance window activates. If the current date is before this date, the maintenance window is inactive + // and will not be used for upgrades. If not specified, the maintenance window will + // be active right away. + StartDate *time.Time + + // The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the default is + // '+00:00'. + UTCOffset *string +} + +// ManagedCluster - Managed cluster. +type ManagedCluster struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation + + // The identity of the managed cluster, if configured. + Identity *ManagedClusterIdentity + + // Properties of a managed cluster. + Properties *ManagedClusterProperties + + // The managed cluster SKU. + SKU *ManagedClusterSKU + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ManagedClusterAADProfile - For more details see managed AAD on AKS [https://docs.microsoft.com/azure/aks/managed-aad]. +type ManagedClusterAADProfile struct { + // The list of AAD group object IDs that will have admin role of the cluster. + AdminGroupObjectIDs []*string + + // (DEPRECATED) The client AAD application ID. Learn more at https://aka.ms/aks/aad-legacy. + ClientAppID *string + + // Whether to enable Azure RBAC for Kubernetes authorization. + EnableAzureRBAC *bool + + // Whether to enable managed AAD. + Managed *bool + + // (DEPRECATED) The server AAD application ID. Learn more at https://aka.ms/aks/aad-legacy. + ServerAppID *string + + // (DEPRECATED) The server AAD application secret. Learn more at https://aka.ms/aks/aad-legacy. + ServerAppSecret *string + + // The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + TenantID *string +} + +// ManagedClusterAPIServerAccessProfile - Access profile for managed cluster API server. +type ManagedClusterAPIServerAccessProfile struct { + // IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public + // IP Per Node, or clusters that are using a Basic Load Balancer. For more + // information see API server authorized IP ranges [https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges]. + AuthorizedIPRanges []*string + + // Whether to disable run command for the cluster or not. + DisableRunCommand *bool + + // For more details, see Creating a private AKS cluster [https://docs.microsoft.com/azure/aks/private-clusters]. + EnablePrivateCluster *bool + + // Whether to create additional public FQDN for private cluster or not. + EnablePrivateClusterPublicFQDN *bool + + // The default is System. For more details see configure private DNS zone [https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone]. + // Allowed values are 'system' and 'none'. + PrivateDNSZone *string +} + +// ManagedClusterAccessProfile - Managed cluster Access Profile. +type ManagedClusterAccessProfile struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // AccessProfile of a managed cluster. + Properties *AccessProfile + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ManagedClusterAddonProfile - A Kubernetes add-on profile for a managed cluster. +type ManagedClusterAddonProfile struct { + // REQUIRED; Whether the add-on is enabled or not. + Enabled *bool + + // Key-value pairs for configuring an add-on. + Config map[string]*string + + // READ-ONLY; Information of user assigned identity used by this add-on. + Identity *ManagedClusterAddonProfileIdentity +} + +// ManagedClusterAddonProfileIdentity - Information of user assigned identity used by this add-on. +type ManagedClusterAddonProfileIdentity struct { + // The client ID of the user assigned identity. + ClientID *string + + // The object ID of the user assigned identity. + ObjectID *string + + // The resource ID of the user assigned identity. + ResourceID *string +} + +// ManagedClusterAgentPoolProfile - Profile for the container service agent pool. +type ManagedClusterAgentPoolProfile struct { + // REQUIRED; Windows agent pool names must be 6 characters or less. + Name *string + + // The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones []*string + + // AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string + + // Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user + // pools and in the range of 1 to 1000 (inclusive) for system pools. The default + // value is 1. + Count *int32 + + // CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData + + // Whether to enable auto-scaler + EnableAutoScaling *bool + + // This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool + + // See Add a FIPS-enabled node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview] + // for more details. + EnableFIPS *bool + + // Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is + // for gaming workloads, where a console needs to make a direct connection to a + // cloud virtual machine to minimize hops. For more information see assigning a public IP per node + // [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools]. The default + // is false. + EnableNodePublicIP *bool + + // Whether to enable UltraSSD + EnableUltraSSD *bool + + // GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + GpuInstanceProfile *GPUInstanceProfile + + // This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + // For more information see Azure dedicated hosts + // [https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts]. + HostGroupID *string + + // The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig + + // Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. + KubeletDiskType *KubeletDiskType + + // The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig + + // The maximum number of nodes for auto-scaling + MaxCount *int32 + + // The maximum number of pods that can run on a node. + MaxPods *int32 + + // The minimum number of nodes for auto-scaling + MinCount *int32 + + // A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions + // and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools + Mode *AgentPoolMode + + // Network-related settings of an agent pool. + NetworkProfile *AgentPoolNetworkProfile + + // The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string + + // This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string + + // The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints []*string + + // OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it + // will apply the default osDisk size according to the vmSize specified. + OSDiskSizeGB *int32 + + // The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, + // defaults to 'Managed'. May not be changed after creation. For more information + // see Ephemeral OS [https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os]. + OSDiskType *OSDiskType + + // Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when + // Kubernetes = 1.25 if OSType is Windows. + OSSKU *OSSKU + + // The operating system type. The default is Linux. + OSType *OSType + + // Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported GA patch version + // is chosen automatically. Updating the cluster with the same once it has been + // created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, + // you should upgrade all node pools in an AKS cluster to the same Kubernetes + // version. The node pool version must have the same major version as the control plane. The node pool minor version must + // be within two minor versions of the control plane version. The node pool version + // cannot be greater than the control plane version. For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. + OrchestratorVersion *string + + // If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string + + // When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. + // A stopped Agent Pool stops all of its VMs and does not accrue billing + // charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState + + // The ID for Proximity Placement Group. + ProximityPlacementGroupID *string + + // This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. + ScaleDownMode *ScaleDownMode + + // This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. + ScaleSetEvictionPolicy *ScaleSetEvictionPolicy + + // The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. + ScaleSetPriority *ScaleSetPriority + + // Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. + // For more details on spot pricing, see spot VMs pricing + // [https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing] + SpotMaxPrice *float32 + + // The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string + + // The type of Agent Pool. + Type *AgentPoolType + + // Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings + + // VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might + // fail to run correctly. For more details on restricted VM sizes, see: + // https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string + + // If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to + // nodes and pods, otherwise it applies to just nodes. This is of the form: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string + + // Determines the type of workload a node can run. + WorkloadRuntime *WorkloadRuntime + + // READ-ONLY; If orchestratorVersion is a fully specified version , this field will be exactly equal to it. If orchestratorVersion + // is , this field will contain the full version being used. + CurrentOrchestratorVersion *string + + // READ-ONLY; The version of node image + NodeImageVersion *string + + // READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string +} + +// ManagedClusterAgentPoolProfileProperties - Properties for the container service agent pool profile. +type ManagedClusterAgentPoolProfileProperties struct { + // The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones []*string + + // AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string + + // Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user + // pools and in the range of 1 to 1000 (inclusive) for system pools. The default + // value is 1. + Count *int32 + + // CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData + + // Whether to enable auto-scaler + EnableAutoScaling *bool + + // This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool + + // See Add a FIPS-enabled node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview] + // for more details. + EnableFIPS *bool + + // Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is + // for gaming workloads, where a console needs to make a direct connection to a + // cloud virtual machine to minimize hops. For more information see assigning a public IP per node + // [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools]. The default + // is false. + EnableNodePublicIP *bool + + // Whether to enable UltraSSD + EnableUltraSSD *bool + + // GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + GpuInstanceProfile *GPUInstanceProfile + + // This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + // For more information see Azure dedicated hosts + // [https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts]. + HostGroupID *string + + // The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig + + // Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. + KubeletDiskType *KubeletDiskType + + // The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig + + // The maximum number of nodes for auto-scaling + MaxCount *int32 + + // The maximum number of pods that can run on a node. + MaxPods *int32 + + // The minimum number of nodes for auto-scaling + MinCount *int32 + + // A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions + // and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools + Mode *AgentPoolMode + + // Network-related settings of an agent pool. + NetworkProfile *AgentPoolNetworkProfile + + // The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string + + // This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string + + // The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints []*string + + // OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it + // will apply the default osDisk size according to the vmSize specified. + OSDiskSizeGB *int32 + + // The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, + // defaults to 'Managed'. May not be changed after creation. For more information + // see Ephemeral OS [https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os]. + OSDiskType *OSDiskType + + // Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when + // Kubernetes = 1.25 if OSType is Windows. + OSSKU *OSSKU + + // The operating system type. The default is Linux. + OSType *OSType + + // Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported GA patch version + // is chosen automatically. Updating the cluster with the same once it has been + // created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, + // you should upgrade all node pools in an AKS cluster to the same Kubernetes + // version. The node pool version must have the same major version as the control plane. The node pool minor version must + // be within two minor versions of the control plane version. The node pool version + // cannot be greater than the control plane version. For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. + OrchestratorVersion *string + + // If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string + + // When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. + // A stopped Agent Pool stops all of its VMs and does not accrue billing + // charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState + + // The ID for Proximity Placement Group. + ProximityPlacementGroupID *string + + // This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. + ScaleDownMode *ScaleDownMode + + // This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. + ScaleSetEvictionPolicy *ScaleSetEvictionPolicy + + // The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. + ScaleSetPriority *ScaleSetPriority + + // Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. + // For more details on spot pricing, see spot VMs pricing + // [https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing] + SpotMaxPrice *float32 + + // The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string + + // The type of Agent Pool. + Type *AgentPoolType + + // Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings + + // VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might + // fail to run correctly. For more details on restricted VM sizes, see: + // https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string + + // If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to + // nodes and pods, otherwise it applies to just nodes. This is of the form: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string + + // Determines the type of workload a node can run. + WorkloadRuntime *WorkloadRuntime + + // READ-ONLY; If orchestratorVersion is a fully specified version , this field will be exactly equal to it. If orchestratorVersion + // is , this field will contain the full version being used. + CurrentOrchestratorVersion *string + + // READ-ONLY; The version of node image + NodeImageVersion *string + + // READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string +} + +// ManagedClusterAutoUpgradeProfile - Auto upgrade profile for a managed cluster. +type ManagedClusterAutoUpgradeProfile struct { + // Manner in which the OS on your nodes is updated. The default is NodeImage. + NodeOSUpgradeChannel *NodeOSUpgradeChannel + + // For more information see setting the AKS cluster auto-upgrade channel [https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel]. + UpgradeChannel *UpgradeChannel +} + +// ManagedClusterAzureMonitorProfile - Azure Monitor addon profiles for monitoring the managed cluster. +type ManagedClusterAzureMonitorProfile struct { + // Metrics profile for the Azure Monitor managed service for Prometheus addon. Collect out-of-the-box Kubernetes infrastructure + // metrics to send to an Azure Monitor Workspace and configure additional + // scraping for custom targets. See aka.ms/AzureManagedPrometheus for an overview. + Metrics *ManagedClusterAzureMonitorProfileMetrics +} + +// ManagedClusterAzureMonitorProfileKubeStateMetrics - Kube State Metrics profile for the Azure Managed Prometheus addon. +// These optional settings are for the kube-state-metrics pod that is deployed with the addon. See +// aka.ms/AzureManagedPrometheus-optional-parameters for details. +type ManagedClusterAzureMonitorProfileKubeStateMetrics struct { + // Comma-separated list of Kubernetes annotation keys that will be used in the resource's labels metric (Example: 'namespaces=[kubernetes.io/team,…],pods=[kubernetes.io/team],…'). + // By default the metric + // contains only resource name and namespace labels. + MetricAnnotationsAllowList *string + + // Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric (Example: 'namespaces=[k8s-label-1,k8s-label-n,…],pods=[app],…'). + // By default the metric + // contains only resource name and namespace labels. + MetricLabelsAllowlist *string +} + +// ManagedClusterAzureMonitorProfileMetrics - Metrics profile for the Azure Monitor managed service for Prometheus addon. +// Collect out-of-the-box Kubernetes infrastructure metrics to send to an Azure Monitor Workspace and configure additional +// scraping for custom targets. See aka.ms/AzureManagedPrometheus for an overview. +type ManagedClusterAzureMonitorProfileMetrics struct { + // REQUIRED; Whether to enable or disable the Azure Managed Prometheus addon for Prometheus monitoring. See aka.ms/AzureManagedPrometheus-aks-enable + // for details on enabling and disabling. + Enabled *bool + + // Kube State Metrics profile for the Azure Managed Prometheus addon. These optional settings are for the kube-state-metrics + // pod that is deployed with the addon. See + // aka.ms/AzureManagedPrometheus-optional-parameters for details. + KubeStateMetrics *ManagedClusterAzureMonitorProfileKubeStateMetrics +} + +// ManagedClusterHTTPProxyConfig - Cluster HTTP proxy configuration. +type ManagedClusterHTTPProxyConfig struct { + // The HTTP proxy server endpoint to use. + HTTPProxy *string + + // The HTTPS proxy server endpoint to use. + HTTPSProxy *string + + // The endpoints that should not go through proxy. + NoProxy []*string + + // Alternative CA cert to use for connecting to proxy servers. + TrustedCa *string +} + +// ManagedClusterIdentity - Identity for the managed cluster. +type ManagedClusterIdentity struct { + // The delegated identity resources assigned to this managed cluster. This can only be set by another Azure Resource Provider, + // and managed cluster only accept one delegated identity resource. Internal + // use only. + DelegatedResources map[string]*DelegatedResource + + // For more information see use managed identities in AKS [https://docs.microsoft.com/azure/aks/use-managed-identity]. + Type *ResourceIdentityType + + // The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*ManagedServiceIdentityUserAssignedIdentitiesValue + + // READ-ONLY; The principal id of the system assigned identity which is used by master components. + PrincipalID *string + + // READ-ONLY; The tenant id of the system assigned identity which is used by master components. + TenantID *string +} + +// ManagedClusterListResult - The response from the List Managed Clusters operation. +type ManagedClusterListResult struct { + // The list of managed clusters. + Value []*ManagedCluster + + // READ-ONLY; The URL to get the next set of managed cluster results. + NextLink *string +} + +// ManagedClusterLoadBalancerProfile - Profile of the managed cluster load balancer. +type ManagedClusterLoadBalancerProfile struct { + // The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default + // value is 0 which results in Azure dynamically allocating ports. + AllocatedOutboundPorts *int32 + + // The type of the managed inbound Load Balancer BackendPool. + BackendPoolType *BackendPoolType + + // The effective outbound IP resources of the cluster load balancer. + EffectiveOutboundIPs []*ResourceReference + + // Enable multiple standard load balancers per AKS cluster or not. + EnableMultipleStandardLoadBalancers *bool + + // Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value + // is 30 minutes. + IdleTimeoutInMinutes *int32 + + // Desired managed outbound IPs for the cluster load balancer. + ManagedOutboundIPs *ManagedClusterLoadBalancerProfileManagedOutboundIPs + + // Desired outbound IP Prefix resources for the cluster load balancer. + OutboundIPPrefixes *ManagedClusterLoadBalancerProfileOutboundIPPrefixes + + // Desired outbound IP resources for the cluster load balancer. + OutboundIPs *ManagedClusterLoadBalancerProfileOutboundIPs +} + +// ManagedClusterLoadBalancerProfileManagedOutboundIPs - Desired managed outbound IPs for the cluster load balancer. +type ManagedClusterLoadBalancerProfileManagedOutboundIPs struct { + // The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be + // in the range of 1 to 100 (inclusive). The default value is 1. + Count *int32 + + // The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be + // in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and + // 1 for dual-stack. + CountIPv6 *int32 +} + +// ManagedClusterLoadBalancerProfileOutboundIPPrefixes - Desired outbound IP Prefix resources for the cluster load balancer. +type ManagedClusterLoadBalancerProfileOutboundIPPrefixes struct { + // A list of public IP prefix resources. + PublicIPPrefixes []*ResourceReference +} + +// ManagedClusterLoadBalancerProfileOutboundIPs - Desired outbound IP resources for the cluster load balancer. +type ManagedClusterLoadBalancerProfileOutboundIPs struct { + // A list of public IP resources. + PublicIPs []*ResourceReference +} + +// ManagedClusterManagedOutboundIPProfile - Profile of the managed outbound IP resources of the managed cluster. +type ManagedClusterManagedOutboundIPProfile struct { + // The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). + // The default value is 1. + Count *int32 +} + +// ManagedClusterNATGatewayProfile - Profile of the managed cluster NAT gateway. +type ManagedClusterNATGatewayProfile struct { + // The effective outbound IP resources of the cluster NAT gateway. + EffectiveOutboundIPs []*ResourceReference + + // Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value + // is 4 minutes. + IdleTimeoutInMinutes *int32 + + // Profile of the managed outbound IP resources of the cluster NAT gateway. + ManagedOutboundIPProfile *ManagedClusterManagedOutboundIPProfile +} + +// ManagedClusterOIDCIssuerProfile - The OIDC issuer profile of the Managed Cluster. +type ManagedClusterOIDCIssuerProfile struct { + // Whether the OIDC issuer is enabled. + Enabled *bool + + // READ-ONLY; The OIDC issuer url of the Managed Cluster. + IssuerURL *string +} + +// ManagedClusterPodIdentity - Details about the pod identity assigned to the Managed Cluster. +type ManagedClusterPodIdentity struct { + // REQUIRED; The user assigned identity details. + Identity *UserAssignedIdentity + + // REQUIRED; The name of the pod identity. + Name *string + + // REQUIRED; The namespace of the pod identity. + Namespace *string + + // The binding selector to use for the AzureIdentityBinding resource. + BindingSelector *string + + // READ-ONLY + ProvisioningInfo *ManagedClusterPodIdentityProvisioningInfo + + // READ-ONLY; The current provisioning state of the pod identity. + ProvisioningState *ManagedClusterPodIdentityProvisioningState +} + +// ManagedClusterPodIdentityException - See disable AAD Pod Identity for a specific Pod/Application [https://azure.github.io/aad-pod-identity/docs/configure/application_exception/] +// for more details. +type ManagedClusterPodIdentityException struct { + // REQUIRED; The name of the pod identity exception. + Name *string + + // REQUIRED; The namespace of the pod identity exception. + Namespace *string + + // REQUIRED; The pod labels to match. + PodLabels map[string]*string +} + +// ManagedClusterPodIdentityProfile - See use AAD pod identity [https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity] +// for more details on pod identity integration. +type ManagedClusterPodIdentityProfile struct { + // Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. + // See using Kubenet network plugin with AAD Pod Identity + // [https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities] + // for more information. + AllowNetworkPluginKubenet *bool + + // Whether the pod identity addon is enabled. + Enabled *bool + + // The pod identities to use in the cluster. + UserAssignedIdentities []*ManagedClusterPodIdentity + + // The pod identity exceptions to allow. + UserAssignedIdentityExceptions []*ManagedClusterPodIdentityException +} + +// ManagedClusterPodIdentityProvisioningError - An error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningError struct { + // Details about the error. + Error *ManagedClusterPodIdentityProvisioningErrorBody +} + +// ManagedClusterPodIdentityProvisioningErrorBody - An error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningErrorBody struct { + // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string + + // A list of additional details about the error. + Details []*ManagedClusterPodIdentityProvisioningErrorBody + + // A message describing the error, intended to be suitable for display in a user interface. + Message *string + + // The target of the particular error. For example, the name of the property in error. + Target *string +} + +type ManagedClusterPodIdentityProvisioningInfo struct { + // Pod identity assignment error (if any). + Error *ManagedClusterPodIdentityProvisioningError +} + +// ManagedClusterPoolUpgradeProfile - The list of available upgrade versions. +type ManagedClusterPoolUpgradeProfile struct { + // REQUIRED; The Kubernetes version (major.minor.patch). + KubernetesVersion *string + + // REQUIRED; The operating system type. The default is Linux. + OSType *OSType + + // The Agent Pool name. + Name *string + + // List of orchestrator types and versions available for upgrade. + Upgrades []*ManagedClusterPoolUpgradeProfileUpgradesItem +} + +type ManagedClusterPoolUpgradeProfileUpgradesItem struct { + // Whether the Kubernetes version is currently in preview. + IsPreview *bool + + // The Kubernetes version (major.minor.patch). + KubernetesVersion *string +} + +// ManagedClusterProperties - Properties of the managed cluster. +type ManagedClusterProperties struct { + // The Azure Active Directory configuration. + AADProfile *ManagedClusterAADProfile + + // The access profile for managed cluster API server. + APIServerAccessProfile *ManagedClusterAPIServerAccessProfile + + // The profile of managed cluster add-on. + AddonProfiles map[string]*ManagedClusterAddonProfile + + // The agent pool properties. + AgentPoolProfiles []*ManagedClusterAgentPoolProfile + + // Parameters to be applied to the cluster-autoscaler when enabled + AutoScalerProfile *ManagedClusterPropertiesAutoScalerProfile + + // The auto upgrade configuration. + AutoUpgradeProfile *ManagedClusterAutoUpgradeProfile + + // Azure Monitor addon profiles for monitoring the managed cluster. + AzureMonitorProfile *ManagedClusterAzureMonitorProfile + + // This cannot be updated once the Managed Cluster has been created. + DNSPrefix *string + + // If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters + // that are AAD enabled. For more details see disable local accounts + // [https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview]. + DisableLocalAccounts *bool + + // This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}' + DiskEncryptionSetID *string + + // (DEPRECATED) Whether to enable Kubernetes pod security policy (preview). PodSecurityPolicy was deprecated in Kubernetes + // v1.21, and removed from Kubernetes in v1.25. Learn more at + // https://aka.ms/k8s/psp and https://aka.ms/aks/psp. + EnablePodSecurityPolicy *bool + + // Whether to enable Kubernetes Role-Based Access Control. + EnableRBAC *bool + + // This cannot be updated once the Managed Cluster has been created. + FqdnSubdomain *string + + // Configurations for provisioning the cluster with HTTP proxy servers. + HTTPProxyConfig *ManagedClusterHTTPProxyConfig + + // Identities associated with the cluster. + IdentityProfile map[string]*UserAssignedIdentity + + // Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported GA patch version + // is chosen automatically. Updating the cluster with the same once it has been + // created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. When you upgrade + // a supported AKS cluster, Kubernetes minor versions cannot be skipped. All + // upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x + // -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See upgrading + // an AKS cluster [https://docs.microsoft.com/azure/aks/upgrade-cluster] for more details. + KubernetesVersion *string + + // The profile for Linux VMs in the Managed Cluster. + LinuxProfile *LinuxProfile + + // The network configuration profile. + NetworkProfile *NetworkProfile + + // The name of the resource group containing agent pool nodes. + NodeResourceGroup *string + + // The OIDC issuer profile of the Managed Cluster. + OidcIssuerProfile *ManagedClusterOIDCIssuerProfile + + // See use AAD pod identity [https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity] for more details on AAD pod identity + // integration. + PodIdentityProfile *ManagedClusterPodIdentityProfile + + // Private link resources associated with the cluster. + PrivateLinkResources []*PrivateLinkResource + + // Allow or deny public network access for AKS + PublicNetworkAccess *PublicNetworkAccess + + // Security profile for the managed cluster. + SecurityProfile *ManagedClusterSecurityProfile + + // Service mesh profile for a managed cluster. + ServiceMeshProfile *ServiceMeshProfile + + // Information about a service principal identity for the cluster to use for manipulating Azure APIs. + ServicePrincipalProfile *ManagedClusterServicePrincipalProfile + + // Storage profile for the managed cluster. + StorageProfile *ManagedClusterStorageProfile + + // The support plan for the Managed Cluster. If unspecified, the default is 'KubernetesOfficial'. + SupportPlan *KubernetesSupportPlan + + // Settings for upgrading a cluster. + UpgradeSettings *ClusterUpgradeSettings + + // The profile for Windows VMs in the Managed Cluster. + WindowsProfile *ManagedClusterWindowsProfile + + // Workload Auto-scaler profile for the managed cluster. + WorkloadAutoScalerProfile *ManagedClusterWorkloadAutoScalerProfile + + // READ-ONLY; The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, + // which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, + // allowing the Azure Portal to function properly. + AzurePortalFQDN *string + + // READ-ONLY; If kubernetesVersion was a fully specified version , this field will be exactly equal to it. If kubernetesVersion + // was , this field will contain the full version being used. + CurrentKubernetesVersion *string + + // READ-ONLY; The FQDN of the master pool. + Fqdn *string + + // READ-ONLY; The max number of agent pools for the managed cluster. + MaxAgentPools *int32 + + // READ-ONLY; The Power State of the cluster. + PowerState *PowerState + + // READ-ONLY; The FQDN of private cluster. + PrivateFQDN *string + + // READ-ONLY; The current provisioning state. + ProvisioningState *string + + // READ-ONLY; The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create + // sequence) + ResourceUID *string +} + +// ManagedClusterPropertiesAutoScalerProfile - Parameters to be applied to the cluster-autoscaler when enabled +type ManagedClusterPropertiesAutoScalerProfile struct { + // Valid values are 'true' and 'false' + BalanceSimilarNodeGroups *string + + // If not specified, the default is 'random'. See expanders [https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders] + // for more information. + Expander *Expander + + // The default is 10. + MaxEmptyBulkDelete *string + + // The default is 600. + MaxGracefulTerminationSec *string + + // The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + MaxNodeProvisionTime *string + + // The default is 45. The maximum is 100 and the minimum is 0. + MaxTotalUnreadyPercentage *string + + // For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all + // the pods, you can tell CA to ignore unscheduled pods before they're a certain + // age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, + // etc). + NewPodScaleUpDelay *string + + // This must be an integer. The default is 3. + OkTotalUnreadyCount *string + + // The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterAdd *string + + // The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) + // is supported. + ScaleDownDelayAfterDelete *string + + // The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterFailure *string + + // The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnneededTime *string + + // The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnreadyTime *string + + // The default is '0.5'. + ScaleDownUtilizationThreshold *string + + // The default is '10'. Values must be an integer number of seconds. + ScanInterval *string + + // The default is true. + SkipNodesWithLocalStorage *string + + // The default is true. + SkipNodesWithSystemPods *string +} + +// ManagedClusterSKU - The SKU of a Managed Cluster. +type ManagedClusterSKU struct { + // The name of a managed cluster SKU. + Name *ManagedClusterSKUName + + // If not specified, the default is 'Free'. See AKS Pricing Tier [https://learn.microsoft.com/azure/aks/free-standard-pricing-tiers] + // for more details. + Tier *ManagedClusterSKUTier +} + +// ManagedClusterSecurityProfile - Security profile for the container service cluster. +type ManagedClusterSecurityProfile struct { + // Azure Key Vault key management service [https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/] settings for + // the security profile. + AzureKeyVaultKms *AzureKeyVaultKms + + // Microsoft Defender settings for the security profile. + Defender *ManagedClusterSecurityProfileDefender + + // Image Cleaner settings for the security profile. + ImageCleaner *ManagedClusterSecurityProfileImageCleaner + + // Workload identity settings for the security profile. Workload identity enables Kubernetes applications to access Azure + // cloud resources securely with Azure AD. See https://aka.ms/aks/wi for more + // details. + WorkloadIdentity *ManagedClusterSecurityProfileWorkloadIdentity +} + +// ManagedClusterSecurityProfileDefender - Microsoft Defender settings for the security profile. +type ManagedClusterSecurityProfileDefender struct { + // Resource ID of the Log Analytics workspace to be associated with Microsoft Defender. When Microsoft Defender is enabled, + // this field is required and must be a valid workspace resource ID. When + // Microsoft Defender is disabled, leave the field empty. + LogAnalyticsWorkspaceResourceID *string + + // Microsoft Defender threat detection for Cloud settings for the security profile. + SecurityMonitoring *ManagedClusterSecurityProfileDefenderSecurityMonitoring +} + +// ManagedClusterSecurityProfileDefenderSecurityMonitoring - Microsoft Defender settings for the security profile threat detection. +type ManagedClusterSecurityProfileDefenderSecurityMonitoring struct { + // Whether to enable Defender threat detection + Enabled *bool +} + +// ManagedClusterSecurityProfileImageCleaner - Image Cleaner removes unused images from nodes, freeing up disk space and helping +// to reduce attack surface area. Here are settings for the security profile. +type ManagedClusterSecurityProfileImageCleaner struct { + // Whether to enable Image Cleaner on AKS cluster. + Enabled *bool + + // Image Cleaner scanning interval in hours. + IntervalHours *int32 +} + +// ManagedClusterSecurityProfileWorkloadIdentity - Workload identity settings for the security profile. +type ManagedClusterSecurityProfileWorkloadIdentity struct { + // Whether to enable workload identity. + Enabled *bool +} + +// ManagedClusterServicePrincipalProfile - Information about a service principal identity for the cluster to use for manipulating +// Azure APIs. +type ManagedClusterServicePrincipalProfile struct { + // REQUIRED; The ID for the service principal. + ClientID *string + + // The secret password associated with the service principal in plain text. + Secret *string +} + +// ManagedClusterStorageProfile - Storage profile for the container service cluster. +type ManagedClusterStorageProfile struct { + // AzureBlob CSI Driver settings for the storage profile. + BlobCSIDriver *ManagedClusterStorageProfileBlobCSIDriver + + // AzureDisk CSI Driver settings for the storage profile. + DiskCSIDriver *ManagedClusterStorageProfileDiskCSIDriver + + // AzureFile CSI Driver settings for the storage profile. + FileCSIDriver *ManagedClusterStorageProfileFileCSIDriver + + // Snapshot Controller settings for the storage profile. + SnapshotController *ManagedClusterStorageProfileSnapshotController +} + +// ManagedClusterStorageProfileBlobCSIDriver - AzureBlob CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileBlobCSIDriver struct { + // Whether to enable AzureBlob CSI Driver. The default value is false. + Enabled *bool +} + +// ManagedClusterStorageProfileDiskCSIDriver - AzureDisk CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileDiskCSIDriver struct { + // Whether to enable AzureDisk CSI Driver. The default value is true. + Enabled *bool +} + +// ManagedClusterStorageProfileFileCSIDriver - AzureFile CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileFileCSIDriver struct { + // Whether to enable AzureFile CSI Driver. The default value is true. + Enabled *bool +} + +// ManagedClusterStorageProfileSnapshotController - Snapshot Controller settings for the storage profile. +type ManagedClusterStorageProfileSnapshotController struct { + // Whether to enable Snapshot Controller. The default value is true. + Enabled *bool +} + +// ManagedClusterUpgradeProfile - The list of available upgrades for compute pools. +type ManagedClusterUpgradeProfile struct { + // REQUIRED; The properties of the upgrade profile. + Properties *ManagedClusterUpgradeProfileProperties + + // READ-ONLY; The ID of the upgrade profile. + ID *string + + // READ-ONLY; The name of the upgrade profile. + Name *string + + // READ-ONLY; The type of the upgrade profile. + Type *string +} + +// ManagedClusterUpgradeProfileProperties - Control plane and agent pool upgrade profiles. +type ManagedClusterUpgradeProfileProperties struct { + // REQUIRED; The list of available upgrade versions for agent pools. + AgentPoolProfiles []*ManagedClusterPoolUpgradeProfile + + // REQUIRED; The list of available upgrade versions for the control plane. + ControlPlaneProfile *ManagedClusterPoolUpgradeProfile +} + +// ManagedClusterWindowsProfile - Profile for Windows VMs in the managed cluster. +type ManagedClusterWindowsProfile struct { + // REQUIRED; Specifies the name of the administrator account. + // Restriction: Cannot end in "." + // Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", + // "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + // "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + // Minimum-length: 1 character + // Max-length: 20 characters + AdminUsername *string + + // Specifies the password of the administrator account. + // Minimum-length: 8 characters + // Max-length: 123 characters + // Complexity requirements: 3 out of 4 conditions below need to be fulfilled + // Has lower characters + // Has upper characters + // Has a digit + // Has a special character (Regex match [\W_]) + // Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", + // "Password22", "iloveyou!" + AdminPassword *string + + // For more details on CSI proxy, see the CSI proxy GitHub repo [https://github.com/kubernetes-csi/csi-proxy]. + EnableCSIProxy *bool + + // The Windows gMSA Profile in the Managed Cluster. + GmsaProfile *WindowsGmsaProfile + + // The license type to use for Windows VMs. See Azure Hybrid User Benefits [https://azure.microsoft.com/pricing/hybrid-benefit/faq/] + // for more details. + LicenseType *LicenseType +} + +// ManagedClusterWorkloadAutoScalerProfile - Workload Auto-scaler profile for the managed cluster. +type ManagedClusterWorkloadAutoScalerProfile struct { + // KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. + Keda *ManagedClusterWorkloadAutoScalerProfileKeda + + // VPA (Vertical Pod Autoscaler) settings for the workload auto-scaler profile. + VerticalPodAutoscaler *ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler +} + +// ManagedClusterWorkloadAutoScalerProfileKeda - KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler +// profile. +type ManagedClusterWorkloadAutoScalerProfileKeda struct { + // REQUIRED; Whether to enable KEDA. + Enabled *bool +} + +// ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler - VPA (Vertical Pod Autoscaler) settings for the workload +// auto-scaler profile. +type ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler struct { + // REQUIRED; Whether to enable VPA. Default value is false. + Enabled *bool +} + +type ManagedServiceIdentityUserAssignedIdentitiesValue struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string +} + +// MeshRevision - Holds information on upgrades and compatibility for given major.minor mesh release. +type MeshRevision struct { + // List of items this revision of service mesh is compatible with, and their associated versions. + CompatibleWith []*CompatibleVersions + + // The revision of the mesh release. + Revision *string + + // List of revisions available for upgrade of a specific mesh revision + Upgrades []*string +} + +// MeshRevisionProfile - Mesh revision profile for a mesh. +type MeshRevisionProfile struct { + // Mesh revision profile properties for a mesh + Properties *MeshRevisionProfileProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// MeshRevisionProfileList - Holds an array of MeshRevisionsProfiles +type MeshRevisionProfileList struct { + // Array of service mesh add-on revision profiles for all supported mesh modes. + Value []*MeshRevisionProfile + + // READ-ONLY; The URL to get the next set of mesh revision profile. + NextLink *string +} + +// MeshRevisionProfileProperties - Mesh revision profile properties for a mesh +type MeshRevisionProfileProperties struct { + MeshRevisions []*MeshRevision +} + +// MeshUpgradeProfile - Upgrade profile for given mesh. +type MeshUpgradeProfile struct { + // Mesh upgrade profile properties for a major.minor release. + Properties *MeshUpgradeProfileProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// MeshUpgradeProfileList - Holds an array of MeshUpgradeProfiles +type MeshUpgradeProfileList struct { + // Array of supported service mesh add-on upgrade profiles. + Value []*MeshUpgradeProfile + + // READ-ONLY; The URL to get the next set of mesh upgrade profile. + NextLink *string +} + +// MeshUpgradeProfileProperties - Mesh upgrade profile properties for a major.minor release. +type MeshUpgradeProfileProperties struct { + // List of items this revision of service mesh is compatible with, and their associated versions. + CompatibleWith []*CompatibleVersions + + // The revision of the mesh release. + Revision *string + + // List of revisions available for upgrade of a specific mesh revision + Upgrades []*string +} + +// NetworkProfile - Profile of network configuration. +type NetworkProfile struct { + // An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified + // in serviceCidr. + DNSServiceIP *string + + // IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For + // dual-stack, the expected values are IPv4 and IPv6. + IPFamilies []*IPFamily + + // Profile of the cluster load balancer. + LoadBalancerProfile *ManagedClusterLoadBalancerProfile + + // The default is 'standard'. See Azure Load Balancer SKUs [https://docs.microsoft.com/azure/load-balancer/skus] for more + // information about the differences between load balancer SKUs. + LoadBalancerSKU *LoadBalancerSKU + + // Profile of the cluster NAT gateway. + NatGatewayProfile *ManagedClusterNATGatewayProfile + + // Network dataplane used in the Kubernetes cluster. + NetworkDataplane *NetworkDataplane + + // This cannot be specified if networkPlugin is anything other than 'azure'. + NetworkMode *NetworkMode + + // Network plugin used for building the Kubernetes network. + NetworkPlugin *NetworkPlugin + + // The mode the network plugin should use. + NetworkPluginMode *NetworkPluginMode + + // Network policy used for building the Kubernetes network. + NetworkPolicy *NetworkPolicy + + // This can only be set at cluster creation time and cannot be changed later. For more information see egress outbound type + // [https://docs.microsoft.com/azure/aks/egress-outboundtype]. + OutboundType *OutboundType + + // A CIDR notation IP range from which to assign pod IPs when kubenet is used. + PodCidr *string + + // One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack + // networking. + PodCidrs []*string + + // A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. + ServiceCidr *string + + // One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack + // networking. They must not overlap with any Subnet IP ranges. + ServiceCidrs []*string +} + +// OSOptionProfile - The OS option profile. +type OSOptionProfile struct { + // REQUIRED; The list of OS options. + Properties *OSOptionPropertyList + + // READ-ONLY; The ID of the OS option resource. + ID *string + + // READ-ONLY; The name of the OS option resource. + Name *string + + // READ-ONLY; The type of the OS option resource. + Type *string +} + +// OSOptionProperty - OS option property. +type OSOptionProperty struct { + // REQUIRED; Whether the image is FIPS-enabled. + EnableFipsImage *bool + + // REQUIRED; The OS type. + OSType *string +} + +// OSOptionPropertyList - The list of OS option properties. +type OSOptionPropertyList struct { + // REQUIRED; The list of OS options. + OSOptionPropertyList []*OSOptionProperty +} + +// OperationListResult - The List Operation response. +type OperationListResult struct { + // READ-ONLY; The list of operations + Value []*OperationValue +} + +// OperationValue - Describes the properties of a Operation value. +type OperationValue struct { + // Describes the properties of a Operation Value Display. + Display *OperationValueDisplay + + // READ-ONLY; The name of the operation. + Name *string + + // READ-ONLY; The origin of the operation. + Origin *string +} + +// OperationValueDisplay - Describes the properties of a Operation Value Display. +type OperationValueDisplay struct { + // READ-ONLY; The description of the operation. + Description *string + + // READ-ONLY; The display name of the operation. + Operation *string + + // READ-ONLY; The resource provider for the operation. + Provider *string + + // READ-ONLY; The display name of the resource the operation applies to. + Resource *string +} + +// OutboundEnvironmentEndpoint - Egress endpoints which AKS agent nodes connect to for common purpose. +type OutboundEnvironmentEndpoint struct { + // The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. + Category *string + + // The endpoints that AKS agent nodes connect to + Endpoints []*EndpointDependency +} + +// OutboundEnvironmentEndpointCollection - Collection of OutboundEnvironmentEndpoint +type OutboundEnvironmentEndpointCollection struct { + // REQUIRED; Collection of resources. + Value []*OutboundEnvironmentEndpoint + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// PortRange - The port range. +type PortRange struct { + // The maximum port that is included in the range. It should be ranged from 1 to 65535, and be greater than or equal to portStart. + PortEnd *int32 + + // The minimum port that is included in the range. It should be ranged from 1 to 65535, and be less than or equal to portEnd. + PortStart *int32 + + // The network protocol of the port. + Protocol *Protocol +} + +// PowerState - Describes the Power State of the cluster +type PowerState struct { + // Tells whether the cluster is Running or Stopped + Code *Code +} + +// PrivateEndpoint - Private endpoint which a connection belongs to. +type PrivateEndpoint struct { + // The resource ID of the private endpoint + ID *string +} + +// PrivateEndpointConnection - A private endpoint connection +type PrivateEndpointConnection struct { + // The properties of a private endpoint connection. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; The ID of the private endpoint connection. + ID *string + + // READ-ONLY; The name of the private endpoint connection. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// PrivateEndpointConnectionListResult - A list of private endpoint connections +type PrivateEndpointConnectionListResult struct { + // The collection value. + Value []*PrivateEndpointConnection +} + +// PrivateEndpointConnectionProperties - Properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The resource of private endpoint. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The current provisioning state. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + // The group ID of the resource. + GroupID *string + + // The ID of the private link resource. + ID *string + + // The name of the private link resource. + Name *string + + // The RequiredMembers of the resource + RequiredMembers []*string + + // The resource type. + Type *string + + // READ-ONLY; The private link service ID of the resource, this field is exposed only to NRP internally. + PrivateLinkServiceID *string +} + +// PrivateLinkResourcesListResult - A list of private link resources +type PrivateLinkResourcesListResult struct { + // The collection value. + Value []*PrivateLinkResource +} + +// PrivateLinkServiceConnectionState - The state of a private link service connection. +type PrivateLinkServiceConnectionState struct { + // The private link service connection description. + Description *string + + // The private link service connection status. + Status *ConnectionStatus +} + +// RelativeMonthlySchedule - For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last +// Friday'. +type RelativeMonthlySchedule struct { + // REQUIRED; Specifies on which day of the week the maintenance occurs. + DayOfWeek *WeekDay + + // REQUIRED; Specifies the number of months between each set of occurrences. + IntervalMonths *int32 + + // REQUIRED; Specifies on which week of the month the dayOfWeek applies. + WeekIndex *Type +} + +// ResourceReference - A reference to an Azure resource. +type ResourceReference struct { + // The fully qualified Azure resource id. + ID *string +} + +// RunCommandRequest - A run command request +type RunCommandRequest struct { + // REQUIRED; The command to run. + Command *string + + // AuthToken issued for AKS AAD Server App. + ClusterToken *string + + // A base64 encoded zip file containing the files required by the command. + Context *string +} + +// RunCommandResult - run command result. +type RunCommandResult struct { + // Properties of command result. + Properties *CommandResultProperties + + // READ-ONLY; The command id. + ID *string +} + +// SSHConfiguration - SSH configuration for Linux-based VMs running on Azure. +type SSHConfiguration struct { + // REQUIRED; The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. + PublicKeys []*SSHPublicKey +} + +// SSHPublicKey - Contains information about SSH certificate public key data. +type SSHPublicKey struct { + // REQUIRED; Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with + // or without headers. + KeyData *string +} + +// Schedule - One and only one of the schedule types should be specified. Choose either 'daily', 'weekly', 'absoluteMonthly' +// or 'relativeMonthly' for your maintenance schedule. +type Schedule struct { + // For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'. + AbsoluteMonthly *AbsoluteMonthlySchedule + + // For schedules like: 'recur every day' or 'recur every 3 days'. + Daily *DailySchedule + + // For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'. + RelativeMonthly *RelativeMonthlySchedule + + // For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'. + Weekly *WeeklySchedule +} + +// ServiceMeshProfile - Service mesh profile for a managed cluster. +type ServiceMeshProfile struct { + // REQUIRED; Mode of the service mesh. + Mode *ServiceMeshMode + + // Istio service mesh configuration. + Istio *IstioServiceMesh +} + +// Snapshot - A node pool snapshot resource. +type Snapshot struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Properties of a snapshot. + Properties *SnapshotProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SnapshotListResult - The response from the List Snapshots operation. +type SnapshotListResult struct { + // The list of snapshots. + Value []*Snapshot + + // READ-ONLY; The URL to get the next set of snapshot results. + NextLink *string +} + +// SnapshotProperties - Properties used to configure a node pool snapshot. +type SnapshotProperties struct { + // CreationData to be used to specify the source agent pool resource ID to create this snapshot. + CreationData *CreationData + + // The type of a snapshot. The default is NodePool. + SnapshotType *SnapshotType + + // READ-ONLY; Whether to use a FIPS-enabled OS. + EnableFIPS *bool + + // READ-ONLY; The version of Kubernetes. + KubernetesVersion *string + + // READ-ONLY; The version of node image. + NodeImageVersion *string + + // READ-ONLY; Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 + // when Kubernetes = 1.25 if OSType is Windows. + OSSKU *OSSKU + + // READ-ONLY; The operating system type. The default is Linux. + OSType *OSType + + // READ-ONLY; The size of the VM. + VMSize *string +} + +// SysctlConfig - Sysctl settings for Linux agent nodes. +type SysctlConfig struct { + // Sysctl setting fs.aio-max-nr. + FsAioMaxNr *int32 + + // Sysctl setting fs.file-max. + FsFileMax *int32 + + // Sysctl setting fs.inotify.maxuserwatches. + FsInotifyMaxUserWatches *int32 + + // Sysctl setting fs.nr_open. + FsNrOpen *int32 + + // Sysctl setting kernel.threads-max. + KernelThreadsMax *int32 + + // Sysctl setting net.core.netdevmaxbacklog. + NetCoreNetdevMaxBacklog *int32 + + // Sysctl setting net.core.optmem_max. + NetCoreOptmemMax *int32 + + // Sysctl setting net.core.rmem_default. + NetCoreRmemDefault *int32 + + // Sysctl setting net.core.rmem_max. + NetCoreRmemMax *int32 + + // Sysctl setting net.core.somaxconn. + NetCoreSomaxconn *int32 + + // Sysctl setting net.core.wmem_default. + NetCoreWmemDefault *int32 + + // Sysctl setting net.core.wmem_max. + NetCoreWmemMax *int32 + + // Sysctl setting net.ipv4.iplocalport_range. + NetIPv4IPLocalPortRange *string + + // Sysctl setting net.ipv4.neigh.default.gc_thresh1. + NetIPv4NeighDefaultGcThresh1 *int32 + + // Sysctl setting net.ipv4.neigh.default.gc_thresh2. + NetIPv4NeighDefaultGcThresh2 *int32 + + // Sysctl setting net.ipv4.neigh.default.gc_thresh3. + NetIPv4NeighDefaultGcThresh3 *int32 + + // Sysctl setting net.ipv4.tcpfintimeout. + NetIPv4TCPFinTimeout *int32 + + // Sysctl setting net.ipv4.tcpkeepaliveprobes. + NetIPv4TCPKeepaliveProbes *int32 + + // Sysctl setting net.ipv4.tcpkeepalivetime. + NetIPv4TCPKeepaliveTime *int32 + + // Sysctl setting net.ipv4.tcpmaxsyn_backlog. + NetIPv4TCPMaxSynBacklog *int32 + + // Sysctl setting net.ipv4.tcpmaxtw_buckets. + NetIPv4TCPMaxTwBuckets *int32 + + // Sysctl setting net.ipv4.tcptwreuse. + NetIPv4TCPTwReuse *bool + + // Sysctl setting net.ipv4.tcpkeepaliveintvl. + NetIPv4TcpkeepaliveIntvl *int32 + + // Sysctl setting net.netfilter.nfconntrackbuckets. + NetNetfilterNfConntrackBuckets *int32 + + // Sysctl setting net.netfilter.nfconntrackmax. + NetNetfilterNfConntrackMax *int32 + + // Sysctl setting vm.maxmapcount. + VMMaxMapCount *int32 + + // Sysctl setting vm.swappiness. + VMSwappiness *int32 + + // Sysctl setting vm.vfscachepressure. + VMVfsCachePressure *int32 +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// TagsObject - Tags object for patch operations. +type TagsObject struct { + // Resource tags. + Tags map[string]*string +} + +// TimeInWeek - Time in a week. +type TimeInWeek struct { + // The day of the week. + Day *WeekDay + + // Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds + // to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the + // 00:00 - 02:00 UTC time range. + HourSlots []*int32 +} + +// TimeSpan - For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. +type TimeSpan struct { + // The end of a time span + End *time.Time + + // The start of a time span + Start *time.Time +} + +// TrustedAccessRole - Trusted access role definition. +type TrustedAccessRole struct { + // READ-ONLY; Name of role, name is unique under a source resource type + Name *string + + // READ-ONLY; List of rules for the role. This maps to 'rules' property of Kubernetes Cluster Role [https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/#ClusterRole]. + Rules []*TrustedAccessRoleRule + + // READ-ONLY; Resource type of Azure resource + SourceResourceType *string +} + +// TrustedAccessRoleBinding - Defines binding between a resource and role +type TrustedAccessRoleBinding struct { + // REQUIRED; Properties for trusted access role binding + Properties *TrustedAccessRoleBindingProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TrustedAccessRoleBindingListResult - List of trusted access role bindings +type TrustedAccessRoleBindingListResult struct { + // Role binding list + Value []*TrustedAccessRoleBinding + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// TrustedAccessRoleBindingProperties - Properties for trusted access role binding +type TrustedAccessRoleBindingProperties struct { + // REQUIRED; A list of roles to bind, each item is a resource type qualified role name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + Roles []*string + + // REQUIRED; The ARM resource ID of source resource that trusted access is configured for. + SourceResourceID *string + + // READ-ONLY; The current provisioning state of trusted access role binding. + ProvisioningState *TrustedAccessRoleBindingProvisioningState +} + +// TrustedAccessRoleListResult - List of trusted access roles +type TrustedAccessRoleListResult struct { + // READ-ONLY; Link to next page of resources. + NextLink *string + + // READ-ONLY; Role list + Value []*TrustedAccessRole +} + +// TrustedAccessRoleRule - Rule for trusted access role +type TrustedAccessRoleRule struct { + // READ-ONLY; List of allowed apiGroups + APIGroups []*string + + // READ-ONLY; List of allowed nonResourceURLs + NonResourceURLs []*string + + // READ-ONLY; List of allowed names + ResourceNames []*string + + // READ-ONLY; List of allowed resources + Resources []*string + + // READ-ONLY; List of allowed verbs + Verbs []*string +} + +// UpgradeOverrideSettings - Settings for overrides when upgrading a cluster. +type UpgradeOverrideSettings struct { + // Whether to force upgrade the cluster. Note that this option instructs upgrade operation to bypass upgrade protections such + // as checking for deprecated API usage. Enable this option only with caution. + ForceUpgrade *bool + + // Until when the overrides are effective. Note that this only matches the start time of an upgrade, and the effectiveness + // won't change once an upgrade starts even if the until expires as upgrade + // proceeds. This field is not set by default. It must be set for the overrides to take effect. + Until *time.Time +} + +// UserAssignedIdentity - Details about a user assigned identity. +type UserAssignedIdentity struct { + // The client ID of the user assigned identity. + ClientID *string + + // The object ID of the user assigned identity. + ObjectID *string + + // The resource ID of the user assigned identity. + ResourceID *string +} + +// WeeklySchedule - For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'. +type WeeklySchedule struct { + // REQUIRED; Specifies on which day of the week the maintenance occurs. + DayOfWeek *WeekDay + + // REQUIRED; Specifies the number of weeks between each set of occurrences. + IntervalWeeks *int32 +} + +// WindowsGmsaProfile - Windows gMSA Profile in the managed cluster. +type WindowsGmsaProfile struct { + // Specifies the DNS server for Windows gMSA. + // Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + DNSServer *string + + // Specifies whether to enable Windows gMSA in the managed cluster. + Enabled *bool + + // Specifies the root domain name for Windows gMSA. + // Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + RootDomainName *string +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/models_serde.go new file mode 100644 index 000000000..5a3eeac7a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/models_serde.go @@ -0,0 +1,5698 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AbsoluteMonthlySchedule. +func (a AbsoluteMonthlySchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dayOfMonth", a.DayOfMonth) + populate(objectMap, "intervalMonths", a.IntervalMonths) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AbsoluteMonthlySchedule. +func (a *AbsoluteMonthlySchedule) UnmarshalJSON(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 "dayOfMonth": + err = unpopulate(val, "DayOfMonth", &a.DayOfMonth) + delete(rawMsg, key) + case "intervalMonths": + err = unpopulate(val, "IntervalMonths", &a.IntervalMonths) + 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 AccessProfile. +func (a AccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateByteArray(objectMap, "kubeConfig", a.KubeConfig, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessProfile. +func (a *AccessProfile) UnmarshalJSON(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 "kubeConfig": + err = runtime.DecodeByteArray(string(val), &a.KubeConfig, runtime.Base64StdFormat) + 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 AgentPool. +func (a AgentPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 AgentPool. +func (a *AgentPool) UnmarshalJSON(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 AgentPoolAvailableVersions. +func (a AgentPoolAvailableVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 AgentPoolAvailableVersions. +func (a *AgentPoolAvailableVersions) UnmarshalJSON(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 AgentPoolAvailableVersionsProperties. +func (a AgentPoolAvailableVersionsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentPoolVersions", a.AgentPoolVersions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolAvailableVersionsProperties. +func (a *AgentPoolAvailableVersionsProperties) UnmarshalJSON(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 "agentPoolVersions": + err = unpopulate(val, "AgentPoolVersions", &a.AgentPoolVersions) + 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 AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. +func (a AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "default", a.Default) + populate(objectMap, "isPreview", a.IsPreview) + populate(objectMap, "kubernetesVersion", a.KubernetesVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. +func (a *AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem) UnmarshalJSON(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 "default": + err = unpopulate(val, "Default", &a.Default) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &a.IsPreview) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &a.KubernetesVersion) + 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 AgentPoolListResult. +func (a AgentPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolListResult. +func (a *AgentPoolListResult) UnmarshalJSON(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 AgentPoolNetworkProfile. +func (a AgentPoolNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedHostPorts", a.AllowedHostPorts) + populate(objectMap, "applicationSecurityGroups", a.ApplicationSecurityGroups) + populate(objectMap, "nodePublicIPTags", a.NodePublicIPTags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolNetworkProfile. +func (a *AgentPoolNetworkProfile) UnmarshalJSON(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 "allowedHostPorts": + err = unpopulate(val, "AllowedHostPorts", &a.AllowedHostPorts) + delete(rawMsg, key) + case "applicationSecurityGroups": + err = unpopulate(val, "ApplicationSecurityGroups", &a.ApplicationSecurityGroups) + delete(rawMsg, key) + case "nodePublicIPTags": + err = unpopulate(val, "NodePublicIPTags", &a.NodePublicIPTags) + 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 AgentPoolUpgradeProfile. +func (a AgentPoolUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 AgentPoolUpgradeProfile. +func (a *AgentPoolUpgradeProfile) UnmarshalJSON(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 AgentPoolUpgradeProfileProperties. +func (a AgentPoolUpgradeProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kubernetesVersion", a.KubernetesVersion) + populate(objectMap, "latestNodeImageVersion", a.LatestNodeImageVersion) + populate(objectMap, "osType", a.OSType) + populate(objectMap, "upgrades", a.Upgrades) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolUpgradeProfileProperties. +func (a *AgentPoolUpgradeProfileProperties) UnmarshalJSON(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 "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &a.KubernetesVersion) + delete(rawMsg, key) + case "latestNodeImageVersion": + err = unpopulate(val, "LatestNodeImageVersion", &a.LatestNodeImageVersion) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &a.OSType) + delete(rawMsg, key) + case "upgrades": + err = unpopulate(val, "Upgrades", &a.Upgrades) + 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 AgentPoolUpgradeProfilePropertiesUpgradesItem. +func (a AgentPoolUpgradeProfilePropertiesUpgradesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isPreview", a.IsPreview) + populate(objectMap, "kubernetesVersion", a.KubernetesVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolUpgradeProfilePropertiesUpgradesItem. +func (a *AgentPoolUpgradeProfilePropertiesUpgradesItem) UnmarshalJSON(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 "isPreview": + err = unpopulate(val, "IsPreview", &a.IsPreview) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &a.KubernetesVersion) + 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 AgentPoolUpgradeSettings. +func (a AgentPoolUpgradeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "drainTimeoutInMinutes", a.DrainTimeoutInMinutes) + populate(objectMap, "maxSurge", a.MaxSurge) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolUpgradeSettings. +func (a *AgentPoolUpgradeSettings) UnmarshalJSON(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 "drainTimeoutInMinutes": + err = unpopulate(val, "DrainTimeoutInMinutes", &a.DrainTimeoutInMinutes) + delete(rawMsg, key) + case "maxSurge": + err = unpopulate(val, "MaxSurge", &a.MaxSurge) + 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 AzureKeyVaultKms. +func (a AzureKeyVaultKms) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "keyId", a.KeyID) + populate(objectMap, "keyVaultNetworkAccess", a.KeyVaultNetworkAccess) + populate(objectMap, "keyVaultResourceId", a.KeyVaultResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureKeyVaultKms. +func (a *AzureKeyVaultKms) UnmarshalJSON(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 "keyId": + err = unpopulate(val, "KeyID", &a.KeyID) + delete(rawMsg, key) + case "keyVaultNetworkAccess": + err = unpopulate(val, "KeyVaultNetworkAccess", &a.KeyVaultNetworkAccess) + delete(rawMsg, key) + case "keyVaultResourceId": + err = unpopulate(val, "KeyVaultResourceID", &a.KeyVaultResourceID) + 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 ClusterUpgradeSettings. +func (c ClusterUpgradeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "overrideSettings", c.OverrideSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterUpgradeSettings. +func (c *ClusterUpgradeSettings) UnmarshalJSON(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 "overrideSettings": + err = unpopulate(val, "OverrideSettings", &c.OverrideSettings) + 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 CommandResultProperties. +func (c CommandResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exitCode", c.ExitCode) + populateDateTimeRFC3339(objectMap, "finishedAt", c.FinishedAt) + populate(objectMap, "logs", c.Logs) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "reason", c.Reason) + populateDateTimeRFC3339(objectMap, "startedAt", c.StartedAt) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommandResultProperties. +func (c *CommandResultProperties) UnmarshalJSON(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 "exitCode": + err = unpopulate(val, "ExitCode", &c.ExitCode) + delete(rawMsg, key) + case "finishedAt": + err = unpopulateDateTimeRFC3339(val, "FinishedAt", &c.FinishedAt) + delete(rawMsg, key) + case "logs": + err = unpopulate(val, "Logs", &c.Logs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + delete(rawMsg, key) + case "startedAt": + err = unpopulateDateTimeRFC3339(val, "StartedAt", &c.StartedAt) + 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 CompatibleVersions. +func (c CompatibleVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "versions", c.Versions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CompatibleVersions. +func (c *CompatibleVersions) UnmarshalJSON(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 "versions": + err = unpopulate(val, "Versions", &c.Versions) + 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]any) + populate(objectMap, "sourceResourceId", c.SourceResourceID) + 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 "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &c.SourceResourceID) + 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 CredentialResult. +func (c CredentialResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populateByteArray(objectMap, "value", c.Value, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialResult. +func (c *CredentialResult) UnmarshalJSON(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 "value": + err = runtime.DecodeByteArray(string(val), &c.Value, runtime.Base64StdFormat) + 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 CredentialResults. +func (c CredentialResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kubeconfigs", c.Kubeconfigs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialResults. +func (c *CredentialResults) UnmarshalJSON(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 "kubeconfigs": + err = unpopulate(val, "Kubeconfigs", &c.Kubeconfigs) + 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 DailySchedule. +func (d DailySchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "intervalDays", d.IntervalDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DailySchedule. +func (d *DailySchedule) UnmarshalJSON(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 "intervalDays": + err = unpopulate(val, "IntervalDays", &d.IntervalDays) + 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 DateSpan. +func (d DateSpan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateType(objectMap, "end", d.End) + populateDateType(objectMap, "start", d.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DateSpan. +func (d *DateSpan) UnmarshalJSON(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 "end": + err = unpopulateDateType(val, "End", &d.End) + delete(rawMsg, key) + case "start": + err = unpopulateDateType(val, "Start", &d.Start) + 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 DelegatedResource. +func (d DelegatedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", d.Location) + populate(objectMap, "referralResource", d.ReferralResource) + populate(objectMap, "resourceId", d.ResourceID) + populate(objectMap, "tenantId", d.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DelegatedResource. +func (d *DelegatedResource) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "referralResource": + err = unpopulate(val, "ReferralResource", &d.ReferralResource) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &d.ResourceID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &d.TenantID) + 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 EndpointDependency. +func (e EndpointDependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "domainName", e.DomainName) + populate(objectMap, "endpointDetails", e.EndpointDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. +func (e *EndpointDependency) UnmarshalJSON(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 "domainName": + err = unpopulate(val, "DomainName", &e.DomainName) + delete(rawMsg, key) + case "endpointDetails": + err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) + 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 EndpointDetail. +func (e EndpointDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", e.Description) + populate(objectMap, "ipAddress", e.IPAddress) + populate(objectMap, "port", e.Port) + populate(objectMap, "protocol", e.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. +func (e *EndpointDetail) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &e.Description) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &e.IPAddress) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &e.Port) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &e.Protocol) + 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]any) + 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 IPTag. +func (i IPTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 IstioCertificateAuthority. +func (i IstioCertificateAuthority) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "plugin", i.Plugin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IstioCertificateAuthority. +func (i *IstioCertificateAuthority) UnmarshalJSON(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 "plugin": + err = unpopulate(val, "Plugin", &i.Plugin) + 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 IstioComponents. +func (i IstioComponents) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "egressGateways", i.EgressGateways) + populate(objectMap, "ingressGateways", i.IngressGateways) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IstioComponents. +func (i *IstioComponents) UnmarshalJSON(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 "egressGateways": + err = unpopulate(val, "EgressGateways", &i.EgressGateways) + delete(rawMsg, key) + case "ingressGateways": + err = unpopulate(val, "IngressGateways", &i.IngressGateways) + 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 IstioEgressGateway. +func (i IstioEgressGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", i.Enabled) + populate(objectMap, "nodeSelector", i.NodeSelector) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IstioEgressGateway. +func (i *IstioEgressGateway) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &i.Enabled) + delete(rawMsg, key) + case "nodeSelector": + err = unpopulate(val, "NodeSelector", &i.NodeSelector) + 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 IstioIngressGateway. +func (i IstioIngressGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", i.Enabled) + populate(objectMap, "mode", i.Mode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IstioIngressGateway. +func (i *IstioIngressGateway) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &i.Enabled) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &i.Mode) + 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 IstioPluginCertificateAuthority. +func (i IstioPluginCertificateAuthority) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certChainObjectName", i.CertChainObjectName) + populate(objectMap, "certObjectName", i.CertObjectName) + populate(objectMap, "keyObjectName", i.KeyObjectName) + populate(objectMap, "keyVaultId", i.KeyVaultID) + populate(objectMap, "rootCertObjectName", i.RootCertObjectName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IstioPluginCertificateAuthority. +func (i *IstioPluginCertificateAuthority) UnmarshalJSON(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 "certChainObjectName": + err = unpopulate(val, "CertChainObjectName", &i.CertChainObjectName) + delete(rawMsg, key) + case "certObjectName": + err = unpopulate(val, "CertObjectName", &i.CertObjectName) + delete(rawMsg, key) + case "keyObjectName": + err = unpopulate(val, "KeyObjectName", &i.KeyObjectName) + delete(rawMsg, key) + case "keyVaultId": + err = unpopulate(val, "KeyVaultID", &i.KeyVaultID) + delete(rawMsg, key) + case "rootCertObjectName": + err = unpopulate(val, "RootCertObjectName", &i.RootCertObjectName) + 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 IstioServiceMesh. +func (i IstioServiceMesh) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificateAuthority", i.CertificateAuthority) + populate(objectMap, "components", i.Components) + populate(objectMap, "revisions", i.Revisions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IstioServiceMesh. +func (i *IstioServiceMesh) UnmarshalJSON(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 "certificateAuthority": + err = unpopulate(val, "CertificateAuthority", &i.CertificateAuthority) + delete(rawMsg, key) + case "components": + err = unpopulate(val, "Components", &i.Components) + delete(rawMsg, key) + case "revisions": + err = unpopulate(val, "Revisions", &i.Revisions) + 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 KubeletConfig. +func (k KubeletConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedUnsafeSysctls", k.AllowedUnsafeSysctls) + populate(objectMap, "cpuCfsQuota", k.CPUCfsQuota) + populate(objectMap, "cpuCfsQuotaPeriod", k.CPUCfsQuotaPeriod) + populate(objectMap, "cpuManagerPolicy", k.CPUManagerPolicy) + populate(objectMap, "containerLogMaxFiles", k.ContainerLogMaxFiles) + populate(objectMap, "containerLogMaxSizeMB", k.ContainerLogMaxSizeMB) + populate(objectMap, "failSwapOn", k.FailSwapOn) + populate(objectMap, "imageGcHighThreshold", k.ImageGcHighThreshold) + populate(objectMap, "imageGcLowThreshold", k.ImageGcLowThreshold) + populate(objectMap, "podMaxPids", k.PodMaxPids) + populate(objectMap, "topologyManagerPolicy", k.TopologyManagerPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubeletConfig. +func (k *KubeletConfig) UnmarshalJSON(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 "allowedUnsafeSysctls": + err = unpopulate(val, "AllowedUnsafeSysctls", &k.AllowedUnsafeSysctls) + delete(rawMsg, key) + case "cpuCfsQuota": + err = unpopulate(val, "CPUCfsQuota", &k.CPUCfsQuota) + delete(rawMsg, key) + case "cpuCfsQuotaPeriod": + err = unpopulate(val, "CPUCfsQuotaPeriod", &k.CPUCfsQuotaPeriod) + delete(rawMsg, key) + case "cpuManagerPolicy": + err = unpopulate(val, "CPUManagerPolicy", &k.CPUManagerPolicy) + delete(rawMsg, key) + case "containerLogMaxFiles": + err = unpopulate(val, "ContainerLogMaxFiles", &k.ContainerLogMaxFiles) + delete(rawMsg, key) + case "containerLogMaxSizeMB": + err = unpopulate(val, "ContainerLogMaxSizeMB", &k.ContainerLogMaxSizeMB) + delete(rawMsg, key) + case "failSwapOn": + err = unpopulate(val, "FailSwapOn", &k.FailSwapOn) + delete(rawMsg, key) + case "imageGcHighThreshold": + err = unpopulate(val, "ImageGcHighThreshold", &k.ImageGcHighThreshold) + delete(rawMsg, key) + case "imageGcLowThreshold": + err = unpopulate(val, "ImageGcLowThreshold", &k.ImageGcLowThreshold) + delete(rawMsg, key) + case "podMaxPids": + err = unpopulate(val, "PodMaxPids", &k.PodMaxPids) + delete(rawMsg, key) + case "topologyManagerPolicy": + err = unpopulate(val, "TopologyManagerPolicy", &k.TopologyManagerPolicy) + 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 KubernetesPatchVersion. +func (k KubernetesPatchVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "upgrades", k.Upgrades) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesPatchVersion. +func (k *KubernetesPatchVersion) UnmarshalJSON(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 "upgrades": + err = unpopulate(val, "Upgrades", &k.Upgrades) + 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 KubernetesVersion. +func (k KubernetesVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capabilities", k.Capabilities) + populate(objectMap, "isPreview", k.IsPreview) + populate(objectMap, "patchVersions", k.PatchVersions) + populate(objectMap, "version", k.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersion. +func (k *KubernetesVersion) UnmarshalJSON(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 "capabilities": + err = unpopulate(val, "Capabilities", &k.Capabilities) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &k.IsPreview) + delete(rawMsg, key) + case "patchVersions": + err = unpopulate(val, "PatchVersions", &k.PatchVersions) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &k.Version) + 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 KubernetesVersionCapabilities. +func (k KubernetesVersionCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "supportPlan", k.SupportPlan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionCapabilities. +func (k *KubernetesVersionCapabilities) UnmarshalJSON(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 "supportPlan": + err = unpopulate(val, "SupportPlan", &k.SupportPlan) + 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 KubernetesVersionListResult. +func (k KubernetesVersionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "values", k.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionListResult. +func (k *KubernetesVersionListResult) UnmarshalJSON(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 "values": + err = unpopulate(val, "Values", &k.Values) + 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 LinuxOSConfig. +func (l LinuxOSConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "swapFileSizeMB", l.SwapFileSizeMB) + populate(objectMap, "sysctls", l.Sysctls) + populate(objectMap, "transparentHugePageDefrag", l.TransparentHugePageDefrag) + populate(objectMap, "transparentHugePageEnabled", l.TransparentHugePageEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxOSConfig. +func (l *LinuxOSConfig) UnmarshalJSON(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 "swapFileSizeMB": + err = unpopulate(val, "SwapFileSizeMB", &l.SwapFileSizeMB) + delete(rawMsg, key) + case "sysctls": + err = unpopulate(val, "Sysctls", &l.Sysctls) + delete(rawMsg, key) + case "transparentHugePageDefrag": + err = unpopulate(val, "TransparentHugePageDefrag", &l.TransparentHugePageDefrag) + delete(rawMsg, key) + case "transparentHugePageEnabled": + err = unpopulate(val, "TransparentHugePageEnabled", &l.TransparentHugePageEnabled) + 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 LinuxProfile. +func (l LinuxProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminUsername", l.AdminUsername) + populate(objectMap, "ssh", l.SSH) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxProfile. +func (l *LinuxProfile) UnmarshalJSON(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 "adminUsername": + err = unpopulate(val, "AdminUsername", &l.AdminUsername) + 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 MaintenanceConfiguration. +func (m MaintenanceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 MaintenanceConfiguration. +func (m *MaintenanceConfiguration) UnmarshalJSON(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) + 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 MaintenanceConfigurationListResult. +func (m MaintenanceConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfigurationListResult. +func (m *MaintenanceConfigurationListResult) UnmarshalJSON(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 MaintenanceConfigurationProperties. +func (m MaintenanceConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maintenanceWindow", m.MaintenanceWindow) + populate(objectMap, "notAllowedTime", m.NotAllowedTime) + populate(objectMap, "timeInWeek", m.TimeInWeek) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfigurationProperties. +func (m *MaintenanceConfigurationProperties) UnmarshalJSON(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 "maintenanceWindow": + err = unpopulate(val, "MaintenanceWindow", &m.MaintenanceWindow) + delete(rawMsg, key) + case "notAllowedTime": + err = unpopulate(val, "NotAllowedTime", &m.NotAllowedTime) + delete(rawMsg, key) + case "timeInWeek": + err = unpopulate(val, "TimeInWeek", &m.TimeInWeek) + 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 MaintenanceWindow. +func (m MaintenanceWindow) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "durationHours", m.DurationHours) + populate(objectMap, "notAllowedDates", m.NotAllowedDates) + populate(objectMap, "schedule", m.Schedule) + populateDateType(objectMap, "startDate", m.StartDate) + populate(objectMap, "startTime", m.StartTime) + populate(objectMap, "utcOffset", m.UTCOffset) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceWindow. +func (m *MaintenanceWindow) UnmarshalJSON(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 "durationHours": + err = unpopulate(val, "DurationHours", &m.DurationHours) + delete(rawMsg, key) + case "notAllowedDates": + err = unpopulate(val, "NotAllowedDates", &m.NotAllowedDates) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &m.Schedule) + delete(rawMsg, key) + case "startDate": + err = unpopulateDateType(val, "StartDate", &m.StartDate) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &m.StartTime) + delete(rawMsg, key) + case "utcOffset": + err = unpopulate(val, "UTCOffset", &m.UTCOffset) + 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 ManagedCluster. +func (m ManagedCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", m.ExtendedLocation) + populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "sku", m.SKU) + 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 ManagedCluster. +func (m *ManagedCluster) UnmarshalJSON(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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &m.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + 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 "sku": + err = unpopulate(val, "SKU", &m.SKU) + 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 ManagedClusterAADProfile. +func (m ManagedClusterAADProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminGroupObjectIDs", m.AdminGroupObjectIDs) + populate(objectMap, "clientAppID", m.ClientAppID) + populate(objectMap, "enableAzureRBAC", m.EnableAzureRBAC) + populate(objectMap, "managed", m.Managed) + populate(objectMap, "serverAppID", m.ServerAppID) + populate(objectMap, "serverAppSecret", m.ServerAppSecret) + populate(objectMap, "tenantID", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAADProfile. +func (m *ManagedClusterAADProfile) UnmarshalJSON(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 "adminGroupObjectIDs": + err = unpopulate(val, "AdminGroupObjectIDs", &m.AdminGroupObjectIDs) + delete(rawMsg, key) + case "clientAppID": + err = unpopulate(val, "ClientAppID", &m.ClientAppID) + delete(rawMsg, key) + case "enableAzureRBAC": + err = unpopulate(val, "EnableAzureRBAC", &m.EnableAzureRBAC) + delete(rawMsg, key) + case "managed": + err = unpopulate(val, "Managed", &m.Managed) + delete(rawMsg, key) + case "serverAppID": + err = unpopulate(val, "ServerAppID", &m.ServerAppID) + delete(rawMsg, key) + case "serverAppSecret": + err = unpopulate(val, "ServerAppSecret", &m.ServerAppSecret) + delete(rawMsg, key) + case "tenantID": + err = unpopulate(val, "TenantID", &m.TenantID) + 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 ManagedClusterAPIServerAccessProfile. +func (m ManagedClusterAPIServerAccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorizedIPRanges", m.AuthorizedIPRanges) + populate(objectMap, "disableRunCommand", m.DisableRunCommand) + populate(objectMap, "enablePrivateCluster", m.EnablePrivateCluster) + populate(objectMap, "enablePrivateClusterPublicFQDN", m.EnablePrivateClusterPublicFQDN) + populate(objectMap, "privateDNSZone", m.PrivateDNSZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAPIServerAccessProfile. +func (m *ManagedClusterAPIServerAccessProfile) UnmarshalJSON(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 "authorizedIPRanges": + err = unpopulate(val, "AuthorizedIPRanges", &m.AuthorizedIPRanges) + delete(rawMsg, key) + case "disableRunCommand": + err = unpopulate(val, "DisableRunCommand", &m.DisableRunCommand) + delete(rawMsg, key) + case "enablePrivateCluster": + err = unpopulate(val, "EnablePrivateCluster", &m.EnablePrivateCluster) + delete(rawMsg, key) + case "enablePrivateClusterPublicFQDN": + err = unpopulate(val, "EnablePrivateClusterPublicFQDN", &m.EnablePrivateClusterPublicFQDN) + delete(rawMsg, key) + case "privateDNSZone": + err = unpopulate(val, "PrivateDNSZone", &m.PrivateDNSZone) + 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 ManagedClusterAccessProfile. +func (m ManagedClusterAccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 ManagedClusterAccessProfile. +func (m *ManagedClusterAccessProfile) UnmarshalJSON(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) + 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 ManagedClusterAddonProfile. +func (m ManagedClusterAddonProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "config", m.Config) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "identity", m.Identity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAddonProfile. +func (m *ManagedClusterAddonProfile) UnmarshalJSON(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 "config": + err = unpopulate(val, "Config", &m.Config) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + 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 ManagedClusterAddonProfileIdentity. +func (m ManagedClusterAddonProfileIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", m.ClientID) + populate(objectMap, "objectId", m.ObjectID) + populate(objectMap, "resourceId", m.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAddonProfileIdentity. +func (m *ManagedClusterAddonProfileIdentity) UnmarshalJSON(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 "clientId": + err = unpopulate(val, "ClientID", &m.ClientID) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &m.ObjectID) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &m.ResourceID) + 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 ManagedClusterAgentPoolProfile. +func (m ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityZones", m.AvailabilityZones) + populate(objectMap, "capacityReservationGroupID", m.CapacityReservationGroupID) + populate(objectMap, "count", m.Count) + populate(objectMap, "creationData", m.CreationData) + populate(objectMap, "currentOrchestratorVersion", m.CurrentOrchestratorVersion) + populate(objectMap, "enableAutoScaling", m.EnableAutoScaling) + populate(objectMap, "enableEncryptionAtHost", m.EnableEncryptionAtHost) + populate(objectMap, "enableFIPS", m.EnableFIPS) + populate(objectMap, "enableNodePublicIP", m.EnableNodePublicIP) + populate(objectMap, "enableUltraSSD", m.EnableUltraSSD) + populate(objectMap, "gpuInstanceProfile", m.GpuInstanceProfile) + populate(objectMap, "hostGroupID", m.HostGroupID) + populate(objectMap, "kubeletConfig", m.KubeletConfig) + populate(objectMap, "kubeletDiskType", m.KubeletDiskType) + populate(objectMap, "linuxOSConfig", m.LinuxOSConfig) + populate(objectMap, "maxCount", m.MaxCount) + populate(objectMap, "maxPods", m.MaxPods) + populate(objectMap, "minCount", m.MinCount) + populate(objectMap, "mode", m.Mode) + populate(objectMap, "name", m.Name) + populate(objectMap, "networkProfile", m.NetworkProfile) + populate(objectMap, "nodeImageVersion", m.NodeImageVersion) + populate(objectMap, "nodeLabels", m.NodeLabels) + populate(objectMap, "nodePublicIPPrefixID", m.NodePublicIPPrefixID) + populate(objectMap, "nodeTaints", m.NodeTaints) + populate(objectMap, "osDiskSizeGB", m.OSDiskSizeGB) + populate(objectMap, "osDiskType", m.OSDiskType) + populate(objectMap, "osSKU", m.OSSKU) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "orchestratorVersion", m.OrchestratorVersion) + populate(objectMap, "podSubnetID", m.PodSubnetID) + populate(objectMap, "powerState", m.PowerState) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "proximityPlacementGroupID", m.ProximityPlacementGroupID) + populate(objectMap, "scaleDownMode", m.ScaleDownMode) + populate(objectMap, "scaleSetEvictionPolicy", m.ScaleSetEvictionPolicy) + populate(objectMap, "scaleSetPriority", m.ScaleSetPriority) + populate(objectMap, "spotMaxPrice", m.SpotMaxPrice) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + populate(objectMap, "upgradeSettings", m.UpgradeSettings) + populate(objectMap, "vmSize", m.VMSize) + populate(objectMap, "vnetSubnetID", m.VnetSubnetID) + populate(objectMap, "workloadRuntime", m.WorkloadRuntime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAgentPoolProfile. +func (m *ManagedClusterAgentPoolProfile) UnmarshalJSON(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 "availabilityZones": + err = unpopulate(val, "AvailabilityZones", &m.AvailabilityZones) + delete(rawMsg, key) + case "capacityReservationGroupID": + err = unpopulate(val, "CapacityReservationGroupID", &m.CapacityReservationGroupID) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &m.Count) + delete(rawMsg, key) + case "creationData": + err = unpopulate(val, "CreationData", &m.CreationData) + delete(rawMsg, key) + case "currentOrchestratorVersion": + err = unpopulate(val, "CurrentOrchestratorVersion", &m.CurrentOrchestratorVersion) + delete(rawMsg, key) + case "enableAutoScaling": + err = unpopulate(val, "EnableAutoScaling", &m.EnableAutoScaling) + delete(rawMsg, key) + case "enableEncryptionAtHost": + err = unpopulate(val, "EnableEncryptionAtHost", &m.EnableEncryptionAtHost) + delete(rawMsg, key) + case "enableFIPS": + err = unpopulate(val, "EnableFIPS", &m.EnableFIPS) + delete(rawMsg, key) + case "enableNodePublicIP": + err = unpopulate(val, "EnableNodePublicIP", &m.EnableNodePublicIP) + delete(rawMsg, key) + case "enableUltraSSD": + err = unpopulate(val, "EnableUltraSSD", &m.EnableUltraSSD) + delete(rawMsg, key) + case "gpuInstanceProfile": + err = unpopulate(val, "GpuInstanceProfile", &m.GpuInstanceProfile) + delete(rawMsg, key) + case "hostGroupID": + err = unpopulate(val, "HostGroupID", &m.HostGroupID) + delete(rawMsg, key) + case "kubeletConfig": + err = unpopulate(val, "KubeletConfig", &m.KubeletConfig) + delete(rawMsg, key) + case "kubeletDiskType": + err = unpopulate(val, "KubeletDiskType", &m.KubeletDiskType) + delete(rawMsg, key) + case "linuxOSConfig": + err = unpopulate(val, "LinuxOSConfig", &m.LinuxOSConfig) + delete(rawMsg, key) + case "maxCount": + err = unpopulate(val, "MaxCount", &m.MaxCount) + delete(rawMsg, key) + case "maxPods": + err = unpopulate(val, "MaxPods", &m.MaxPods) + delete(rawMsg, key) + case "minCount": + err = unpopulate(val, "MinCount", &m.MinCount) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &m.Mode) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) + delete(rawMsg, key) + case "nodeImageVersion": + err = unpopulate(val, "NodeImageVersion", &m.NodeImageVersion) + delete(rawMsg, key) + case "nodeLabels": + err = unpopulate(val, "NodeLabels", &m.NodeLabels) + delete(rawMsg, key) + case "nodePublicIPPrefixID": + err = unpopulate(val, "NodePublicIPPrefixID", &m.NodePublicIPPrefixID) + delete(rawMsg, key) + case "nodeTaints": + err = unpopulate(val, "NodeTaints", &m.NodeTaints) + delete(rawMsg, key) + case "osDiskSizeGB": + err = unpopulate(val, "OSDiskSizeGB", &m.OSDiskSizeGB) + delete(rawMsg, key) + case "osDiskType": + err = unpopulate(val, "OSDiskType", &m.OSDiskType) + delete(rawMsg, key) + case "osSKU": + err = unpopulate(val, "OSSKU", &m.OSSKU) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &m.OSType) + delete(rawMsg, key) + case "orchestratorVersion": + err = unpopulate(val, "OrchestratorVersion", &m.OrchestratorVersion) + delete(rawMsg, key) + case "podSubnetID": + err = unpopulate(val, "PodSubnetID", &m.PodSubnetID) + delete(rawMsg, key) + case "powerState": + err = unpopulate(val, "PowerState", &m.PowerState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "proximityPlacementGroupID": + err = unpopulate(val, "ProximityPlacementGroupID", &m.ProximityPlacementGroupID) + delete(rawMsg, key) + case "scaleDownMode": + err = unpopulate(val, "ScaleDownMode", &m.ScaleDownMode) + delete(rawMsg, key) + case "scaleSetEvictionPolicy": + err = unpopulate(val, "ScaleSetEvictionPolicy", &m.ScaleSetEvictionPolicy) + delete(rawMsg, key) + case "scaleSetPriority": + err = unpopulate(val, "ScaleSetPriority", &m.ScaleSetPriority) + delete(rawMsg, key) + case "spotMaxPrice": + err = unpopulate(val, "SpotMaxPrice", &m.SpotMaxPrice) + 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) + case "upgradeSettings": + err = unpopulate(val, "UpgradeSettings", &m.UpgradeSettings) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &m.VMSize) + delete(rawMsg, key) + case "vnetSubnetID": + err = unpopulate(val, "VnetSubnetID", &m.VnetSubnetID) + delete(rawMsg, key) + case "workloadRuntime": + err = unpopulate(val, "WorkloadRuntime", &m.WorkloadRuntime) + 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 ManagedClusterAgentPoolProfileProperties. +func (m ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityZones", m.AvailabilityZones) + populate(objectMap, "capacityReservationGroupID", m.CapacityReservationGroupID) + populate(objectMap, "count", m.Count) + populate(objectMap, "creationData", m.CreationData) + populate(objectMap, "currentOrchestratorVersion", m.CurrentOrchestratorVersion) + populate(objectMap, "enableAutoScaling", m.EnableAutoScaling) + populate(objectMap, "enableEncryptionAtHost", m.EnableEncryptionAtHost) + populate(objectMap, "enableFIPS", m.EnableFIPS) + populate(objectMap, "enableNodePublicIP", m.EnableNodePublicIP) + populate(objectMap, "enableUltraSSD", m.EnableUltraSSD) + populate(objectMap, "gpuInstanceProfile", m.GpuInstanceProfile) + populate(objectMap, "hostGroupID", m.HostGroupID) + populate(objectMap, "kubeletConfig", m.KubeletConfig) + populate(objectMap, "kubeletDiskType", m.KubeletDiskType) + populate(objectMap, "linuxOSConfig", m.LinuxOSConfig) + populate(objectMap, "maxCount", m.MaxCount) + populate(objectMap, "maxPods", m.MaxPods) + populate(objectMap, "minCount", m.MinCount) + populate(objectMap, "mode", m.Mode) + populate(objectMap, "networkProfile", m.NetworkProfile) + populate(objectMap, "nodeImageVersion", m.NodeImageVersion) + populate(objectMap, "nodeLabels", m.NodeLabels) + populate(objectMap, "nodePublicIPPrefixID", m.NodePublicIPPrefixID) + populate(objectMap, "nodeTaints", m.NodeTaints) + populate(objectMap, "osDiskSizeGB", m.OSDiskSizeGB) + populate(objectMap, "osDiskType", m.OSDiskType) + populate(objectMap, "osSKU", m.OSSKU) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "orchestratorVersion", m.OrchestratorVersion) + populate(objectMap, "podSubnetID", m.PodSubnetID) + populate(objectMap, "powerState", m.PowerState) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "proximityPlacementGroupID", m.ProximityPlacementGroupID) + populate(objectMap, "scaleDownMode", m.ScaleDownMode) + populate(objectMap, "scaleSetEvictionPolicy", m.ScaleSetEvictionPolicy) + populate(objectMap, "scaleSetPriority", m.ScaleSetPriority) + populate(objectMap, "spotMaxPrice", m.SpotMaxPrice) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + populate(objectMap, "upgradeSettings", m.UpgradeSettings) + populate(objectMap, "vmSize", m.VMSize) + populate(objectMap, "vnetSubnetID", m.VnetSubnetID) + populate(objectMap, "workloadRuntime", m.WorkloadRuntime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAgentPoolProfileProperties. +func (m *ManagedClusterAgentPoolProfileProperties) UnmarshalJSON(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 "availabilityZones": + err = unpopulate(val, "AvailabilityZones", &m.AvailabilityZones) + delete(rawMsg, key) + case "capacityReservationGroupID": + err = unpopulate(val, "CapacityReservationGroupID", &m.CapacityReservationGroupID) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &m.Count) + delete(rawMsg, key) + case "creationData": + err = unpopulate(val, "CreationData", &m.CreationData) + delete(rawMsg, key) + case "currentOrchestratorVersion": + err = unpopulate(val, "CurrentOrchestratorVersion", &m.CurrentOrchestratorVersion) + delete(rawMsg, key) + case "enableAutoScaling": + err = unpopulate(val, "EnableAutoScaling", &m.EnableAutoScaling) + delete(rawMsg, key) + case "enableEncryptionAtHost": + err = unpopulate(val, "EnableEncryptionAtHost", &m.EnableEncryptionAtHost) + delete(rawMsg, key) + case "enableFIPS": + err = unpopulate(val, "EnableFIPS", &m.EnableFIPS) + delete(rawMsg, key) + case "enableNodePublicIP": + err = unpopulate(val, "EnableNodePublicIP", &m.EnableNodePublicIP) + delete(rawMsg, key) + case "enableUltraSSD": + err = unpopulate(val, "EnableUltraSSD", &m.EnableUltraSSD) + delete(rawMsg, key) + case "gpuInstanceProfile": + err = unpopulate(val, "GpuInstanceProfile", &m.GpuInstanceProfile) + delete(rawMsg, key) + case "hostGroupID": + err = unpopulate(val, "HostGroupID", &m.HostGroupID) + delete(rawMsg, key) + case "kubeletConfig": + err = unpopulate(val, "KubeletConfig", &m.KubeletConfig) + delete(rawMsg, key) + case "kubeletDiskType": + err = unpopulate(val, "KubeletDiskType", &m.KubeletDiskType) + delete(rawMsg, key) + case "linuxOSConfig": + err = unpopulate(val, "LinuxOSConfig", &m.LinuxOSConfig) + delete(rawMsg, key) + case "maxCount": + err = unpopulate(val, "MaxCount", &m.MaxCount) + delete(rawMsg, key) + case "maxPods": + err = unpopulate(val, "MaxPods", &m.MaxPods) + delete(rawMsg, key) + case "minCount": + err = unpopulate(val, "MinCount", &m.MinCount) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &m.Mode) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) + delete(rawMsg, key) + case "nodeImageVersion": + err = unpopulate(val, "NodeImageVersion", &m.NodeImageVersion) + delete(rawMsg, key) + case "nodeLabels": + err = unpopulate(val, "NodeLabels", &m.NodeLabels) + delete(rawMsg, key) + case "nodePublicIPPrefixID": + err = unpopulate(val, "NodePublicIPPrefixID", &m.NodePublicIPPrefixID) + delete(rawMsg, key) + case "nodeTaints": + err = unpopulate(val, "NodeTaints", &m.NodeTaints) + delete(rawMsg, key) + case "osDiskSizeGB": + err = unpopulate(val, "OSDiskSizeGB", &m.OSDiskSizeGB) + delete(rawMsg, key) + case "osDiskType": + err = unpopulate(val, "OSDiskType", &m.OSDiskType) + delete(rawMsg, key) + case "osSKU": + err = unpopulate(val, "OSSKU", &m.OSSKU) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &m.OSType) + delete(rawMsg, key) + case "orchestratorVersion": + err = unpopulate(val, "OrchestratorVersion", &m.OrchestratorVersion) + delete(rawMsg, key) + case "podSubnetID": + err = unpopulate(val, "PodSubnetID", &m.PodSubnetID) + delete(rawMsg, key) + case "powerState": + err = unpopulate(val, "PowerState", &m.PowerState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "proximityPlacementGroupID": + err = unpopulate(val, "ProximityPlacementGroupID", &m.ProximityPlacementGroupID) + delete(rawMsg, key) + case "scaleDownMode": + err = unpopulate(val, "ScaleDownMode", &m.ScaleDownMode) + delete(rawMsg, key) + case "scaleSetEvictionPolicy": + err = unpopulate(val, "ScaleSetEvictionPolicy", &m.ScaleSetEvictionPolicy) + delete(rawMsg, key) + case "scaleSetPriority": + err = unpopulate(val, "ScaleSetPriority", &m.ScaleSetPriority) + delete(rawMsg, key) + case "spotMaxPrice": + err = unpopulate(val, "SpotMaxPrice", &m.SpotMaxPrice) + 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) + case "upgradeSettings": + err = unpopulate(val, "UpgradeSettings", &m.UpgradeSettings) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &m.VMSize) + delete(rawMsg, key) + case "vnetSubnetID": + err = unpopulate(val, "VnetSubnetID", &m.VnetSubnetID) + delete(rawMsg, key) + case "workloadRuntime": + err = unpopulate(val, "WorkloadRuntime", &m.WorkloadRuntime) + 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 ManagedClusterAutoUpgradeProfile. +func (m ManagedClusterAutoUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nodeOSUpgradeChannel", m.NodeOSUpgradeChannel) + populate(objectMap, "upgradeChannel", m.UpgradeChannel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAutoUpgradeProfile. +func (m *ManagedClusterAutoUpgradeProfile) UnmarshalJSON(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 "nodeOSUpgradeChannel": + err = unpopulate(val, "NodeOSUpgradeChannel", &m.NodeOSUpgradeChannel) + delete(rawMsg, key) + case "upgradeChannel": + err = unpopulate(val, "UpgradeChannel", &m.UpgradeChannel) + 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 ManagedClusterAzureMonitorProfile. +func (m ManagedClusterAzureMonitorProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "metrics", m.Metrics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAzureMonitorProfile. +func (m *ManagedClusterAzureMonitorProfile) UnmarshalJSON(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 "metrics": + err = unpopulate(val, "Metrics", &m.Metrics) + 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 ManagedClusterAzureMonitorProfileKubeStateMetrics. +func (m ManagedClusterAzureMonitorProfileKubeStateMetrics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "metricAnnotationsAllowList", m.MetricAnnotationsAllowList) + populate(objectMap, "metricLabelsAllowlist", m.MetricLabelsAllowlist) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAzureMonitorProfileKubeStateMetrics. +func (m *ManagedClusterAzureMonitorProfileKubeStateMetrics) UnmarshalJSON(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 "metricAnnotationsAllowList": + err = unpopulate(val, "MetricAnnotationsAllowList", &m.MetricAnnotationsAllowList) + delete(rawMsg, key) + case "metricLabelsAllowlist": + err = unpopulate(val, "MetricLabelsAllowlist", &m.MetricLabelsAllowlist) + 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 ManagedClusterAzureMonitorProfileMetrics. +func (m ManagedClusterAzureMonitorProfileMetrics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "kubeStateMetrics", m.KubeStateMetrics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAzureMonitorProfileMetrics. +func (m *ManagedClusterAzureMonitorProfileMetrics) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "kubeStateMetrics": + err = unpopulate(val, "KubeStateMetrics", &m.KubeStateMetrics) + 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 ManagedClusterHTTPProxyConfig. +func (m ManagedClusterHTTPProxyConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "httpProxy", m.HTTPProxy) + populate(objectMap, "httpsProxy", m.HTTPSProxy) + populate(objectMap, "noProxy", m.NoProxy) + populate(objectMap, "trustedCa", m.TrustedCa) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterHTTPProxyConfig. +func (m *ManagedClusterHTTPProxyConfig) UnmarshalJSON(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 "httpProxy": + err = unpopulate(val, "HTTPProxy", &m.HTTPProxy) + delete(rawMsg, key) + case "httpsProxy": + err = unpopulate(val, "HTTPSProxy", &m.HTTPSProxy) + delete(rawMsg, key) + case "noProxy": + err = unpopulate(val, "NoProxy", &m.NoProxy) + delete(rawMsg, key) + case "trustedCa": + err = unpopulate(val, "TrustedCa", &m.TrustedCa) + 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 ManagedClusterIdentity. +func (m ManagedClusterIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "delegatedResources", m.DelegatedResources) + 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 ManagedClusterIdentity. +func (m *ManagedClusterIdentity) UnmarshalJSON(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 "delegatedResources": + err = unpopulate(val, "DelegatedResources", &m.DelegatedResources) + delete(rawMsg, 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 ManagedClusterListResult. +func (m ManagedClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterListResult. +func (m *ManagedClusterListResult) UnmarshalJSON(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 ManagedClusterLoadBalancerProfile. +func (m ManagedClusterLoadBalancerProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedOutboundPorts", m.AllocatedOutboundPorts) + populate(objectMap, "backendPoolType", m.BackendPoolType) + populate(objectMap, "effectiveOutboundIPs", m.EffectiveOutboundIPs) + populate(objectMap, "enableMultipleStandardLoadBalancers", m.EnableMultipleStandardLoadBalancers) + populate(objectMap, "idleTimeoutInMinutes", m.IdleTimeoutInMinutes) + populate(objectMap, "managedOutboundIPs", m.ManagedOutboundIPs) + populate(objectMap, "outboundIPPrefixes", m.OutboundIPPrefixes) + populate(objectMap, "outboundIPs", m.OutboundIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterLoadBalancerProfile. +func (m *ManagedClusterLoadBalancerProfile) UnmarshalJSON(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 "allocatedOutboundPorts": + err = unpopulate(val, "AllocatedOutboundPorts", &m.AllocatedOutboundPorts) + delete(rawMsg, key) + case "backendPoolType": + err = unpopulate(val, "BackendPoolType", &m.BackendPoolType) + delete(rawMsg, key) + case "effectiveOutboundIPs": + err = unpopulate(val, "EffectiveOutboundIPs", &m.EffectiveOutboundIPs) + delete(rawMsg, key) + case "enableMultipleStandardLoadBalancers": + err = unpopulate(val, "EnableMultipleStandardLoadBalancers", &m.EnableMultipleStandardLoadBalancers) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &m.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "managedOutboundIPs": + err = unpopulate(val, "ManagedOutboundIPs", &m.ManagedOutboundIPs) + delete(rawMsg, key) + case "outboundIPPrefixes": + err = unpopulate(val, "OutboundIPPrefixes", &m.OutboundIPPrefixes) + delete(rawMsg, key) + case "outboundIPs": + err = unpopulate(val, "OutboundIPs", &m.OutboundIPs) + 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 ManagedClusterLoadBalancerProfileManagedOutboundIPs. +func (m ManagedClusterLoadBalancerProfileManagedOutboundIPs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", m.Count) + populate(objectMap, "countIPv6", m.CountIPv6) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterLoadBalancerProfileManagedOutboundIPs. +func (m *ManagedClusterLoadBalancerProfileManagedOutboundIPs) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &m.Count) + delete(rawMsg, key) + case "countIPv6": + err = unpopulate(val, "CountIPv6", &m.CountIPv6) + 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 ManagedClusterLoadBalancerProfileOutboundIPPrefixes. +func (m ManagedClusterLoadBalancerProfileOutboundIPPrefixes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publicIPPrefixes", m.PublicIPPrefixes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterLoadBalancerProfileOutboundIPPrefixes. +func (m *ManagedClusterLoadBalancerProfileOutboundIPPrefixes) UnmarshalJSON(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 "publicIPPrefixes": + err = unpopulate(val, "PublicIPPrefixes", &m.PublicIPPrefixes) + 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 ManagedClusterLoadBalancerProfileOutboundIPs. +func (m ManagedClusterLoadBalancerProfileOutboundIPs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publicIPs", m.PublicIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterLoadBalancerProfileOutboundIPs. +func (m *ManagedClusterLoadBalancerProfileOutboundIPs) UnmarshalJSON(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 "publicIPs": + err = unpopulate(val, "PublicIPs", &m.PublicIPs) + 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 ManagedClusterManagedOutboundIPProfile. +func (m ManagedClusterManagedOutboundIPProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", m.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterManagedOutboundIPProfile. +func (m *ManagedClusterManagedOutboundIPProfile) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &m.Count) + 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 ManagedClusterNATGatewayProfile. +func (m ManagedClusterNATGatewayProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "effectiveOutboundIPs", m.EffectiveOutboundIPs) + populate(objectMap, "idleTimeoutInMinutes", m.IdleTimeoutInMinutes) + populate(objectMap, "managedOutboundIPProfile", m.ManagedOutboundIPProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterNATGatewayProfile. +func (m *ManagedClusterNATGatewayProfile) UnmarshalJSON(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 "effectiveOutboundIPs": + err = unpopulate(val, "EffectiveOutboundIPs", &m.EffectiveOutboundIPs) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &m.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "managedOutboundIPProfile": + err = unpopulate(val, "ManagedOutboundIPProfile", &m.ManagedOutboundIPProfile) + 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 ManagedClusterOIDCIssuerProfile. +func (m ManagedClusterOIDCIssuerProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "issuerURL", m.IssuerURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterOIDCIssuerProfile. +func (m *ManagedClusterOIDCIssuerProfile) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "issuerURL": + err = unpopulate(val, "IssuerURL", &m.IssuerURL) + 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 ManagedClusterPodIdentity. +func (m ManagedClusterPodIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bindingSelector", m.BindingSelector) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "name", m.Name) + populate(objectMap, "namespace", m.Namespace) + populate(objectMap, "provisioningInfo", m.ProvisioningInfo) + populate(objectMap, "provisioningState", m.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPodIdentity. +func (m *ManagedClusterPodIdentity) UnmarshalJSON(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 "bindingSelector": + err = unpopulate(val, "BindingSelector", &m.BindingSelector) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "namespace": + err = unpopulate(val, "Namespace", &m.Namespace) + delete(rawMsg, key) + case "provisioningInfo": + err = unpopulate(val, "ProvisioningInfo", &m.ProvisioningInfo) + 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 ManagedClusterPodIdentityException. +func (m ManagedClusterPodIdentityException) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + populate(objectMap, "namespace", m.Namespace) + populate(objectMap, "podLabels", m.PodLabels) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPodIdentityException. +func (m *ManagedClusterPodIdentityException) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "namespace": + err = unpopulate(val, "Namespace", &m.Namespace) + delete(rawMsg, key) + case "podLabels": + err = unpopulate(val, "PodLabels", &m.PodLabels) + 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 ManagedClusterPodIdentityProfile. +func (m ManagedClusterPodIdentityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowNetworkPluginKubenet", m.AllowNetworkPluginKubenet) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + populate(objectMap, "userAssignedIdentityExceptions", m.UserAssignedIdentityExceptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPodIdentityProfile. +func (m *ManagedClusterPodIdentityProfile) UnmarshalJSON(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 "allowNetworkPluginKubenet": + err = unpopulate(val, "AllowNetworkPluginKubenet", &m.AllowNetworkPluginKubenet) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + case "userAssignedIdentityExceptions": + err = unpopulate(val, "UserAssignedIdentityExceptions", &m.UserAssignedIdentityExceptions) + 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 ManagedClusterPodIdentityProvisioningError. +func (m ManagedClusterPodIdentityProvisioningError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", m.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPodIdentityProvisioningError. +func (m *ManagedClusterPodIdentityProvisioningError) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &m.Error) + 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 ManagedClusterPodIdentityProvisioningErrorBody. +func (m ManagedClusterPodIdentityProvisioningErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", m.Code) + populate(objectMap, "details", m.Details) + populate(objectMap, "message", m.Message) + populate(objectMap, "target", m.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPodIdentityProvisioningErrorBody. +func (m *ManagedClusterPodIdentityProvisioningErrorBody) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &m.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &m.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &m.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &m.Target) + 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 ManagedClusterPodIdentityProvisioningInfo. +func (m ManagedClusterPodIdentityProvisioningInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", m.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPodIdentityProvisioningInfo. +func (m *ManagedClusterPodIdentityProvisioningInfo) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &m.Error) + 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 ManagedClusterPoolUpgradeProfile. +func (m ManagedClusterPoolUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kubernetesVersion", m.KubernetesVersion) + populate(objectMap, "name", m.Name) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "upgrades", m.Upgrades) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPoolUpgradeProfile. +func (m *ManagedClusterPoolUpgradeProfile) UnmarshalJSON(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 "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &m.KubernetesVersion) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &m.OSType) + delete(rawMsg, key) + case "upgrades": + err = unpopulate(val, "Upgrades", &m.Upgrades) + 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 ManagedClusterPoolUpgradeProfileUpgradesItem. +func (m ManagedClusterPoolUpgradeProfileUpgradesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isPreview", m.IsPreview) + populate(objectMap, "kubernetesVersion", m.KubernetesVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPoolUpgradeProfileUpgradesItem. +func (m *ManagedClusterPoolUpgradeProfileUpgradesItem) UnmarshalJSON(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 "isPreview": + err = unpopulate(val, "IsPreview", &m.IsPreview) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &m.KubernetesVersion) + 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 ManagedClusterProperties. +func (m ManagedClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aadProfile", m.AADProfile) + populate(objectMap, "apiServerAccessProfile", m.APIServerAccessProfile) + populate(objectMap, "addonProfiles", m.AddonProfiles) + populate(objectMap, "agentPoolProfiles", m.AgentPoolProfiles) + populate(objectMap, "autoScalerProfile", m.AutoScalerProfile) + populate(objectMap, "autoUpgradeProfile", m.AutoUpgradeProfile) + populate(objectMap, "azureMonitorProfile", m.AzureMonitorProfile) + populate(objectMap, "azurePortalFQDN", m.AzurePortalFQDN) + populate(objectMap, "currentKubernetesVersion", m.CurrentKubernetesVersion) + populate(objectMap, "dnsPrefix", m.DNSPrefix) + populate(objectMap, "disableLocalAccounts", m.DisableLocalAccounts) + populate(objectMap, "diskEncryptionSetID", m.DiskEncryptionSetID) + populate(objectMap, "enablePodSecurityPolicy", m.EnablePodSecurityPolicy) + populate(objectMap, "enableRBAC", m.EnableRBAC) + populate(objectMap, "fqdn", m.Fqdn) + populate(objectMap, "fqdnSubdomain", m.FqdnSubdomain) + populate(objectMap, "httpProxyConfig", m.HTTPProxyConfig) + populate(objectMap, "identityProfile", m.IdentityProfile) + populate(objectMap, "kubernetesVersion", m.KubernetesVersion) + populate(objectMap, "linuxProfile", m.LinuxProfile) + populate(objectMap, "maxAgentPools", m.MaxAgentPools) + populate(objectMap, "networkProfile", m.NetworkProfile) + populate(objectMap, "nodeResourceGroup", m.NodeResourceGroup) + populate(objectMap, "oidcIssuerProfile", m.OidcIssuerProfile) + populate(objectMap, "podIdentityProfile", m.PodIdentityProfile) + populate(objectMap, "powerState", m.PowerState) + populate(objectMap, "privateFQDN", m.PrivateFQDN) + populate(objectMap, "privateLinkResources", m.PrivateLinkResources) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) + populate(objectMap, "resourceUID", m.ResourceUID) + populate(objectMap, "securityProfile", m.SecurityProfile) + populate(objectMap, "serviceMeshProfile", m.ServiceMeshProfile) + populate(objectMap, "servicePrincipalProfile", m.ServicePrincipalProfile) + populate(objectMap, "storageProfile", m.StorageProfile) + populate(objectMap, "supportPlan", m.SupportPlan) + populate(objectMap, "upgradeSettings", m.UpgradeSettings) + populate(objectMap, "windowsProfile", m.WindowsProfile) + populate(objectMap, "workloadAutoScalerProfile", m.WorkloadAutoScalerProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterProperties. +func (m *ManagedClusterProperties) UnmarshalJSON(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 "aadProfile": + err = unpopulate(val, "AADProfile", &m.AADProfile) + delete(rawMsg, key) + case "apiServerAccessProfile": + err = unpopulate(val, "APIServerAccessProfile", &m.APIServerAccessProfile) + delete(rawMsg, key) + case "addonProfiles": + err = unpopulate(val, "AddonProfiles", &m.AddonProfiles) + delete(rawMsg, key) + case "agentPoolProfiles": + err = unpopulate(val, "AgentPoolProfiles", &m.AgentPoolProfiles) + delete(rawMsg, key) + case "autoScalerProfile": + err = unpopulate(val, "AutoScalerProfile", &m.AutoScalerProfile) + delete(rawMsg, key) + case "autoUpgradeProfile": + err = unpopulate(val, "AutoUpgradeProfile", &m.AutoUpgradeProfile) + delete(rawMsg, key) + case "azureMonitorProfile": + err = unpopulate(val, "AzureMonitorProfile", &m.AzureMonitorProfile) + delete(rawMsg, key) + case "azurePortalFQDN": + err = unpopulate(val, "AzurePortalFQDN", &m.AzurePortalFQDN) + delete(rawMsg, key) + case "currentKubernetesVersion": + err = unpopulate(val, "CurrentKubernetesVersion", &m.CurrentKubernetesVersion) + delete(rawMsg, key) + case "dnsPrefix": + err = unpopulate(val, "DNSPrefix", &m.DNSPrefix) + delete(rawMsg, key) + case "disableLocalAccounts": + err = unpopulate(val, "DisableLocalAccounts", &m.DisableLocalAccounts) + delete(rawMsg, key) + case "diskEncryptionSetID": + err = unpopulate(val, "DiskEncryptionSetID", &m.DiskEncryptionSetID) + delete(rawMsg, key) + case "enablePodSecurityPolicy": + err = unpopulate(val, "EnablePodSecurityPolicy", &m.EnablePodSecurityPolicy) + delete(rawMsg, key) + case "enableRBAC": + err = unpopulate(val, "EnableRBAC", &m.EnableRBAC) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &m.Fqdn) + delete(rawMsg, key) + case "fqdnSubdomain": + err = unpopulate(val, "FqdnSubdomain", &m.FqdnSubdomain) + delete(rawMsg, key) + case "httpProxyConfig": + err = unpopulate(val, "HTTPProxyConfig", &m.HTTPProxyConfig) + delete(rawMsg, key) + case "identityProfile": + err = unpopulate(val, "IdentityProfile", &m.IdentityProfile) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &m.KubernetesVersion) + delete(rawMsg, key) + case "linuxProfile": + err = unpopulate(val, "LinuxProfile", &m.LinuxProfile) + delete(rawMsg, key) + case "maxAgentPools": + err = unpopulate(val, "MaxAgentPools", &m.MaxAgentPools) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) + delete(rawMsg, key) + case "nodeResourceGroup": + err = unpopulate(val, "NodeResourceGroup", &m.NodeResourceGroup) + delete(rawMsg, key) + case "oidcIssuerProfile": + err = unpopulate(val, "OidcIssuerProfile", &m.OidcIssuerProfile) + delete(rawMsg, key) + case "podIdentityProfile": + err = unpopulate(val, "PodIdentityProfile", &m.PodIdentityProfile) + delete(rawMsg, key) + case "powerState": + err = unpopulate(val, "PowerState", &m.PowerState) + delete(rawMsg, key) + case "privateFQDN": + err = unpopulate(val, "PrivateFQDN", &m.PrivateFQDN) + delete(rawMsg, key) + case "privateLinkResources": + err = unpopulate(val, "PrivateLinkResources", &m.PrivateLinkResources) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &m.PublicNetworkAccess) + delete(rawMsg, key) + case "resourceUID": + err = unpopulate(val, "ResourceUID", &m.ResourceUID) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &m.SecurityProfile) + delete(rawMsg, key) + case "serviceMeshProfile": + err = unpopulate(val, "ServiceMeshProfile", &m.ServiceMeshProfile) + delete(rawMsg, key) + case "servicePrincipalProfile": + err = unpopulate(val, "ServicePrincipalProfile", &m.ServicePrincipalProfile) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &m.StorageProfile) + delete(rawMsg, key) + case "supportPlan": + err = unpopulate(val, "SupportPlan", &m.SupportPlan) + delete(rawMsg, key) + case "upgradeSettings": + err = unpopulate(val, "UpgradeSettings", &m.UpgradeSettings) + delete(rawMsg, key) + case "windowsProfile": + err = unpopulate(val, "WindowsProfile", &m.WindowsProfile) + delete(rawMsg, key) + case "workloadAutoScalerProfile": + err = unpopulate(val, "WorkloadAutoScalerProfile", &m.WorkloadAutoScalerProfile) + 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 ManagedClusterPropertiesAutoScalerProfile. +func (m ManagedClusterPropertiesAutoScalerProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "balance-similar-node-groups", m.BalanceSimilarNodeGroups) + populate(objectMap, "expander", m.Expander) + populate(objectMap, "max-empty-bulk-delete", m.MaxEmptyBulkDelete) + populate(objectMap, "max-graceful-termination-sec", m.MaxGracefulTerminationSec) + populate(objectMap, "max-node-provision-time", m.MaxNodeProvisionTime) + populate(objectMap, "max-total-unready-percentage", m.MaxTotalUnreadyPercentage) + populate(objectMap, "new-pod-scale-up-delay", m.NewPodScaleUpDelay) + populate(objectMap, "ok-total-unready-count", m.OkTotalUnreadyCount) + populate(objectMap, "scale-down-delay-after-add", m.ScaleDownDelayAfterAdd) + populate(objectMap, "scale-down-delay-after-delete", m.ScaleDownDelayAfterDelete) + populate(objectMap, "scale-down-delay-after-failure", m.ScaleDownDelayAfterFailure) + populate(objectMap, "scale-down-unneeded-time", m.ScaleDownUnneededTime) + populate(objectMap, "scale-down-unready-time", m.ScaleDownUnreadyTime) + populate(objectMap, "scale-down-utilization-threshold", m.ScaleDownUtilizationThreshold) + populate(objectMap, "scan-interval", m.ScanInterval) + populate(objectMap, "skip-nodes-with-local-storage", m.SkipNodesWithLocalStorage) + populate(objectMap, "skip-nodes-with-system-pods", m.SkipNodesWithSystemPods) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPropertiesAutoScalerProfile. +func (m *ManagedClusterPropertiesAutoScalerProfile) UnmarshalJSON(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 "balance-similar-node-groups": + err = unpopulate(val, "BalanceSimilarNodeGroups", &m.BalanceSimilarNodeGroups) + delete(rawMsg, key) + case "expander": + err = unpopulate(val, "Expander", &m.Expander) + delete(rawMsg, key) + case "max-empty-bulk-delete": + err = unpopulate(val, "MaxEmptyBulkDelete", &m.MaxEmptyBulkDelete) + delete(rawMsg, key) + case "max-graceful-termination-sec": + err = unpopulate(val, "MaxGracefulTerminationSec", &m.MaxGracefulTerminationSec) + delete(rawMsg, key) + case "max-node-provision-time": + err = unpopulate(val, "MaxNodeProvisionTime", &m.MaxNodeProvisionTime) + delete(rawMsg, key) + case "max-total-unready-percentage": + err = unpopulate(val, "MaxTotalUnreadyPercentage", &m.MaxTotalUnreadyPercentage) + delete(rawMsg, key) + case "new-pod-scale-up-delay": + err = unpopulate(val, "NewPodScaleUpDelay", &m.NewPodScaleUpDelay) + delete(rawMsg, key) + case "ok-total-unready-count": + err = unpopulate(val, "OkTotalUnreadyCount", &m.OkTotalUnreadyCount) + delete(rawMsg, key) + case "scale-down-delay-after-add": + err = unpopulate(val, "ScaleDownDelayAfterAdd", &m.ScaleDownDelayAfterAdd) + delete(rawMsg, key) + case "scale-down-delay-after-delete": + err = unpopulate(val, "ScaleDownDelayAfterDelete", &m.ScaleDownDelayAfterDelete) + delete(rawMsg, key) + case "scale-down-delay-after-failure": + err = unpopulate(val, "ScaleDownDelayAfterFailure", &m.ScaleDownDelayAfterFailure) + delete(rawMsg, key) + case "scale-down-unneeded-time": + err = unpopulate(val, "ScaleDownUnneededTime", &m.ScaleDownUnneededTime) + delete(rawMsg, key) + case "scale-down-unready-time": + err = unpopulate(val, "ScaleDownUnreadyTime", &m.ScaleDownUnreadyTime) + delete(rawMsg, key) + case "scale-down-utilization-threshold": + err = unpopulate(val, "ScaleDownUtilizationThreshold", &m.ScaleDownUtilizationThreshold) + delete(rawMsg, key) + case "scan-interval": + err = unpopulate(val, "ScanInterval", &m.ScanInterval) + delete(rawMsg, key) + case "skip-nodes-with-local-storage": + err = unpopulate(val, "SkipNodesWithLocalStorage", &m.SkipNodesWithLocalStorage) + delete(rawMsg, key) + case "skip-nodes-with-system-pods": + err = unpopulate(val, "SkipNodesWithSystemPods", &m.SkipNodesWithSystemPods) + 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 ManagedClusterSKU. +func (m ManagedClusterSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + populate(objectMap, "tier", m.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSKU. +func (m *ManagedClusterSKU) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &m.Tier) + 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 ManagedClusterSecurityProfile. +func (m ManagedClusterSecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureKeyVaultKms", m.AzureKeyVaultKms) + populate(objectMap, "defender", m.Defender) + populate(objectMap, "imageCleaner", m.ImageCleaner) + populate(objectMap, "workloadIdentity", m.WorkloadIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSecurityProfile. +func (m *ManagedClusterSecurityProfile) UnmarshalJSON(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 "azureKeyVaultKms": + err = unpopulate(val, "AzureKeyVaultKms", &m.AzureKeyVaultKms) + delete(rawMsg, key) + case "defender": + err = unpopulate(val, "Defender", &m.Defender) + delete(rawMsg, key) + case "imageCleaner": + err = unpopulate(val, "ImageCleaner", &m.ImageCleaner) + delete(rawMsg, key) + case "workloadIdentity": + err = unpopulate(val, "WorkloadIdentity", &m.WorkloadIdentity) + 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 ManagedClusterSecurityProfileDefender. +func (m ManagedClusterSecurityProfileDefender) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logAnalyticsWorkspaceResourceId", m.LogAnalyticsWorkspaceResourceID) + populate(objectMap, "securityMonitoring", m.SecurityMonitoring) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSecurityProfileDefender. +func (m *ManagedClusterSecurityProfileDefender) UnmarshalJSON(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 "logAnalyticsWorkspaceResourceId": + err = unpopulate(val, "LogAnalyticsWorkspaceResourceID", &m.LogAnalyticsWorkspaceResourceID) + delete(rawMsg, key) + case "securityMonitoring": + err = unpopulate(val, "SecurityMonitoring", &m.SecurityMonitoring) + 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 ManagedClusterSecurityProfileDefenderSecurityMonitoring. +func (m ManagedClusterSecurityProfileDefenderSecurityMonitoring) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSecurityProfileDefenderSecurityMonitoring. +func (m *ManagedClusterSecurityProfileDefenderSecurityMonitoring) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + 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 ManagedClusterSecurityProfileImageCleaner. +func (m ManagedClusterSecurityProfileImageCleaner) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "intervalHours", m.IntervalHours) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSecurityProfileImageCleaner. +func (m *ManagedClusterSecurityProfileImageCleaner) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "intervalHours": + err = unpopulate(val, "IntervalHours", &m.IntervalHours) + 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 ManagedClusterSecurityProfileWorkloadIdentity. +func (m ManagedClusterSecurityProfileWorkloadIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSecurityProfileWorkloadIdentity. +func (m *ManagedClusterSecurityProfileWorkloadIdentity) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + 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 ManagedClusterServicePrincipalProfile. +func (m ManagedClusterServicePrincipalProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", m.ClientID) + populate(objectMap, "secret", m.Secret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterServicePrincipalProfile. +func (m *ManagedClusterServicePrincipalProfile) UnmarshalJSON(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 "clientId": + err = unpopulate(val, "ClientID", &m.ClientID) + delete(rawMsg, key) + case "secret": + err = unpopulate(val, "Secret", &m.Secret) + 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 ManagedClusterStorageProfile. +func (m ManagedClusterStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobCSIDriver", m.BlobCSIDriver) + populate(objectMap, "diskCSIDriver", m.DiskCSIDriver) + populate(objectMap, "fileCSIDriver", m.FileCSIDriver) + populate(objectMap, "snapshotController", m.SnapshotController) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterStorageProfile. +func (m *ManagedClusterStorageProfile) UnmarshalJSON(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 "blobCSIDriver": + err = unpopulate(val, "BlobCSIDriver", &m.BlobCSIDriver) + delete(rawMsg, key) + case "diskCSIDriver": + err = unpopulate(val, "DiskCSIDriver", &m.DiskCSIDriver) + delete(rawMsg, key) + case "fileCSIDriver": + err = unpopulate(val, "FileCSIDriver", &m.FileCSIDriver) + delete(rawMsg, key) + case "snapshotController": + err = unpopulate(val, "SnapshotController", &m.SnapshotController) + 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 ManagedClusterStorageProfileBlobCSIDriver. +func (m ManagedClusterStorageProfileBlobCSIDriver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterStorageProfileBlobCSIDriver. +func (m *ManagedClusterStorageProfileBlobCSIDriver) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + 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 ManagedClusterStorageProfileDiskCSIDriver. +func (m ManagedClusterStorageProfileDiskCSIDriver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterStorageProfileDiskCSIDriver. +func (m *ManagedClusterStorageProfileDiskCSIDriver) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + 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 ManagedClusterStorageProfileFileCSIDriver. +func (m ManagedClusterStorageProfileFileCSIDriver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterStorageProfileFileCSIDriver. +func (m *ManagedClusterStorageProfileFileCSIDriver) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + 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 ManagedClusterStorageProfileSnapshotController. +func (m ManagedClusterStorageProfileSnapshotController) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterStorageProfileSnapshotController. +func (m *ManagedClusterStorageProfileSnapshotController) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + 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 ManagedClusterUpgradeProfile. +func (m ManagedClusterUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterUpgradeProfile. +func (m *ManagedClusterUpgradeProfile) UnmarshalJSON(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) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + 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 ManagedClusterUpgradeProfileProperties. +func (m ManagedClusterUpgradeProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentPoolProfiles", m.AgentPoolProfiles) + populate(objectMap, "controlPlaneProfile", m.ControlPlaneProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterUpgradeProfileProperties. +func (m *ManagedClusterUpgradeProfileProperties) UnmarshalJSON(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 "agentPoolProfiles": + err = unpopulate(val, "AgentPoolProfiles", &m.AgentPoolProfiles) + delete(rawMsg, key) + case "controlPlaneProfile": + err = unpopulate(val, "ControlPlaneProfile", &m.ControlPlaneProfile) + 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 ManagedClusterWindowsProfile. +func (m ManagedClusterWindowsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminPassword", m.AdminPassword) + populate(objectMap, "adminUsername", m.AdminUsername) + populate(objectMap, "enableCSIProxy", m.EnableCSIProxy) + populate(objectMap, "gmsaProfile", m.GmsaProfile) + populate(objectMap, "licenseType", m.LicenseType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterWindowsProfile. +func (m *ManagedClusterWindowsProfile) UnmarshalJSON(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 "adminPassword": + err = unpopulate(val, "AdminPassword", &m.AdminPassword) + delete(rawMsg, key) + case "adminUsername": + err = unpopulate(val, "AdminUsername", &m.AdminUsername) + delete(rawMsg, key) + case "enableCSIProxy": + err = unpopulate(val, "EnableCSIProxy", &m.EnableCSIProxy) + delete(rawMsg, key) + case "gmsaProfile": + err = unpopulate(val, "GmsaProfile", &m.GmsaProfile) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &m.LicenseType) + 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 ManagedClusterWorkloadAutoScalerProfile. +func (m ManagedClusterWorkloadAutoScalerProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keda", m.Keda) + populate(objectMap, "verticalPodAutoscaler", m.VerticalPodAutoscaler) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterWorkloadAutoScalerProfile. +func (m *ManagedClusterWorkloadAutoScalerProfile) UnmarshalJSON(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 "keda": + err = unpopulate(val, "Keda", &m.Keda) + delete(rawMsg, key) + case "verticalPodAutoscaler": + err = unpopulate(val, "VerticalPodAutoscaler", &m.VerticalPodAutoscaler) + 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 ManagedClusterWorkloadAutoScalerProfileKeda. +func (m ManagedClusterWorkloadAutoScalerProfileKeda) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterWorkloadAutoScalerProfileKeda. +func (m *ManagedClusterWorkloadAutoScalerProfileKeda) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + 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 ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler. +func (m ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler. +func (m *ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + 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 ManagedServiceIdentityUserAssignedIdentitiesValue. +func (m ManagedServiceIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", m.ClientID) + populate(objectMap, "principalId", m.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentityUserAssignedIdentitiesValue. +func (m *ManagedServiceIdentityUserAssignedIdentitiesValue) UnmarshalJSON(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 "clientId": + err = unpopulate(val, "ClientID", &m.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + 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 MeshRevision. +func (m MeshRevision) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "compatibleWith", m.CompatibleWith) + populate(objectMap, "revision", m.Revision) + populate(objectMap, "upgrades", m.Upgrades) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MeshRevision. +func (m *MeshRevision) UnmarshalJSON(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 "compatibleWith": + err = unpopulate(val, "CompatibleWith", &m.CompatibleWith) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &m.Revision) + delete(rawMsg, key) + case "upgrades": + err = unpopulate(val, "Upgrades", &m.Upgrades) + 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 MeshRevisionProfile. +func (m MeshRevisionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 MeshRevisionProfile. +func (m *MeshRevisionProfile) UnmarshalJSON(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) + 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 MeshRevisionProfileList. +func (m MeshRevisionProfileList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MeshRevisionProfileList. +func (m *MeshRevisionProfileList) UnmarshalJSON(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 MeshRevisionProfileProperties. +func (m MeshRevisionProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "meshRevisions", m.MeshRevisions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MeshRevisionProfileProperties. +func (m *MeshRevisionProfileProperties) UnmarshalJSON(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 "meshRevisions": + err = unpopulate(val, "MeshRevisions", &m.MeshRevisions) + 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 MeshUpgradeProfile. +func (m MeshUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 MeshUpgradeProfile. +func (m *MeshUpgradeProfile) UnmarshalJSON(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) + 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 MeshUpgradeProfileList. +func (m MeshUpgradeProfileList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MeshUpgradeProfileList. +func (m *MeshUpgradeProfileList) UnmarshalJSON(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 MeshUpgradeProfileProperties. +func (m MeshUpgradeProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "compatibleWith", m.CompatibleWith) + populate(objectMap, "revision", m.Revision) + populate(objectMap, "upgrades", m.Upgrades) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MeshUpgradeProfileProperties. +func (m *MeshUpgradeProfileProperties) UnmarshalJSON(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 "compatibleWith": + err = unpopulate(val, "CompatibleWith", &m.CompatibleWith) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &m.Revision) + delete(rawMsg, key) + case "upgrades": + err = unpopulate(val, "Upgrades", &m.Upgrades) + 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 NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServiceIP", n.DNSServiceIP) + populate(objectMap, "ipFamilies", n.IPFamilies) + populate(objectMap, "loadBalancerProfile", n.LoadBalancerProfile) + populate(objectMap, "loadBalancerSku", n.LoadBalancerSKU) + populate(objectMap, "natGatewayProfile", n.NatGatewayProfile) + populate(objectMap, "networkDataplane", n.NetworkDataplane) + populate(objectMap, "networkMode", n.NetworkMode) + populate(objectMap, "networkPlugin", n.NetworkPlugin) + populate(objectMap, "networkPluginMode", n.NetworkPluginMode) + populate(objectMap, "networkPolicy", n.NetworkPolicy) + populate(objectMap, "outboundType", n.OutboundType) + populate(objectMap, "podCidr", n.PodCidr) + populate(objectMap, "podCidrs", n.PodCidrs) + populate(objectMap, "serviceCidr", n.ServiceCidr) + populate(objectMap, "serviceCidrs", n.ServiceCidrs) + 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 "dnsServiceIP": + err = unpopulate(val, "DNSServiceIP", &n.DNSServiceIP) + delete(rawMsg, key) + case "ipFamilies": + err = unpopulate(val, "IPFamilies", &n.IPFamilies) + delete(rawMsg, key) + case "loadBalancerProfile": + err = unpopulate(val, "LoadBalancerProfile", &n.LoadBalancerProfile) + delete(rawMsg, key) + case "loadBalancerSku": + err = unpopulate(val, "LoadBalancerSKU", &n.LoadBalancerSKU) + delete(rawMsg, key) + case "natGatewayProfile": + err = unpopulate(val, "NatGatewayProfile", &n.NatGatewayProfile) + delete(rawMsg, key) + case "networkDataplane": + err = unpopulate(val, "NetworkDataplane", &n.NetworkDataplane) + delete(rawMsg, key) + case "networkMode": + err = unpopulate(val, "NetworkMode", &n.NetworkMode) + delete(rawMsg, key) + case "networkPlugin": + err = unpopulate(val, "NetworkPlugin", &n.NetworkPlugin) + delete(rawMsg, key) + case "networkPluginMode": + err = unpopulate(val, "NetworkPluginMode", &n.NetworkPluginMode) + delete(rawMsg, key) + case "networkPolicy": + err = unpopulate(val, "NetworkPolicy", &n.NetworkPolicy) + delete(rawMsg, key) + case "outboundType": + err = unpopulate(val, "OutboundType", &n.OutboundType) + delete(rawMsg, key) + case "podCidr": + err = unpopulate(val, "PodCidr", &n.PodCidr) + delete(rawMsg, key) + case "podCidrs": + err = unpopulate(val, "PodCidrs", &n.PodCidrs) + delete(rawMsg, key) + case "serviceCidr": + err = unpopulate(val, "ServiceCidr", &n.ServiceCidr) + delete(rawMsg, key) + case "serviceCidrs": + err = unpopulate(val, "ServiceCidrs", &n.ServiceCidrs) + 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 OSOptionProfile. +func (o OSOptionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 OSOptionProfile. +func (o *OSOptionProfile) UnmarshalJSON(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 "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 OSOptionProperty. +func (o OSOptionProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enable-fips-image", o.EnableFipsImage) + populate(objectMap, "os-type", o.OSType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSOptionProperty. +func (o *OSOptionProperty) UnmarshalJSON(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 "enable-fips-image": + err = unpopulate(val, "EnableFipsImage", &o.EnableFipsImage) + delete(rawMsg, key) + case "os-type": + err = unpopulate(val, "OSType", &o.OSType) + 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 OSOptionPropertyList. +func (o OSOptionPropertyList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "osOptionPropertyList", o.OSOptionPropertyList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSOptionPropertyList. +func (o *OSOptionPropertyList) UnmarshalJSON(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 "osOptionPropertyList": + err = unpopulate(val, "OSOptionPropertyList", &o.OSOptionPropertyList) + 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]any) + 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]any) + 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]any) + 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 OutboundEnvironmentEndpoint. +func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", o.Category) + populate(objectMap, "endpoints", o.Endpoints) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. +func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(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 "category": + err = unpopulate(val, "Category", &o.Category) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &o.Endpoints) + 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 OutboundEnvironmentEndpointCollection. +func (o OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointCollection. +func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(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 PortRange. +func (p PortRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "portEnd", p.PortEnd) + populate(objectMap, "portStart", p.PortStart) + populate(objectMap, "protocol", p.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PortRange. +func (p *PortRange) UnmarshalJSON(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 "portEnd": + err = unpopulate(val, "PortEnd", &p.PortEnd) + delete(rawMsg, key) + case "portStart": + err = unpopulate(val, "PortStart", &p.PortStart) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &p.Protocol) + 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 PowerState. +func (p PowerState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", p.Code) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PowerState. +func (p *PowerState) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &p.Code) + 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]any) + 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]any) + 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]any) + 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 "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]any) + 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]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "privateLinkServiceID", p.PrivateLinkServiceID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + 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 "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + 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 "privateLinkServiceID": + err = unpopulate(val, "PrivateLinkServiceID", &p.PrivateLinkServiceID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + 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 PrivateLinkResourcesListResult. +func (p PrivateLinkResourcesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourcesListResult. +func (p *PrivateLinkResourcesListResult) UnmarshalJSON(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 PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 "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 RelativeMonthlySchedule. +func (r RelativeMonthlySchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dayOfWeek", r.DayOfWeek) + populate(objectMap, "intervalMonths", r.IntervalMonths) + populate(objectMap, "weekIndex", r.WeekIndex) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RelativeMonthlySchedule. +func (r *RelativeMonthlySchedule) UnmarshalJSON(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 "dayOfWeek": + err = unpopulate(val, "DayOfWeek", &r.DayOfWeek) + delete(rawMsg, key) + case "intervalMonths": + err = unpopulate(val, "IntervalMonths", &r.IntervalMonths) + delete(rawMsg, key) + case "weekIndex": + err = unpopulate(val, "WeekIndex", &r.WeekIndex) + 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 ResourceReference. +func (r ResourceReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReference. +func (r *ResourceReference) UnmarshalJSON(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 RunCommandRequest. +func (r RunCommandRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterToken", r.ClusterToken) + populate(objectMap, "command", r.Command) + populate(objectMap, "context", r.Context) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandRequest. +func (r *RunCommandRequest) UnmarshalJSON(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 "clusterToken": + err = unpopulate(val, "ClusterToken", &r.ClusterToken) + delete(rawMsg, key) + case "command": + err = unpopulate(val, "Command", &r.Command) + delete(rawMsg, key) + case "context": + err = unpopulate(val, "Context", &r.Context) + 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]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "properties", r.Properties) + 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 "id": + err = unpopulate(val, "ID", &r.ID) + 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 SSHConfiguration. +func (s SSHConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + populate(objectMap, "keyData", s.KeyData) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Schedule. +func (s Schedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "absoluteMonthly", s.AbsoluteMonthly) + populate(objectMap, "daily", s.Daily) + populate(objectMap, "relativeMonthly", s.RelativeMonthly) + populate(objectMap, "weekly", s.Weekly) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Schedule. +func (s *Schedule) UnmarshalJSON(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 "absoluteMonthly": + err = unpopulate(val, "AbsoluteMonthly", &s.AbsoluteMonthly) + delete(rawMsg, key) + case "daily": + err = unpopulate(val, "Daily", &s.Daily) + delete(rawMsg, key) + case "relativeMonthly": + err = unpopulate(val, "RelativeMonthly", &s.RelativeMonthly) + delete(rawMsg, key) + case "weekly": + err = unpopulate(val, "Weekly", &s.Weekly) + 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 ServiceMeshProfile. +func (s ServiceMeshProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "istio", s.Istio) + populate(objectMap, "mode", s.Mode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceMeshProfile. +func (s *ServiceMeshProfile) UnmarshalJSON(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 "istio": + err = unpopulate(val, "Istio", &s.Istio) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &s.Mode) + 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]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + 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 "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 "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + 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 SnapshotListResult. +func (s SnapshotListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotListResult. +func (s *SnapshotListResult) UnmarshalJSON(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]any) + populate(objectMap, "creationData", s.CreationData) + populate(objectMap, "enableFIPS", s.EnableFIPS) + populate(objectMap, "kubernetesVersion", s.KubernetesVersion) + populate(objectMap, "nodeImageVersion", s.NodeImageVersion) + populate(objectMap, "osSku", s.OSSKU) + populate(objectMap, "osType", s.OSType) + populate(objectMap, "snapshotType", s.SnapshotType) + populate(objectMap, "vmSize", s.VMSize) + 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 "creationData": + err = unpopulate(val, "CreationData", &s.CreationData) + delete(rawMsg, key) + case "enableFIPS": + err = unpopulate(val, "EnableFIPS", &s.EnableFIPS) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &s.KubernetesVersion) + delete(rawMsg, key) + case "nodeImageVersion": + err = unpopulate(val, "NodeImageVersion", &s.NodeImageVersion) + delete(rawMsg, key) + case "osSku": + err = unpopulate(val, "OSSKU", &s.OSSKU) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &s.OSType) + delete(rawMsg, key) + case "snapshotType": + err = unpopulate(val, "SnapshotType", &s.SnapshotType) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &s.VMSize) + 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 SysctlConfig. +func (s SysctlConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fsAioMaxNr", s.FsAioMaxNr) + populate(objectMap, "fsFileMax", s.FsFileMax) + populate(objectMap, "fsInotifyMaxUserWatches", s.FsInotifyMaxUserWatches) + populate(objectMap, "fsNrOpen", s.FsNrOpen) + populate(objectMap, "kernelThreadsMax", s.KernelThreadsMax) + populate(objectMap, "netCoreNetdevMaxBacklog", s.NetCoreNetdevMaxBacklog) + populate(objectMap, "netCoreOptmemMax", s.NetCoreOptmemMax) + populate(objectMap, "netCoreRmemDefault", s.NetCoreRmemDefault) + populate(objectMap, "netCoreRmemMax", s.NetCoreRmemMax) + populate(objectMap, "netCoreSomaxconn", s.NetCoreSomaxconn) + populate(objectMap, "netCoreWmemDefault", s.NetCoreWmemDefault) + populate(objectMap, "netCoreWmemMax", s.NetCoreWmemMax) + populate(objectMap, "netIpv4IpLocalPortRange", s.NetIPv4IPLocalPortRange) + populate(objectMap, "netIpv4NeighDefaultGcThresh1", s.NetIPv4NeighDefaultGcThresh1) + populate(objectMap, "netIpv4NeighDefaultGcThresh2", s.NetIPv4NeighDefaultGcThresh2) + populate(objectMap, "netIpv4NeighDefaultGcThresh3", s.NetIPv4NeighDefaultGcThresh3) + populate(objectMap, "netIpv4TcpFinTimeout", s.NetIPv4TCPFinTimeout) + populate(objectMap, "netIpv4TcpKeepaliveProbes", s.NetIPv4TCPKeepaliveProbes) + populate(objectMap, "netIpv4TcpKeepaliveTime", s.NetIPv4TCPKeepaliveTime) + populate(objectMap, "netIpv4TcpMaxSynBacklog", s.NetIPv4TCPMaxSynBacklog) + populate(objectMap, "netIpv4TcpMaxTwBuckets", s.NetIPv4TCPMaxTwBuckets) + populate(objectMap, "netIpv4TcpTwReuse", s.NetIPv4TCPTwReuse) + populate(objectMap, "netIpv4TcpkeepaliveIntvl", s.NetIPv4TcpkeepaliveIntvl) + populate(objectMap, "netNetfilterNfConntrackBuckets", s.NetNetfilterNfConntrackBuckets) + populate(objectMap, "netNetfilterNfConntrackMax", s.NetNetfilterNfConntrackMax) + populate(objectMap, "vmMaxMapCount", s.VMMaxMapCount) + populate(objectMap, "vmSwappiness", s.VMSwappiness) + populate(objectMap, "vmVfsCachePressure", s.VMVfsCachePressure) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SysctlConfig. +func (s *SysctlConfig) UnmarshalJSON(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 "fsAioMaxNr": + err = unpopulate(val, "FsAioMaxNr", &s.FsAioMaxNr) + delete(rawMsg, key) + case "fsFileMax": + err = unpopulate(val, "FsFileMax", &s.FsFileMax) + delete(rawMsg, key) + case "fsInotifyMaxUserWatches": + err = unpopulate(val, "FsInotifyMaxUserWatches", &s.FsInotifyMaxUserWatches) + delete(rawMsg, key) + case "fsNrOpen": + err = unpopulate(val, "FsNrOpen", &s.FsNrOpen) + delete(rawMsg, key) + case "kernelThreadsMax": + err = unpopulate(val, "KernelThreadsMax", &s.KernelThreadsMax) + delete(rawMsg, key) + case "netCoreNetdevMaxBacklog": + err = unpopulate(val, "NetCoreNetdevMaxBacklog", &s.NetCoreNetdevMaxBacklog) + delete(rawMsg, key) + case "netCoreOptmemMax": + err = unpopulate(val, "NetCoreOptmemMax", &s.NetCoreOptmemMax) + delete(rawMsg, key) + case "netCoreRmemDefault": + err = unpopulate(val, "NetCoreRmemDefault", &s.NetCoreRmemDefault) + delete(rawMsg, key) + case "netCoreRmemMax": + err = unpopulate(val, "NetCoreRmemMax", &s.NetCoreRmemMax) + delete(rawMsg, key) + case "netCoreSomaxconn": + err = unpopulate(val, "NetCoreSomaxconn", &s.NetCoreSomaxconn) + delete(rawMsg, key) + case "netCoreWmemDefault": + err = unpopulate(val, "NetCoreWmemDefault", &s.NetCoreWmemDefault) + delete(rawMsg, key) + case "netCoreWmemMax": + err = unpopulate(val, "NetCoreWmemMax", &s.NetCoreWmemMax) + delete(rawMsg, key) + case "netIpv4IpLocalPortRange": + err = unpopulate(val, "NetIPv4IPLocalPortRange", &s.NetIPv4IPLocalPortRange) + delete(rawMsg, key) + case "netIpv4NeighDefaultGcThresh1": + err = unpopulate(val, "NetIPv4NeighDefaultGcThresh1", &s.NetIPv4NeighDefaultGcThresh1) + delete(rawMsg, key) + case "netIpv4NeighDefaultGcThresh2": + err = unpopulate(val, "NetIPv4NeighDefaultGcThresh2", &s.NetIPv4NeighDefaultGcThresh2) + delete(rawMsg, key) + case "netIpv4NeighDefaultGcThresh3": + err = unpopulate(val, "NetIPv4NeighDefaultGcThresh3", &s.NetIPv4NeighDefaultGcThresh3) + delete(rawMsg, key) + case "netIpv4TcpFinTimeout": + err = unpopulate(val, "NetIPv4TCPFinTimeout", &s.NetIPv4TCPFinTimeout) + delete(rawMsg, key) + case "netIpv4TcpKeepaliveProbes": + err = unpopulate(val, "NetIPv4TCPKeepaliveProbes", &s.NetIPv4TCPKeepaliveProbes) + delete(rawMsg, key) + case "netIpv4TcpKeepaliveTime": + err = unpopulate(val, "NetIPv4TCPKeepaliveTime", &s.NetIPv4TCPKeepaliveTime) + delete(rawMsg, key) + case "netIpv4TcpMaxSynBacklog": + err = unpopulate(val, "NetIPv4TCPMaxSynBacklog", &s.NetIPv4TCPMaxSynBacklog) + delete(rawMsg, key) + case "netIpv4TcpMaxTwBuckets": + err = unpopulate(val, "NetIPv4TCPMaxTwBuckets", &s.NetIPv4TCPMaxTwBuckets) + delete(rawMsg, key) + case "netIpv4TcpTwReuse": + err = unpopulate(val, "NetIPv4TCPTwReuse", &s.NetIPv4TCPTwReuse) + delete(rawMsg, key) + case "netIpv4TcpkeepaliveIntvl": + err = unpopulate(val, "NetIPv4TcpkeepaliveIntvl", &s.NetIPv4TcpkeepaliveIntvl) + delete(rawMsg, key) + case "netNetfilterNfConntrackBuckets": + err = unpopulate(val, "NetNetfilterNfConntrackBuckets", &s.NetNetfilterNfConntrackBuckets) + delete(rawMsg, key) + case "netNetfilterNfConntrackMax": + err = unpopulate(val, "NetNetfilterNfConntrackMax", &s.NetNetfilterNfConntrackMax) + delete(rawMsg, key) + case "vmMaxMapCount": + err = unpopulate(val, "VMMaxMapCount", &s.VMMaxMapCount) + delete(rawMsg, key) + case "vmSwappiness": + err = unpopulate(val, "VMSwappiness", &s.VMSwappiness) + delete(rawMsg, key) + case "vmVfsCachePressure": + err = unpopulate(val, "VMVfsCachePressure", &s.VMVfsCachePressure) + 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]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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]any) + 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 TimeInWeek. +func (t TimeInWeek) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "day", t.Day) + populate(objectMap, "hourSlots", t.HourSlots) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeInWeek. +func (t *TimeInWeek) UnmarshalJSON(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 "day": + err = unpopulate(val, "Day", &t.Day) + delete(rawMsg, key) + case "hourSlots": + err = unpopulate(val, "HourSlots", &t.HourSlots) + 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 TimeSpan. +func (t TimeSpan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "end", t.End) + populateDateTimeRFC3339(objectMap, "start", t.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSpan. +func (t *TimeSpan) UnmarshalJSON(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 "end": + err = unpopulateDateTimeRFC3339(val, "End", &t.End) + delete(rawMsg, key) + case "start": + err = unpopulateDateTimeRFC3339(val, "Start", &t.Start) + 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 TrustedAccessRole. +func (t TrustedAccessRole) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", t.Name) + populate(objectMap, "rules", t.Rules) + populate(objectMap, "sourceResourceType", t.SourceResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRole. +func (t *TrustedAccessRole) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &t.Rules) + delete(rawMsg, key) + case "sourceResourceType": + err = unpopulate(val, "SourceResourceType", &t.SourceResourceType) + 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 TrustedAccessRoleBinding. +func (t TrustedAccessRoleBinding) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleBinding. +func (t *TrustedAccessRoleBinding) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TrustedAccessRoleBindingListResult. +func (t TrustedAccessRoleBindingListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleBindingListResult. +func (t *TrustedAccessRoleBindingListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TrustedAccessRoleBindingProperties. +func (t TrustedAccessRoleBindingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "roles", t.Roles) + populate(objectMap, "sourceResourceId", t.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleBindingProperties. +func (t *TrustedAccessRoleBindingProperties) UnmarshalJSON(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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "roles": + err = unpopulate(val, "Roles", &t.Roles) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &t.SourceResourceID) + 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 TrustedAccessRoleListResult. +func (t TrustedAccessRoleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleListResult. +func (t *TrustedAccessRoleListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TrustedAccessRoleRule. +func (t TrustedAccessRoleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiGroups", t.APIGroups) + populate(objectMap, "nonResourceURLs", t.NonResourceURLs) + populate(objectMap, "resourceNames", t.ResourceNames) + populate(objectMap, "resources", t.Resources) + populate(objectMap, "verbs", t.Verbs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleRule. +func (t *TrustedAccessRoleRule) UnmarshalJSON(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 "apiGroups": + err = unpopulate(val, "APIGroups", &t.APIGroups) + delete(rawMsg, key) + case "nonResourceURLs": + err = unpopulate(val, "NonResourceURLs", &t.NonResourceURLs) + delete(rawMsg, key) + case "resourceNames": + err = unpopulate(val, "ResourceNames", &t.ResourceNames) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &t.Resources) + delete(rawMsg, key) + case "verbs": + err = unpopulate(val, "Verbs", &t.Verbs) + 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 UpgradeOverrideSettings. +func (u UpgradeOverrideSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "forceUpgrade", u.ForceUpgrade) + populateDateTimeRFC3339(objectMap, "until", u.Until) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpgradeOverrideSettings. +func (u *UpgradeOverrideSettings) UnmarshalJSON(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 "forceUpgrade": + err = unpopulate(val, "ForceUpgrade", &u.ForceUpgrade) + delete(rawMsg, key) + case "until": + err = unpopulateDateTimeRFC3339(val, "Until", &u.Until) + 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 UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "objectId", u.ObjectID) + populate(objectMap, "resourceId", u.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(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 "objectId": + err = unpopulate(val, "ObjectID", &u.ObjectID) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &u.ResourceID) + 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 WeeklySchedule. +func (w WeeklySchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dayOfWeek", w.DayOfWeek) + populate(objectMap, "intervalWeeks", w.IntervalWeeks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WeeklySchedule. +func (w *WeeklySchedule) UnmarshalJSON(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 "dayOfWeek": + err = unpopulate(val, "DayOfWeek", &w.DayOfWeek) + delete(rawMsg, key) + case "intervalWeeks": + err = unpopulate(val, "IntervalWeeks", &w.IntervalWeeks) + 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 WindowsGmsaProfile. +func (w WindowsGmsaProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServer", w.DNSServer) + populate(objectMap, "enabled", w.Enabled) + populate(objectMap, "rootDomainName", w.RootDomainName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsGmsaProfile. +func (w *WindowsGmsaProfile) UnmarshalJSON(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 "dnsServer": + err = unpopulate(val, "DNSServer", &w.DNSServer) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &w.Enabled) + delete(rawMsg, key) + case "rootDomainName": + err = unpopulate(val, "RootDomainName", &w.RootDomainName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateByteArray(m map[string]any, k string, b []byte, f runtime.Base64Encoding) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = runtime.EncodeByteArray(b, f) + } +} + +func unpopulate(data json.RawMessage, fn string, v any) 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/containerservice/armcontainerservice/v4/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/operations_client.go new file mode 100644 index 000000000..7275bdd49 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/operations_client.go @@ -0,0 +1,89 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "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/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 { + internal *arm.Client +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Gets a list of operations. +// +// Generated from API version 2023-10-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.ContainerService/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-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/containerservice/armcontainerservice/v4/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/options.go new file mode 100644 index 000000000..061d3e76d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/options.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +// AgentPoolsClientBeginAbortLatestOperationOptions contains the optional parameters for the AgentPoolsClient.BeginAbortLatestOperation +// method. +type AgentPoolsClientBeginAbortLatestOperationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the AgentPoolsClient.BeginCreateOrUpdate +// method. +type AgentPoolsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolsClientBeginDeleteOptions contains the optional parameters for the AgentPoolsClient.BeginDelete method. +type AgentPoolsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolsClientBeginUpgradeNodeImageVersionOptions contains the optional parameters for the AgentPoolsClient.BeginUpgradeNodeImageVersion +// method. +type AgentPoolsClientBeginUpgradeNodeImageVersionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolsClientGetAvailableAgentPoolVersionsOptions contains the optional parameters for the AgentPoolsClient.GetAvailableAgentPoolVersions +// method. +type AgentPoolsClientGetAvailableAgentPoolVersionsOptions struct { + // placeholder for future optional parameters +} + +// AgentPoolsClientGetOptions contains the optional parameters for the AgentPoolsClient.Get method. +type AgentPoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AgentPoolsClientGetUpgradeProfileOptions contains the optional parameters for the AgentPoolsClient.GetUpgradeProfile method. +type AgentPoolsClientGetUpgradeProfileOptions struct { + // placeholder for future optional parameters +} + +// AgentPoolsClientListOptions contains the optional parameters for the AgentPoolsClient.NewListPager method. +type AgentPoolsClientListOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the MaintenanceConfigurationsClient.CreateOrUpdate +// method. +type MaintenanceConfigurationsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceConfigurationsClientDeleteOptions contains the optional parameters for the MaintenanceConfigurationsClient.Delete +// method. +type MaintenanceConfigurationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceConfigurationsClientGetOptions contains the optional parameters for the MaintenanceConfigurationsClient.Get +// method. +type MaintenanceConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceConfigurationsClientListByManagedClusterOptions contains the optional parameters for the MaintenanceConfigurationsClient.NewListByManagedClusterPager +// method. +type MaintenanceConfigurationsClientListByManagedClusterOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientBeginAbortLatestOperationOptions contains the optional parameters for the ManagedClustersClient.BeginAbortLatestOperation +// method. +type ManagedClustersClientBeginAbortLatestOperationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedClustersClient.BeginCreateOrUpdate +// method. +type ManagedClustersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginDeleteOptions contains the optional parameters for the ManagedClustersClient.BeginDelete method. +type ManagedClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginResetAADProfileOptions contains the optional parameters for the ManagedClustersClient.BeginResetAADProfile +// method. +type ManagedClustersClientBeginResetAADProfileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginResetServicePrincipalProfileOptions contains the optional parameters for the ManagedClustersClient.BeginResetServicePrincipalProfile +// method. +type ManagedClustersClientBeginResetServicePrincipalProfileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginRotateClusterCertificatesOptions contains the optional parameters for the ManagedClustersClient.BeginRotateClusterCertificates +// method. +type ManagedClustersClientBeginRotateClusterCertificatesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions contains the optional parameters for the ManagedClustersClient.BeginRotateServiceAccountSigningKeys +// method. +type ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginRunCommandOptions contains the optional parameters for the ManagedClustersClient.BeginRunCommand +// method. +type ManagedClustersClientBeginRunCommandOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginStartOptions contains the optional parameters for the ManagedClustersClient.BeginStart method. +type ManagedClustersClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginStopOptions contains the optional parameters for the ManagedClustersClient.BeginStop method. +type ManagedClustersClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientBeginUpdateTagsOptions contains the optional parameters for the ManagedClustersClient.BeginUpdateTags +// method. +type ManagedClustersClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedClustersClientGetAccessProfileOptions contains the optional parameters for the ManagedClustersClient.GetAccessProfile +// method. +type ManagedClustersClientGetAccessProfileOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientGetCommandResultOptions contains the optional parameters for the ManagedClustersClient.GetCommandResult +// method. +type ManagedClustersClientGetCommandResultOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientGetMeshRevisionProfileOptions contains the optional parameters for the ManagedClustersClient.GetMeshRevisionProfile +// method. +type ManagedClustersClientGetMeshRevisionProfileOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientGetMeshUpgradeProfileOptions contains the optional parameters for the ManagedClustersClient.GetMeshUpgradeProfile +// method. +type ManagedClustersClientGetMeshUpgradeProfileOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientGetOSOptionsOptions contains the optional parameters for the ManagedClustersClient.GetOSOptions method. +type ManagedClustersClientGetOSOptionsOptions struct { + // The resource type for which the OS options needs to be returned + ResourceType *string +} + +// ManagedClustersClientGetOptions contains the optional parameters for the ManagedClustersClient.Get method. +type ManagedClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientGetUpgradeProfileOptions contains the optional parameters for the ManagedClustersClient.GetUpgradeProfile +// method. +type ManagedClustersClientGetUpgradeProfileOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientListByResourceGroupOptions contains the optional parameters for the ManagedClustersClient.NewListByResourceGroupPager +// method. +type ManagedClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientListClusterAdminCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterAdminCredentials +// method. +type ManagedClustersClientListClusterAdminCredentialsOptions struct { + // server fqdn type for credentials to be returned + ServerFqdn *string +} + +// ManagedClustersClientListClusterMonitoringUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterMonitoringUserCredentials +// method. +type ManagedClustersClientListClusterMonitoringUserCredentialsOptions struct { + // server fqdn type for credentials to be returned + ServerFqdn *string +} + +// ManagedClustersClientListClusterUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterUserCredentials +// method. +type ManagedClustersClientListClusterUserCredentialsOptions struct { + // Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider + // kubeconfig; format 'exec' will return exec format kubeconfig, which requires + // kubelogin binary in the path. + Format *Format + + // server fqdn type for credentials to be returned + ServerFqdn *string +} + +// ManagedClustersClientListKubernetesVersionsOptions contains the optional parameters for the ManagedClustersClient.ListKubernetesVersions +// method. +type ManagedClustersClientListKubernetesVersionsOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientListMeshRevisionProfilesOptions contains the optional parameters for the ManagedClustersClient.NewListMeshRevisionProfilesPager +// method. +type ManagedClustersClientListMeshRevisionProfilesOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientListMeshUpgradeProfilesOptions contains the optional parameters for the ManagedClustersClient.NewListMeshUpgradeProfilesPager +// method. +type ManagedClustersClientListMeshUpgradeProfilesOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientListOptions contains the optional parameters for the ManagedClustersClient.NewListPager method. +type ManagedClustersClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedClustersClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the ManagedClustersClient.NewListOutboundNetworkDependenciesEndpointsPager +// method. +type ManagedClustersClientListOutboundNetworkDependenciesEndpointsOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. +type PrivateEndpointConnectionsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List method. +type PrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + +// ResolvePrivateLinkServiceIDClientPOSTOptions contains the optional parameters for the ResolvePrivateLinkServiceIDClient.POST +// method. +type ResolvePrivateLinkServiceIDClientPOSTOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsClientCreateOrUpdateOptions contains the optional parameters for the SnapshotsClient.CreateOrUpdate method. +type SnapshotsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsClientDeleteOptions contains the optional parameters for the SnapshotsClient.Delete method. +type SnapshotsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type SnapshotsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsClientListOptions contains the optional parameters for the SnapshotsClient.NewListPager method. +type SnapshotsClientListOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsClientUpdateTagsOptions contains the optional parameters for the SnapshotsClient.UpdateTags method. +type SnapshotsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.BeginCreateOrUpdate +// method. +type TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TrustedAccessRoleBindingsClientBeginDeleteOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.BeginDelete +// method. +type TrustedAccessRoleBindingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TrustedAccessRoleBindingsClientGetOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.Get +// method. +type TrustedAccessRoleBindingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TrustedAccessRoleBindingsClientListOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.NewListPager +// method. +type TrustedAccessRoleBindingsClientListOptions struct { + // placeholder for future optional parameters +} + +// TrustedAccessRolesClientListOptions contains the optional parameters for the TrustedAccessRolesClient.NewListPager method. +type TrustedAccessRolesClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/privateendpointconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/privateendpointconnections_client.go new file mode 100644 index 000000000..c82074711 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/privateendpointconnections_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Deletes a private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// List - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List +// method. +func (client *PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientListOptions) (PrivateEndpointConnectionsClientListResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { + result := PrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} + +// Update - Updates a private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - parameters - The updated private endpoint connection. +// - options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. +func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, parameters, options) + if err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *PrivateEndpointConnectionsClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientUpdateResponse, error) { + result := PrivateEndpointConnectionsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/privatelinkresources_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/privatelinkresources_client.go new file mode 100644 index 000000000..a9e0940b0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/privatelinkresources_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// List - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List +// method. +func (client *PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesClientListOptions) (PrivateLinkResourcesClientListResponse, error) { + var err error + const operationName = "PrivateLinkResourcesClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { + result := PrivateLinkResourcesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesListResult); err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/resolveprivatelinkserviceid_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/resolveprivatelinkserviceid_client.go new file mode 100644 index 000000000..bec89442e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/resolveprivatelinkserviceid_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ResolvePrivateLinkServiceIDClient contains the methods for the ResolvePrivateLinkServiceID group. +// Don't use this type directly, use NewResolvePrivateLinkServiceIDClient() instead. +type ResolvePrivateLinkServiceIDClient struct { + internal *arm.Client + subscriptionID string +} + +// NewResolvePrivateLinkServiceIDClient creates a new instance of ResolvePrivateLinkServiceIDClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewResolvePrivateLinkServiceIDClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResolvePrivateLinkServiceIDClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ResolvePrivateLinkServiceIDClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// POST - Gets the private link service ID for the specified managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - parameters - Parameters required in order to resolve a private link service ID. +// - options - ResolvePrivateLinkServiceIDClientPOSTOptions contains the optional parameters for the ResolvePrivateLinkServiceIDClient.POST +// method. +func (client *ResolvePrivateLinkServiceIDClient) POST(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource, options *ResolvePrivateLinkServiceIDClientPOSTOptions) (ResolvePrivateLinkServiceIDClientPOSTResponse, error) { + var err error + const operationName = "ResolvePrivateLinkServiceIDClient.POST" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return ResolvePrivateLinkServiceIDClientPOSTResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResolvePrivateLinkServiceIDClientPOSTResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResolvePrivateLinkServiceIDClientPOSTResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the POST request. +func (client *ResolvePrivateLinkServiceIDClient) postCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource, options *ResolvePrivateLinkServiceIDClientPOSTOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// postHandleResponse handles the POST response. +func (client *ResolvePrivateLinkServiceIDClient) postHandleResponse(resp *http.Response) (ResolvePrivateLinkServiceIDClientPOSTResponse, error) { + result := ResolvePrivateLinkServiceIDClientPOSTResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return ResolvePrivateLinkServiceIDClientPOSTResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/response_types.go new file mode 100644 index 000000000..ae19892e0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/response_types.go @@ -0,0 +1,342 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +// AgentPoolsClientAbortLatestOperationResponse contains the response from method AgentPoolsClient.BeginAbortLatestOperation. +type AgentPoolsClientAbortLatestOperationResponse struct { + // placeholder for future response values +} + +// AgentPoolsClientCreateOrUpdateResponse contains the response from method AgentPoolsClient.BeginCreateOrUpdate. +type AgentPoolsClientCreateOrUpdateResponse struct { + // Agent Pool. + AgentPool +} + +// AgentPoolsClientDeleteResponse contains the response from method AgentPoolsClient.BeginDelete. +type AgentPoolsClientDeleteResponse struct { + // placeholder for future response values +} + +// AgentPoolsClientGetAvailableAgentPoolVersionsResponse contains the response from method AgentPoolsClient.GetAvailableAgentPoolVersions. +type AgentPoolsClientGetAvailableAgentPoolVersionsResponse struct { + // The list of available versions for an agent pool. + AgentPoolAvailableVersions +} + +// AgentPoolsClientGetResponse contains the response from method AgentPoolsClient.Get. +type AgentPoolsClientGetResponse struct { + // Agent Pool. + AgentPool +} + +// AgentPoolsClientGetUpgradeProfileResponse contains the response from method AgentPoolsClient.GetUpgradeProfile. +type AgentPoolsClientGetUpgradeProfileResponse struct { + // The list of available upgrades for an agent pool. + AgentPoolUpgradeProfile +} + +// AgentPoolsClientListResponse contains the response from method AgentPoolsClient.NewListPager. +type AgentPoolsClientListResponse struct { + // The response from the List Agent Pools operation. + AgentPoolListResult +} + +// AgentPoolsClientUpgradeNodeImageVersionResponse contains the response from method AgentPoolsClient.BeginUpgradeNodeImageVersion. +type AgentPoolsClientUpgradeNodeImageVersionResponse struct { + // Agent Pool. + AgentPool +} + +// MaintenanceConfigurationsClientCreateOrUpdateResponse contains the response from method MaintenanceConfigurationsClient.CreateOrUpdate. +type MaintenanceConfigurationsClientCreateOrUpdateResponse struct { + // See [planned maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about planned + // maintenance. + MaintenanceConfiguration +} + +// MaintenanceConfigurationsClientDeleteResponse contains the response from method MaintenanceConfigurationsClient.Delete. +type MaintenanceConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// MaintenanceConfigurationsClientGetResponse contains the response from method MaintenanceConfigurationsClient.Get. +type MaintenanceConfigurationsClientGetResponse struct { + // See [planned maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about planned + // maintenance. + MaintenanceConfiguration +} + +// MaintenanceConfigurationsClientListByManagedClusterResponse contains the response from method MaintenanceConfigurationsClient.NewListByManagedClusterPager. +type MaintenanceConfigurationsClientListByManagedClusterResponse struct { + // The response from the List maintenance configurations operation. + MaintenanceConfigurationListResult +} + +// ManagedClustersClientAbortLatestOperationResponse contains the response from method ManagedClustersClient.BeginAbortLatestOperation. +type ManagedClustersClientAbortLatestOperationResponse struct { + // placeholder for future response values +} + +// ManagedClustersClientCreateOrUpdateResponse contains the response from method ManagedClustersClient.BeginCreateOrUpdate. +type ManagedClustersClientCreateOrUpdateResponse struct { + // Managed cluster. + ManagedCluster +} + +// ManagedClustersClientDeleteResponse contains the response from method ManagedClustersClient.BeginDelete. +type ManagedClustersClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedClustersClientGetAccessProfileResponse contains the response from method ManagedClustersClient.GetAccessProfile. +type ManagedClustersClientGetAccessProfileResponse struct { + // Managed cluster Access Profile. + ManagedClusterAccessProfile +} + +// ManagedClustersClientGetCommandResultResponse contains the response from method ManagedClustersClient.GetCommandResult. +type ManagedClustersClientGetCommandResultResponse struct { + // run command result. + RunCommandResult + + // Location contains the information returned from the Location header response. + Location *string +} + +// ManagedClustersClientGetMeshRevisionProfileResponse contains the response from method ManagedClustersClient.GetMeshRevisionProfile. +type ManagedClustersClientGetMeshRevisionProfileResponse struct { + // Mesh revision profile for a mesh. + MeshRevisionProfile +} + +// ManagedClustersClientGetMeshUpgradeProfileResponse contains the response from method ManagedClustersClient.GetMeshUpgradeProfile. +type ManagedClustersClientGetMeshUpgradeProfileResponse struct { + // Upgrade profile for given mesh. + MeshUpgradeProfile +} + +// ManagedClustersClientGetOSOptionsResponse contains the response from method ManagedClustersClient.GetOSOptions. +type ManagedClustersClientGetOSOptionsResponse struct { + // The OS option profile. + OSOptionProfile +} + +// ManagedClustersClientGetResponse contains the response from method ManagedClustersClient.Get. +type ManagedClustersClientGetResponse struct { + // Managed cluster. + ManagedCluster +} + +// ManagedClustersClientGetUpgradeProfileResponse contains the response from method ManagedClustersClient.GetUpgradeProfile. +type ManagedClustersClientGetUpgradeProfileResponse struct { + // The list of available upgrades for compute pools. + ManagedClusterUpgradeProfile +} + +// ManagedClustersClientListByResourceGroupResponse contains the response from method ManagedClustersClient.NewListByResourceGroupPager. +type ManagedClustersClientListByResourceGroupResponse struct { + // The response from the List Managed Clusters operation. + ManagedClusterListResult +} + +// ManagedClustersClientListClusterAdminCredentialsResponse contains the response from method ManagedClustersClient.ListClusterAdminCredentials. +type ManagedClustersClientListClusterAdminCredentialsResponse struct { + // The list credential result response. + CredentialResults +} + +// ManagedClustersClientListClusterMonitoringUserCredentialsResponse contains the response from method ManagedClustersClient.ListClusterMonitoringUserCredentials. +type ManagedClustersClientListClusterMonitoringUserCredentialsResponse struct { + // The list credential result response. + CredentialResults +} + +// ManagedClustersClientListClusterUserCredentialsResponse contains the response from method ManagedClustersClient.ListClusterUserCredentials. +type ManagedClustersClientListClusterUserCredentialsResponse struct { + // The list credential result response. + CredentialResults +} + +// ManagedClustersClientListKubernetesVersionsResponse contains the response from method ManagedClustersClient.ListKubernetesVersions. +type ManagedClustersClientListKubernetesVersionsResponse struct { + // Hold values properties, which is array of KubernetesVersion + KubernetesVersionListResult +} + +// ManagedClustersClientListMeshRevisionProfilesResponse contains the response from method ManagedClustersClient.NewListMeshRevisionProfilesPager. +type ManagedClustersClientListMeshRevisionProfilesResponse struct { + // Holds an array of MeshRevisionsProfiles + MeshRevisionProfileList +} + +// ManagedClustersClientListMeshUpgradeProfilesResponse contains the response from method ManagedClustersClient.NewListMeshUpgradeProfilesPager. +type ManagedClustersClientListMeshUpgradeProfilesResponse struct { + // Holds an array of MeshUpgradeProfiles + MeshUpgradeProfileList +} + +// ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse contains the response from method ManagedClustersClient.NewListOutboundNetworkDependenciesEndpointsPager. +type ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse struct { + // Collection of OutboundEnvironmentEndpoint + OutboundEnvironmentEndpointCollection +} + +// ManagedClustersClientListResponse contains the response from method ManagedClustersClient.NewListPager. +type ManagedClustersClientListResponse struct { + // The response from the List Managed Clusters operation. + ManagedClusterListResult +} + +// ManagedClustersClientResetAADProfileResponse contains the response from method ManagedClustersClient.BeginResetAADProfile. +type ManagedClustersClientResetAADProfileResponse struct { + // placeholder for future response values +} + +// ManagedClustersClientResetServicePrincipalProfileResponse contains the response from method ManagedClustersClient.BeginResetServicePrincipalProfile. +type ManagedClustersClientResetServicePrincipalProfileResponse struct { + // placeholder for future response values +} + +// ManagedClustersClientRotateClusterCertificatesResponse contains the response from method ManagedClustersClient.BeginRotateClusterCertificates. +type ManagedClustersClientRotateClusterCertificatesResponse struct { + // placeholder for future response values +} + +// ManagedClustersClientRotateServiceAccountSigningKeysResponse contains the response from method ManagedClustersClient.BeginRotateServiceAccountSigningKeys. +type ManagedClustersClientRotateServiceAccountSigningKeysResponse struct { + // placeholder for future response values +} + +// ManagedClustersClientRunCommandResponse contains the response from method ManagedClustersClient.BeginRunCommand. +type ManagedClustersClientRunCommandResponse struct { + // run command result. + RunCommandResult +} + +// ManagedClustersClientStartResponse contains the response from method ManagedClustersClient.BeginStart. +type ManagedClustersClientStartResponse struct { + // placeholder for future response values +} + +// ManagedClustersClientStopResponse contains the response from method ManagedClustersClient.BeginStop. +type ManagedClustersClientStopResponse struct { + // placeholder for future response values +} + +// ManagedClustersClientUpdateTagsResponse contains the response from method ManagedClustersClient.BeginUpdateTags. +type ManagedClustersClientUpdateTagsResponse struct { + // Managed cluster. + ManagedCluster +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // The List Operation response. + OperationListResult +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + // A private endpoint connection + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.List. +type PrivateEndpointConnectionsClientListResponse struct { + // A list of private endpoint connections + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsClientUpdateResponse contains the response from method PrivateEndpointConnectionsClient.Update. +type PrivateEndpointConnectionsClientUpdateResponse struct { + // A private endpoint connection + PrivateEndpointConnection +} + +// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.List. +type PrivateLinkResourcesClientListResponse struct { + // A list of private link resources + PrivateLinkResourcesListResult +} + +// ResolvePrivateLinkServiceIDClientPOSTResponse contains the response from method ResolvePrivateLinkServiceIDClient.POST. +type ResolvePrivateLinkServiceIDClientPOSTResponse struct { + // A private link resource + PrivateLinkResource +} + +// SnapshotsClientCreateOrUpdateResponse contains the response from method SnapshotsClient.CreateOrUpdate. +type SnapshotsClientCreateOrUpdateResponse struct { + // A node pool snapshot resource. + 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 { + // A node pool snapshot resource. + Snapshot +} + +// SnapshotsClientListByResourceGroupResponse contains the response from method SnapshotsClient.NewListByResourceGroupPager. +type SnapshotsClientListByResourceGroupResponse struct { + // The response from the List Snapshots operation. + SnapshotListResult +} + +// SnapshotsClientListResponse contains the response from method SnapshotsClient.NewListPager. +type SnapshotsClientListResponse struct { + // The response from the List Snapshots operation. + SnapshotListResult +} + +// SnapshotsClientUpdateTagsResponse contains the response from method SnapshotsClient.UpdateTags. +type SnapshotsClientUpdateTagsResponse struct { + // A node pool snapshot resource. + Snapshot +} + +// TrustedAccessRoleBindingsClientCreateOrUpdateResponse contains the response from method TrustedAccessRoleBindingsClient.BeginCreateOrUpdate. +type TrustedAccessRoleBindingsClientCreateOrUpdateResponse struct { + // Defines binding between a resource and role + TrustedAccessRoleBinding +} + +// TrustedAccessRoleBindingsClientDeleteResponse contains the response from method TrustedAccessRoleBindingsClient.BeginDelete. +type TrustedAccessRoleBindingsClientDeleteResponse struct { + // placeholder for future response values +} + +// TrustedAccessRoleBindingsClientGetResponse contains the response from method TrustedAccessRoleBindingsClient.Get. +type TrustedAccessRoleBindingsClientGetResponse struct { + // Defines binding between a resource and role + TrustedAccessRoleBinding +} + +// TrustedAccessRoleBindingsClientListResponse contains the response from method TrustedAccessRoleBindingsClient.NewListPager. +type TrustedAccessRoleBindingsClientListResponse struct { + // List of trusted access role bindings + TrustedAccessRoleBindingListResult +} + +// TrustedAccessRolesClientListResponse contains the response from method TrustedAccessRolesClient.NewListPager. +type TrustedAccessRolesClientListResponse struct { + // List of trusted access roles + TrustedAccessRoleListResult +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/snapshots_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/snapshots_client.go new file mode 100644 index 000000000..c0a7182fd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/snapshots_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// NewSnapshotsClient creates a new instance of SnapshotsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SnapshotsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - parameters - The snapshot to create or update. +// - options - SnapshotsClientCreateOrUpdateOptions contains the optional parameters for the SnapshotsClient.CreateOrUpdate +// method. +func (client *SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot, options *SnapshotsClientCreateOrUpdateOptions) (SnapshotsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "SnapshotsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return SnapshotsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SnapshotsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SnapshotsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot, options *SnapshotsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SnapshotsClient) createOrUpdateHandleResponse(resp *http.Response) (SnapshotsClientCreateOrUpdateResponse, error) { + result := SnapshotsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { + return SnapshotsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - SnapshotsClientDeleteOptions contains the optional parameters for the SnapshotsClient.Delete method. +func (client *SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *SnapshotsClientDeleteOptions) (SnapshotsClientDeleteResponse, error) { + var err error + const operationName = "SnapshotsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return SnapshotsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SnapshotsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SnapshotsClientDeleteResponse{}, err + } + return SnapshotsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SnapshotsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - SnapshotsClientGetOptions contains the optional parameters for the SnapshotsClient.Get method. +func (client *SnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *SnapshotsClientGetOptions) (SnapshotsClientGetResponse, error) { + var err error + const operationName = "SnapshotsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SnapshotsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SnapshotsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + 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 +} + +// NewListPager - Gets a list of snapshots in the specified subscription. +// +// Generated from API version 2023-10-01 +// - options - SnapshotsClientListOptions contains the optional parameters for the SnapshotsClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SnapshotsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return SnapshotsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *SnapshotsClient) listCreateRequest(ctx context.Context, options *SnapshotsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + 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.SnapshotListResult); err != nil { + return SnapshotsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists snapshots in the specified subscription and resource group. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SnapshotsClientListByResourceGroupOptions contains the optional parameters for the SnapshotsClient.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SnapshotsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return SnapshotsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.ContainerService/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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + 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.SnapshotListResult); err != nil { + return SnapshotsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates tags on a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - parameters - Parameters supplied to the Update snapshot Tags operation. +// - options - SnapshotsClientUpdateTagsOptions contains the optional parameters for the SnapshotsClient.UpdateTags method. +func (client *SnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *SnapshotsClientUpdateTagsOptions) (SnapshotsClientUpdateTagsResponse, error) { + var err error + const operationName = "SnapshotsClient.UpdateTags" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return SnapshotsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SnapshotsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SnapshotsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *SnapshotsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *SnapshotsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *SnapshotsClient) updateTagsHandleResponse(resp *http.Response) (SnapshotsClientUpdateTagsResponse, error) { + result := SnapshotsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { + return SnapshotsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/time_rfc3339.go new file mode 100644 index 000000000..296cd68af --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// 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+)*"*$`) + +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func populateDateTimeRFC3339(m map[string]any, 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] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateTimeRFC3339 + 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/containerservice/armcontainerservice/v4/trustedaccessrolebindings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/trustedaccessrolebindings_client.go new file mode 100644 index 000000000..5dcd89d6a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/trustedaccessrolebindings_client.go @@ -0,0 +1,345 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TrustedAccessRoleBindingsClient contains the methods for the TrustedAccessRoleBindings group. +// Don't use this type directly, use NewTrustedAccessRoleBindingsClient() instead. +type TrustedAccessRoleBindingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTrustedAccessRoleBindingsClient creates a new instance of TrustedAccessRoleBindingsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTrustedAccessRoleBindingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TrustedAccessRoleBindingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TrustedAccessRoleBindingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a trusted access role binding +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - trustedAccessRoleBindingName - The name of trusted access role binding. +// - trustedAccessRoleBinding - A trusted access role binding +// - options - TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.BeginCreateOrUpdate +// method. +func (client *TrustedAccessRoleBindingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, trustedAccessRoleBinding TrustedAccessRoleBinding, options *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, trustedAccessRoleBindingName, trustedAccessRoleBinding, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TrustedAccessRoleBindingsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TrustedAccessRoleBindingsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update a trusted access role binding +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *TrustedAccessRoleBindingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, trustedAccessRoleBinding TrustedAccessRoleBinding, options *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TrustedAccessRoleBindingsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, trustedAccessRoleBindingName, trustedAccessRoleBinding, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TrustedAccessRoleBindingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, trustedAccessRoleBinding TrustedAccessRoleBinding, options *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if trustedAccessRoleBindingName == "" { + return nil, errors.New("parameter trustedAccessRoleBindingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trustedAccessRoleBindingName}", url.PathEscape(trustedAccessRoleBindingName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, trustedAccessRoleBinding); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a trusted access role binding. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - trustedAccessRoleBindingName - The name of trusted access role binding. +// - options - TrustedAccessRoleBindingsClientBeginDeleteOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.BeginDelete +// method. +func (client *TrustedAccessRoleBindingsClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, trustedAccessRoleBindingName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TrustedAccessRoleBindingsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TrustedAccessRoleBindingsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a trusted access role binding. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +func (client *TrustedAccessRoleBindingsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "TrustedAccessRoleBindingsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, trustedAccessRoleBindingName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TrustedAccessRoleBindingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if trustedAccessRoleBindingName == "" { + return nil, errors.New("parameter trustedAccessRoleBindingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trustedAccessRoleBindingName}", url.PathEscape(trustedAccessRoleBindingName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a trusted access role binding. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - trustedAccessRoleBindingName - The name of trusted access role binding. +// - options - TrustedAccessRoleBindingsClientGetOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.Get +// method. +func (client *TrustedAccessRoleBindingsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientGetOptions) (TrustedAccessRoleBindingsClientGetResponse, error) { + var err error + const operationName = "TrustedAccessRoleBindingsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, trustedAccessRoleBindingName, options) + if err != nil { + return TrustedAccessRoleBindingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TrustedAccessRoleBindingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TrustedAccessRoleBindingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TrustedAccessRoleBindingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if trustedAccessRoleBindingName == "" { + return nil, errors.New("parameter trustedAccessRoleBindingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trustedAccessRoleBindingName}", url.PathEscape(trustedAccessRoleBindingName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TrustedAccessRoleBindingsClient) getHandleResponse(resp *http.Response) (TrustedAccessRoleBindingsClientGetResponse, error) { + result := TrustedAccessRoleBindingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrustedAccessRoleBinding); err != nil { + return TrustedAccessRoleBindingsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List trusted access role bindings. +// +// Generated from API version 2023-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - TrustedAccessRoleBindingsClientListOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.NewListPager +// method. +func (client *TrustedAccessRoleBindingsClient) NewListPager(resourceGroupName string, resourceName string, options *TrustedAccessRoleBindingsClientListOptions) *runtime.Pager[TrustedAccessRoleBindingsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TrustedAccessRoleBindingsClientListResponse]{ + More: func(page TrustedAccessRoleBindingsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TrustedAccessRoleBindingsClientListResponse) (TrustedAccessRoleBindingsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TrustedAccessRoleBindingsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, nil) + if err != nil { + return TrustedAccessRoleBindingsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TrustedAccessRoleBindingsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *TrustedAccessRoleBindingsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TrustedAccessRoleBindingsClient) listHandleResponse(resp *http.Response) (TrustedAccessRoleBindingsClientListResponse, error) { + result := TrustedAccessRoleBindingsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrustedAccessRoleBindingListResult); err != nil { + return TrustedAccessRoleBindingsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/trustedaccessroles_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/trustedaccessroles_client.go new file mode 100644 index 000000000..587e9b2bd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/trustedaccessroles_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TrustedAccessRolesClient contains the methods for the TrustedAccessRoles group. +// Don't use this type directly, use NewTrustedAccessRolesClient() instead. +type TrustedAccessRolesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTrustedAccessRolesClient creates a new instance of TrustedAccessRolesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTrustedAccessRolesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TrustedAccessRolesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TrustedAccessRolesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List supported trusted access roles. +// +// Generated from API version 2023-10-01 +// - location - The name of the Azure region. +// - options - TrustedAccessRolesClientListOptions contains the optional parameters for the TrustedAccessRolesClient.NewListPager +// method. +func (client *TrustedAccessRolesClient) NewListPager(location string, options *TrustedAccessRolesClientListOptions) *runtime.Pager[TrustedAccessRolesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TrustedAccessRolesClientListResponse]{ + More: func(page TrustedAccessRolesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TrustedAccessRolesClientListResponse) (TrustedAccessRolesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TrustedAccessRolesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return TrustedAccessRolesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TrustedAccessRolesClient) listCreateRequest(ctx context.Context, location string, options *TrustedAccessRolesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TrustedAccessRolesClient) listHandleResponse(resp *http.Response) (TrustedAccessRolesClientListResponse, error) { + result := TrustedAccessRolesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrustedAccessRoleListResult); err != nil { + return TrustedAccessRolesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md index f9cd65aaa..77a737e73 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md @@ -1,5 +1,23 @@ # Release History +## 1.4.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + +## 1.3.0 (2023-10-27) +### Features Added + +- New value `ManagedHsmSKUNameCustomB6` added to enum type `ManagedHsmSKUName` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New struct `ManagedServiceIdentity` +- New struct `UserAssignedIdentity` +- New field `Identity` in struct `MHSMPrivateEndpointConnection` +- New field `Identity` in struct `MHSMPrivateLinkResource` +- New field `Identity` in struct `ManagedHsm` + + ## 1.2.0 (2023-04-28) ### Features Added diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/README.md index 11dbffa46..c394a2d43 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/README.md @@ -60,6 +60,13 @@ A client groups a set of related APIs, providing access to its functionality. C client := clientFactory.NewVaultsClient() ``` +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + ## More sample code - [Key](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/keyvault/key) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/assets.json index 9ae804c30..84f2859a2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/assets.json +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/keyvault/armkeyvault", - "Tag": "go/resourcemanager/keyvault/armkeyvault_283c3f03b2" + "Tag": "go/resourcemanager/keyvault/armkeyvault_820248387e" } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/autorest.md index 4692f2f56..25de347af 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/autorest.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/autorest.md @@ -5,11 +5,11 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/keyvault/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/keyvault/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 1.4.0 modelerfour: seal-single-value-enum-by-default: true -tag: package-2023-02 +tag: package-2023-07 ``` \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/build.go index c3da538ed..ef03d7674 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/build.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/build.go @@ -2,6 +2,6 @@ // 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/keyvault/armkeyvault +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/keyvault/armkeyvault package armkeyvault diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go index ff61f9101..90daa8e6f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -29,7 +28,7 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -39,57 +38,68 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +// NewKeysClient creates a new instance of KeysClient. func (c *ClientFactory) NewKeysClient() *KeysClient { subClient, _ := NewKeysClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagedHsmKeysClient() *ManagedHsmKeysClient { - subClient, _ := NewManagedHsmKeysClient(c.subscriptionID, c.credential, c.options) +// NewMHSMPrivateEndpointConnectionsClient creates a new instance of MHSMPrivateEndpointConnectionsClient. +func (c *ClientFactory) NewMHSMPrivateEndpointConnectionsClient() *MHSMPrivateEndpointConnectionsClient { + subClient, _ := NewMHSMPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewVaultsClient() *VaultsClient { - subClient, _ := NewVaultsClient(c.subscriptionID, c.credential, c.options) +// NewMHSMPrivateLinkResourcesClient creates a new instance of MHSMPrivateLinkResourcesClient. +func (c *ClientFactory) NewMHSMPrivateLinkResourcesClient() *MHSMPrivateLinkResourcesClient { + subClient, _ := NewMHSMPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +// NewMHSMRegionsClient creates a new instance of MHSMRegionsClient. +func (c *ClientFactory) NewMHSMRegionsClient() *MHSMRegionsClient { + subClient, _ := NewMHSMRegionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +// NewManagedHsmKeysClient creates a new instance of ManagedHsmKeysClient. +func (c *ClientFactory) NewManagedHsmKeysClient() *ManagedHsmKeysClient { + subClient, _ := NewManagedHsmKeysClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewManagedHsmsClient creates a new instance of ManagedHsmsClient. func (c *ClientFactory) NewManagedHsmsClient() *ManagedHsmsClient { subClient, _ := NewManagedHsmsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewMHSMPrivateEndpointConnectionsClient() *MHSMPrivateEndpointConnectionsClient { - subClient, _ := NewMHSMPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewMHSMPrivateLinkResourcesClient() *MHSMPrivateLinkResourcesClient { - subClient, _ := NewMHSMPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewMHSMRegionsClient() *MHSMRegionsClient { - subClient, _ := NewMHSMRegionsClient(c.subscriptionID, c.credential, c.options) +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +// NewSecretsClient creates a new instance of SecretsClient. +func (c *ClientFactory) NewSecretsClient() *SecretsClient { + subClient, _ := NewSecretsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewSecretsClient() *SecretsClient { - subClient, _ := NewSecretsClient(c.subscriptionID, c.credential, c.options) +// NewVaultsClient creates a new instance of VaultsClient. +func (c *ClientFactory) NewVaultsClient() *VaultsClient { + subClient, _ := NewVaultsClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/constants.go index d6415ed56..0d763ddfb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/constants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/constants.go @@ -3,31 +3,30 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault const ( - moduleName = "armkeyvault" - moduleVersion = "v1.2.0" + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" + moduleVersion = "v1.4.0" ) type AccessPolicyUpdateKind string const ( AccessPolicyUpdateKindAdd AccessPolicyUpdateKind = "add" - AccessPolicyUpdateKindReplace AccessPolicyUpdateKind = "replace" AccessPolicyUpdateKindRemove AccessPolicyUpdateKind = "remove" + AccessPolicyUpdateKindReplace AccessPolicyUpdateKind = "replace" ) // PossibleAccessPolicyUpdateKindValues returns the possible values for the AccessPolicyUpdateKind const type. func PossibleAccessPolicyUpdateKindValues() []AccessPolicyUpdateKind { return []AccessPolicyUpdateKind{ AccessPolicyUpdateKindAdd, - AccessPolicyUpdateKindReplace, AccessPolicyUpdateKindRemove, + AccessPolicyUpdateKindReplace, } } @@ -118,15 +117,15 @@ func PossibleCertificatePermissionsValues() []CertificatePermissions { type CreateMode string const ( - CreateModeRecover CreateMode = "recover" CreateModeDefault CreateMode = "default" + CreateModeRecover CreateMode = "recover" ) // PossibleCreateModeValues returns the possible values for the CreateMode const type. func PossibleCreateModeValues() []CreateMode { return []CreateMode{ - CreateModeRecover, CreateModeDefault, + CreateModeRecover, } } @@ -321,15 +320,15 @@ func PossibleKeyPermissionsValues() []KeyPermissions { type KeyRotationPolicyActionType string const ( - KeyRotationPolicyActionTypeRotate KeyRotationPolicyActionType = "rotate" KeyRotationPolicyActionTypeNotify KeyRotationPolicyActionType = "notify" + KeyRotationPolicyActionTypeRotate KeyRotationPolicyActionType = "rotate" ) // PossibleKeyRotationPolicyActionTypeValues returns the possible values for the KeyRotationPolicyActionType const type. func PossibleKeyRotationPolicyActionTypeValues() []KeyRotationPolicyActionType { return []KeyRotationPolicyActionType{ - KeyRotationPolicyActionTypeRotate, KeyRotationPolicyActionTypeNotify, + KeyRotationPolicyActionTypeRotate, } } @@ -351,15 +350,37 @@ func PossibleManagedHsmSKUFamilyValues() []ManagedHsmSKUFamily { type ManagedHsmSKUName string const ( - ManagedHsmSKUNameStandardB1 ManagedHsmSKUName = "Standard_B1" ManagedHsmSKUNameCustomB32 ManagedHsmSKUName = "Custom_B32" + ManagedHsmSKUNameCustomB6 ManagedHsmSKUName = "Custom_B6" + ManagedHsmSKUNameStandardB1 ManagedHsmSKUName = "Standard_B1" ) // PossibleManagedHsmSKUNameValues returns the possible values for the ManagedHsmSKUName const type. func PossibleManagedHsmSKUNameValues() []ManagedHsmSKUName { return []ManagedHsmSKUName{ - ManagedHsmSKUNameStandardB1, ManagedHsmSKUNameCustomB32, + ManagedHsmSKUNameCustomB6, + ManagedHsmSKUNameStandardB1, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, } } @@ -477,7 +498,7 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// PublicNetworkAccess - Control permission for data plane traffic coming from public networks while private endpoint is enabled. +// PublicNetworkAccess - Control permission to the managed HSM from public networks. type PublicNetworkAccess string const ( @@ -527,15 +548,15 @@ func PossibleSKUFamilyValues() []SKUFamily { type SKUName string const ( - SKUNameStandard SKUName = "standard" SKUNamePremium SKUName = "premium" + SKUNameStandard SKUName = "standard" ) // PossibleSKUNameValues returns the possible values for the SKUName const type. func PossibleSKUNameValues() []SKUName { return []SKUName{ - SKUNameStandard, SKUNamePremium, + SKUNameStandard, } } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go index bd55b5b7c..4942ef7dd 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/keys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -34,7 +33,7 @@ type KeysClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*KeysClient, error) { - cl, err := arm.NewClient(moduleName+".KeysClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -50,7 +49,7 @@ func NewKeysClient(subscriptionID string, credential azcore.TokenCredential, opt // versions, and does not update existing keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the key vault which contains the key to be created. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -59,18 +58,25 @@ func NewKeysClient(subscriptionID string, credential azcore.TokenCredential, opt // - parameters - The parameters used to create the specified key. // - options - KeysClientCreateIfNotExistOptions contains the optional parameters for the KeysClient.CreateIfNotExist method. func (client *KeysClient) CreateIfNotExist(ctx context.Context, resourceGroupName string, vaultName string, keyName string, parameters KeyCreateParameters, options *KeysClientCreateIfNotExistOptions) (KeysClientCreateIfNotExistResponse, error) { + var err error + const operationName = "KeysClient.CreateIfNotExist" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createIfNotExistCreateRequest(ctx, resourceGroupName, vaultName, keyName, parameters, options) if err != nil { return KeysClientCreateIfNotExistResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return KeysClientCreateIfNotExistResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return KeysClientCreateIfNotExistResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return KeysClientCreateIfNotExistResponse{}, err } - return client.createIfNotExistHandleResponse(resp) + resp, err := client.createIfNotExistHandleResponse(httpResp) + return resp, err } // createIfNotExistCreateRequest creates the CreateIfNotExist request. @@ -97,10 +103,13 @@ func (client *KeysClient) createIfNotExistCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createIfNotExistHandleResponse handles the CreateIfNotExist response. @@ -115,24 +124,31 @@ func (client *KeysClient) createIfNotExistHandleResponse(resp *http.Response) (K // Get - Gets the current version of the specified key from the specified key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the vault which contains the key to be retrieved. // - keyName - The name of the key to be retrieved. // - options - KeysClientGetOptions contains the optional parameters for the KeysClient.Get method. func (client *KeysClient) Get(ctx context.Context, resourceGroupName string, vaultName string, keyName string, options *KeysClientGetOptions) (KeysClientGetResponse, error) { + var err error + const operationName = "KeysClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, keyName, options) if err != nil { return KeysClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return KeysClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return KeysClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return KeysClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -159,7 +175,7 @@ func (client *KeysClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -177,25 +193,32 @@ func (client *KeysClient) getHandleResponse(resp *http.Response) (KeysClientGetR // GetVersion - Gets the specified version of the specified key in the specified key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the vault which contains the key version to be retrieved. // - keyName - The name of the key version to be retrieved. // - keyVersion - The version of the key to be retrieved. // - options - KeysClientGetVersionOptions contains the optional parameters for the KeysClient.GetVersion method. func (client *KeysClient) GetVersion(ctx context.Context, resourceGroupName string, vaultName string, keyName string, keyVersion string, options *KeysClientGetVersionOptions) (KeysClientGetVersionResponse, error) { + var err error + const operationName = "KeysClient.GetVersion" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getVersionCreateRequest(ctx, resourceGroupName, vaultName, keyName, keyVersion, options) if err != nil { return KeysClientGetVersionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return KeysClientGetVersionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return KeysClientGetVersionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return KeysClientGetVersionResponse{}, err } - return client.getVersionHandleResponse(resp) + resp, err := client.getVersionHandleResponse(httpResp) + return resp, err } // getVersionCreateRequest creates the GetVersion request. @@ -226,7 +249,7 @@ func (client *KeysClient) getVersionCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,7 +266,7 @@ func (client *KeysClient) getVersionHandleResponse(resp *http.Response) (KeysCli // NewListPager - Lists the keys in the specified key vault. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the vault which contains the keys to be retrieved. // - options - KeysClientListOptions contains the optional parameters for the KeysClient.NewListPager method. @@ -253,25 +276,20 @@ func (client *KeysClient) NewListPager(resourceGroupName string, vaultName strin return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *KeysClientListResponse) (KeysClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, vaultName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return KeysClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "KeysClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + }, nil) if err != nil { return KeysClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return KeysClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -295,7 +313,7 @@ func (client *KeysClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -312,7 +330,7 @@ func (client *KeysClient) listHandleResponse(resp *http.Response) (KeysClientLis // NewListVersionsPager - Lists the versions of the specified key in the specified key vault. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group which contains the specified key vault. // - vaultName - The name of the vault which contains the key versions to be retrieved. // - keyName - The name of the key versions to be retrieved. @@ -323,25 +341,20 @@ func (client *KeysClient) NewListVersionsPager(resourceGroupName string, vaultNa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *KeysClientListVersionsResponse) (KeysClientListVersionsResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listVersionsCreateRequest(ctx, resourceGroupName, vaultName, keyName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "KeysClient.NewListVersionsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listVersionsCreateRequest(ctx, resourceGroupName, vaultName, keyName, options) + }, nil) if err != nil { return KeysClientListVersionsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return KeysClientListVersionsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return KeysClientListVersionsResponse{}, runtime.NewResponseError(resp) - } return client.listVersionsHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -369,7 +382,7 @@ func (client *KeysClient) listVersionsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-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/keyvault/armkeyvault/managedhsmkeys_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go index 3288eefd3..eb94d15a9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/managedhsmkeys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -34,7 +33,7 @@ type ManagedHsmKeysClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewManagedHsmKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedHsmKeysClient, error) { - cl, err := arm.NewClient(moduleName+".ManagedHsmKeysClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -50,7 +49,7 @@ func NewManagedHsmKeysClient(subscriptionID string, credential azcore.TokenCrede // versions, and does not update existing keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -60,18 +59,25 @@ func NewManagedHsmKeysClient(subscriptionID string, credential azcore.TokenCrede // - options - ManagedHsmKeysClientCreateIfNotExistOptions contains the optional parameters for the ManagedHsmKeysClient.CreateIfNotExist // method. func (client *ManagedHsmKeysClient) CreateIfNotExist(ctx context.Context, resourceGroupName string, name string, keyName string, parameters ManagedHsmKeyCreateParameters, options *ManagedHsmKeysClientCreateIfNotExistOptions) (ManagedHsmKeysClientCreateIfNotExistResponse, error) { + var err error + const operationName = "ManagedHsmKeysClient.CreateIfNotExist" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createIfNotExistCreateRequest(ctx, resourceGroupName, name, keyName, parameters, options) if err != nil { return ManagedHsmKeysClientCreateIfNotExistResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmKeysClientCreateIfNotExistResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmKeysClientCreateIfNotExistResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmKeysClientCreateIfNotExistResponse{}, err } - return client.createIfNotExistHandleResponse(resp) + resp, err := client.createIfNotExistHandleResponse(httpResp) + return resp, err } // createIfNotExistCreateRequest creates the CreateIfNotExist request. @@ -98,10 +104,13 @@ func (client *ManagedHsmKeysClient) createIfNotExistCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createIfNotExistHandleResponse handles the CreateIfNotExist response. @@ -116,7 +125,7 @@ func (client *ManagedHsmKeysClient) createIfNotExistHandleResponse(resp *http.Re // Get - Gets the current version of the specified key from the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -124,18 +133,25 @@ func (client *ManagedHsmKeysClient) createIfNotExistHandleResponse(resp *http.Re // information. // - options - ManagedHsmKeysClientGetOptions contains the optional parameters for the ManagedHsmKeysClient.Get method. func (client *ManagedHsmKeysClient) Get(ctx context.Context, resourceGroupName string, name string, keyName string, options *ManagedHsmKeysClientGetOptions) (ManagedHsmKeysClientGetResponse, error) { + var err error + const operationName = "ManagedHsmKeysClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, name, keyName, options) if err != nil { return ManagedHsmKeysClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmKeysClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmKeysClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmKeysClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -162,7 +178,7 @@ func (client *ManagedHsmKeysClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +196,7 @@ func (client *ManagedHsmKeysClient) getHandleResponse(resp *http.Response) (Mana // GetVersion - Gets the specified version of the specified key in the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -190,18 +206,25 @@ func (client *ManagedHsmKeysClient) getHandleResponse(resp *http.Response) (Mana // - options - ManagedHsmKeysClientGetVersionOptions contains the optional parameters for the ManagedHsmKeysClient.GetVersion // method. func (client *ManagedHsmKeysClient) GetVersion(ctx context.Context, resourceGroupName string, name string, keyName string, keyVersion string, options *ManagedHsmKeysClientGetVersionOptions) (ManagedHsmKeysClientGetVersionResponse, error) { + var err error + const operationName = "ManagedHsmKeysClient.GetVersion" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getVersionCreateRequest(ctx, resourceGroupName, name, keyName, keyVersion, options) if err != nil { return ManagedHsmKeysClientGetVersionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmKeysClientGetVersionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmKeysClientGetVersionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmKeysClientGetVersionResponse{}, err } - return client.getVersionHandleResponse(resp) + resp, err := client.getVersionHandleResponse(httpResp) + return resp, err } // getVersionCreateRequest creates the GetVersion request. @@ -232,7 +255,7 @@ func (client *ManagedHsmKeysClient) getVersionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +272,7 @@ func (client *ManagedHsmKeysClient) getVersionHandleResponse(resp *http.Response // NewListPager - Lists the keys in the specified managed HSM. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - options - ManagedHsmKeysClientListOptions contains the optional parameters for the ManagedHsmKeysClient.NewListPager method. @@ -259,25 +282,20 @@ func (client *ManagedHsmKeysClient) NewListPager(resourceGroupName string, name return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedHsmKeysClientListResponse) (ManagedHsmKeysClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, name, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagedHsmKeysClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedHsmKeysClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, name, options) + }, nil) if err != nil { return ManagedHsmKeysClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmKeysClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -301,7 +319,7 @@ func (client *ManagedHsmKeysClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -318,7 +336,7 @@ func (client *ManagedHsmKeysClient) listHandleResponse(resp *http.Response) (Man // NewListVersionsPager - Lists the versions of the specified key in the specified managed HSM. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - name - The name of the Managed HSM Pool within the specified resource group. // - keyName - The name of the key to be created. The value you provide may be copied globally for the purpose of running the @@ -332,25 +350,20 @@ func (client *ManagedHsmKeysClient) NewListVersionsPager(resourceGroupName strin return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedHsmKeysClientListVersionsResponse) (ManagedHsmKeysClientListVersionsResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listVersionsCreateRequest(ctx, resourceGroupName, name, keyName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedHsmKeysClient.NewListVersionsPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listVersionsCreateRequest(ctx, resourceGroupName, name, keyName, options) + }, nil) if err != nil { return ManagedHsmKeysClientListVersionsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ManagedHsmKeysClientListVersionsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmKeysClientListVersionsResponse{}, runtime.NewResponseError(resp) - } return client.listVersionsHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -378,7 +391,7 @@ func (client *ManagedHsmKeysClient) listVersionsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-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/keyvault/armkeyvault/managedhsms_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go index 21d87f4e5..169d9b8be 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/managedhsms_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -35,7 +34,7 @@ type ManagedHsmsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewManagedHsmsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedHsmsClient, error) { - cl, err := arm.NewClient(moduleName+".ManagedHsmsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,23 +48,30 @@ func NewManagedHsmsClient(subscriptionID string, credential azcore.TokenCredenti // CheckMhsmNameAvailability - Checks that the managed hsm name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - mhsmName - The name of the managed hsm. // - options - ManagedHsmsClientCheckMhsmNameAvailabilityOptions contains the optional parameters for the ManagedHsmsClient.CheckMhsmNameAvailability // method. func (client *ManagedHsmsClient) CheckMhsmNameAvailability(ctx context.Context, mhsmName CheckMhsmNameAvailabilityParameters, options *ManagedHsmsClientCheckMhsmNameAvailabilityOptions) (ManagedHsmsClientCheckMhsmNameAvailabilityResponse, error) { + var err error + const operationName = "ManagedHsmsClient.CheckMhsmNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkMhsmNameAvailabilityCreateRequest(ctx, mhsmName, options) if err != nil { return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmsClientCheckMhsmNameAvailabilityResponse{}, err } - return client.checkMhsmNameAvailabilityHandleResponse(resp) + resp, err := client.checkMhsmNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkMhsmNameAvailabilityCreateRequest creates the CheckMhsmNameAvailability request. @@ -80,10 +86,13 @@ func (client *ManagedHsmsClient) checkMhsmNameAvailabilityCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, mhsmName) + if err := runtime.MarshalAsJSON(req, mhsmName); err != nil { + return nil, err + } + return req, nil } // checkMhsmNameAvailabilityHandleResponse handles the CheckMhsmNameAvailability response. @@ -98,7 +107,7 @@ func (client *ManagedHsmsClient) checkMhsmNameAvailabilityHandleResponse(resp *h // BeginCreateOrUpdate - Create or update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - parameters - Parameters to create or update the managed HSM Pool @@ -110,29 +119,40 @@ func (client *ManagedHsmsClient) BeginCreateOrUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[ManagedHsmsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedHsmsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ManagedHsmsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedHsmsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Create or update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 func (client *ManagedHsmsClient) createOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ManagedHsmsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, name, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -155,16 +175,19 @@ func (client *ManagedHsmsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the specified managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - The name of the managed HSM Pool to delete // - options - ManagedHsmsClientBeginDeleteOptions contains the optional parameters for the ManagedHsmsClient.BeginDelete method. @@ -174,29 +197,40 @@ func (client *ManagedHsmsClient) BeginDelete(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[ManagedHsmsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedHsmsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ManagedHsmsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedHsmsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Deletes the specified managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 func (client *ManagedHsmsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, options *ManagedHsmsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ManagedHsmsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, name, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -219,7 +253,7 @@ func (client *ManagedHsmsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,23 +262,30 @@ func (client *ManagedHsmsClient) deleteCreateRequest(ctx context.Context, resour // Get - Gets the specified managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - The name of the managed HSM Pool. // - options - ManagedHsmsClientGetOptions contains the optional parameters for the ManagedHsmsClient.Get method. func (client *ManagedHsmsClient) Get(ctx context.Context, resourceGroupName string, name string, options *ManagedHsmsClientGetOptions) (ManagedHsmsClientGetResponse, error) { + var err error + const operationName = "ManagedHsmsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, name, options) if err != nil { return ManagedHsmsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ManagedHsmsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -267,7 +308,7 @@ func (client *ManagedHsmsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -285,23 +326,30 @@ func (client *ManagedHsmsClient) getHandleResponse(resp *http.Response) (Managed // GetDeleted - Gets the specified deleted managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - name - The name of the deleted managed HSM. // - location - The location of the deleted managed HSM. // - options - ManagedHsmsClientGetDeletedOptions contains the optional parameters for the ManagedHsmsClient.GetDeleted method. func (client *ManagedHsmsClient) GetDeleted(ctx context.Context, name string, location string, options *ManagedHsmsClientGetDeletedOptions) (ManagedHsmsClientGetDeletedResponse, error) { + var err error + const operationName = "ManagedHsmsClient.GetDeleted" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getDeletedCreateRequest(ctx, name, location, options) if err != nil { return ManagedHsmsClientGetDeletedResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedHsmsClientGetDeletedResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmsClientGetDeletedResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedHsmsClientGetDeletedResponse{}, err } - return client.getDeletedHandleResponse(resp) + resp, err := client.getDeletedHandleResponse(httpResp) + return resp, err } // getDeletedCreateRequest creates the GetDeleted request. @@ -324,7 +372,7 @@ func (client *ManagedHsmsClient) getDeletedCreateRequest(ctx context.Context, na return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,7 +390,7 @@ func (client *ManagedHsmsClient) getDeletedHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - The List operation gets information about the managed HSM Pools associated with the subscription // and within the specified resource group. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - options - ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.NewListByResourceGroupPager // method. @@ -352,25 +400,20 @@ func (client *ManagedHsmsClient) NewListByResourceGroupPager(resourceGroupName s return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedHsmsClientListByResourceGroupResponse) (ManagedHsmsClientListByResourceGroupResponse, 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 ManagedHsmsClientListByResourceGroupResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedHsmsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return ManagedHsmsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -393,7 +436,7 @@ func (client *ManagedHsmsClient) listByResourceGroupCreateRequest(ctx context.Co if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -410,7 +453,7 @@ func (client *ManagedHsmsClient) listByResourceGroupHandleResponse(resp *http.Re // NewListBySubscriptionPager - The List operation gets information about the managed HSM Pools associated with the subscription. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - options - ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.NewListBySubscriptionPager // method. func (client *ManagedHsmsClient) NewListBySubscriptionPager(options *ManagedHsmsClientListBySubscriptionOptions) *runtime.Pager[ManagedHsmsClientListBySubscriptionResponse] { @@ -419,25 +462,20 @@ func (client *ManagedHsmsClient) NewListBySubscriptionPager(options *ManagedHsms return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedHsmsClientListBySubscriptionResponse) (ManagedHsmsClientListBySubscriptionResponse, 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 ManagedHsmsClientListBySubscriptionResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedHsmsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return ManagedHsmsClientListBySubscriptionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -456,7 +494,7 @@ func (client *ManagedHsmsClient) listBySubscriptionCreateRequest(ctx context.Con if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -473,7 +511,7 @@ func (client *ManagedHsmsClient) listBySubscriptionHandleResponse(resp *http.Res // NewListDeletedPager - The List operation gets information about the deleted managed HSMs associated with the subscription. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - options - ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.NewListDeletedPager // method. func (client *ManagedHsmsClient) NewListDeletedPager(options *ManagedHsmsClientListDeletedOptions) *runtime.Pager[ManagedHsmsClientListDeletedResponse] { @@ -482,25 +520,20 @@ func (client *ManagedHsmsClient) NewListDeletedPager(options *ManagedHsmsClientL return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedHsmsClientListDeletedResponse) (ManagedHsmsClientListDeletedResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listDeletedCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ManagedHsmsClientListDeletedResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedHsmsClient.NewListDeletedPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listDeletedCreateRequest(ctx, options) + }, nil) if err != nil { return ManagedHsmsClientListDeletedResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedHsmsClientListDeletedResponse{}, runtime.NewResponseError(resp) - } return client.listDeletedHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -516,7 +549,7 @@ func (client *ManagedHsmsClient) listDeletedCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -534,7 +567,7 @@ func (client *ManagedHsmsClient) listDeletedHandleResponse(resp *http.Response) // BeginPurgeDeleted - Permanently deletes the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - name - The name of the soft-deleted managed HSM. // - location - The location of the soft-deleted managed HSM. // - options - ManagedHsmsClientBeginPurgeDeletedOptions contains the optional parameters for the ManagedHsmsClient.BeginPurgeDeleted @@ -545,29 +578,40 @@ func (client *ManagedHsmsClient) BeginPurgeDeleted(ctx context.Context, name str if err != nil { return nil, err } - return runtime.NewPoller[ManagedHsmsClientPurgeDeletedResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedHsmsClientPurgeDeletedResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ManagedHsmsClientPurgeDeletedResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedHsmsClientPurgeDeletedResponse]{ + Tracer: client.internal.Tracer(), + }) } } // PurgeDeleted - Permanently deletes the specified managed HSM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 func (client *ManagedHsmsClient) purgeDeleted(ctx context.Context, name string, location string, options *ManagedHsmsClientBeginPurgeDeletedOptions) (*http.Response, error) { + var err error + const operationName = "ManagedHsmsClient.BeginPurgeDeleted" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.purgeDeletedCreateRequest(ctx, name, location, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // purgeDeletedCreateRequest creates the PurgeDeleted request. @@ -590,7 +634,7 @@ func (client *ManagedHsmsClient) purgeDeletedCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -599,7 +643,7 @@ func (client *ManagedHsmsClient) purgeDeletedCreateRequest(ctx context.Context, // BeginUpdate - Update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - parameters - Parameters to patch the managed HSM Pool @@ -610,29 +654,40 @@ func (client *ManagedHsmsClient) BeginUpdate(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[ManagedHsmsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedHsmsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ManagedHsmsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedHsmsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Update a managed HSM Pool in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 func (client *ManagedHsmsClient) update(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm, options *ManagedHsmsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ManagedHsmsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, name, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -655,8 +710,11 @@ func (client *ManagedHsmsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go index b8b66a494..41cf70240 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -35,7 +34,7 @@ type MHSMPrivateEndpointConnectionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewMHSMPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MHSMPrivateEndpointConnectionsClient, error) { - cl, err := arm.NewClient(moduleName+".MHSMPrivateEndpointConnectionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewMHSMPrivateEndpointConnectionsClient(subscriptionID string, credential a // BeginDelete - Deletes the specified private endpoint connection associated with the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. @@ -61,29 +60,40 @@ func (client *MHSMPrivateEndpointConnectionsClient) BeginDelete(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[MHSMPrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MHSMPrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[MHSMPrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MHSMPrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Deletes the specified private endpoint connection associated with the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 func (client *MHSMPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *MHSMPrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "MHSMPrivateEndpointConnectionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, name, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -110,7 +120,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,25 +129,32 @@ func (client *MHSMPrivateEndpointConnectionsClient) deleteCreateRequest(ctx cont // Get - Gets the specified private endpoint connection associated with the managed HSM Pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. // - options - MHSMPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Get // method. func (client *MHSMPrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *MHSMPrivateEndpointConnectionsClientGetOptions) (MHSMPrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "MHSMPrivateEndpointConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, name, privateEndpointConnectionName, options) if err != nil { return MHSMPrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MHSMPrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MHSMPrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MHSMPrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -164,7 +181,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +199,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) getHandleResponse(resp *http // NewListByResourcePager - The List operation gets information about the private endpoint connections associated with the // managed HSM Pool. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - options - MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.NewListByResourcePager @@ -193,25 +210,20 @@ func (client *MHSMPrivateEndpointConnectionsClient) NewListByResourcePager(resou return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *MHSMPrivateEndpointConnectionsClientListByResourceResponse) (MHSMPrivateEndpointConnectionsClientListByResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceCreateRequest(ctx, resourceGroupName, name, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return MHSMPrivateEndpointConnectionsClientListByResourceResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MHSMPrivateEndpointConnectionsClient.NewListByResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceCreateRequest(ctx, resourceGroupName, name, options) + }, nil) if err != nil { return MHSMPrivateEndpointConnectionsClientListByResourceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MHSMPrivateEndpointConnectionsClientListByResourceResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -235,7 +247,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) listByResourceCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +265,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) listByResourceHandleResponse // Put - Updates the specified private endpoint connection associated with the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - privateEndpointConnectionName - Name of the private endpoint connection associated with the managed hsm pool. @@ -261,18 +273,25 @@ func (client *MHSMPrivateEndpointConnectionsClient) listByResourceHandleResponse // - options - MHSMPrivateEndpointConnectionsClientPutOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Put // method. func (client *MHSMPrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, properties MHSMPrivateEndpointConnection, options *MHSMPrivateEndpointConnectionsClientPutOptions) (MHSMPrivateEndpointConnectionsClientPutResponse, error) { + var err error + const operationName = "MHSMPrivateEndpointConnectionsClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.putCreateRequest(ctx, resourceGroupName, name, privateEndpointConnectionName, properties, options) if err != nil { return MHSMPrivateEndpointConnectionsClientPutResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MHSMPrivateEndpointConnectionsClientPutResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MHSMPrivateEndpointConnectionsClientPutResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MHSMPrivateEndpointConnectionsClientPutResponse{}, err } - return client.putHandleResponse(resp) + resp, err := client.putHandleResponse(httpResp) + return resp, err } // putCreateRequest creates the Put request. @@ -299,15 +318,21 @@ func (client *MHSMPrivateEndpointConnectionsClient) putCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // putHandleResponse handles the Put response. func (client *MHSMPrivateEndpointConnectionsClient) putHandleResponse(resp *http.Response) (MHSMPrivateEndpointConnectionsClientPutResponse, error) { result := MHSMPrivateEndpointConnectionsClientPutResponse{} + if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { + result.AzureAsyncOperation = &val + } if val := resp.Header.Get("Retry-After"); val != "" { retryAfter32, err := strconv.ParseInt(val, 10, 32) retryAfter := int32(retryAfter32) @@ -316,9 +341,6 @@ func (client *MHSMPrivateEndpointConnectionsClient) putHandleResponse(resp *http } result.RetryAfter = &retryAfter } - if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { - result.AzureAsyncOperation = &val - } if err := runtime.UnmarshalAsJSON(resp, &result.MHSMPrivateEndpointConnection); err != nil { return MHSMPrivateEndpointConnectionsClientPutResponse{}, err } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go index 4bff50b0f..319d6a7e8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmprivatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -34,7 +33,7 @@ type MHSMPrivateLinkResourcesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewMHSMPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MHSMPrivateLinkResourcesClient, error) { - cl, err := arm.NewClient(moduleName+".MHSMPrivateLinkResourcesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -48,24 +47,31 @@ func NewMHSMPrivateLinkResourcesClient(subscriptionID string, credential azcore. // ListByMHSMResource - Gets the private link resources supported for the managed hsm pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - options - MHSMPrivateLinkResourcesClientListByMHSMResourceOptions contains the optional parameters for the MHSMPrivateLinkResourcesClient.ListByMHSMResource // method. func (client *MHSMPrivateLinkResourcesClient) ListByMHSMResource(ctx context.Context, resourceGroupName string, name string, options *MHSMPrivateLinkResourcesClientListByMHSMResourceOptions) (MHSMPrivateLinkResourcesClientListByMHSMResourceResponse, error) { + var err error + const operationName = "MHSMPrivateLinkResourcesClient.ListByMHSMResource" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listByMHSMResourceCreateRequest(ctx, resourceGroupName, name, options) if err != nil { return MHSMPrivateLinkResourcesClientListByMHSMResourceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MHSMPrivateLinkResourcesClientListByMHSMResourceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MHSMPrivateLinkResourcesClientListByMHSMResourceResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MHSMPrivateLinkResourcesClientListByMHSMResourceResponse{}, err } - return client.listByMHSMResourceHandleResponse(resp) + resp, err := client.listByMHSMResourceHandleResponse(httpResp) + return resp, err } // listByMHSMResourceCreateRequest creates the ListByMHSMResource request. @@ -88,7 +94,7 @@ func (client *MHSMPrivateLinkResourcesClient) listByMHSMResourceCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-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/keyvault/armkeyvault/mhsmregions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client.go index 64692ec10..15acd3c3a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/mhsmregions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -34,7 +33,7 @@ type MHSMRegionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewMHSMRegionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MHSMRegionsClient, error) { - cl, err := arm.NewClient(moduleName+".MHSMRegionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -47,7 +46,7 @@ func NewMHSMRegionsClient(subscriptionID string, credential azcore.TokenCredenti // NewListByResourcePager - The List operation gets information about the regions associated with the managed HSM Pool. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the managed HSM pool. // - name - Name of the managed HSM Pool // - options - MHSMRegionsClientListByResourceOptions contains the optional parameters for the MHSMRegionsClient.NewListByResourcePager @@ -58,25 +57,20 @@ func (client *MHSMRegionsClient) NewListByResourcePager(resourceGroupName string return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *MHSMRegionsClientListByResourceResponse) (MHSMRegionsClientListByResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceCreateRequest(ctx, resourceGroupName, name, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MHSMRegionsClient.NewListByResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceCreateRequest(ctx, resourceGroupName, name, options) + }, nil) if err != nil { return MHSMRegionsClientListByResourceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MHSMRegionsClientListByResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MHSMRegionsClientListByResourceResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -100,7 +94,7 @@ func (client *MHSMRegionsClient) listByResourceCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-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/keyvault/armkeyvault/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/models.go index 27413da2a..edf63b437 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -16,1578 +15,1334 @@ import "time" type AccessPolicyEntry struct { // REQUIRED; The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. // The object ID must be unique for the list of access policies. - ObjectID *string `json:"objectId,omitempty"` + ObjectID *string // REQUIRED; Permissions the identity has for keys, secrets and certificates. - Permissions *Permissions `json:"permissions,omitempty"` + Permissions *Permissions // REQUIRED; The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string // Application ID of the client making request on behalf of a principal - ApplicationID *string `json:"applicationId,omitempty"` + ApplicationID *string } type Action struct { // The type of action. - Type *KeyRotationPolicyActionType `json:"type,omitempty"` -} - -// Attributes - The object attributes managed by the KeyVault service. -type Attributes struct { - // Determines whether the object is enabled. - Enabled *bool `json:"enabled,omitempty"` - - // Expiry date in seconds since 1970-01-01T00:00:00Z. - Expires *time.Time `json:"exp,omitempty"` - - // Not before date in seconds since 1970-01-01T00:00:00Z. - NotBefore *time.Time `json:"nbf,omitempty"` - - // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *time.Time `json:"created,omitempty" azure:"ro"` - - // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *time.Time `json:"updated,omitempty" azure:"ro"` + Type *KeyRotationPolicyActionType } // CheckMhsmNameAvailabilityParameters - The parameters used to check the availability of the managed hsm name. type CheckMhsmNameAvailabilityParameters struct { // REQUIRED; The managed hsm name. - Name *string `json:"name,omitempty"` + Name *string } // CheckMhsmNameAvailabilityResult - The CheckMhsmNameAvailability operation response. type CheckMhsmNameAvailabilityResult struct { // READ-ONLY; An error message explaining the Reason value in more detail. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string // READ-ONLY; A boolean value that indicates whether the name is available for you to use. If true, the name is available. // If false, the name has already been taken or is invalid and cannot be used. - NameAvailable *bool `json:"nameAvailable,omitempty" azure:"ro"` + NameAvailable *bool // READ-ONLY; The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is // false. - Reason *Reason `json:"reason,omitempty" azure:"ro"` + Reason *Reason } // CheckNameAvailabilityResult - The CheckNameAvailability operation response. type CheckNameAvailabilityResult struct { // READ-ONLY; An error message explaining the Reason value in more detail. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string // READ-ONLY; A boolean value that indicates whether the name is available for you to use. If true, the name is available. // If false, the name has already been taken or is invalid and cannot be used. - NameAvailable *bool `json:"nameAvailable,omitempty" azure:"ro"` + NameAvailable *bool // READ-ONLY; The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. - Reason *Reason `json:"reason,omitempty" azure:"ro"` + Reason *Reason } type DeletedManagedHsm struct { // Properties of the deleted managed HSM - Properties *DeletedManagedHsmProperties `json:"properties,omitempty"` + Properties *DeletedManagedHsmProperties // READ-ONLY; The Azure Resource Manager resource ID for the deleted managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DeletedManagedHsmListResult - List of deleted managed HSM Pools type DeletedManagedHsmListResult struct { // The URL to get the next set of deleted managed HSM Pools. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of deleted managed HSM Pools. - Value []*DeletedManagedHsm `json:"value,omitempty"` + Value []*DeletedManagedHsm } // DeletedManagedHsmProperties - Properties of the deleted managed HSM. type DeletedManagedHsmProperties struct { // READ-ONLY; The deleted date. - DeletionDate *time.Time `json:"deletionDate,omitempty" azure:"ro"` + DeletionDate *time.Time // READ-ONLY; The location of the original managed HSM. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; The resource id of the original managed HSM. - MhsmID *string `json:"mhsmId,omitempty" azure:"ro"` + MhsmID *string // READ-ONLY; Purge protection status of the original managed HSM. - PurgeProtectionEnabled *bool `json:"purgeProtectionEnabled,omitempty" azure:"ro"` + PurgeProtectionEnabled *bool // READ-ONLY; The scheduled purged date. - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` + ScheduledPurgeDate *time.Time // READ-ONLY; Tags of the original managed HSM. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string } // DeletedVault - Deleted vault information with extended details. type DeletedVault struct { // Properties of the vault - Properties *DeletedVaultProperties `json:"properties,omitempty"` + Properties *DeletedVaultProperties // READ-ONLY; The resource ID for the deleted key vault. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the key vault. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The resource type of the key vault. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DeletedVaultListResult - List of vaults type DeletedVaultListResult struct { // The URL to get the next set of deleted vaults. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of deleted vaults. - Value []*DeletedVault `json:"value,omitempty"` + Value []*DeletedVault } // DeletedVaultProperties - Properties of the deleted vault. type DeletedVaultProperties struct { // READ-ONLY; The deleted date. - DeletionDate *time.Time `json:"deletionDate,omitempty" azure:"ro"` + DeletionDate *time.Time // READ-ONLY; The location of the original vault. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Purge protection status of the original vault. - PurgeProtectionEnabled *bool `json:"purgeProtectionEnabled,omitempty" azure:"ro"` + PurgeProtectionEnabled *bool // READ-ONLY; The scheduled purged date. - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` + ScheduledPurgeDate *time.Time // READ-ONLY; Tags of the original vault. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; The resource id of the original vault. - VaultID *string `json:"vaultId,omitempty" azure:"ro"` + VaultID *string } // DimensionProperties - Type of operation: get, read, delete, etc. type DimensionProperties struct { // Display name of dimension. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // Name of dimension. - Name *string `json:"name,omitempty"` + Name *string // Property to specify whether the dimension should be exported for Shoebox. - ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` -} - -// Error - The server error. -type Error struct { - // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; The inner error, contains a more specific error code. - InnerError *Error `json:"innererror,omitempty" azure:"ro"` - - // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` + ToBeExportedForShoebox *bool } // IPRule - A rule governing the accessibility of a vault from a specific ip address or ip range. type IPRule struct { // REQUIRED; An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses // that start with 124.56.78). - Value *string `json:"value,omitempty"` + Value *string } // Key - The key resource. type Key struct { // REQUIRED; The properties of the key. - Properties *KeyProperties `json:"properties,omitempty"` + Properties *KeyProperties // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // KeyAttributes - The object attributes managed by the Azure Key Vault service. type KeyAttributes struct { // Determines whether or not the object is enabled. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Expiry date in seconds since 1970-01-01T00:00:00Z. - Expires *int64 `json:"exp,omitempty"` + Expires *int64 // Indicates if the private key can be exported. - Exportable *bool `json:"exportable,omitempty"` + Exportable *bool // Not before date in seconds since 1970-01-01T00:00:00Z. - NotBefore *int64 `json:"nbf,omitempty"` + NotBefore *int64 // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *int64 `json:"created,omitempty" azure:"ro"` + Created *int64 // READ-ONLY; The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object // can be permanently deleted by a privileged user; otherwise, only the system can purge the // object at the end of the retention interval. - RecoveryLevel *DeletionRecoveryLevel `json:"recoveryLevel,omitempty" azure:"ro"` + RecoveryLevel *DeletionRecoveryLevel // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *int64 `json:"updated,omitempty" azure:"ro"` + Updated *int64 } // KeyCreateParameters - The parameters used to create a key. type KeyCreateParameters struct { // REQUIRED; The properties of the key to be created. - Properties *KeyProperties `json:"properties,omitempty"` + Properties *KeyProperties // The tags that will be assigned to the key. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // KeyListResult - The page of keys. type KeyListResult struct { // The URL to get the next page of keys. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The key resources. - Value []*Key `json:"value,omitempty"` + Value []*Key } // KeyProperties - The properties of the key. type KeyProperties struct { // The attributes of the key. - Attributes *KeyAttributes `json:"attributes,omitempty"` + Attributes *KeyAttributes // The elliptic curve name. For valid values, see JsonWebKeyCurveName. - CurveName *JSONWebKeyCurveName `json:"curveName,omitempty"` - KeyOps []*JSONWebKeyOperation `json:"keyOps,omitempty"` + CurveName *JSONWebKeyCurveName + KeyOps []*JSONWebKeyOperation // The key size in bits. For example: 2048, 3072, or 4096 for RSA. - KeySize *int32 `json:"keySize,omitempty"` + KeySize *int32 // The type of the key. For valid values, see JsonWebKeyType. - Kty *JSONWebKeyType `json:"kty,omitempty"` + Kty *JSONWebKeyType // Key release policy in response. It will be used for both output and input. Omitted if empty - ReleasePolicy *KeyReleasePolicy `json:"release_policy,omitempty"` + ReleasePolicy *KeyReleasePolicy // Key rotation policy in response. It will be used for both output and input. Omitted if empty - RotationPolicy *RotationPolicy `json:"rotationPolicy,omitempty"` + RotationPolicy *RotationPolicy // READ-ONLY; The URI to retrieve the current version of the key. - KeyURI *string `json:"keyUri,omitempty" azure:"ro"` + KeyURI *string // READ-ONLY; The URI to retrieve the specific version of the key. - KeyURIWithVersion *string `json:"keyUriWithVersion,omitempty" azure:"ro"` + KeyURIWithVersion *string } type KeyReleasePolicy struct { // Content type and version of key release policy - ContentType *string `json:"contentType,omitempty"` + ContentType *string // Blob encoding the policy rules under which the key can be released. - Data []byte `json:"data,omitempty"` + Data []byte } type KeyRotationPolicyAttributes struct { // The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'. - ExpiryTime *string `json:"expiryTime,omitempty"` + ExpiryTime *string // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *int64 `json:"created,omitempty" azure:"ro"` + Created *int64 // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *int64 `json:"updated,omitempty" azure:"ro"` -} - -// KeysClientCreateIfNotExistOptions contains the optional parameters for the KeysClient.CreateIfNotExist method. -type KeysClientCreateIfNotExistOptions struct { - // placeholder for future optional parameters -} - -// KeysClientGetOptions contains the optional parameters for the KeysClient.Get method. -type KeysClientGetOptions struct { - // placeholder for future optional parameters -} - -// KeysClientGetVersionOptions contains the optional parameters for the KeysClient.GetVersion method. -type KeysClientGetVersionOptions struct { - // placeholder for future optional parameters -} - -// KeysClientListOptions contains the optional parameters for the KeysClient.NewListPager method. -type KeysClientListOptions struct { - // placeholder for future optional parameters -} - -// KeysClientListVersionsOptions contains the optional parameters for the KeysClient.NewListVersionsPager method. -type KeysClientListVersionsOptions struct { - // placeholder for future optional parameters + Updated *int64 } type LifetimeAction struct { // The action of key rotation policy lifetimeAction. - Action *Action `json:"action,omitempty"` + Action *Action // The trigger of key rotation policy lifetimeAction. - Trigger *Trigger `json:"trigger,omitempty"` + Trigger *Trigger } // LogSpecification - Log specification of operation. type LogSpecification struct { // Blob duration of specification. - BlobDuration *string `json:"blobDuration,omitempty"` + BlobDuration *string // Display name of log specification. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // Name of log specification. - Name *string `json:"name,omitempty"` + Name *string } // MHSMGeoReplicatedRegion - A region that this managed HSM Pool has been extended to. type MHSMGeoReplicatedRegion struct { // A boolean value that indicates whether the region is the primary region or a secondary region. - IsPrimary *bool `json:"isPrimary,omitempty"` + IsPrimary *bool // Name of the geo replicated region. - Name *string `json:"name,omitempty"` + Name *string // READ-ONLY; Provisioning state of the geo replicated region. - ProvisioningState *GeoReplicationRegionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *GeoReplicationRegionProvisioningState } // MHSMIPRule - A rule governing the accessibility of a managed HSM pool from a specific IP address or IP range. type MHSMIPRule struct { // REQUIRED; An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses // that start with 124.56.78). - Value *string `json:"value,omitempty"` + Value *string } // MHSMNetworkRuleSet - A set of rules governing the network accessibility of a managed hsm pool. type MHSMNetworkRuleSet struct { // Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. - Bypass *NetworkRuleBypassOptions `json:"bypass,omitempty"` + Bypass *NetworkRuleBypassOptions // The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property // has been evaluated. - DefaultAction *NetworkRuleAction `json:"defaultAction,omitempty"` + DefaultAction *NetworkRuleAction // The list of IP address rules. - IPRules []*MHSMIPRule `json:"ipRules,omitempty"` + IPRules []*MHSMIPRule // The list of virtual network rules. - VirtualNetworkRules []*MHSMVirtualNetworkRule `json:"virtualNetworkRules,omitempty"` + VirtualNetworkRules []*MHSMVirtualNetworkRule } // MHSMPrivateEndpoint - Private endpoint object properties. type MHSMPrivateEndpoint struct { // READ-ONLY; Full identifier of the private endpoint resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string } // MHSMPrivateEndpointConnection - Private endpoint connection resource. type MHSMPrivateEndpointConnection struct { // Modified whenever there is a change in the state of private endpoint connection. - Etag *string `json:"etag,omitempty"` + Etag *string + + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity // The supported Azure location where the managed HSM Pool should be created. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *MHSMPrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *MHSMPrivateEndpointConnectionProperties // SKU details - SKU *ManagedHsmSKU `json:"sku,omitempty"` + SKU *ManagedHsmSKU // Resource tags - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the key vault resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // MHSMPrivateEndpointConnectionItem - Private endpoint connection item. type MHSMPrivateEndpointConnectionItem struct { // Modified whenever there is a change in the state of private endpoint connection. - Etag *string `json:"etag,omitempty"` + Etag *string // Id of private endpoint connection. - ID *string `json:"id,omitempty"` + ID *string // Private endpoint connection properties. - Properties *MHSMPrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *MHSMPrivateEndpointConnectionProperties } // MHSMPrivateEndpointConnectionProperties - Properties of the private endpoint connection resource. type MHSMPrivateEndpointConnectionProperties struct { // Properties of the private endpoint object. - PrivateEndpoint *MHSMPrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateEndpoint *MHSMPrivateEndpoint // Approval state of the private link connection. - PrivateLinkServiceConnectionState *MHSMPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + PrivateLinkServiceConnectionState *MHSMPrivateLinkServiceConnectionState // Provisioning state of the private endpoint connection. - ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// MHSMPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.BeginDelete -// method. -type MHSMPrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MHSMPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Get -// method. -type MHSMPrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.NewListByResourcePager -// method. -type MHSMPrivateEndpointConnectionsClientListByResourceOptions struct { - // placeholder for future optional parameters -} - -// MHSMPrivateEndpointConnectionsClientPutOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Put -// method. -type MHSMPrivateEndpointConnectionsClientPutOptions struct { - // placeholder for future optional parameters + ProvisioningState *PrivateEndpointConnectionProvisioningState } // MHSMPrivateEndpointConnectionsListResult - List of private endpoint connections associated with a managed HSM Pools type MHSMPrivateEndpointConnectionsListResult struct { // The URL to get the next set of managed HSM Pools. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The private endpoint connection associated with a managed HSM Pools. - Value []*MHSMPrivateEndpointConnection `json:"value,omitempty"` + Value []*MHSMPrivateEndpointConnection } // MHSMPrivateLinkResource - A private link resource type MHSMPrivateLinkResource struct { + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity + // The supported Azure location where the managed HSM Pool should be created. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *MHSMPrivateLinkResourceProperties `json:"properties,omitempty"` + Properties *MHSMPrivateLinkResourceProperties // SKU details - SKU *ManagedHsmSKU `json:"sku,omitempty"` + SKU *ManagedHsmSKU // Resource tags - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the key vault resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // MHSMPrivateLinkResourceListResult - A list of private link resources type MHSMPrivateLinkResourceListResult struct { // Array of private link resources - Value []*MHSMPrivateLinkResource `json:"value,omitempty"` + Value []*MHSMPrivateLinkResource } // MHSMPrivateLinkResourceProperties - Properties of a private link resource. type MHSMPrivateLinkResourceProperties struct { // Required DNS zone names of the the private link resource. - RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` + RequiredZoneNames []*string // READ-ONLY; Group identifier of private link resource. - GroupID *string `json:"groupId,omitempty" azure:"ro"` + GroupID *string // READ-ONLY; Required member names of private link resource. - RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` -} - -// MHSMPrivateLinkResourcesClientListByMHSMResourceOptions contains the optional parameters for the MHSMPrivateLinkResourcesClient.ListByMHSMResource -// method. -type MHSMPrivateLinkResourcesClientListByMHSMResourceOptions struct { - // placeholder for future optional parameters + RequiredMembers []*string } // MHSMPrivateLinkServiceConnectionState - An object that represents the approval state of the private link connection. type MHSMPrivateLinkServiceConnectionState struct { // A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *ActionsRequired `json:"actionsRequired,omitempty"` + ActionsRequired *ActionsRequired // The reason for approval or rejection. - Description *string `json:"description,omitempty"` + Description *string // Indicates whether the connection has been approved, rejected or removed by the key vault owner. - Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` -} - -// MHSMRegionsClientListByResourceOptions contains the optional parameters for the MHSMRegionsClient.NewListByResourcePager -// method. -type MHSMRegionsClientListByResourceOptions struct { - // placeholder for future optional parameters + Status *PrivateEndpointServiceConnectionStatus } // MHSMRegionsListResult - List of regions associated with a managed HSM Pools type MHSMRegionsListResult struct { // The URL to get the next set of managed HSM Pools. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The region associated with a managed HSM Pools. - Value []*MHSMGeoReplicatedRegion `json:"value,omitempty"` + Value []*MHSMGeoReplicatedRegion } // MHSMVirtualNetworkRule - A rule governing the accessibility of a managed hsm pool from a specific virtual network. type MHSMVirtualNetworkRule struct { // REQUIRED; Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - ID *string `json:"id,omitempty"` + ID *string } // ManagedHSMSecurityDomainProperties - The security domain properties of the managed hsm. type ManagedHSMSecurityDomainProperties struct { // READ-ONLY; Activation Status - ActivationStatus *ActivationStatus `json:"activationStatus,omitempty" azure:"ro"` + ActivationStatus *ActivationStatus // READ-ONLY; Activation Status Message. - ActivationStatusMessage *string `json:"activationStatusMessage,omitempty" azure:"ro"` + ActivationStatusMessage *string } // ManagedHsm - Resource information with extended details. type ManagedHsm struct { + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity + // The supported Azure location where the managed HSM Pool should be created. - Location *string `json:"location,omitempty"` + Location *string // Properties of the managed HSM - Properties *ManagedHsmProperties `json:"properties,omitempty"` + Properties *ManagedHsmProperties // SKU details - SKU *ManagedHsmSKU `json:"sku,omitempty"` + SKU *ManagedHsmSKU // Resource tags - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the key vault resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } type ManagedHsmAction struct { // The type of action. - Type *KeyRotationPolicyActionType `json:"type,omitempty"` -} - -// ManagedHsmError - The error exception. -type ManagedHsmError struct { - // READ-ONLY; The server error. - Error *Error `json:"error,omitempty" azure:"ro"` + Type *KeyRotationPolicyActionType } // ManagedHsmKey - The key resource. type ManagedHsmKey struct { // REQUIRED; The properties of the key. - Properties *ManagedHsmKeyProperties `json:"properties,omitempty"` + Properties *ManagedHsmKeyProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedHsmKeyAttributes - The object attributes managed by the Azure Key Vault service. type ManagedHsmKeyAttributes struct { // Determines whether or not the object is enabled. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Expiry date in seconds since 1970-01-01T00:00:00Z. - Expires *int64 `json:"exp,omitempty"` + Expires *int64 // Indicates if the private key can be exported. - Exportable *bool `json:"exportable,omitempty"` + Exportable *bool // Not before date in seconds since 1970-01-01T00:00:00Z. - NotBefore *int64 `json:"nbf,omitempty"` + NotBefore *int64 // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *int64 `json:"created,omitempty" azure:"ro"` + Created *int64 // READ-ONLY; The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object // can be permanently deleted by a privileged user; otherwise, only the system can purge the // object at the end of the retention interval. - RecoveryLevel *DeletionRecoveryLevel `json:"recoveryLevel,omitempty" azure:"ro"` + RecoveryLevel *DeletionRecoveryLevel // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *int64 `json:"updated,omitempty" azure:"ro"` + Updated *int64 } // ManagedHsmKeyCreateParameters - The parameters used to create a key. type ManagedHsmKeyCreateParameters struct { // REQUIRED; The properties of the key to be created. - Properties *ManagedHsmKeyProperties `json:"properties,omitempty"` + Properties *ManagedHsmKeyProperties // The tags that will be assigned to the key. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // ManagedHsmKeyListResult - The page of keys. type ManagedHsmKeyListResult struct { // The URL to get the next page of keys. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The key resources. - Value []*ManagedHsmKey `json:"value,omitempty"` + Value []*ManagedHsmKey } // ManagedHsmKeyProperties - The properties of the key. type ManagedHsmKeyProperties struct { // The attributes of the key. - Attributes *ManagedHsmKeyAttributes `json:"attributes,omitempty"` + Attributes *ManagedHsmKeyAttributes // The elliptic curve name. For valid values, see JsonWebKeyCurveName. - CurveName *JSONWebKeyCurveName `json:"curveName,omitempty"` - KeyOps []*JSONWebKeyOperation `json:"keyOps,omitempty"` + CurveName *JSONWebKeyCurveName + KeyOps []*JSONWebKeyOperation // The key size in bits. For example: 2048, 3072, or 4096 for RSA. - KeySize *int32 `json:"keySize,omitempty"` + KeySize *int32 // The type of the key. For valid values, see JsonWebKeyType. - Kty *JSONWebKeyType `json:"kty,omitempty"` + Kty *JSONWebKeyType // Key release policy in response. It will be used for both output and input. Omitted if empty - ReleasePolicy *ManagedHsmKeyReleasePolicy `json:"release_policy,omitempty"` + ReleasePolicy *ManagedHsmKeyReleasePolicy // Key rotation policy in response. It will be used for both output and input. Omitted if empty - RotationPolicy *ManagedHsmRotationPolicy `json:"rotationPolicy,omitempty"` + RotationPolicy *ManagedHsmRotationPolicy // READ-ONLY; The URI to retrieve the current version of the key. - KeyURI *string `json:"keyUri,omitempty" azure:"ro"` + KeyURI *string // READ-ONLY; The URI to retrieve the specific version of the key. - KeyURIWithVersion *string `json:"keyUriWithVersion,omitempty" azure:"ro"` + KeyURIWithVersion *string } type ManagedHsmKeyReleasePolicy struct { // Content type and version of key release policy - ContentType *string `json:"contentType,omitempty"` + ContentType *string // Blob encoding the policy rules under which the key can be released. - Data []byte `json:"data,omitempty"` + Data []byte } type ManagedHsmKeyRotationPolicyAttributes struct { // The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'. - ExpiryTime *string `json:"expiryTime,omitempty"` + ExpiryTime *string // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *int64 `json:"created,omitempty" azure:"ro"` + Created *int64 // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *int64 `json:"updated,omitempty" azure:"ro"` -} - -// ManagedHsmKeysClientCreateIfNotExistOptions contains the optional parameters for the ManagedHsmKeysClient.CreateIfNotExist -// method. -type ManagedHsmKeysClientCreateIfNotExistOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmKeysClientGetOptions contains the optional parameters for the ManagedHsmKeysClient.Get method. -type ManagedHsmKeysClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmKeysClientGetVersionOptions contains the optional parameters for the ManagedHsmKeysClient.GetVersion method. -type ManagedHsmKeysClientGetVersionOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmKeysClientListOptions contains the optional parameters for the ManagedHsmKeysClient.NewListPager method. -type ManagedHsmKeysClientListOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmKeysClientListVersionsOptions contains the optional parameters for the ManagedHsmKeysClient.NewListVersionsPager -// method. -type ManagedHsmKeysClientListVersionsOptions struct { - // placeholder for future optional parameters + Updated *int64 } type ManagedHsmLifetimeAction struct { // The action of key rotation policy lifetimeAction. - Action *ManagedHsmAction `json:"action,omitempty"` + Action *ManagedHsmAction // The trigger of key rotation policy lifetimeAction. - Trigger *ManagedHsmTrigger `json:"trigger,omitempty"` + Trigger *ManagedHsmTrigger } // ManagedHsmListResult - List of managed HSM Pools type ManagedHsmListResult struct { // The URL to get the next set of managed HSM Pools. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of managed HSM Pools. - Value []*ManagedHsm `json:"value,omitempty"` + Value []*ManagedHsm } // ManagedHsmProperties - Properties of the managed HSM Pool type ManagedHsmProperties struct { // The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. - CreateMode *CreateMode `json:"createMode,omitempty"` + CreateMode *CreateMode // Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property to true // activates protection against purge for this managed HSM pool and its content - - // only the Managed HSM service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete - // is also enabled. Enabling this functionality is irreversible. - EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + // only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling this functionality is irreversible. + EnablePurgeProtection *bool - // Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. If it's not set to any - // value(true or false) when creating new managed HSM pool, it will be set to true - // by default. Once set to true, it cannot be reverted to false. - EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + // Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. Soft delete is enabled + // by default for all managed HSMs and is immutable. + EnableSoftDelete *bool // Array of initial administrators object ids for this managed hsm pool. - InitialAdminObjectIDs []*string `json:"initialAdminObjectIds,omitempty"` + InitialAdminObjectIDs []*string // Rules governing the accessibility of the key vault from specific network locations. - NetworkACLs *MHSMNetworkRuleSet `json:"networkAcls,omitempty"` + NetworkACLs *MHSMNetworkRuleSet - // Control permission for data plane traffic coming from public networks while private endpoint is enabled. - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // Control permission to the managed HSM from public networks. + PublicNetworkAccess *PublicNetworkAccess // List of all regions associated with the managed hsm pool. - Regions []*MHSMGeoReplicatedRegion `json:"regions,omitempty"` + Regions []*MHSMGeoReplicatedRegion - // softDelete data retention days. It accepts >=7 and <=90. - SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` + // Soft deleted data retention days. When you delete an HSM or a key, it will remain recoverable for the configured retention + // period or for a default period of 90 days. It accepts values between 7 and + // 90. + SoftDeleteRetentionInDays *int32 // The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string // READ-ONLY; The URI of the managed hsm pool for performing operations on keys. - HsmURI *string `json:"hsmUri,omitempty" azure:"ro"` + HsmURI *string // READ-ONLY; List of private endpoint connections associated with the managed hsm pool. - PrivateEndpointConnections []*MHSMPrivateEndpointConnectionItem `json:"privateEndpointConnections,omitempty" azure:"ro"` + PrivateEndpointConnections []*MHSMPrivateEndpointConnectionItem // READ-ONLY; Provisioning state. - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *ProvisioningState // READ-ONLY; The scheduled purge date in UTC. - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` + ScheduledPurgeDate *time.Time // READ-ONLY; Managed HSM security domain properties. - SecurityDomainProperties *ManagedHSMSecurityDomainProperties `json:"securityDomainProperties,omitempty" azure:"ro"` + SecurityDomainProperties *ManagedHSMSecurityDomainProperties // READ-ONLY; Resource Status Message. - StatusMessage *string `json:"statusMessage,omitempty" azure:"ro"` -} - -// ManagedHsmResource - Managed HSM resource -type ManagedHsmResource struct { - // The supported Azure location where the managed HSM Pool should be created. - Location *string `json:"location,omitempty"` - - // SKU details - SKU *ManagedHsmSKU `json:"sku,omitempty"` - - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the managed HSM Pool. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Metadata pertaining to creation and last modification of the key vault resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The resource type of the managed HSM Pool. - Type *string `json:"type,omitempty" azure:"ro"` + StatusMessage *string } type ManagedHsmRotationPolicy struct { // The attributes of key rotation policy. - Attributes *ManagedHsmKeyRotationPolicyAttributes `json:"attributes,omitempty"` + Attributes *ManagedHsmKeyRotationPolicyAttributes // The lifetimeActions for key rotation action. - LifetimeActions []*ManagedHsmLifetimeAction `json:"lifetimeActions,omitempty"` + LifetimeActions []*ManagedHsmLifetimeAction } // ManagedHsmSKU - SKU details type ManagedHsmSKU struct { // REQUIRED; SKU Family of the managed HSM Pool - Family *ManagedHsmSKUFamily `json:"family,omitempty"` + Family *ManagedHsmSKUFamily // REQUIRED; SKU of the managed HSM Pool - Name *ManagedHsmSKUName `json:"name,omitempty"` + Name *ManagedHsmSKUName } type ManagedHsmTrigger struct { // The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601 duration format. // Eg: 'P90D', 'P1Y'. - TimeAfterCreate *string `json:"timeAfterCreate,omitempty"` + TimeAfterCreate *string // The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. - TimeBeforeExpiry *string `json:"timeBeforeExpiry,omitempty"` + TimeBeforeExpiry *string } -// ManagedHsmsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginCreateOrUpdate -// method. -type ManagedHsmsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType -// ManagedHsmsClientBeginDeleteOptions contains the optional parameters for the ManagedHsmsClient.BeginDelete method. -type ManagedHsmsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity -// ManagedHsmsClientBeginPurgeDeletedOptions contains the optional parameters for the ManagedHsmsClient.BeginPurgeDeleted -// method. -type ManagedHsmsClientBeginPurgeDeletedOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedHsmsClientBeginUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginUpdate method. -type ManagedHsmsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedHsmsClientCheckMhsmNameAvailabilityOptions contains the optional parameters for the ManagedHsmsClient.CheckMhsmNameAvailability -// method. -type ManagedHsmsClientCheckMhsmNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmsClientGetDeletedOptions contains the optional parameters for the ManagedHsmsClient.GetDeleted method. -type ManagedHsmsClientGetDeletedOptions struct { - // placeholder for future optional parameters -} - -// ManagedHsmsClientGetOptions contains the optional parameters for the ManagedHsmsClient.Get method. -type ManagedHsmsClientGetOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string -// ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.NewListByResourceGroupPager -// method. -type ManagedHsmsClientListByResourceGroupOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.NewListBySubscriptionPager -// method. -type ManagedHsmsClientListBySubscriptionOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.NewListDeletedPager method. -type ManagedHsmsClientListDeletedOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string } // MetricSpecification - Metric specification of operation. type MetricSpecification struct { // The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. - AggregationType *string `json:"aggregationType,omitempty"` + AggregationType *string // The dimensions of metric - Dimensions []*DimensionProperties `json:"dimensions,omitempty"` + Dimensions []*DimensionProperties // Display description of metric specification. - DisplayDescription *string `json:"displayDescription,omitempty"` + DisplayDescription *string // Display name of metric specification. - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string // Property to specify whether to fill gap with zero. - FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + FillGapWithZero *bool // The internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` + InternalMetricName *string // The metric lock aggregation type. - LockAggregationType *string `json:"lockAggregationType,omitempty"` + LockAggregationType *string // Name of metric specification. - Name *string `json:"name,omitempty"` + Name *string // The supported aggregation types for the metrics. - SupportedAggregationTypes []*string `json:"supportedAggregationTypes,omitempty"` + SupportedAggregationTypes []*string // The supported time grain types for the metrics. - SupportedTimeGrainTypes []*string `json:"supportedTimeGrainTypes,omitempty"` + SupportedTimeGrainTypes []*string // The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - Unit *string `json:"unit,omitempty"` + Unit *string } // NetworkRuleSet - A set of rules governing the network accessibility of a vault. type NetworkRuleSet struct { // Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. - Bypass *NetworkRuleBypassOptions `json:"bypass,omitempty"` + Bypass *NetworkRuleBypassOptions // The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property // has been evaluated. - DefaultAction *NetworkRuleAction `json:"defaultAction,omitempty"` + DefaultAction *NetworkRuleAction // The list of IP address rules. - IPRules []*IPRule `json:"ipRules,omitempty"` + IPRules []*IPRule // The list of virtual network rules. - VirtualNetworkRules []*VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` + VirtualNetworkRules []*VirtualNetworkRule } // Operation - Key Vault REST API operation definition. type Operation struct { // Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` + Display *OperationDisplay // Property to specify whether the action is a data action. - IsDataAction *bool `json:"isDataAction,omitempty"` + IsDataAction *bool // Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` + Name *string // Properties of operation, include metric specifications. - OperationProperties *OperationProperties `json:"properties,omitempty"` + OperationProperties *OperationProperties // The origin of operations. - Origin *string `json:"origin,omitempty"` + Origin *string } // OperationDisplay - Display metadata associated with the operation. type OperationDisplay struct { // Description of operation. - Description *string `json:"description,omitempty"` + Description *string // Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` + Operation *string // Service provider: Microsoft Key Vault. - Provider *string `json:"provider,omitempty"` + Provider *string // Resource on which the operation is performed etc. - Resource *string `json:"resource,omitempty"` + Resource *string } // OperationListResult - Result of the request to list Storage operations. It contains a list of operations and a URL link // to get the next set of results. type OperationListResult struct { // The URL to get the next set of operations. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // List of Storage operations supported by the Storage resource provider. - Value []*Operation `json:"value,omitempty"` + Value []*Operation } // OperationProperties - Properties of operation, include metric specifications. type OperationProperties struct { // One property of operation, include metric specifications. - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters + ServiceSpecification *ServiceSpecification } // Permissions the identity has for keys, secrets, certificates and storage. type Permissions struct { // Permissions to certificates - Certificates []*CertificatePermissions `json:"certificates,omitempty"` + Certificates []*CertificatePermissions // Permissions to keys - Keys []*KeyPermissions `json:"keys,omitempty"` + Keys []*KeyPermissions // Permissions to secrets - Secrets []*SecretPermissions `json:"secrets,omitempty"` + Secrets []*SecretPermissions // Permissions to storage accounts - Storage []*StoragePermissions `json:"storage,omitempty"` + Storage []*StoragePermissions } // PrivateEndpoint - Private endpoint object properties. type PrivateEndpoint struct { // READ-ONLY; Full identifier of the private endpoint resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string } // PrivateEndpointConnection - Private endpoint connection resource. type PrivateEndpointConnection struct { // Modified whenever there is a change in the state of private endpoint connection. - Etag *string `json:"etag,omitempty"` + Etag *string // Resource properties. - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *PrivateEndpointConnectionProperties // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // PrivateEndpointConnectionItem - Private endpoint connection item. type PrivateEndpointConnectionItem struct { // Modified whenever there is a change in the state of private endpoint connection. - Etag *string `json:"etag,omitempty"` + Etag *string // Id of private endpoint connection. - ID *string `json:"id,omitempty"` + ID *string // Private endpoint connection properties. - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *PrivateEndpointConnectionProperties } // PrivateEndpointConnectionListResult - List of private endpoint connections. type PrivateEndpointConnectionListResult struct { // The URL to get the next set of private endpoint connections. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of private endpoint connections. - Value []*PrivateEndpointConnection `json:"value,omitempty"` + Value []*PrivateEndpointConnection } // PrivateEndpointConnectionProperties - Properties of the private endpoint connection resource. type PrivateEndpointConnectionProperties struct { // Properties of the private endpoint object. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateEndpoint *PrivateEndpoint // Approval state of the private link connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState // Provisioning state of the private endpoint connection. - ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager -// method. -type PrivateEndpointConnectionsClientListByResourceOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put -// method. -type PrivateEndpointConnectionsClientPutOptions struct { - // placeholder for future optional parameters + ProvisioningState *PrivateEndpointConnectionProvisioningState } // PrivateLinkResource - A private link resource type PrivateLinkResource struct { // Resource properties. - Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + Properties *PrivateLinkResourceProperties // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // PrivateLinkResourceListResult - A list of private link resources type PrivateLinkResourceListResult struct { // Array of private link resources - Value []*PrivateLinkResource `json:"value,omitempty"` + Value []*PrivateLinkResource } // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { // Required DNS zone names of the the private link resource. - RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` + RequiredZoneNames []*string // READ-ONLY; Group identifier of private link resource. - GroupID *string `json:"groupId,omitempty" azure:"ro"` + GroupID *string // READ-ONLY; Required member names of private link resource. - RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` -} - -// PrivateLinkResourcesClientListByVaultOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByVault -// method. -type PrivateLinkResourcesClientListByVaultOptions struct { - // placeholder for future optional parameters + RequiredMembers []*string } // PrivateLinkServiceConnectionState - An object that represents the approval state of the private link connection. type PrivateLinkServiceConnectionState struct { // A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *ActionsRequired `json:"actionsRequired,omitempty"` + ActionsRequired *ActionsRequired // The reason for approval or rejection. - Description *string `json:"description,omitempty"` + Description *string // Indicates whether the connection has been approved, rejected or removed by the key vault owner. - Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` -} - -// ProxyResourceWithoutSystemData - Common fields that are returned in the response for all Azure Resource Manager resources -type ProxyResourceWithoutSystemData struct { - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Status *PrivateEndpointServiceConnectionStatus } // Resource - Key Vault resource type Resource struct { // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ResourceListResult - List of vault resources. type ResourceListResult struct { // The URL to get the next set of vault resources. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of vault resources. - Value []*Resource `json:"value,omitempty"` + Value []*Resource } type RotationPolicy struct { // The attributes of key rotation policy. - Attributes *KeyRotationPolicyAttributes `json:"attributes,omitempty"` + Attributes *KeyRotationPolicyAttributes // The lifetimeActions for key rotation action. - LifetimeActions []*LifetimeAction `json:"lifetimeActions,omitempty"` + LifetimeActions []*LifetimeAction } // SKU details type SKU struct { // REQUIRED; SKU family name - Family *SKUFamily `json:"family,omitempty"` + Family *SKUFamily // REQUIRED; SKU name to specify whether the key vault is a standard vault or a premium vault. - Name *SKUName `json:"name,omitempty"` + Name *SKUName } // Secret - Resource information with extended details. type Secret struct { // REQUIRED; Properties of the secret - Properties *SecretProperties `json:"properties,omitempty"` + Properties *SecretProperties // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Azure location of the key vault resource. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SecretAttributes - The secret management attributes. type SecretAttributes struct { // Determines whether the object is enabled. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Expiry date in seconds since 1970-01-01T00:00:00Z. - Expires *time.Time `json:"exp,omitempty"` + Expires *time.Time // Not before date in seconds since 1970-01-01T00:00:00Z. - NotBefore *time.Time `json:"nbf,omitempty"` + NotBefore *time.Time // READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. - Created *time.Time `json:"created,omitempty" azure:"ro"` + Created *time.Time // READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. - Updated *time.Time `json:"updated,omitempty" azure:"ro"` + Updated *time.Time } // SecretCreateOrUpdateParameters - Parameters for creating or updating a secret type SecretCreateOrUpdateParameters struct { // REQUIRED; Properties of the secret - Properties *SecretProperties `json:"properties,omitempty"` + Properties *SecretProperties // The tags that will be assigned to the secret. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // SecretListResult - List of secrets type SecretListResult struct { // The URL to get the next set of secrets. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of secrets. - Value []*Secret `json:"value,omitempty"` + Value []*Secret } // SecretPatchParameters - Parameters for patching a secret type SecretPatchParameters struct { // Properties of the secret - Properties *SecretPatchProperties `json:"properties,omitempty"` + Properties *SecretPatchProperties // The tags that will be assigned to the secret. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // SecretPatchProperties - Properties of the secret type SecretPatchProperties struct { // The attributes of the secret. - Attributes *SecretAttributes `json:"attributes,omitempty"` + Attributes *SecretAttributes // The content type of the secret. - ContentType *string `json:"contentType,omitempty"` + ContentType *string // The value of the secret. - Value *string `json:"value,omitempty"` + Value *string } // SecretProperties - Properties of the secret type SecretProperties struct { // The attributes of the secret. - Attributes *SecretAttributes `json:"attributes,omitempty"` + Attributes *SecretAttributes // The content type of the secret. - ContentType *string `json:"contentType,omitempty"` + ContentType *string // The value of the secret. NOTE: 'value' will never be returned from the service, as APIs using this model are is intended // for internal use in ARM deployments. Users should use the data-plane REST // service for interaction with vault secrets. - Value *string `json:"value,omitempty"` + Value *string // READ-ONLY; The URI to retrieve the current version of the secret. - SecretURI *string `json:"secretUri,omitempty" azure:"ro"` + SecretURI *string // READ-ONLY; The URI to retrieve the specific version of the secret. - SecretURIWithVersion *string `json:"secretUriWithVersion,omitempty" azure:"ro"` -} - -// SecretsClientCreateOrUpdateOptions contains the optional parameters for the SecretsClient.CreateOrUpdate method. -type SecretsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// SecretsClientGetOptions contains the optional parameters for the SecretsClient.Get method. -type SecretsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SecretsClientListOptions contains the optional parameters for the SecretsClient.NewListPager method. -type SecretsClientListOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// SecretsClientUpdateOptions contains the optional parameters for the SecretsClient.Update method. -type SecretsClientUpdateOptions struct { - // placeholder for future optional parameters + SecretURIWithVersion *string } // ServiceSpecification - One property of operation, include log specifications. type ServiceSpecification struct { // Log specifications of operation. - LogSpecifications []*LogSpecification `json:"logSpecifications,omitempty"` + LogSpecifications []*LogSpecification // Metric specifications of operation. - MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty"` + MetricSpecifications []*MetricSpecification } // SystemData - Metadata pertaining to creation and last modification of the key vault resource. type SystemData struct { // The timestamp of the key vault resource creation (UTC). - CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAt *time.Time // The identity that created the key vault resource. - CreatedBy *string `json:"createdBy,omitempty"` + CreatedBy *string // The type of identity that created the key vault resource. - CreatedByType *IdentityType `json:"createdByType,omitempty"` + CreatedByType *IdentityType // The timestamp of the key vault resource last modification (UTC). - LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAt *time.Time // The identity that last modified the key vault resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedBy *string // The type of identity that last modified the key vault resource. - LastModifiedByType *IdentityType `json:"lastModifiedByType,omitempty"` + LastModifiedByType *IdentityType } type Trigger struct { // The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601 duration format. // Eg: 'P90D', 'P1Y'. - TimeAfterCreate *string `json:"timeAfterCreate,omitempty"` + TimeAfterCreate *string // The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. - TimeBeforeExpiry *string `json:"timeBeforeExpiry,omitempty"` + TimeBeforeExpiry *string +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string } // Vault - Resource information with extended details. type Vault struct { // REQUIRED; Properties of the vault - Properties *VaultProperties `json:"properties,omitempty"` + Properties *VaultProperties // Azure location of the key vault resource. - Location *string `json:"location,omitempty"` + Location *string // Tags assigned to the key vault resource. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified identifier of the key vault resource. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Name of the key vault resource. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; System metadata for the key vault. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; Resource type of the key vault resource. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // VaultAccessPolicyParameters - Parameters for updating the access policy in a vault type VaultAccessPolicyParameters struct { // REQUIRED; Properties of the access policy - Properties *VaultAccessPolicyProperties `json:"properties,omitempty"` + Properties *VaultAccessPolicyProperties // READ-ONLY; The resource id of the access policy. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The resource type of the access policy. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; The resource name of the access policy. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The resource name of the access policy. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // VaultAccessPolicyProperties - Properties of the vault access policy type VaultAccessPolicyProperties struct { // REQUIRED; An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same // tenant ID as the key vault's tenant ID. - AccessPolicies []*AccessPolicyEntry `json:"accessPolicies,omitempty"` + AccessPolicies []*AccessPolicyEntry } // VaultCheckNameAvailabilityParameters - The parameters used to check the availability of the vault name. type VaultCheckNameAvailabilityParameters struct { // REQUIRED; The vault name. - Name *string `json:"name,omitempty"` + Name *string // CONSTANT; The type of resource, Microsoft.KeyVault/vaults // Field has constant value "Microsoft.KeyVault/vaults", any specified value is ignored. - Type *string `json:"type,omitempty"` + Type *string } // VaultCreateOrUpdateParameters - Parameters for creating or updating a vault type VaultCreateOrUpdateParameters struct { // REQUIRED; The supported Azure location where the key vault should be created. - Location *string `json:"location,omitempty"` + Location *string // REQUIRED; Properties of the vault - Properties *VaultProperties `json:"properties,omitempty"` + Properties *VaultProperties // The tags that will be assigned to the key vault. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // VaultListResult - List of vaults type VaultListResult struct { // The URL to get the next set of vaults. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of vaults. - Value []*Vault `json:"value,omitempty"` + Value []*Vault } // VaultPatchParameters - Parameters for creating or updating a vault type VaultPatchParameters struct { // Properties of the vault - Properties *VaultPatchProperties `json:"properties,omitempty"` + Properties *VaultPatchProperties // The tags that will be assigned to the key vault. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // VaultPatchProperties - Properties of the vault type VaultPatchProperties struct { // An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant // ID as the key vault's tenant ID. - AccessPolicies []*AccessPolicyEntry `json:"accessPolicies,omitempty"` + AccessPolicies []*AccessPolicyEntry // The vault's create mode to indicate whether the vault need to be recovered or not. - CreateMode *CreateMode `json:"createMode,omitempty"` + CreateMode *CreateMode // Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates // protection against purge for this vault and its content - only the Key Vault // service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling // this functionality is irreversible - that is, the property does not accept // false as its value. - EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + EnablePurgeProtection *bool // Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) // for authorization of data actions, and the access policies specified in vault // properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any // policy stored on Azure Resource Manager will be ignored. If null or not // specified, the value of this property will not change. - EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` + EnableRbacAuthorization *bool // Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot // be reverted to false. - EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + EnableSoftDelete *bool // Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key // vault. - EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` + EnabledForDeployment *bool // Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. - EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` + EnabledForDiskEncryption *bool // Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. - EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` + EnabledForTemplateDeployment *bool // A collection of rules governing the accessibility of the vault from specific network locations. - NetworkACLs *NetworkRuleSet `json:"networkAcls,omitempty"` + NetworkACLs *NetworkRuleSet // Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except // private endpoint traffic and that that originates from trusted services will be // blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor // the rules. - PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` + PublicNetworkAccess *string // SKU details - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // softDelete data retention days. It accepts >=7 and <=90. - SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` + SoftDeleteRetentionInDays *int32 // The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string } // VaultProperties - Properties of the vault type VaultProperties struct { // REQUIRED; SKU details - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // REQUIRED; The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string // An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant // ID as the key vault's tenant ID. When createMode is set to recover, access // policies are not required. Otherwise, access policies are required. - AccessPolicies []*AccessPolicyEntry `json:"accessPolicies,omitempty"` + AccessPolicies []*AccessPolicyEntry // The vault's create mode to indicate whether the vault need to be recovered or not. - CreateMode *CreateMode `json:"createMode,omitempty"` + CreateMode *CreateMode // Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates // protection against purge for this vault and its content - only the Key Vault // service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling // this functionality is irreversible - that is, the property does not accept // false as its value. - EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + EnablePurgeProtection *bool // Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) // for authorization of data actions, and the access policies specified in vault @@ -1595,120 +1350,53 @@ type VaultProperties struct { // policy stored on Azure Resource Manager will be ignored. If null or not // specified, the vault is created with the default value of false. Note that management actions are always authorized with // RBAC. - EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` + EnableRbacAuthorization *bool // Property to specify whether the 'soft delete' functionality is enabled for this key vault. If it's not set to any value(true // or false) when creating new key vault, it will be set to true by default. // Once set to true, it cannot be reverted to false. - EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + EnableSoftDelete *bool // Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key // vault. - EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` + EnabledForDeployment *bool // Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. - EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` + EnabledForDiskEncryption *bool // Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. - EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` + EnabledForTemplateDeployment *bool // Rules governing the accessibility of the key vault from specific network locations. - NetworkACLs *NetworkRuleSet `json:"networkAcls,omitempty"` + NetworkACLs *NetworkRuleSet // Provisioning state of the vault. - ProvisioningState *VaultProvisioningState `json:"provisioningState,omitempty"` + ProvisioningState *VaultProvisioningState // Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except // private endpoint traffic and that that originates from trusted services will be // blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor // the rules. - PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` + PublicNetworkAccess *string // softDelete data retention days. It accepts >=7 and <=90. - SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` + SoftDeleteRetentionInDays *int32 // The URI of the vault for performing operations on keys and secrets. - VaultURI *string `json:"vaultUri,omitempty"` + VaultURI *string // READ-ONLY; The resource id of HSM Pool. - HsmPoolResourceID *string `json:"hsmPoolResourceId,omitempty" azure:"ro"` + HsmPoolResourceID *string // READ-ONLY; List of private endpoint connections associated with the key vault. - PrivateEndpointConnections []*PrivateEndpointConnectionItem `json:"privateEndpointConnections,omitempty" azure:"ro"` -} - -// VaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the VaultsClient.BeginCreateOrUpdate method. -type VaultsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VaultsClientBeginPurgeDeletedOptions contains the optional parameters for the VaultsClient.BeginPurgeDeleted method. -type VaultsClientBeginPurgeDeletedOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability method. -type VaultsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientDeleteOptions contains the optional parameters for the VaultsClient.Delete method. -type VaultsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientGetDeletedOptions contains the optional parameters for the VaultsClient.GetDeleted method. -type VaultsClientGetDeletedOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientGetOptions contains the optional parameters for the VaultsClient.Get method. -type VaultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.NewListByResourceGroupPager -// method. -type VaultsClientListByResourceGroupOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.NewListBySubscriptionPager -// method. -type VaultsClientListBySubscriptionOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.NewListDeletedPager method. -type VaultsClientListDeletedOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientListOptions contains the optional parameters for the VaultsClient.NewListPager method. -type VaultsClientListOptions struct { - // Maximum number of results to return. - Top *int32 -} - -// VaultsClientUpdateAccessPolicyOptions contains the optional parameters for the VaultsClient.UpdateAccessPolicy method. -type VaultsClientUpdateAccessPolicyOptions struct { - // placeholder for future optional parameters -} - -// VaultsClientUpdateOptions contains the optional parameters for the VaultsClient.Update method. -type VaultsClientUpdateOptions struct { - // placeholder for future optional parameters + PrivateEndpointConnections []*PrivateEndpointConnectionItem } // VirtualNetworkRule - A rule governing the accessibility of a vault from a specific virtual network. type VirtualNetworkRule struct { // REQUIRED; Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - ID *string `json:"id,omitempty"` + ID *string // Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + IgnoreMissingVnetServiceEndpoint *bool } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go index 7f7a5e10c..fbc4d3172 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -84,49 +83,6 @@ func (a *Action) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Attributes. -func (a Attributes) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateTimeUnix(objectMap, "created", a.Created) - populate(objectMap, "enabled", a.Enabled) - populateTimeUnix(objectMap, "exp", a.Expires) - populateTimeUnix(objectMap, "nbf", a.NotBefore) - populateTimeUnix(objectMap, "updated", a.Updated) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Attributes. -func (a *Attributes) UnmarshalJSON(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 "created": - err = unpopulateTimeUnix(val, "Created", &a.Created) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - case "exp": - err = unpopulateTimeUnix(val, "Expires", &a.Expires) - delete(rawMsg, key) - case "nbf": - err = unpopulateTimeUnix(val, "NotBefore", &a.NotBefore) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeUnix(val, "Updated", &a.Updated) - 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 CheckMhsmNameAvailabilityParameters. func (c CheckMhsmNameAvailabilityParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -297,11 +253,11 @@ func (d *DeletedManagedHsmListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeletedManagedHsmProperties. func (d DeletedManagedHsmProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) + populateDateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) populate(objectMap, "location", d.Location) populate(objectMap, "mhsmId", d.MhsmID) populate(objectMap, "purgeProtectionEnabled", d.PurgeProtectionEnabled) - populateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) + populateDateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) populate(objectMap, "tags", d.Tags) return json.Marshal(objectMap) } @@ -316,7 +272,7 @@ func (d *DeletedManagedHsmProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "deletionDate": - err = unpopulateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) + err = unpopulateDateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &d.Location) @@ -328,7 +284,7 @@ func (d *DeletedManagedHsmProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "PurgeProtectionEnabled", &d.PurgeProtectionEnabled) delete(rawMsg, key) case "scheduledPurgeDate": - err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) + err = unpopulateDateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &d.Tags) @@ -414,10 +370,10 @@ func (d *DeletedVaultListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeletedVaultProperties. func (d DeletedVaultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) + populateDateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) populate(objectMap, "location", d.Location) populate(objectMap, "purgeProtectionEnabled", d.PurgeProtectionEnabled) - populateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) + populateDateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) populate(objectMap, "tags", d.Tags) populate(objectMap, "vaultId", d.VaultID) return json.Marshal(objectMap) @@ -433,7 +389,7 @@ func (d *DeletedVaultProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "deletionDate": - err = unpopulateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) + err = unpopulateDateTimeRFC3339(val, "DeletionDate", &d.DeletionDate) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &d.Location) @@ -442,7 +398,7 @@ func (d *DeletedVaultProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "PurgeProtectionEnabled", &d.PurgeProtectionEnabled) delete(rawMsg, key) case "scheduledPurgeDate": - err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) + err = unpopulateDateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &d.Tags) @@ -493,41 +449,6 @@ func (d *DimensionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "innererror", e.InnerError) - populate(objectMap, "message", e.Message) - 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 "innererror": - err = unpopulate(val, "InnerError", &e.InnerError) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - 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 IPRule. func (i IPRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1039,6 +960,7 @@ func (m MHSMPrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", m.Etag) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) @@ -1064,6 +986,9 @@ func (m *MHSMPrivateEndpointConnection) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -1198,6 +1123,7 @@ func (m *MHSMPrivateEndpointConnectionsListResult) UnmarshalJSON(data []byte) er func (m MHSMPrivateLinkResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) @@ -1220,6 +1146,9 @@ func (m *MHSMPrivateLinkResource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -1439,6 +1368,7 @@ func (m *ManagedHSMSecurityDomainProperties) UnmarshalJSON(data []byte) error { func (m ManagedHsm) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) @@ -1461,6 +1391,9 @@ func (m *ManagedHsm) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -1517,33 +1450,6 @@ func (m *ManagedHsmAction) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedHsmError. -func (m ManagedHsmError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", m.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedHsmError. -func (m *ManagedHsmError) UnmarshalJSON(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 "error": - err = unpopulate(val, "Error", &m.Error) - 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 ManagedHsmKey. func (m ManagedHsmKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1900,7 +1806,7 @@ func (m ManagedHsmProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) populate(objectMap, "regions", m.Regions) - populateTimeRFC3339(objectMap, "scheduledPurgeDate", m.ScheduledPurgeDate) + populateDateTimeRFC3339(objectMap, "scheduledPurgeDate", m.ScheduledPurgeDate) populate(objectMap, "securityDomainProperties", m.SecurityDomainProperties) populate(objectMap, "softDeleteRetentionInDays", m.SoftDeleteRetentionInDays) populate(objectMap, "statusMessage", m.StatusMessage) @@ -1948,7 +1854,7 @@ func (m *ManagedHsmProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Regions", &m.Regions) delete(rawMsg, key) case "scheduledPurgeDate": - err = unpopulateTimeRFC3339(val, "ScheduledPurgeDate", &m.ScheduledPurgeDate) + err = unpopulateDateTimeRFC3339(val, "ScheduledPurgeDate", &m.ScheduledPurgeDate) delete(rawMsg, key) case "securityDomainProperties": err = unpopulate(val, "SecurityDomainProperties", &m.SecurityDomainProperties) @@ -1970,57 +1876,6 @@ func (m *ManagedHsmProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedHsmResource. -func (m ManagedHsmResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "sku", m.SKU) - 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 ManagedHsmResource. -func (m *ManagedHsmResource) UnmarshalJSON(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) - case "location": - err = unpopulate(val, "Location", &m.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &m.SKU) - 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 ManagedHsmRotationPolicy. func (m ManagedHsmRotationPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2117,6 +1972,45 @@ func (m *ManagedHsmTrigger) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 MetricSpecification. func (m MetricSpecification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2725,45 +2619,6 @@ func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResourceWithoutSystemData. -func (p ProxyResourceWithoutSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResourceWithoutSystemData. -func (p *ProxyResourceWithoutSystemData) UnmarshalJSON(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 "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 Resource. func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3198,10 +3053,10 @@ func (s *ServiceSpecification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -3217,7 +3072,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -3226,7 +3081,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -3273,6 +3128,37 @@ func (t *Trigger) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(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 Vault. func (v Vault) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go index 3b7216f1d..23c695a64 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -28,7 +27,7 @@ type OperationsClient struct { // - 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) { - cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Key Vault Rest API operations. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -48,25 +47,20 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption 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) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -78,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-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/keyvault/armkeyvault/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/options.go new file mode 100644 index 000000000..0f3515424 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/options.go @@ -0,0 +1,283 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armkeyvault + +// KeysClientCreateIfNotExistOptions contains the optional parameters for the KeysClient.CreateIfNotExist method. +type KeysClientCreateIfNotExistOptions struct { + // placeholder for future optional parameters +} + +// KeysClientGetOptions contains the optional parameters for the KeysClient.Get method. +type KeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// KeysClientGetVersionOptions contains the optional parameters for the KeysClient.GetVersion method. +type KeysClientGetVersionOptions struct { + // placeholder for future optional parameters +} + +// KeysClientListOptions contains the optional parameters for the KeysClient.NewListPager method. +type KeysClientListOptions struct { + // placeholder for future optional parameters +} + +// KeysClientListVersionsOptions contains the optional parameters for the KeysClient.NewListVersionsPager method. +type KeysClientListVersionsOptions struct { + // placeholder for future optional parameters +} + +// MHSMPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.BeginDelete +// method. +type MHSMPrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MHSMPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Get +// method. +type MHSMPrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// MHSMPrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.NewListByResourcePager +// method. +type MHSMPrivateEndpointConnectionsClientListByResourceOptions struct { + // placeholder for future optional parameters +} + +// MHSMPrivateEndpointConnectionsClientPutOptions contains the optional parameters for the MHSMPrivateEndpointConnectionsClient.Put +// method. +type MHSMPrivateEndpointConnectionsClientPutOptions struct { + // placeholder for future optional parameters +} + +// MHSMPrivateLinkResourcesClientListByMHSMResourceOptions contains the optional parameters for the MHSMPrivateLinkResourcesClient.ListByMHSMResource +// method. +type MHSMPrivateLinkResourcesClientListByMHSMResourceOptions struct { + // placeholder for future optional parameters +} + +// MHSMRegionsClientListByResourceOptions contains the optional parameters for the MHSMRegionsClient.NewListByResourcePager +// method. +type MHSMRegionsClientListByResourceOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientCreateIfNotExistOptions contains the optional parameters for the ManagedHsmKeysClient.CreateIfNotExist +// method. +type ManagedHsmKeysClientCreateIfNotExistOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientGetOptions contains the optional parameters for the ManagedHsmKeysClient.Get method. +type ManagedHsmKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientGetVersionOptions contains the optional parameters for the ManagedHsmKeysClient.GetVersion method. +type ManagedHsmKeysClientGetVersionOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientListOptions contains the optional parameters for the ManagedHsmKeysClient.NewListPager method. +type ManagedHsmKeysClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmKeysClientListVersionsOptions contains the optional parameters for the ManagedHsmKeysClient.NewListVersionsPager +// method. +type ManagedHsmKeysClientListVersionsOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginCreateOrUpdate +// method. +type ManagedHsmsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedHsmsClientBeginDeleteOptions contains the optional parameters for the ManagedHsmsClient.BeginDelete method. +type ManagedHsmsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedHsmsClientBeginPurgeDeletedOptions contains the optional parameters for the ManagedHsmsClient.BeginPurgeDeleted +// method. +type ManagedHsmsClientBeginPurgeDeletedOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedHsmsClientBeginUpdateOptions contains the optional parameters for the ManagedHsmsClient.BeginUpdate method. +type ManagedHsmsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedHsmsClientCheckMhsmNameAvailabilityOptions contains the optional parameters for the ManagedHsmsClient.CheckMhsmNameAvailability +// method. +type ManagedHsmsClientCheckMhsmNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmsClientGetDeletedOptions contains the optional parameters for the ManagedHsmsClient.GetDeleted method. +type ManagedHsmsClientGetDeletedOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmsClientGetOptions contains the optional parameters for the ManagedHsmsClient.Get method. +type ManagedHsmsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedHsmsClientListByResourceGroupOptions contains the optional parameters for the ManagedHsmsClient.NewListByResourceGroupPager +// method. +type ManagedHsmsClientListByResourceGroupOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// ManagedHsmsClientListBySubscriptionOptions contains the optional parameters for the ManagedHsmsClient.NewListBySubscriptionPager +// method. +type ManagedHsmsClientListBySubscriptionOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// ManagedHsmsClientListDeletedOptions contains the optional parameters for the ManagedHsmsClient.NewListDeletedPager method. +type ManagedHsmsClientListDeletedOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager +// method. +type PrivateEndpointConnectionsClientListByResourceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put +// method. +type PrivateEndpointConnectionsClientPutOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByVaultOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByVault +// method. +type PrivateLinkResourcesClientListByVaultOptions struct { + // placeholder for future optional parameters +} + +// SecretsClientCreateOrUpdateOptions contains the optional parameters for the SecretsClient.CreateOrUpdate method. +type SecretsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SecretsClientGetOptions contains the optional parameters for the SecretsClient.Get method. +type SecretsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SecretsClientListOptions contains the optional parameters for the SecretsClient.NewListPager method. +type SecretsClientListOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// SecretsClientUpdateOptions contains the optional parameters for the SecretsClient.Update method. +type SecretsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the VaultsClient.BeginCreateOrUpdate method. +type VaultsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VaultsClientBeginPurgeDeletedOptions contains the optional parameters for the VaultsClient.BeginPurgeDeleted method. +type VaultsClientBeginPurgeDeletedOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability method. +type VaultsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientDeleteOptions contains the optional parameters for the VaultsClient.Delete method. +type VaultsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientGetDeletedOptions contains the optional parameters for the VaultsClient.GetDeleted method. +type VaultsClientGetDeletedOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientGetOptions contains the optional parameters for the VaultsClient.Get method. +type VaultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.NewListByResourceGroupPager +// method. +type VaultsClientListByResourceGroupOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.NewListBySubscriptionPager +// method. +type VaultsClientListBySubscriptionOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.NewListDeletedPager method. +type VaultsClientListDeletedOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientListOptions contains the optional parameters for the VaultsClient.NewListPager method. +type VaultsClientListOptions struct { + // Maximum number of results to return. + Top *int32 +} + +// VaultsClientUpdateAccessPolicyOptions contains the optional parameters for the VaultsClient.UpdateAccessPolicy method. +type VaultsClientUpdateAccessPolicyOptions struct { + // placeholder for future optional parameters +} + +// VaultsClientUpdateOptions contains the optional parameters for the VaultsClient.Update method. +type VaultsClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go index 5d48db74b..4941b953f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -35,7 +34,7 @@ type PrivateEndpointConnectionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { - cl, err := arm.NewClient(moduleName+".PrivateEndpointConnectionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Deletes the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. @@ -61,29 +60,40 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Deletes the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -110,7 +120,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,25 +129,32 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -164,7 +181,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +199,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByResourcePager - The List operation gets information about the private endpoint connections associated with the // vault. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - options - PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager @@ -193,25 +210,20 @@ func (client *PrivateEndpointConnectionsClient) NewListByResourcePager(resourceG return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByResourceResponse) (PrivateEndpointConnectionsClientListByResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceCreateRequest(ctx, resourceGroupName, vaultName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PrivateEndpointConnectionsClientListByResourceResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListByResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceCreateRequest(ctx, resourceGroupName, vaultName, options) + }, nil) if err != nil { return PrivateEndpointConnectionsClientListByResourceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientListByResourceResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -235,7 +247,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +265,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceHandleResponse(res // Put - Updates the specified private endpoint connection associated with the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - privateEndpointConnectionName - Name of the private endpoint connection associated with the key vault. @@ -261,18 +273,25 @@ func (client *PrivateEndpointConnectionsClient) listByResourceHandleResponse(res // - options - PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put // method. func (client *PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientPutOptions) (PrivateEndpointConnectionsClientPutResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.putCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, properties, options) if err != nil { return PrivateEndpointConnectionsClientPutResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientPutResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientPutResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientPutResponse{}, err } - return client.putHandleResponse(resp) + resp, err := client.putHandleResponse(httpResp) + return resp, err } // putCreateRequest creates the Put request. @@ -299,15 +318,21 @@ func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // putHandleResponse handles the Put response. func (client *PrivateEndpointConnectionsClient) putHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientPutResponse, error) { result := PrivateEndpointConnectionsClientPutResponse{} + if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { + result.AzureAsyncOperation = &val + } if val := resp.Header.Get("Retry-After"); val != "" { retryAfter32, err := strconv.ParseInt(val, 10, 32) retryAfter := int32(retryAfter32) @@ -316,9 +341,6 @@ func (client *PrivateEndpointConnectionsClient) putHandleResponse(resp *http.Res } result.RetryAfter = &retryAfter } - if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { - result.AzureAsyncOperation = &val - } if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { return PrivateEndpointConnectionsClientPutResponse{}, err } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go index 731c8aa54..b329955a7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -34,7 +33,7 @@ type PrivateLinkResourcesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { - cl, err := arm.NewClient(moduleName+".PrivateLinkResourcesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -48,24 +47,31 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // ListByVault - Gets the private link resources supported for the key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - Name of the resource group that contains the key vault. // - vaultName - The name of the key vault. // - options - PrivateLinkResourcesClientListByVaultOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByVault // method. func (client *PrivateLinkResourcesClient) ListByVault(ctx context.Context, resourceGroupName string, vaultName string, options *PrivateLinkResourcesClientListByVaultOptions) (PrivateLinkResourcesClientListByVaultResponse, error) { + var err error + const operationName = "PrivateLinkResourcesClient.ListByVault" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listByVaultCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return PrivateLinkResourcesClientListByVaultResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientListByVaultResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientListByVaultResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientListByVaultResponse{}, err } - return client.listByVaultHandleResponse(resp) + resp, err := client.listByVaultHandleResponse(httpResp) + return resp, err } // listByVaultCreateRequest creates the ListByVault request. @@ -88,7 +94,7 @@ func (client *PrivateLinkResourcesClient) listByVaultCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-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/keyvault/armkeyvault/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/response_types.go index a1fd185c6..efeaaf1c7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/response_types.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/response_types.go @@ -3,55 +3,64 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault // KeysClientCreateIfNotExistResponse contains the response from method KeysClient.CreateIfNotExist. type KeysClientCreateIfNotExistResponse struct { + // The key resource. Key } // KeysClientGetResponse contains the response from method KeysClient.Get. type KeysClientGetResponse struct { + // The key resource. Key } // KeysClientGetVersionResponse contains the response from method KeysClient.GetVersion. type KeysClientGetVersionResponse struct { + // The key resource. Key } // KeysClientListResponse contains the response from method KeysClient.NewListPager. type KeysClientListResponse struct { + // The page of keys. KeyListResult } // KeysClientListVersionsResponse contains the response from method KeysClient.NewListVersionsPager. type KeysClientListVersionsResponse struct { + // The page of keys. KeyListResult } // MHSMPrivateEndpointConnectionsClientDeleteResponse contains the response from method MHSMPrivateEndpointConnectionsClient.BeginDelete. type MHSMPrivateEndpointConnectionsClientDeleteResponse struct { + // Private endpoint connection resource. MHSMPrivateEndpointConnection } // MHSMPrivateEndpointConnectionsClientGetResponse contains the response from method MHSMPrivateEndpointConnectionsClient.Get. type MHSMPrivateEndpointConnectionsClientGetResponse struct { + // Private endpoint connection resource. MHSMPrivateEndpointConnection } // MHSMPrivateEndpointConnectionsClientListByResourceResponse contains the response from method MHSMPrivateEndpointConnectionsClient.NewListByResourcePager. type MHSMPrivateEndpointConnectionsClientListByResourceResponse struct { + // List of private endpoint connections associated with a managed HSM Pools MHSMPrivateEndpointConnectionsListResult } // MHSMPrivateEndpointConnectionsClientPutResponse contains the response from method MHSMPrivateEndpointConnectionsClient.Put. type MHSMPrivateEndpointConnectionsClientPutResponse struct { + // Private endpoint connection resource. MHSMPrivateEndpointConnection + // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -61,46 +70,55 @@ type MHSMPrivateEndpointConnectionsClientPutResponse struct { // MHSMPrivateLinkResourcesClientListByMHSMResourceResponse contains the response from method MHSMPrivateLinkResourcesClient.ListByMHSMResource. type MHSMPrivateLinkResourcesClientListByMHSMResourceResponse struct { + // A list of private link resources MHSMPrivateLinkResourceListResult } // MHSMRegionsClientListByResourceResponse contains the response from method MHSMRegionsClient.NewListByResourcePager. type MHSMRegionsClientListByResourceResponse struct { + // List of regions associated with a managed HSM Pools MHSMRegionsListResult } // ManagedHsmKeysClientCreateIfNotExistResponse contains the response from method ManagedHsmKeysClient.CreateIfNotExist. type ManagedHsmKeysClientCreateIfNotExistResponse struct { + // The key resource. ManagedHsmKey } // ManagedHsmKeysClientGetResponse contains the response from method ManagedHsmKeysClient.Get. type ManagedHsmKeysClientGetResponse struct { + // The key resource. ManagedHsmKey } // ManagedHsmKeysClientGetVersionResponse contains the response from method ManagedHsmKeysClient.GetVersion. type ManagedHsmKeysClientGetVersionResponse struct { + // The key resource. ManagedHsmKey } // ManagedHsmKeysClientListResponse contains the response from method ManagedHsmKeysClient.NewListPager. type ManagedHsmKeysClientListResponse struct { + // The page of keys. ManagedHsmKeyListResult } // ManagedHsmKeysClientListVersionsResponse contains the response from method ManagedHsmKeysClient.NewListVersionsPager. type ManagedHsmKeysClientListVersionsResponse struct { + // The page of keys. ManagedHsmKeyListResult } // ManagedHsmsClientCheckMhsmNameAvailabilityResponse contains the response from method ManagedHsmsClient.CheckMhsmNameAvailability. type ManagedHsmsClientCheckMhsmNameAvailabilityResponse struct { + // The CheckMhsmNameAvailability operation response. CheckMhsmNameAvailabilityResult } // ManagedHsmsClientCreateOrUpdateResponse contains the response from method ManagedHsmsClient.BeginCreateOrUpdate. type ManagedHsmsClientCreateOrUpdateResponse struct { + // Resource information with extended details. ManagedHsm } @@ -116,21 +134,25 @@ type ManagedHsmsClientGetDeletedResponse struct { // ManagedHsmsClientGetResponse contains the response from method ManagedHsmsClient.Get. type ManagedHsmsClientGetResponse struct { + // Resource information with extended details. ManagedHsm } // ManagedHsmsClientListByResourceGroupResponse contains the response from method ManagedHsmsClient.NewListByResourceGroupPager. type ManagedHsmsClientListByResourceGroupResponse struct { + // List of managed HSM Pools ManagedHsmListResult } // ManagedHsmsClientListBySubscriptionResponse contains the response from method ManagedHsmsClient.NewListBySubscriptionPager. type ManagedHsmsClientListBySubscriptionResponse struct { + // List of managed HSM Pools ManagedHsmListResult } // ManagedHsmsClientListDeletedResponse contains the response from method ManagedHsmsClient.NewListDeletedPager. type ManagedHsmsClientListDeletedResponse struct { + // List of deleted managed HSM Pools DeletedManagedHsmListResult } @@ -141,32 +163,40 @@ type ManagedHsmsClientPurgeDeletedResponse struct { // ManagedHsmsClientUpdateResponse contains the response from method ManagedHsmsClient.BeginUpdate. type ManagedHsmsClientUpdateResponse struct { + // Resource information with extended details. ManagedHsm } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of + // results. OperationListResult } // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { + // Private endpoint connection resource. PrivateEndpointConnection } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // Private endpoint connection resource. PrivateEndpointConnection } // PrivateEndpointConnectionsClientListByResourceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByResourcePager. type PrivateEndpointConnectionsClientListByResourceResponse struct { + // List of private endpoint connections. PrivateEndpointConnectionListResult } // PrivateEndpointConnectionsClientPutResponse contains the response from method PrivateEndpointConnectionsClient.Put. type PrivateEndpointConnectionsClientPutResponse struct { + // Private endpoint connection resource. PrivateEndpointConnection + // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -176,36 +206,43 @@ type PrivateEndpointConnectionsClientPutResponse struct { // PrivateLinkResourcesClientListByVaultResponse contains the response from method PrivateLinkResourcesClient.ListByVault. type PrivateLinkResourcesClientListByVaultResponse struct { + // A list of private link resources PrivateLinkResourceListResult } // SecretsClientCreateOrUpdateResponse contains the response from method SecretsClient.CreateOrUpdate. type SecretsClientCreateOrUpdateResponse struct { + // Resource information with extended details. Secret } // SecretsClientGetResponse contains the response from method SecretsClient.Get. type SecretsClientGetResponse struct { + // Resource information with extended details. Secret } // SecretsClientListResponse contains the response from method SecretsClient.NewListPager. type SecretsClientListResponse struct { + // List of secrets SecretListResult } // SecretsClientUpdateResponse contains the response from method SecretsClient.Update. type SecretsClientUpdateResponse struct { + // Resource information with extended details. Secret } // VaultsClientCheckNameAvailabilityResponse contains the response from method VaultsClient.CheckNameAvailability. type VaultsClientCheckNameAvailabilityResponse struct { + // The CheckNameAvailability operation response. CheckNameAvailabilityResult } // VaultsClientCreateOrUpdateResponse contains the response from method VaultsClient.BeginCreateOrUpdate. type VaultsClientCreateOrUpdateResponse struct { + // Resource information with extended details. Vault } @@ -216,31 +253,37 @@ type VaultsClientDeleteResponse struct { // VaultsClientGetDeletedResponse contains the response from method VaultsClient.GetDeleted. type VaultsClientGetDeletedResponse struct { + // Deleted vault information with extended details. DeletedVault } // VaultsClientGetResponse contains the response from method VaultsClient.Get. type VaultsClientGetResponse struct { + // Resource information with extended details. Vault } // VaultsClientListByResourceGroupResponse contains the response from method VaultsClient.NewListByResourceGroupPager. type VaultsClientListByResourceGroupResponse struct { + // List of vaults VaultListResult } // VaultsClientListBySubscriptionResponse contains the response from method VaultsClient.NewListBySubscriptionPager. type VaultsClientListBySubscriptionResponse struct { + // List of vaults VaultListResult } // VaultsClientListDeletedResponse contains the response from method VaultsClient.NewListDeletedPager. type VaultsClientListDeletedResponse struct { + // List of vaults DeletedVaultListResult } // VaultsClientListResponse contains the response from method VaultsClient.NewListPager. type VaultsClientListResponse struct { + // List of vault resources. ResourceListResult } @@ -251,10 +294,12 @@ type VaultsClientPurgeDeletedResponse struct { // VaultsClientUpdateAccessPolicyResponse contains the response from method VaultsClient.UpdateAccessPolicy. type VaultsClientUpdateAccessPolicyResponse struct { + // Parameters for updating the access policy in a vault VaultAccessPolicyParameters } // VaultsClientUpdateResponse contains the response from method VaultsClient.Update. type VaultsClientUpdateResponse struct { + // Resource information with extended details. Vault } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go index cf43971e1..d57157653 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/secrets_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -35,7 +34,7 @@ type SecretsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSecretsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecretsClient, error) { - cl, err := arm.NewClient(moduleName+".SecretsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -51,7 +50,7 @@ func NewSecretsClient(subscriptionID string, credential azcore.TokenCredential, // with vault secrets. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - Name of the vault // - secretName - Name of the secret. The value you provide may be copied globally for the purpose of running the service. The @@ -59,18 +58,25 @@ func NewSecretsClient(subscriptionID string, credential azcore.TokenCredential, // - parameters - Parameters to create or update the secret // - options - SecretsClientCreateOrUpdateOptions contains the optional parameters for the SecretsClient.CreateOrUpdate method. func (client *SecretsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretCreateOrUpdateParameters, options *SecretsClientCreateOrUpdateOptions) (SecretsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "SecretsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, secretName, parameters, options) if err != nil { return SecretsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SecretsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return SecretsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SecretsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -97,10 +103,13 @@ func (client *SecretsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -116,24 +125,31 @@ func (client *SecretsClient) createOrUpdateHandleResponse(resp *http.Response) ( // REST service for interaction with vault secrets. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - The name of the vault. // - secretName - The name of the secret. // - options - SecretsClientGetOptions contains the optional parameters for the SecretsClient.Get method. func (client *SecretsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, secretName string, options *SecretsClientGetOptions) (SecretsClientGetResponse, error) { + var err error + const operationName = "SecretsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, secretName, options) if err != nil { return SecretsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SecretsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SecretsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecretsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -160,7 +176,7 @@ func (client *SecretsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +195,7 @@ func (client *SecretsClient) getHandleResponse(resp *http.Response) (SecretsClie // use in ARM deployments. Users should use the data-plane REST service for interaction with // vault secrets. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - The name of the vault. // - options - SecretsClientListOptions contains the optional parameters for the SecretsClient.NewListPager method. @@ -189,25 +205,20 @@ func (client *SecretsClient) NewListPager(resourceGroupName string, vaultName st return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SecretsClientListResponse) (SecretsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, vaultName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecretsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + }, nil) if err != nil { return SecretsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SecretsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SecretsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -234,7 +245,7 @@ func (client *SecretsClient) listCreateRequest(ctx context.Context, resourceGrou if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,25 +264,32 @@ func (client *SecretsClient) listHandleResponse(resp *http.Response) (SecretsCli // Users should use the data-plane REST service for interaction with vault secrets. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - Name of the vault // - secretName - Name of the secret // - parameters - Parameters to patch the secret // - options - SecretsClientUpdateOptions contains the optional parameters for the SecretsClient.Update method. func (client *SecretsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretPatchParameters, options *SecretsClientUpdateOptions) (SecretsClientUpdateResponse, error) { + var err error + const operationName = "SecretsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, secretName, parameters, options) if err != nil { return SecretsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SecretsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return SecretsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SecretsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -298,10 +316,13 @@ func (client *SecretsClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go index 6b1097513..a7b9a6b4d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -19,50 +18,50 @@ import ( "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 +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON if tzOffsetRegex.Match(data) { - layout = rfc3339JSON + layout = dateTimeJSON } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime if tzOffsetRegex.Match(data) { layout = time.RFC3339Nano } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { @@ -71,14 +70,14 @@ func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { } else if reflect.ValueOf(t).IsNil() { return } - m[k] = (*timeRFC3339)(t) + m[k] = (*dateTimeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { if data == nil || strings.EqualFold(string(data), "null") { return nil } - var aux timeRFC3339 + var aux dateTimeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go index 569805882..bf0463717 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/time_unix.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go index b087a90a9..00075aff0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault/vaults_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkeyvault @@ -35,7 +34,7 @@ type VaultsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VaultsClient, error) { - cl, err := arm.NewClient(moduleName+".VaultsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,23 +48,30 @@ func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, o // CheckNameAvailability - Checks that the vault name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - vaultName - The name of the vault. // - options - VaultsClientCheckNameAvailabilityOptions contains the optional parameters for the VaultsClient.CheckNameAvailability // method. func (client *VaultsClient) CheckNameAvailability(ctx context.Context, vaultName VaultCheckNameAvailabilityParameters, options *VaultsClientCheckNameAvailabilityOptions) (VaultsClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "VaultsClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkNameAvailabilityCreateRequest(ctx, vaultName, options) if err != nil { return VaultsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VaultsClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -80,10 +86,13 @@ func (client *VaultsClient) checkNameAvailabilityCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, vaultName) + if err := runtime.MarshalAsJSON(req, vaultName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -98,7 +107,7 @@ func (client *VaultsClient) checkNameAvailabilityHandleResponse(resp *http.Respo // BeginCreateOrUpdate - Create or update a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the server belongs. // - vaultName - Name of the vault // - parameters - Parameters to create or update the vault @@ -110,29 +119,40 @@ func (client *VaultsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[VaultsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VaultsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[VaultsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VaultsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Create or update a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 func (client *VaultsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters, options *VaultsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VaultsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -155,30 +175,39 @@ func (client *VaultsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Delete - Deletes the specified Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - The name of the vault to delete // - options - VaultsClientDeleteOptions contains the optional parameters for the VaultsClient.Delete method. func (client *VaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, options *VaultsClientDeleteOptions) (VaultsClientDeleteResponse, error) { + var err error + const operationName = "VaultsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return VaultsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return VaultsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return VaultsClientDeleteResponse{}, err } return VaultsClientDeleteResponse{}, nil } @@ -203,7 +232,7 @@ func (client *VaultsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,23 +241,30 @@ func (client *VaultsClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the specified Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - The name of the vault. // - options - VaultsClientGetOptions contains the optional parameters for the VaultsClient.Get method. func (client *VaultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, options *VaultsClientGetOptions) (VaultsClientGetResponse, error) { + var err error + const operationName = "VaultsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return VaultsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VaultsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -251,7 +287,7 @@ func (client *VaultsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,23 +305,30 @@ func (client *VaultsClient) getHandleResponse(resp *http.Response) (VaultsClient // GetDeleted - Gets the deleted Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - vaultName - The name of the vault. // - location - The location of the deleted vault. // - options - VaultsClientGetDeletedOptions contains the optional parameters for the VaultsClient.GetDeleted method. func (client *VaultsClient) GetDeleted(ctx context.Context, vaultName string, location string, options *VaultsClientGetDeletedOptions) (VaultsClientGetDeletedResponse, error) { + var err error + const operationName = "VaultsClient.GetDeleted" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getDeletedCreateRequest(ctx, vaultName, location, options) if err != nil { return VaultsClientGetDeletedResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientGetDeletedResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientGetDeletedResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VaultsClientGetDeletedResponse{}, err } - return client.getDeletedHandleResponse(resp) + resp, err := client.getDeletedHandleResponse(httpResp) + return resp, err } // getDeletedCreateRequest creates the GetDeleted request. @@ -308,7 +351,7 @@ func (client *VaultsClient) getDeletedCreateRequest(ctx context.Context, vaultNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -325,7 +368,7 @@ func (client *VaultsClient) getDeletedHandleResponse(resp *http.Response) (Vault // NewListPager - The List operation gets information about the vaults associated with the subscription. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - options - VaultsClientListOptions contains the optional parameters for the VaultsClient.NewListPager method. func (client *VaultsClient) NewListPager(options *VaultsClientListOptions) *runtime.Pager[VaultsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListResponse]{ @@ -333,25 +376,20 @@ func (client *VaultsClient) NewListPager(options *VaultsClientListOptions) *runt return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *VaultsClientListResponse) (VaultsClientListResponse, 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 VaultsClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VaultsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return VaultsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -389,7 +427,7 @@ func (client *VaultsClient) listHandleResponse(resp *http.Response) (VaultsClien // NewListByResourceGroupPager - The List operation gets information about the vaults associated with the subscription and // within the specified resource group. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - options - VaultsClientListByResourceGroupOptions contains the optional parameters for the VaultsClient.NewListByResourceGroupPager // method. @@ -399,25 +437,20 @@ func (client *VaultsClient) NewListByResourceGroupPager(resourceGroupName string return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *VaultsClientListByResourceGroupResponse) (VaultsClientListByResourceGroupResponse, 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 VaultsClientListByResourceGroupResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VaultsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return VaultsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -440,7 +473,7 @@ func (client *VaultsClient) listByResourceGroupCreateRequest(ctx context.Context if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -457,7 +490,7 @@ func (client *VaultsClient) listByResourceGroupHandleResponse(resp *http.Respons // NewListBySubscriptionPager - The List operation gets information about the vaults associated with the subscription. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - options - VaultsClientListBySubscriptionOptions contains the optional parameters for the VaultsClient.NewListBySubscriptionPager // method. func (client *VaultsClient) NewListBySubscriptionPager(options *VaultsClientListBySubscriptionOptions) *runtime.Pager[VaultsClientListBySubscriptionResponse] { @@ -466,25 +499,20 @@ func (client *VaultsClient) NewListBySubscriptionPager(options *VaultsClientList return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *VaultsClientListBySubscriptionResponse) (VaultsClientListBySubscriptionResponse, 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) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VaultsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return VaultsClientListBySubscriptionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VaultsClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -503,7 +531,7 @@ func (client *VaultsClient) listBySubscriptionCreateRequest(ctx context.Context, if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -520,7 +548,7 @@ func (client *VaultsClient) listBySubscriptionHandleResponse(resp *http.Response // NewListDeletedPager - Gets information about the deleted vaults in a subscription. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - options - VaultsClientListDeletedOptions contains the optional parameters for the VaultsClient.NewListDeletedPager method. func (client *VaultsClient) NewListDeletedPager(options *VaultsClientListDeletedOptions) *runtime.Pager[VaultsClientListDeletedResponse] { return runtime.NewPager(runtime.PagingHandler[VaultsClientListDeletedResponse]{ @@ -528,25 +556,20 @@ func (client *VaultsClient) NewListDeletedPager(options *VaultsClientListDeleted return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *VaultsClientListDeletedResponse) (VaultsClientListDeletedResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listDeletedCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VaultsClient.NewListDeletedPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listDeletedCreateRequest(ctx, options) + }, nil) if err != nil { return VaultsClientListDeletedResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VaultsClientListDeletedResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VaultsClientListDeletedResponse{}, runtime.NewResponseError(resp) - } return client.listDeletedHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -562,7 +585,7 @@ func (client *VaultsClient) listDeletedCreateRequest(ctx context.Context, option return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -580,7 +603,7 @@ func (client *VaultsClient) listDeletedHandleResponse(resp *http.Response) (Vaul // BeginPurgeDeleted - Permanently deletes the specified vault. aka Purges the deleted Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - vaultName - The name of the soft-deleted vault. // - location - The location of the soft-deleted vault. // - options - VaultsClientBeginPurgeDeletedOptions contains the optional parameters for the VaultsClient.BeginPurgeDeleted @@ -591,29 +614,40 @@ func (client *VaultsClient) BeginPurgeDeleted(ctx context.Context, vaultName str if err != nil { return nil, err } - return runtime.NewPoller[VaultsClientPurgeDeletedResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VaultsClientPurgeDeletedResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[VaultsClientPurgeDeletedResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VaultsClientPurgeDeletedResponse]{ + Tracer: client.internal.Tracer(), + }) } } // PurgeDeleted - Permanently deletes the specified vault. aka Purges the deleted Azure key vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 func (client *VaultsClient) purgeDeleted(ctx context.Context, vaultName string, location string, options *VaultsClientBeginPurgeDeletedOptions) (*http.Response, error) { + var err error + const operationName = "VaultsClient.BeginPurgeDeleted" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.purgeDeletedCreateRequest(ctx, vaultName, location, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // purgeDeletedCreateRequest creates the PurgeDeleted request. @@ -636,7 +670,7 @@ func (client *VaultsClient) purgeDeletedCreateRequest(ctx context.Context, vault return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -645,24 +679,31 @@ func (client *VaultsClient) purgeDeletedCreateRequest(ctx context.Context, vault // Update - Update a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the server belongs. // - vaultName - Name of the vault // - parameters - Parameters to patch the vault // - options - VaultsClientUpdateOptions contains the optional parameters for the VaultsClient.Update method. func (client *VaultsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultPatchParameters, options *VaultsClientUpdateOptions) (VaultsClientUpdateResponse, error) { + var err error + const operationName = "VaultsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return VaultsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return VaultsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return VaultsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -685,10 +726,13 @@ func (client *VaultsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. @@ -703,7 +747,7 @@ func (client *VaultsClient) updateHandleResponse(resp *http.Response) (VaultsCli // UpdateAccessPolicy - Update access policies in a key vault in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the Resource Group to which the vault belongs. // - vaultName - Name of the vault // - operationKind - Name of the operation @@ -711,18 +755,25 @@ func (client *VaultsClient) updateHandleResponse(resp *http.Response) (VaultsCli // - options - VaultsClientUpdateAccessPolicyOptions contains the optional parameters for the VaultsClient.UpdateAccessPolicy // method. func (client *VaultsClient) UpdateAccessPolicy(ctx context.Context, resourceGroupName string, vaultName string, operationKind AccessPolicyUpdateKind, parameters VaultAccessPolicyParameters, options *VaultsClientUpdateAccessPolicyOptions) (VaultsClientUpdateAccessPolicyResponse, error) { + var err error + const operationName = "VaultsClient.UpdateAccessPolicy" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateAccessPolicyCreateRequest(ctx, resourceGroupName, vaultName, operationKind, parameters, options) if err != nil { return VaultsClientUpdateAccessPolicyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VaultsClientUpdateAccessPolicyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return VaultsClientUpdateAccessPolicyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return VaultsClientUpdateAccessPolicyResponse{}, err } - return client.updateAccessPolicyHandleResponse(resp) + resp, err := client.updateAccessPolicyHandleResponse(httpResp) + return resp, err } // updateAccessPolicyCreateRequest creates the UpdateAccessPolicy request. @@ -749,10 +800,13 @@ func (client *VaultsClient) updateAccessPolicyCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateAccessPolicyHandleResponse handles the UpdateAccessPolicy response. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/CHANGELOG.md new file mode 100644 index 000000000..c8a7b2b16 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/CHANGELOG.md @@ -0,0 +1,721 @@ +# Release History + +## 4.2.0 (2023-09-22) +### Features Added + +- New struct `BastionHostPropertiesFormatNetworkACLs` +- New struct `IPRule` +- New struct `VirtualNetworkGatewayAutoScaleBounds` +- New struct `VirtualNetworkGatewayAutoScaleConfiguration` +- New field `NetworkACLs`, `VirtualNetwork` in struct `BastionHostPropertiesFormat` +- New field `Size` in struct `FirewallPolicyPropertiesFormat` +- New field `Size` in struct `FirewallPolicyRuleCollectionGroupProperties` +- New field `DefaultOutboundAccess` in struct `SubnetPropertiesFormat` +- New field `AutoScaleConfiguration` in struct `VirtualNetworkGatewayPropertiesFormat` + + +## 4.1.0 (2023-08-25) +### Features Added + +- New value `ApplicationGatewaySKUNameBasic` added to enum type `ApplicationGatewaySKUName` +- New value `ApplicationGatewayTierBasic` added to enum type `ApplicationGatewayTier` +- New enum type `SyncMode` with values `SyncModeAutomatic`, `SyncModeManual` +- New function `*LoadBalancersClient.MigrateToIPBased(context.Context, string, string, *LoadBalancersClientMigrateToIPBasedOptions) (LoadBalancersClientMigrateToIPBasedResponse, error)` +- New struct `MigrateLoadBalancerToIPBasedRequest` +- New struct `MigratedPools` +- New field `SyncMode` in struct `BackendAddressPoolPropertiesFormat` + + +## 4.0.0 (2023-07-11) +### Breaking Changes + +- `ApplicationGatewayCustomErrorStatusCodeHTTPStatus499` from enum `ApplicationGatewayCustomErrorStatusCode` has been removed + +### Features Added + +- New enum type `AdminState` with values `AdminStateDisabled`, `AdminStateEnabled` +- New field `ResourceGUID` in struct `AdminPropertiesFormat` +- New field `ResourceGUID` in struct `AdminRuleCollectionPropertiesFormat` +- New field `DefaultPredefinedSSLPolicy` in struct `ApplicationGatewayPropertiesFormat` +- New field `ResourceGUID` in struct `ConnectivityConfigurationProperties` +- New field `ResourceGUID` in struct `DefaultAdminPropertiesFormat` +- New field `ResourceGUID` in struct `GroupProperties` +- New field `ResourceGUID` in struct `ManagerProperties` +- New field `ResourceGUID` in struct `SecurityAdminConfigurationPropertiesFormat` +- New field `AdminState` in struct `VirtualNetworkGatewayPropertiesFormat` + + +## 3.0.0 (2023-05-26) +### Breaking Changes + +- Type of `EffectiveRouteMapRoute.Prefix` has been changed from `[]*string` to `*string` +- `LoadBalancerBackendAddressAdminStateDrain` from enum `LoadBalancerBackendAddressAdminState` has been removed +- Struct `PeerRouteList` has been removed +- Field `PeerRouteList` of struct `VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse` has been removed +- Field `PeerRouteList` of struct `VirtualHubBgpConnectionsClientListLearnedRoutesResponse` has been removed + +### Features Added + +- New value `NetworkInterfaceAuxiliaryModeAcceleratedConnections` added to enum type `NetworkInterfaceAuxiliaryMode` +- New value `WebApplicationFirewallRuleTypeRateLimitRule` added to enum type `WebApplicationFirewallRuleType` +- New enum type `ApplicationGatewayFirewallRateLimitDuration` with values `ApplicationGatewayFirewallRateLimitDurationFiveMins`, `ApplicationGatewayFirewallRateLimitDurationOneMin` +- New enum type `ApplicationGatewayFirewallUserSessionVariable` with values `ApplicationGatewayFirewallUserSessionVariableClientAddr`, `ApplicationGatewayFirewallUserSessionVariableGeoLocation`, `ApplicationGatewayFirewallUserSessionVariableNone` +- New enum type `AzureFirewallPacketCaptureFlagsType` with values `AzureFirewallPacketCaptureFlagsTypeAck`, `AzureFirewallPacketCaptureFlagsTypeFin`, `AzureFirewallPacketCaptureFlagsTypePush`, `AzureFirewallPacketCaptureFlagsTypeRst`, `AzureFirewallPacketCaptureFlagsTypeSyn`, `AzureFirewallPacketCaptureFlagsTypeUrg` +- New enum type `NetworkInterfaceAuxiliarySKU` with values `NetworkInterfaceAuxiliarySKUA1`, `NetworkInterfaceAuxiliarySKUA2`, `NetworkInterfaceAuxiliarySKUA4`, `NetworkInterfaceAuxiliarySKUA8`, `NetworkInterfaceAuxiliarySKUNone` +- New enum type `PublicIPAddressDNSSettingsDomainNameLabelScope` with values `PublicIPAddressDNSSettingsDomainNameLabelScopeNoReuse`, `PublicIPAddressDNSSettingsDomainNameLabelScopeResourceGroupReuse`, `PublicIPAddressDNSSettingsDomainNameLabelScopeSubscriptionReuse`, `PublicIPAddressDNSSettingsDomainNameLabelScopeTenantReuse` +- New enum type `ScrubbingRuleEntryMatchOperator` with values `ScrubbingRuleEntryMatchOperatorEquals`, `ScrubbingRuleEntryMatchOperatorEqualsAny` +- New enum type `ScrubbingRuleEntryMatchVariable` with values `ScrubbingRuleEntryMatchVariableRequestArgNames`, `ScrubbingRuleEntryMatchVariableRequestCookieNames`, `ScrubbingRuleEntryMatchVariableRequestHeaderNames`, `ScrubbingRuleEntryMatchVariableRequestIPAddress`, `ScrubbingRuleEntryMatchVariableRequestJSONArgNames`, `ScrubbingRuleEntryMatchVariableRequestPostArgNames` +- New enum type `ScrubbingRuleEntryState` with values `ScrubbingRuleEntryStateDisabled`, `ScrubbingRuleEntryStateEnabled` +- New enum type `WebApplicationFirewallScrubbingState` with values `WebApplicationFirewallScrubbingStateDisabled`, `WebApplicationFirewallScrubbingStateEnabled` +- New function `*AzureFirewallsClient.BeginPacketCapture(context.Context, string, string, FirewallPacketCaptureParameters, *AzureFirewallsClientBeginPacketCaptureOptions) (*runtime.Poller[AzureFirewallsClientPacketCaptureResponse], error)` +- New function `*ClientFactory.NewVirtualApplianceConnectionsClient() *VirtualApplianceConnectionsClient` +- New function `NewVirtualApplianceConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VirtualApplianceConnectionsClient, error)` +- New function `*VirtualApplianceConnectionsClient.BeginCreateOrUpdate(context.Context, string, string, string, VirtualApplianceConnection, *VirtualApplianceConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualApplianceConnectionsClientCreateOrUpdateResponse], error)` +- New function `*VirtualApplianceConnectionsClient.BeginDelete(context.Context, string, string, string, *VirtualApplianceConnectionsClientBeginDeleteOptions) (*runtime.Poller[VirtualApplianceConnectionsClientDeleteResponse], error)` +- New function `*VirtualApplianceConnectionsClient.Get(context.Context, string, string, string, *VirtualApplianceConnectionsClientGetOptions) (VirtualApplianceConnectionsClientGetResponse, error)` +- New function `*VirtualApplianceConnectionsClient.NewListPager(string, string, *VirtualApplianceConnectionsClientListOptions) *runtime.Pager[VirtualApplianceConnectionsClientListResponse]` +- New struct `AzureFirewallPacketCaptureFlags` +- New struct `AzureFirewallPacketCaptureRule` +- New struct `EffectiveRouteMapRouteList` +- New struct `FirewallPacketCaptureParameters` +- New struct `FirewallPacketCaptureParametersFormat` +- New struct `FirewallPolicyHTTPHeaderToInsert` +- New struct `GroupByUserSession` +- New struct `GroupByVariable` +- New struct `PolicySettingsLogScrubbing` +- New struct `PropagatedRouteTableNfv` +- New struct `RoutingConfigurationNfv` +- New struct `RoutingConfigurationNfvSubResource` +- New struct `VirtualApplianceAdditionalNicProperties` +- New struct `VirtualApplianceConnection` +- New struct `VirtualApplianceConnectionList` +- New struct `VirtualApplianceConnectionProperties` +- New struct `WebApplicationFirewallScrubbingRules` +- New field `HTTPHeadersToInsert` in struct `ApplicationRule` +- New field `EnableKerberos` in struct `BastionHostPropertiesFormat` +- New field `AuxiliarySKU` in struct `InterfacePropertiesFormat` +- New field `FileUploadEnforcement`, `LogScrubbing`, `RequestBodyEnforcement`, `RequestBodyInspectLimitInKB` in struct `PolicySettings` +- New field `PrivateEndpointLocation` in struct `PrivateEndpointConnectionProperties` +- New field `DomainNameLabelScope` in struct `PublicIPAddressDNSSettings` +- New field `InstanceName` in struct `VirtualApplianceNicProperties` +- New field `AdditionalNics`, `VirtualApplianceConnections` in struct `VirtualAppliancePropertiesFormat` +- New field `Value` in struct `VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse` +- New field `Value` in struct `VirtualHubBgpConnectionsClientListLearnedRoutesResponse` +- New anonymous field `VirtualHubEffectiveRouteList` in struct `VirtualHubsClientGetEffectiveVirtualHubRoutesResponse` +- New anonymous field `EffectiveRouteMapRouteList` in struct `VirtualHubsClientGetInboundRoutesResponse` +- New anonymous field `EffectiveRouteMapRouteList` in struct `VirtualHubsClientGetOutboundRoutesResponse` +- New field `GroupByUserSession`, `RateLimitDuration`, `RateLimitThreshold` in struct `WebApplicationFirewallCustomRule` + + +## 2.2.1 (2023-04-14) +### Bug Fixes + +- Fix serialization bug of empty value of `any` type. + + +## 2.2.0 (2023-03-24) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module +- New value `ApplicationGatewayCustomErrorStatusCodeHTTPStatus400`, `ApplicationGatewayCustomErrorStatusCodeHTTPStatus404`, `ApplicationGatewayCustomErrorStatusCodeHTTPStatus405`, `ApplicationGatewayCustomErrorStatusCodeHTTPStatus408`, `ApplicationGatewayCustomErrorStatusCodeHTTPStatus499`, `ApplicationGatewayCustomErrorStatusCodeHTTPStatus500`, `ApplicationGatewayCustomErrorStatusCodeHTTPStatus503`, `ApplicationGatewayCustomErrorStatusCodeHTTPStatus504` added to enum type `ApplicationGatewayCustomErrorStatusCode` +- New enum type `WebApplicationFirewallState` with values `WebApplicationFirewallStateDisabled`, `WebApplicationFirewallStateEnabled` +- New field `AuthorizationStatus` in struct `ExpressRouteCircuitPropertiesFormat` +- New field `IPConfigurationID` in struct `VPNGatewaysClientBeginResetOptions` +- New field `FlowLogs` in struct `VirtualNetworkPropertiesFormat` +- New field `State` in struct `WebApplicationFirewallCustomRule` + + +## 2.1.0 (2022-12-23) +### Features Added + +- New struct `DelegationProperties` +- New struct `PartnerManagedResourceProperties` +- New field `VirtualNetwork` in struct `BackendAddressPoolPropertiesFormat` +- New field `CustomBlockResponseBody` in struct `PolicySettings` +- New field `CustomBlockResponseStatusCode` in struct `PolicySettings` +- New field `Delegation` in struct `VirtualAppliancePropertiesFormat` +- New field `DeploymentType` in struct `VirtualAppliancePropertiesFormat` +- New field `PartnerManagedResource` in struct `VirtualAppliancePropertiesFormat` + + +## 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/v4/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/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/network/armnetwork/v4/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/README.md new file mode 100644 index 000000000..2e7907792 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/README.md @@ -0,0 +1,119 @@ +# 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). + +## Client Factory + +Azure Network module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armnetwork.NewClientFactory(, 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, + }, +} +clientFactory, err := armnetwork.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewVirtualHubBgpConnectionsClient() +``` + +## Fakes +The `fake` package provides implementations for fake servers that can be used for testing. +To create a fake server, declare an instance of the required fake server type(s). +```go +myFakeInterfacesServer := fake.InterfacesServer{} +``` +Next, provide func implementations for the methods you wish to fake. +The named return variables can be used to simplify return value construction. +```go +myFakeInterfacesServer.Get = func(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *armnetwork.InterfacesClientGetOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetResponse], errResp azfake.ErrorResponder) { + // TODO: resp.SetResponse(/* your fake InterfacesClientGetResponse response */) + return +} +``` +You connect the fake server to a client instance during construction through the optional transport. +Use `NewTokenCredential()` from `azcore/fake` to obtain a fake credential. +```go +import azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" +client, err := armnetwork.NewInterfacesClient("subscriptionID", azfake.NewTokenCredential(), &arm.ClientOptions{ + ClientOptions: azcore.ClientOptions{ + Transport: fake.NewInterfacesServerTransport(&myFakeInterfacesServer), + }, +}) +``` + +## 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/v4/adminrulecollections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/adminrulecollections_client.go new file mode 100644 index 000000000..aafaa393f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/adminrulecollections_client.go @@ -0,0 +1,356 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".AdminRuleCollectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AdminRuleCollectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, ruleCollection, options) + if err != nil { + return AdminRuleCollectionsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AdminRuleCollectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return AdminRuleCollectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, ruleCollection); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AdminRuleCollectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AdminRuleCollectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes an admin rule collection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *AdminRuleCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, options *AdminRuleCollectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, options) + if err != nil { + return AdminRuleCollectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AdminRuleCollectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AdminRuleCollectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/adminrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/adminrules_client.go new file mode 100644 index 000000000..499ef39c6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/adminrules_client.go @@ -0,0 +1,373 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".AdminRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AdminRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates an admin rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, ruleName, adminRule, options) + if err != nil { + return AdminRulesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AdminRulesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return AdminRulesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, adminRule); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AdminRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AdminRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes an admin rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *AdminRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleName string, options *AdminRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, ruleName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, ruleName, options) + if err != nil { + return AdminRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AdminRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AdminRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/applicationgatewayprivateendpointconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgatewayprivateendpointconnections_client.go new file mode 100644 index 000000000..251db143c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgatewayprivateendpointconnections_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ApplicationGatewayPrivateEndpointConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewayPrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewayPrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewayPrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, options *ApplicationGatewayPrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationGatewayName, connectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, applicationGatewayName, connectionName, options) + if err != nil { + return ApplicationGatewayPrivateEndpointConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewayPrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewayPrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewayPrivateEndpointConnectionsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewayPrivateEndpointConnectionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) update(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, parameters ApplicationGatewayPrivateEndpointConnection, options *ApplicationGatewayPrivateEndpointConnectionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, applicationGatewayName, connectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgatewayprivatelinkresources_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgatewayprivatelinkresources_client.go new file mode 100644 index 000000000..6ed07da77 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgatewayprivatelinkresources_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ApplicationGatewayPrivateLinkResourcesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewayPrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all private link resources on an application gateway. +// +// Generated from API version 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/applicationgateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgateways_client.go new file mode 100644 index 000000000..ee0dad7ab --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgateways_client.go @@ -0,0 +1,1102 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ApplicationGatewaysClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewaysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientBackendHealthResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientBackendHealthResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ApplicationGatewaysClient) backendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginBackendHealthOptions) (*http.Response, error) { + var err error + req, err := client.backendHealthCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientBackendHealthOnDemandResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientBackendHealthOnDemandResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ApplicationGatewaysClient) backendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, options *ApplicationGatewaysClientBeginBackendHealthOnDemandOptions) (*http.Response, error) { + var err error + req, err := client.backendHealthOnDemandCreateRequest(ctx, resourceGroupName, applicationGatewayName, probeRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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"} + if err := runtime.MarshalAsJSON(req, probeRequest); err != nil { + return nil, err + } + return req, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ApplicationGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, options *ApplicationGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, applicationGatewayName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ApplicationGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return ApplicationGatewaysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewaysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getSSLPredefinedPolicyCreateRequest(ctx, predefinedPolicyName, options) + if err != nil { + return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err + } + resp, err := client.getSSLPredefinedPolicyHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - ApplicationGatewaysClientListOptions contains the optional parameters for the ApplicationGatewaysClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ApplicationGatewaysClientListAllOptions contains the optional parameters for the ApplicationGatewaysClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ApplicationGatewaysClientListAvailableRequestHeadersOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableRequestHeaders +// method. +func (client *ApplicationGatewaysClient) ListAvailableRequestHeaders(ctx context.Context, options *ApplicationGatewaysClientListAvailableRequestHeadersOptions) (ApplicationGatewaysClientListAvailableRequestHeadersResponse, error) { + var err error + req, err := client.listAvailableRequestHeadersCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err + } + resp, err := client.listAvailableRequestHeadersHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ApplicationGatewaysClientListAvailableResponseHeadersOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableResponseHeaders +// method. +func (client *ApplicationGatewaysClient) ListAvailableResponseHeaders(ctx context.Context, options *ApplicationGatewaysClientListAvailableResponseHeadersOptions) (ApplicationGatewaysClientListAvailableResponseHeadersResponse, error) { + var err error + req, err := client.listAvailableResponseHeadersCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err + } + resp, err := client.listAvailableResponseHeadersHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ApplicationGatewaysClientListAvailableSSLOptionsOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableSSLOptions +// method. +func (client *ApplicationGatewaysClient) ListAvailableSSLOptions(ctx context.Context, options *ApplicationGatewaysClientListAvailableSSLOptionsOptions) (ApplicationGatewaysClientListAvailableSSLOptionsResponse, error) { + var err error + req, err := client.listAvailableSSLOptionsCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err + } + resp, err := client.listAvailableSSLOptionsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions contains the optional parameters for the ApplicationGatewaysClient.NewListAvailableSSLPredefinedPoliciesPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ApplicationGatewaysClientListAvailableServerVariablesOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableServerVariables +// method. +func (client *ApplicationGatewaysClient) ListAvailableServerVariables(ctx context.Context, options *ApplicationGatewaysClientListAvailableServerVariablesOptions) (ApplicationGatewaysClientListAvailableServerVariablesResponse, error) { + var err error + req, err := client.listAvailableServerVariablesCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err + } + resp, err := client.listAvailableServerVariablesHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ApplicationGatewaysClientListAvailableWafRuleSetsOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableWafRuleSets +// method. +func (client *ApplicationGatewaysClient) ListAvailableWafRuleSets(ctx context.Context, options *ApplicationGatewaysClientListAvailableWafRuleSetsOptions) (ApplicationGatewaysClientListAvailableWafRuleSetsResponse, error) { + var err error + req, err := client.listAvailableWafRuleSetsCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err + } + resp, err := client.listAvailableWafRuleSetsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Start - Starts the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ApplicationGatewaysClient) start(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStartOptions) (*http.Response, error) { + var err error + req, err := client.startCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientStopResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ApplicationGatewaysClient) stop(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStopOptions) (*http.Response, error) { + var err error + req, err := client.stopCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, applicationGatewayName, parameters, options) + if err != nil { + return ApplicationGatewaysClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewaysClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewaysClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/applicationgatewaywafdynamicmanifests_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgatewaywafdynamicmanifests_client.go new file mode 100644 index 000000000..1860d3a73 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgatewaywafdynamicmanifests_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ApplicationGatewayWafDynamicManifestsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewayWafDynamicManifestsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewGetPager - Gets the regional application gateway waf manifest. +// +// Generated from API version 2023-05-01 +// - location - The region where the nrp are located at. +// - options - ApplicationGatewayWafDynamicManifestsClientGetOptions contains the optional parameters for the ApplicationGatewayWafDynamicManifestsClient.NewGetPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/applicationgatewaywafdynamicmanifestsdefault_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgatewaywafdynamicmanifestsdefault_client.go new file mode 100644 index 000000000..bcc9787bd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationgatewaywafdynamicmanifestsdefault_client.go @@ -0,0 +1,101 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ApplicationGatewayWafDynamicManifestsDefaultClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewayWafDynamicManifestsDefaultClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, location, options) + if err != nil { + return ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/applicationsecuritygroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationsecuritygroups_client.go new file mode 100644 index 000000000..31216f033 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/applicationsecuritygroups_client.go @@ -0,0 +1,440 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ApplicationSecurityGroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ApplicationSecurityGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationSecurityGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationSecurityGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates an application security group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ApplicationSecurityGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup, options *ApplicationSecurityGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, applicationSecurityGroupName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified application security group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationSecurityGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ApplicationSecurityGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified application security group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ApplicationSecurityGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, options *ApplicationSecurityGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationSecurityGroupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, applicationSecurityGroupName, options) + if err != nil { + return ApplicationSecurityGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationSecurityGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationSecurityGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - ApplicationSecurityGroupsClientListOptions contains the optional parameters for the ApplicationSecurityGroupsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ApplicationSecurityGroupsClientListAllOptions contains the optional parameters for the ApplicationSecurityGroupsClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, applicationSecurityGroupName, parameters, options) + if err != nil { + return ApplicationSecurityGroupsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationSecurityGroupsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationSecurityGroupsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/assets.json new file mode 100644 index 000000000..c83bdc67f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "go", + "TagPrefix": "go/resourcemanager/network/armnetwork", + "Tag": "go/resourcemanager/network/armnetwork_66967391f3" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/autorest.md new file mode 100644 index 000000000..b95836c20 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/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/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/network/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/network/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 4.2.0 +tag: package-2023-05 +``` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availabledelegations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availabledelegations_client.go new file mode 100644 index 000000000..d61e4f4ed --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availabledelegations_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".AvailableDelegationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailableDelegationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets all of the available subnet delegations for this subscription in this region. +// +// Generated from API version 2023-05-01 +// - location - The location of the subnet. +// - options - AvailableDelegationsClientListOptions contains the optional parameters for the AvailableDelegationsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/availableendpointservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availableendpointservices_client.go new file mode 100644 index 000000000..2e36c225f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availableendpointservices_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".AvailableEndpointServicesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailableEndpointServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List what values of endpoint services are available for use. +// +// Generated from API version 2023-05-01 +// - location - The location to check available endpoint services. +// - options - AvailableEndpointServicesClientListOptions contains the optional parameters for the AvailableEndpointServicesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/availableprivateendpointtypes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availableprivateendpointtypes_client.go new file mode 100644 index 000000000..5bcece5f1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availableprivateendpointtypes_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".AvailablePrivateEndpointTypesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailablePrivateEndpointTypesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-05-01 +// - location - The location of the domain name. +// - options - AvailablePrivateEndpointTypesClientListOptions contains the optional parameters for the AvailablePrivateEndpointTypesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/availableresourcegroupdelegations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availableresourcegroupdelegations_client.go new file mode 100644 index 000000000..efb41be84 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availableresourcegroupdelegations_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".AvailableResourceGroupDelegationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailableResourceGroupDelegationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets all of the available subnet delegations for this resource group in this region. +// +// Generated from API version 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/availableservicealiases_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availableservicealiases_client.go new file mode 100644 index 000000000..091be2480 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/availableservicealiases_client.go @@ -0,0 +1,180 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".AvailableServiceAliasesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailableServiceAliasesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets all available service aliases for this subscription in this region. +// +// Generated from API version 2023-05-01 +// - location - The location. +// - options - AvailableServiceAliasesClientListOptions contains the optional parameters for the AvailableServiceAliasesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - location - The location. +// - options - AvailableServiceAliasesClientListByResourceGroupOptions contains the optional parameters for the AvailableServiceAliasesClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/azurefirewallfqdntags_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/azurefirewallfqdntags_client.go new file mode 100644 index 000000000..84056a911 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/azurefirewallfqdntags_client.go @@ -0,0 +1,105 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".AzureFirewallFqdnTagsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AzureFirewallFqdnTagsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListAllPager - Gets all the Azure Firewall FQDN Tags in a subscription. +// +// Generated from API version 2023-05-01 +// - options - AzureFirewallFqdnTagsClientListAllOptions contains the optional parameters for the AzureFirewallFqdnTagsClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/azurefirewalls_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/azurefirewalls_client.go new file mode 100644 index 000000000..0563c3397 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/azurefirewalls_client.go @@ -0,0 +1,591 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".AzureFirewallsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AzureFirewallsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureFirewallsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AzureFirewallsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Azure Firewall. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *AzureFirewallsClient) createOrUpdate(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters AzureFirewall, options *AzureFirewallsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, azureFirewallName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified Azure Firewall. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureFirewallsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AzureFirewallsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified Azure Firewall. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *AzureFirewallsClient) deleteOperation(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureFirewallName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, azureFirewallName, options) + if err != nil { + return AzureFirewallsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureFirewallsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AzureFirewallsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - AzureFirewallsClientListOptions contains the optional parameters for the AzureFirewallsClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - AzureFirewallsClientListAllOptions contains the optional parameters for the AzureFirewallsClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureFirewallsClientListLearnedPrefixesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AzureFirewallsClientListLearnedPrefixesResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *AzureFirewallsClient) listLearnedPrefixes(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientBeginListLearnedPrefixesOptions) (*http.Response, error) { + var err error + req, err := client.listLearnedPrefixesCreateRequest(ctx, resourceGroupName, azureFirewallName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginPacketCapture - Runs a packet capture on AzureFirewall. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - azureFirewallName - The name of the Azure Firewall. +// - parameters - Parameters supplied to run packet capture on azure firewall. +// - options - AzureFirewallsClientBeginPacketCaptureOptions contains the optional parameters for the AzureFirewallsClient.BeginPacketCapture +// method. +func (client *AzureFirewallsClient) BeginPacketCapture(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters FirewallPacketCaptureParameters, options *AzureFirewallsClientBeginPacketCaptureOptions) (*runtime.Poller[AzureFirewallsClientPacketCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.packetCapture(ctx, resourceGroupName, azureFirewallName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureFirewallsClientPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AzureFirewallsClientPacketCaptureResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// PacketCapture - Runs a packet capture on AzureFirewall. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *AzureFirewallsClient) packetCapture(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters FirewallPacketCaptureParameters, options *AzureFirewallsClientBeginPacketCaptureOptions) (*http.Response, error) { + var err error + req, err := client.packetCaptureCreateRequest(ctx, resourceGroupName, azureFirewallName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// packetCaptureCreateRequest creates the PacketCapture request. +func (client *AzureFirewallsClient) packetCaptureCreateRequest(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters FirewallPacketCaptureParameters, options *AzureFirewallsClientBeginPacketCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/packetCapture" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureFirewallsClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AzureFirewallsClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateTags - Updates tags of an Azure Firewall resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *AzureFirewallsClient) updateTags(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters TagsObject, options *AzureFirewallsClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, azureFirewallName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/bastionhosts_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/bastionhosts_client.go new file mode 100644 index 000000000..b506493d6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/bastionhosts_client.go @@ -0,0 +1,447 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".BastionHostsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BastionHostsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BastionHostsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[BastionHostsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Bastion Host. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *BastionHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, bastionHostName string, parameters BastionHost, options *BastionHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, bastionHostName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified Bastion Host. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BastionHostsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[BastionHostsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified Bastion Host. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *BastionHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, bastionHostName string, options *BastionHostsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, bastionHostName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, bastionHostName, options) + if err != nil { + return BastionHostsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BastionHostsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BastionHostsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - BastionHostsClientListOptions contains the optional parameters for the BastionHostsClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - BastionHostsClientListByResourceGroupOptions contains the optional parameters for the BastionHostsClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BastionHostsClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[BastionHostsClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateTags - Updates Tags for BastionHost resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *BastionHostsClient) updateTags(ctx context.Context, resourceGroupName string, bastionHostName string, parameters TagsObject, options *BastionHostsClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, bastionHostName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/bgpservicecommunities_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/bgpservicecommunities_client.go new file mode 100644 index 000000000..6ed81473f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/bgpservicecommunities_client.go @@ -0,0 +1,105 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".BgpServiceCommunitiesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BgpServiceCommunitiesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets all the available bgp service communities. +// +// Generated from API version 2023-05-01 +// - options - BgpServiceCommunitiesClientListOptions contains the optional parameters for the BgpServiceCommunitiesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/build.go new file mode 100644 index 000000000..6cb650356 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/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 -goExtension "@autorest/go@4.0.0-preview.54" -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/v4/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/ci.yml new file mode 100644 index 000000000..d1d36edca --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/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/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/v4/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/client_factory.go new file mode 100644 index 000000000..67883a217 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/client_factory.go @@ -0,0 +1,704 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewAdminRuleCollectionsClient() *AdminRuleCollectionsClient { + subClient, _ := NewAdminRuleCollectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAdminRulesClient() *AdminRulesClient { + subClient, _ := NewAdminRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewApplicationGatewayPrivateEndpointConnectionsClient() *ApplicationGatewayPrivateEndpointConnectionsClient { + subClient, _ := NewApplicationGatewayPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewApplicationGatewayPrivateLinkResourcesClient() *ApplicationGatewayPrivateLinkResourcesClient { + subClient, _ := NewApplicationGatewayPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewApplicationGatewayWafDynamicManifestsClient() *ApplicationGatewayWafDynamicManifestsClient { + subClient, _ := NewApplicationGatewayWafDynamicManifestsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewApplicationGatewayWafDynamicManifestsDefaultClient() *ApplicationGatewayWafDynamicManifestsDefaultClient { + subClient, _ := NewApplicationGatewayWafDynamicManifestsDefaultClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewApplicationGatewaysClient() *ApplicationGatewaysClient { + subClient, _ := NewApplicationGatewaysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewApplicationSecurityGroupsClient() *ApplicationSecurityGroupsClient { + subClient, _ := NewApplicationSecurityGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAvailableDelegationsClient() *AvailableDelegationsClient { + subClient, _ := NewAvailableDelegationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAvailableEndpointServicesClient() *AvailableEndpointServicesClient { + subClient, _ := NewAvailableEndpointServicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAvailablePrivateEndpointTypesClient() *AvailablePrivateEndpointTypesClient { + subClient, _ := NewAvailablePrivateEndpointTypesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAvailableResourceGroupDelegationsClient() *AvailableResourceGroupDelegationsClient { + subClient, _ := NewAvailableResourceGroupDelegationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAvailableServiceAliasesClient() *AvailableServiceAliasesClient { + subClient, _ := NewAvailableServiceAliasesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAzureFirewallFqdnTagsClient() *AzureFirewallFqdnTagsClient { + subClient, _ := NewAzureFirewallFqdnTagsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAzureFirewallsClient() *AzureFirewallsClient { + subClient, _ := NewAzureFirewallsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBastionHostsClient() *BastionHostsClient { + subClient, _ := NewBastionHostsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBgpServiceCommunitiesClient() *BgpServiceCommunitiesClient { + subClient, _ := NewBgpServiceCommunitiesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewConfigurationPolicyGroupsClient() *ConfigurationPolicyGroupsClient { + subClient, _ := NewConfigurationPolicyGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewConnectionMonitorsClient() *ConnectionMonitorsClient { + subClient, _ := NewConnectionMonitorsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewConnectivityConfigurationsClient() *ConnectivityConfigurationsClient { + subClient, _ := NewConnectivityConfigurationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCustomIPPrefixesClient() *CustomIPPrefixesClient { + subClient, _ := NewCustomIPPrefixesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDdosCustomPoliciesClient() *DdosCustomPoliciesClient { + subClient, _ := NewDdosCustomPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDdosProtectionPlansClient() *DdosProtectionPlansClient { + subClient, _ := NewDdosProtectionPlansClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDefaultSecurityRulesClient() *DefaultSecurityRulesClient { + subClient, _ := NewDefaultSecurityRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDscpConfigurationClient() *DscpConfigurationClient { + subClient, _ := NewDscpConfigurationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteCircuitAuthorizationsClient() *ExpressRouteCircuitAuthorizationsClient { + subClient, _ := NewExpressRouteCircuitAuthorizationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteCircuitConnectionsClient() *ExpressRouteCircuitConnectionsClient { + subClient, _ := NewExpressRouteCircuitConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteCircuitPeeringsClient() *ExpressRouteCircuitPeeringsClient { + subClient, _ := NewExpressRouteCircuitPeeringsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteCircuitsClient() *ExpressRouteCircuitsClient { + subClient, _ := NewExpressRouteCircuitsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteConnectionsClient() *ExpressRouteConnectionsClient { + subClient, _ := NewExpressRouteConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteCrossConnectionPeeringsClient() *ExpressRouteCrossConnectionPeeringsClient { + subClient, _ := NewExpressRouteCrossConnectionPeeringsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteCrossConnectionsClient() *ExpressRouteCrossConnectionsClient { + subClient, _ := NewExpressRouteCrossConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteGatewaysClient() *ExpressRouteGatewaysClient { + subClient, _ := NewExpressRouteGatewaysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteLinksClient() *ExpressRouteLinksClient { + subClient, _ := NewExpressRouteLinksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRoutePortAuthorizationsClient() *ExpressRoutePortAuthorizationsClient { + subClient, _ := NewExpressRoutePortAuthorizationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRoutePortsClient() *ExpressRoutePortsClient { + subClient, _ := NewExpressRoutePortsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRoutePortsLocationsClient() *ExpressRoutePortsLocationsClient { + subClient, _ := NewExpressRoutePortsLocationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteProviderPortsLocationClient() *ExpressRouteProviderPortsLocationClient { + subClient, _ := NewExpressRouteProviderPortsLocationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExpressRouteServiceProvidersClient() *ExpressRouteServiceProvidersClient { + subClient, _ := NewExpressRouteServiceProvidersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFirewallPoliciesClient() *FirewallPoliciesClient { + subClient, _ := NewFirewallPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFirewallPolicyIdpsSignaturesClient() *FirewallPolicyIdpsSignaturesClient { + subClient, _ := NewFirewallPolicyIdpsSignaturesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFirewallPolicyIdpsSignaturesFilterValuesClient() *FirewallPolicyIdpsSignaturesFilterValuesClient { + subClient, _ := NewFirewallPolicyIdpsSignaturesFilterValuesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFirewallPolicyIdpsSignaturesOverridesClient() *FirewallPolicyIdpsSignaturesOverridesClient { + subClient, _ := NewFirewallPolicyIdpsSignaturesOverridesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFirewallPolicyRuleCollectionGroupsClient() *FirewallPolicyRuleCollectionGroupsClient { + subClient, _ := NewFirewallPolicyRuleCollectionGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFlowLogsClient() *FlowLogsClient { + subClient, _ := NewFlowLogsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewGroupsClient() *GroupsClient { + subClient, _ := NewGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewHubRouteTablesClient() *HubRouteTablesClient { + subClient, _ := NewHubRouteTablesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewHubVirtualNetworkConnectionsClient() *HubVirtualNetworkConnectionsClient { + subClient, _ := NewHubVirtualNetworkConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewIPAllocationsClient() *IPAllocationsClient { + subClient, _ := NewIPAllocationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewIPGroupsClient() *IPGroupsClient { + subClient, _ := NewIPGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewInboundNatRulesClient() *InboundNatRulesClient { + subClient, _ := NewInboundNatRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewInboundSecurityRuleClient() *InboundSecurityRuleClient { + subClient, _ := NewInboundSecurityRuleClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewInterfaceIPConfigurationsClient() *InterfaceIPConfigurationsClient { + subClient, _ := NewInterfaceIPConfigurationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewInterfaceLoadBalancersClient() *InterfaceLoadBalancersClient { + subClient, _ := NewInterfaceLoadBalancersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewInterfaceTapConfigurationsClient() *InterfaceTapConfigurationsClient { + subClient, _ := NewInterfaceTapConfigurationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewInterfacesClient() *InterfacesClient { + subClient, _ := NewInterfacesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLoadBalancerBackendAddressPoolsClient() *LoadBalancerBackendAddressPoolsClient { + subClient, _ := NewLoadBalancerBackendAddressPoolsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLoadBalancerFrontendIPConfigurationsClient() *LoadBalancerFrontendIPConfigurationsClient { + subClient, _ := NewLoadBalancerFrontendIPConfigurationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLoadBalancerLoadBalancingRulesClient() *LoadBalancerLoadBalancingRulesClient { + subClient, _ := NewLoadBalancerLoadBalancingRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLoadBalancerNetworkInterfacesClient() *LoadBalancerNetworkInterfacesClient { + subClient, _ := NewLoadBalancerNetworkInterfacesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLoadBalancerOutboundRulesClient() *LoadBalancerOutboundRulesClient { + subClient, _ := NewLoadBalancerOutboundRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLoadBalancerProbesClient() *LoadBalancerProbesClient { + subClient, _ := NewLoadBalancerProbesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLoadBalancersClient() *LoadBalancersClient { + subClient, _ := NewLoadBalancersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLocalNetworkGatewaysClient() *LocalNetworkGatewaysClient { + subClient, _ := NewLocalNetworkGatewaysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewManagementClient() *ManagementClient { + subClient, _ := NewManagementClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewManagementGroupNetworkManagerConnectionsClient() *ManagementGroupNetworkManagerConnectionsClient { + subClient, _ := NewManagementGroupNetworkManagerConnectionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewManagerCommitsClient() *ManagerCommitsClient { + subClient, _ := NewManagerCommitsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewManagerDeploymentStatusClient() *ManagerDeploymentStatusClient { + subClient, _ := NewManagerDeploymentStatusClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewManagersClient() *ManagersClient { + subClient, _ := NewManagersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewNatGatewaysClient() *NatGatewaysClient { + subClient, _ := NewNatGatewaysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewNatRulesClient() *NatRulesClient { + subClient, _ := NewNatRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewP2SVPNGatewaysClient() *P2SVPNGatewaysClient { + subClient, _ := NewP2SVPNGatewaysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPacketCapturesClient() *PacketCapturesClient { + subClient, _ := NewPacketCapturesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPeerExpressRouteCircuitConnectionsClient() *PeerExpressRouteCircuitConnectionsClient { + subClient, _ := NewPeerExpressRouteCircuitConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateDNSZoneGroupsClient() *PrivateDNSZoneGroupsClient { + subClient, _ := NewPrivateDNSZoneGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateEndpointsClient() *PrivateEndpointsClient { + subClient, _ := NewPrivateEndpointsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkServicesClient() *PrivateLinkServicesClient { + subClient, _ := NewPrivateLinkServicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProfilesClient() *ProfilesClient { + subClient, _ := NewProfilesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPublicIPAddressesClient() *PublicIPAddressesClient { + subClient, _ := NewPublicIPAddressesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPublicIPPrefixesClient() *PublicIPPrefixesClient { + subClient, _ := NewPublicIPPrefixesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewResourceNavigationLinksClient() *ResourceNavigationLinksClient { + subClient, _ := NewResourceNavigationLinksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRouteFilterRulesClient() *RouteFilterRulesClient { + subClient, _ := NewRouteFilterRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRouteFiltersClient() *RouteFiltersClient { + subClient, _ := NewRouteFiltersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRouteMapsClient() *RouteMapsClient { + subClient, _ := NewRouteMapsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRouteTablesClient() *RouteTablesClient { + subClient, _ := NewRouteTablesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRoutesClient() *RoutesClient { + subClient, _ := NewRoutesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRoutingIntentClient() *RoutingIntentClient { + subClient, _ := NewRoutingIntentClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeConnectionsClient() *ScopeConnectionsClient { + subClient, _ := NewScopeConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSecurityAdminConfigurationsClient() *SecurityAdminConfigurationsClient { + subClient, _ := NewSecurityAdminConfigurationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSecurityGroupsClient() *SecurityGroupsClient { + subClient, _ := NewSecurityGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSecurityPartnerProvidersClient() *SecurityPartnerProvidersClient { + subClient, _ := NewSecurityPartnerProvidersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSecurityRulesClient() *SecurityRulesClient { + subClient, _ := NewSecurityRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewServiceAssociationLinksClient() *ServiceAssociationLinksClient { + subClient, _ := NewServiceAssociationLinksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewServiceEndpointPoliciesClient() *ServiceEndpointPoliciesClient { + subClient, _ := NewServiceEndpointPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewServiceEndpointPolicyDefinitionsClient() *ServiceEndpointPolicyDefinitionsClient { + subClient, _ := NewServiceEndpointPolicyDefinitionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewServiceTagInformationClient() *ServiceTagInformationClient { + subClient, _ := NewServiceTagInformationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewServiceTagsClient() *ServiceTagsClient { + subClient, _ := NewServiceTagsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewStaticMembersClient() *StaticMembersClient { + subClient, _ := NewStaticMembersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSubnetsClient() *SubnetsClient { + subClient, _ := NewSubnetsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSubscriptionNetworkManagerConnectionsClient() *SubscriptionNetworkManagerConnectionsClient { + subClient, _ := NewSubscriptionNetworkManagerConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewUsagesClient() *UsagesClient { + subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVPNConnectionsClient() *VPNConnectionsClient { + subClient, _ := NewVPNConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVPNGatewaysClient() *VPNGatewaysClient { + subClient, _ := NewVPNGatewaysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVPNLinkConnectionsClient() *VPNLinkConnectionsClient { + subClient, _ := NewVPNLinkConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVPNServerConfigurationsAssociatedWithVirtualWanClient() *VPNServerConfigurationsAssociatedWithVirtualWanClient { + subClient, _ := NewVPNServerConfigurationsAssociatedWithVirtualWanClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVPNServerConfigurationsClient() *VPNServerConfigurationsClient { + subClient, _ := NewVPNServerConfigurationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVPNSiteLinkConnectionsClient() *VPNSiteLinkConnectionsClient { + subClient, _ := NewVPNSiteLinkConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVPNSiteLinksClient() *VPNSiteLinksClient { + subClient, _ := NewVPNSiteLinksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVPNSitesClient() *VPNSitesClient { + subClient, _ := NewVPNSitesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVPNSitesConfigurationClient() *VPNSitesConfigurationClient { + subClient, _ := NewVPNSitesConfigurationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVipSwapClient() *VipSwapClient { + subClient, _ := NewVipSwapClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualApplianceConnectionsClient() *VirtualApplianceConnectionsClient { + subClient, _ := NewVirtualApplianceConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualApplianceSKUsClient() *VirtualApplianceSKUsClient { + subClient, _ := NewVirtualApplianceSKUsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualApplianceSitesClient() *VirtualApplianceSitesClient { + subClient, _ := NewVirtualApplianceSitesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualAppliancesClient() *VirtualAppliancesClient { + subClient, _ := NewVirtualAppliancesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualHubBgpConnectionClient() *VirtualHubBgpConnectionClient { + subClient, _ := NewVirtualHubBgpConnectionClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualHubBgpConnectionsClient() *VirtualHubBgpConnectionsClient { + subClient, _ := NewVirtualHubBgpConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualHubIPConfigurationClient() *VirtualHubIPConfigurationClient { + subClient, _ := NewVirtualHubIPConfigurationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualHubRouteTableV2SClient() *VirtualHubRouteTableV2SClient { + subClient, _ := NewVirtualHubRouteTableV2SClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualHubsClient() *VirtualHubsClient { + subClient, _ := NewVirtualHubsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualNetworkGatewayConnectionsClient() *VirtualNetworkGatewayConnectionsClient { + subClient, _ := NewVirtualNetworkGatewayConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualNetworkGatewayNatRulesClient() *VirtualNetworkGatewayNatRulesClient { + subClient, _ := NewVirtualNetworkGatewayNatRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualNetworkGatewaysClient() *VirtualNetworkGatewaysClient { + subClient, _ := NewVirtualNetworkGatewaysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualNetworkPeeringsClient() *VirtualNetworkPeeringsClient { + subClient, _ := NewVirtualNetworkPeeringsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualNetworkTapsClient() *VirtualNetworkTapsClient { + subClient, _ := NewVirtualNetworkTapsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualNetworksClient() *VirtualNetworksClient { + subClient, _ := NewVirtualNetworksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualRouterPeeringsClient() *VirtualRouterPeeringsClient { + subClient, _ := NewVirtualRouterPeeringsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualRoutersClient() *VirtualRoutersClient { + subClient, _ := NewVirtualRoutersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVirtualWansClient() *VirtualWansClient { + subClient, _ := NewVirtualWansClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWatchersClient() *WatchersClient { + subClient, _ := NewWatchersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWebApplicationFirewallPoliciesClient() *WebApplicationFirewallPoliciesClient { + subClient, _ := NewWebApplicationFirewallPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewWebCategoriesClient() *WebCategoriesClient { + subClient, _ := NewWebCategoriesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/configurationpolicygroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/configurationpolicygroups_client.go new file mode 100644 index 000000000..864b8e202 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/configurationpolicygroups_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ConfigurationPolicyGroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ConfigurationPolicyGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConfigurationPolicyGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConfigurationPolicyGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ConfigurationPolicyGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, vpnServerConfigurationPolicyGroupParameters VPNServerConfigurationPolicyGroup, options *ConfigurationPolicyGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName, vpnServerConfigurationPolicyGroupParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnServerConfigurationPolicyGroupParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a ConfigurationPolicyGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConfigurationPolicyGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConfigurationPolicyGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a ConfigurationPolicyGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ConfigurationPolicyGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, options *ConfigurationPolicyGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName, options) + if err != nil { + return ConfigurationPolicyGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConfigurationPolicyGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConfigurationPolicyGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListByVPNServerConfigurationPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/connectionmonitors_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/connectionmonitors_client.go new file mode 100644 index 000000000..d3a726752 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/connectionmonitors_client.go @@ -0,0 +1,626 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ConnectionMonitorsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ConnectionMonitorsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectionMonitorsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create or update a connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ConnectionMonitorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor, options *ConnectionMonitorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectionMonitorsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ConnectionMonitorsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return ConnectionMonitorsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectionMonitorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConnectionMonitorsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectionMonitorsClientQueryResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientQueryResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ConnectionMonitorsClient) query(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginQueryOptions) (*http.Response, error) { + var err error + req, err := client.queryCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectionMonitorsClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Start - Starts the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ConnectionMonitorsClient) start(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginStartOptions) (*http.Response, error) { + var err error + req, err := client.startCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectionMonitorsClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Stop - Stops the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ConnectionMonitorsClient) stop(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginStopOptions) (*http.Response, error) { + var err error + req, err := client.stopCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options) + if err != nil { + return ConnectionMonitorsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectionMonitorsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConnectionMonitorsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/connectivityconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/connectivityconfigurations_client.go new file mode 100644 index 000000000..4a9d51534 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/connectivityconfigurations_client.go @@ -0,0 +1,339 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ConnectivityConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ConnectivityConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, connectivityConfiguration, options) + if err != nil { + return ConnectivityConfigurationsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectivityConfigurationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ConnectivityConfigurationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, connectivityConfiguration); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectivityConfigurationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ConnectivityConfigurationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ConnectivityConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *ConnectivityConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return ConnectivityConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ConnectivityConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConnectivityConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/constants.go new file mode 100644 index 000000000..ad3170b2d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/constants.go @@ -0,0 +1,4198 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +const ( + moduleName = "armnetwork" + moduleVersion = "v4.2.0" +) + +// 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, + } +} + +// AdminState - Property to indicate if the Express Route Gateway serves traffic when there are multiple Express Route Gateways +// in the vnet +type AdminState string + +const ( + AdminStateDisabled AdminState = "Disabled" + AdminStateEnabled AdminState = "Enabled" +) + +// PossibleAdminStateValues returns the possible values for the AdminState const type. +func PossibleAdminStateValues() []AdminState { + return []AdminState{ + AdminStateDisabled, + AdminStateEnabled, + } +} + +// 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 custom error. +type ApplicationGatewayCustomErrorStatusCode string + +const ( + ApplicationGatewayCustomErrorStatusCodeHTTPStatus400 ApplicationGatewayCustomErrorStatusCode = "HttpStatus400" + ApplicationGatewayCustomErrorStatusCodeHTTPStatus403 ApplicationGatewayCustomErrorStatusCode = "HttpStatus403" + ApplicationGatewayCustomErrorStatusCodeHTTPStatus404 ApplicationGatewayCustomErrorStatusCode = "HttpStatus404" + ApplicationGatewayCustomErrorStatusCodeHTTPStatus405 ApplicationGatewayCustomErrorStatusCode = "HttpStatus405" + ApplicationGatewayCustomErrorStatusCodeHTTPStatus408 ApplicationGatewayCustomErrorStatusCode = "HttpStatus408" + ApplicationGatewayCustomErrorStatusCodeHTTPStatus500 ApplicationGatewayCustomErrorStatusCode = "HttpStatus500" + ApplicationGatewayCustomErrorStatusCodeHTTPStatus502 ApplicationGatewayCustomErrorStatusCode = "HttpStatus502" + ApplicationGatewayCustomErrorStatusCodeHTTPStatus503 ApplicationGatewayCustomErrorStatusCode = "HttpStatus503" + ApplicationGatewayCustomErrorStatusCodeHTTPStatus504 ApplicationGatewayCustomErrorStatusCode = "HttpStatus504" +) + +// PossibleApplicationGatewayCustomErrorStatusCodeValues returns the possible values for the ApplicationGatewayCustomErrorStatusCode const type. +func PossibleApplicationGatewayCustomErrorStatusCodeValues() []ApplicationGatewayCustomErrorStatusCode { + return []ApplicationGatewayCustomErrorStatusCode{ + ApplicationGatewayCustomErrorStatusCodeHTTPStatus400, + ApplicationGatewayCustomErrorStatusCodeHTTPStatus403, + ApplicationGatewayCustomErrorStatusCodeHTTPStatus404, + ApplicationGatewayCustomErrorStatusCodeHTTPStatus405, + ApplicationGatewayCustomErrorStatusCodeHTTPStatus408, + ApplicationGatewayCustomErrorStatusCodeHTTPStatus500, + ApplicationGatewayCustomErrorStatusCodeHTTPStatus502, + ApplicationGatewayCustomErrorStatusCodeHTTPStatus503, + ApplicationGatewayCustomErrorStatusCodeHTTPStatus504, + } +} + +// 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, + } +} + +// ApplicationGatewayFirewallRateLimitDuration - Duration over which Rate Limit policy will be applied. Applies only when +// ruleType is RateLimitRule. +type ApplicationGatewayFirewallRateLimitDuration string + +const ( + ApplicationGatewayFirewallRateLimitDurationFiveMins ApplicationGatewayFirewallRateLimitDuration = "FiveMins" + ApplicationGatewayFirewallRateLimitDurationOneMin ApplicationGatewayFirewallRateLimitDuration = "OneMin" +) + +// PossibleApplicationGatewayFirewallRateLimitDurationValues returns the possible values for the ApplicationGatewayFirewallRateLimitDuration const type. +func PossibleApplicationGatewayFirewallRateLimitDurationValues() []ApplicationGatewayFirewallRateLimitDuration { + return []ApplicationGatewayFirewallRateLimitDuration{ + ApplicationGatewayFirewallRateLimitDurationFiveMins, + ApplicationGatewayFirewallRateLimitDurationOneMin, + } +} + +// ApplicationGatewayFirewallUserSessionVariable - User Session clause variable. +type ApplicationGatewayFirewallUserSessionVariable string + +const ( + ApplicationGatewayFirewallUserSessionVariableClientAddr ApplicationGatewayFirewallUserSessionVariable = "ClientAddr" + ApplicationGatewayFirewallUserSessionVariableGeoLocation ApplicationGatewayFirewallUserSessionVariable = "GeoLocation" + ApplicationGatewayFirewallUserSessionVariableNone ApplicationGatewayFirewallUserSessionVariable = "None" +) + +// PossibleApplicationGatewayFirewallUserSessionVariableValues returns the possible values for the ApplicationGatewayFirewallUserSessionVariable const type. +func PossibleApplicationGatewayFirewallUserSessionVariableValues() []ApplicationGatewayFirewallUserSessionVariable { + return []ApplicationGatewayFirewallUserSessionVariable{ + ApplicationGatewayFirewallUserSessionVariableClientAddr, + ApplicationGatewayFirewallUserSessionVariableGeoLocation, + ApplicationGatewayFirewallUserSessionVariableNone, + } +} + +// 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 ( + ApplicationGatewaySKUNameBasic ApplicationGatewaySKUName = "Basic" + 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{ + ApplicationGatewaySKUNameBasic, + 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 ( + ApplicationGatewayTierBasic ApplicationGatewayTier = "Basic" + 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{ + ApplicationGatewayTierBasic, + 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, + } +} + +// AzureFirewallPacketCaptureFlagsType - The flags type to be captured. +type AzureFirewallPacketCaptureFlagsType string + +const ( + AzureFirewallPacketCaptureFlagsTypeAck AzureFirewallPacketCaptureFlagsType = "ack" + AzureFirewallPacketCaptureFlagsTypeFin AzureFirewallPacketCaptureFlagsType = "fin" + AzureFirewallPacketCaptureFlagsTypePush AzureFirewallPacketCaptureFlagsType = "push" + AzureFirewallPacketCaptureFlagsTypeRst AzureFirewallPacketCaptureFlagsType = "rst" + AzureFirewallPacketCaptureFlagsTypeSyn AzureFirewallPacketCaptureFlagsType = "syn" + AzureFirewallPacketCaptureFlagsTypeUrg AzureFirewallPacketCaptureFlagsType = "urg" +) + +// PossibleAzureFirewallPacketCaptureFlagsTypeValues returns the possible values for the AzureFirewallPacketCaptureFlagsType const type. +func PossibleAzureFirewallPacketCaptureFlagsTypeValues() []AzureFirewallPacketCaptureFlagsType { + return []AzureFirewallPacketCaptureFlagsType{ + AzureFirewallPacketCaptureFlagsTypeAck, + AzureFirewallPacketCaptureFlagsTypeFin, + AzureFirewallPacketCaptureFlagsTypePush, + AzureFirewallPacketCaptureFlagsTypeRst, + AzureFirewallPacketCaptureFlagsTypeSyn, + AzureFirewallPacketCaptureFlagsTypeUrg, + } +} + +// 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 ( + FirewallPolicyIDPSSignatureDirectionOne FirewallPolicyIDPSSignatureDirection = 1 + FirewallPolicyIDPSSignatureDirectionTwo FirewallPolicyIDPSSignatureDirection = 2 + FirewallPolicyIDPSSignatureDirectionZero FirewallPolicyIDPSSignatureDirection = 0 +) + +// PossibleFirewallPolicyIDPSSignatureDirectionValues returns the possible values for the FirewallPolicyIDPSSignatureDirection const type. +func PossibleFirewallPolicyIDPSSignatureDirectionValues() []FirewallPolicyIDPSSignatureDirection { + return []FirewallPolicyIDPSSignatureDirection{ + FirewallPolicyIDPSSignatureDirectionOne, + FirewallPolicyIDPSSignatureDirectionTwo, + FirewallPolicyIDPSSignatureDirectionZero, + } +} + +// FirewallPolicyIDPSSignatureMode - The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny +type FirewallPolicyIDPSSignatureMode int32 + +const ( + FirewallPolicyIDPSSignatureModeOne FirewallPolicyIDPSSignatureMode = 1 + FirewallPolicyIDPSSignatureModeTwo FirewallPolicyIDPSSignatureMode = 2 + FirewallPolicyIDPSSignatureModeZero FirewallPolicyIDPSSignatureMode = 0 +) + +// PossibleFirewallPolicyIDPSSignatureModeValues returns the possible values for the FirewallPolicyIDPSSignatureMode const type. +func PossibleFirewallPolicyIDPSSignatureModeValues() []FirewallPolicyIDPSSignatureMode { + return []FirewallPolicyIDPSSignatureMode{ + FirewallPolicyIDPSSignatureModeOne, + FirewallPolicyIDPSSignatureModeTwo, + FirewallPolicyIDPSSignatureModeZero, + } +} + +// FirewallPolicyIDPSSignatureSeverity - Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High +type FirewallPolicyIDPSSignatureSeverity int32 + +const ( + FirewallPolicyIDPSSignatureSeverityOne FirewallPolicyIDPSSignatureSeverity = 1 + FirewallPolicyIDPSSignatureSeverityThree FirewallPolicyIDPSSignatureSeverity = 3 + FirewallPolicyIDPSSignatureSeverityTwo FirewallPolicyIDPSSignatureSeverity = 2 +) + +// PossibleFirewallPolicyIDPSSignatureSeverityValues returns the possible values for the FirewallPolicyIDPSSignatureSeverity const type. +func PossibleFirewallPolicyIDPSSignatureSeverityValues() []FirewallPolicyIDPSSignatureSeverity { + return []FirewallPolicyIDPSSignatureSeverity{ + FirewallPolicyIDPSSignatureSeverityOne, + FirewallPolicyIDPSSignatureSeverityThree, + FirewallPolicyIDPSSignatureSeverityTwo, + } +} + +// 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" + LoadBalancerBackendAddressAdminStateNone LoadBalancerBackendAddressAdminState = "None" + LoadBalancerBackendAddressAdminStateUp LoadBalancerBackendAddressAdminState = "Up" +) + +// PossibleLoadBalancerBackendAddressAdminStateValues returns the possible values for the LoadBalancerBackendAddressAdminState const type. +func PossibleLoadBalancerBackendAddressAdminStateValues() []LoadBalancerBackendAddressAdminState { + return []LoadBalancerBackendAddressAdminState{ + LoadBalancerBackendAddressAdminStateDown, + 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 ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeMaxConnections NetworkInterfaceAuxiliaryMode = "MaxConnections" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +// PossibleNetworkInterfaceAuxiliaryModeValues returns the possible values for the NetworkInterfaceAuxiliaryMode const type. +func PossibleNetworkInterfaceAuxiliaryModeValues() []NetworkInterfaceAuxiliaryMode { + return []NetworkInterfaceAuxiliaryMode{ + NetworkInterfaceAuxiliaryModeAcceleratedConnections, + NetworkInterfaceAuxiliaryModeFloating, + NetworkInterfaceAuxiliaryModeMaxConnections, + NetworkInterfaceAuxiliaryModeNone, + } +} + +// NetworkInterfaceAuxiliarySKU - Auxiliary sku of Network Interface resource. +type NetworkInterfaceAuxiliarySKU string + +const ( + NetworkInterfaceAuxiliarySKUA1 NetworkInterfaceAuxiliarySKU = "A1" + NetworkInterfaceAuxiliarySKUA2 NetworkInterfaceAuxiliarySKU = "A2" + NetworkInterfaceAuxiliarySKUA4 NetworkInterfaceAuxiliarySKU = "A4" + NetworkInterfaceAuxiliarySKUA8 NetworkInterfaceAuxiliarySKU = "A8" + NetworkInterfaceAuxiliarySKUNone NetworkInterfaceAuxiliarySKU = "None" +) + +// PossibleNetworkInterfaceAuxiliarySKUValues returns the possible values for the NetworkInterfaceAuxiliarySKU const type. +func PossibleNetworkInterfaceAuxiliarySKUValues() []NetworkInterfaceAuxiliarySKU { + return []NetworkInterfaceAuxiliarySKU{ + NetworkInterfaceAuxiliarySKUA1, + NetworkInterfaceAuxiliarySKUA2, + NetworkInterfaceAuxiliarySKUA4, + NetworkInterfaceAuxiliarySKUA8, + NetworkInterfaceAuxiliarySKUNone, + } +} + +// 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, + } +} + +// PublicIPAddressDNSSettingsDomainNameLabelScope - The domain name label scope. If a domain name label and a domain name +// label scope are specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system with a hashed +// value +// includes in FQDN. +type PublicIPAddressDNSSettingsDomainNameLabelScope string + +const ( + PublicIPAddressDNSSettingsDomainNameLabelScopeNoReuse PublicIPAddressDNSSettingsDomainNameLabelScope = "NoReuse" + PublicIPAddressDNSSettingsDomainNameLabelScopeResourceGroupReuse PublicIPAddressDNSSettingsDomainNameLabelScope = "ResourceGroupReuse" + PublicIPAddressDNSSettingsDomainNameLabelScopeSubscriptionReuse PublicIPAddressDNSSettingsDomainNameLabelScope = "SubscriptionReuse" + PublicIPAddressDNSSettingsDomainNameLabelScopeTenantReuse PublicIPAddressDNSSettingsDomainNameLabelScope = "TenantReuse" +) + +// PossiblePublicIPAddressDNSSettingsDomainNameLabelScopeValues returns the possible values for the PublicIPAddressDNSSettingsDomainNameLabelScope const type. +func PossiblePublicIPAddressDNSSettingsDomainNameLabelScopeValues() []PublicIPAddressDNSSettingsDomainNameLabelScope { + return []PublicIPAddressDNSSettingsDomainNameLabelScope{ + PublicIPAddressDNSSettingsDomainNameLabelScopeNoReuse, + PublicIPAddressDNSSettingsDomainNameLabelScopeResourceGroupReuse, + PublicIPAddressDNSSettingsDomainNameLabelScopeSubscriptionReuse, + PublicIPAddressDNSSettingsDomainNameLabelScopeTenantReuse, + } +} + +// 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 ( + ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeNone, + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeSystemAssignedUserAssigned, + ResourceIdentityTypeUserAssigned, + } +} + +// 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, + } +} + +// ScrubbingRuleEntryMatchOperator - When matchVariable is a collection, operate on the selector to specify which elements +// in the collection this rule applies to. +type ScrubbingRuleEntryMatchOperator string + +const ( + ScrubbingRuleEntryMatchOperatorEquals ScrubbingRuleEntryMatchOperator = "Equals" + ScrubbingRuleEntryMatchOperatorEqualsAny ScrubbingRuleEntryMatchOperator = "EqualsAny" +) + +// PossibleScrubbingRuleEntryMatchOperatorValues returns the possible values for the ScrubbingRuleEntryMatchOperator const type. +func PossibleScrubbingRuleEntryMatchOperatorValues() []ScrubbingRuleEntryMatchOperator { + return []ScrubbingRuleEntryMatchOperator{ + ScrubbingRuleEntryMatchOperatorEquals, + ScrubbingRuleEntryMatchOperatorEqualsAny, + } +} + +// ScrubbingRuleEntryMatchVariable - The variable to be scrubbed from the logs. +type ScrubbingRuleEntryMatchVariable string + +const ( + ScrubbingRuleEntryMatchVariableRequestArgNames ScrubbingRuleEntryMatchVariable = "RequestArgNames" + ScrubbingRuleEntryMatchVariableRequestCookieNames ScrubbingRuleEntryMatchVariable = "RequestCookieNames" + ScrubbingRuleEntryMatchVariableRequestHeaderNames ScrubbingRuleEntryMatchVariable = "RequestHeaderNames" + ScrubbingRuleEntryMatchVariableRequestIPAddress ScrubbingRuleEntryMatchVariable = "RequestIPAddress" + ScrubbingRuleEntryMatchVariableRequestJSONArgNames ScrubbingRuleEntryMatchVariable = "RequestJSONArgNames" + ScrubbingRuleEntryMatchVariableRequestPostArgNames ScrubbingRuleEntryMatchVariable = "RequestPostArgNames" +) + +// PossibleScrubbingRuleEntryMatchVariableValues returns the possible values for the ScrubbingRuleEntryMatchVariable const type. +func PossibleScrubbingRuleEntryMatchVariableValues() []ScrubbingRuleEntryMatchVariable { + return []ScrubbingRuleEntryMatchVariable{ + ScrubbingRuleEntryMatchVariableRequestArgNames, + ScrubbingRuleEntryMatchVariableRequestCookieNames, + ScrubbingRuleEntryMatchVariableRequestHeaderNames, + ScrubbingRuleEntryMatchVariableRequestIPAddress, + ScrubbingRuleEntryMatchVariableRequestJSONArgNames, + ScrubbingRuleEntryMatchVariableRequestPostArgNames, + } +} + +// ScrubbingRuleEntryState - Defines the state of log scrubbing rule. Default value is Enabled. +type ScrubbingRuleEntryState string + +const ( + ScrubbingRuleEntryStateDisabled ScrubbingRuleEntryState = "Disabled" + ScrubbingRuleEntryStateEnabled ScrubbingRuleEntryState = "Enabled" +) + +// PossibleScrubbingRuleEntryStateValues returns the possible values for the ScrubbingRuleEntryState const type. +func PossibleScrubbingRuleEntryStateValues() []ScrubbingRuleEntryState { + return []ScrubbingRuleEntryState{ + ScrubbingRuleEntryStateDisabled, + ScrubbingRuleEntryStateEnabled, + } +} + +// 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, + } +} + +// SyncMode - Backend address synchronous mode for the backend pool +type SyncMode string + +const ( + SyncModeAutomatic SyncMode = "Automatic" + SyncModeManual SyncMode = "Manual" +) + +// PossibleSyncModeValues returns the possible values for the SyncMode const type. +func PossibleSyncModeValues() []SyncMode { + return []SyncMode{ + SyncModeAutomatic, + SyncModeManual, + } +} + +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" + WebApplicationFirewallRuleTypeRateLimitRule WebApplicationFirewallRuleType = "RateLimitRule" +) + +// PossibleWebApplicationFirewallRuleTypeValues returns the possible values for the WebApplicationFirewallRuleType const type. +func PossibleWebApplicationFirewallRuleTypeValues() []WebApplicationFirewallRuleType { + return []WebApplicationFirewallRuleType{ + WebApplicationFirewallRuleTypeInvalid, + WebApplicationFirewallRuleTypeMatchRule, + WebApplicationFirewallRuleTypeRateLimitRule, + } +} + +// WebApplicationFirewallScrubbingState - State of the log scrubbing config. Default value is Enabled. +type WebApplicationFirewallScrubbingState string + +const ( + WebApplicationFirewallScrubbingStateDisabled WebApplicationFirewallScrubbingState = "Disabled" + WebApplicationFirewallScrubbingStateEnabled WebApplicationFirewallScrubbingState = "Enabled" +) + +// PossibleWebApplicationFirewallScrubbingStateValues returns the possible values for the WebApplicationFirewallScrubbingState const type. +func PossibleWebApplicationFirewallScrubbingStateValues() []WebApplicationFirewallScrubbingState { + return []WebApplicationFirewallScrubbingState{ + WebApplicationFirewallScrubbingStateDisabled, + WebApplicationFirewallScrubbingStateEnabled, + } +} + +// WebApplicationFirewallState - Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not +// specified. +type WebApplicationFirewallState string + +const ( + WebApplicationFirewallStateDisabled WebApplicationFirewallState = "Disabled" + WebApplicationFirewallStateEnabled WebApplicationFirewallState = "Enabled" +) + +// PossibleWebApplicationFirewallStateValues returns the possible values for the WebApplicationFirewallState const type. +func PossibleWebApplicationFirewallStateValues() []WebApplicationFirewallState { + return []WebApplicationFirewallState{ + WebApplicationFirewallStateDisabled, + WebApplicationFirewallStateEnabled, + } +} + +// 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/v4/customipprefixes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/customipprefixes_client.go new file mode 100644 index 000000000..8cead915f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/customipprefixes_client.go @@ -0,0 +1,442 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".CustomIPPrefixesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CustomIPPrefixesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomIPPrefixesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[CustomIPPrefixesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a custom IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *CustomIPPrefixesClient) createOrUpdate(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters CustomIPPrefix, options *CustomIPPrefixesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customIPPrefixName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified custom IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomIPPrefixesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[CustomIPPrefixesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified custom IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *CustomIPPrefixesClient) deleteOperation(ctx context.Context, resourceGroupName string, customIPPrefixName string, options *CustomIPPrefixesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, customIPPrefixName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, customIPPrefixName, options) + if err != nil { + return CustomIPPrefixesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomIPPrefixesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomIPPrefixesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - CustomIPPrefixesClientListOptions contains the optional parameters for the CustomIPPrefixesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - CustomIPPrefixesClientListAllOptions contains the optional parameters for the CustomIPPrefixesClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, customIPPrefixName, parameters, options) + if err != nil { + return CustomIPPrefixesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomIPPrefixesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomIPPrefixesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/ddoscustompolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/ddoscustompolicies_client.go new file mode 100644 index 000000000..fd0568c90 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/ddoscustompolicies_client.go @@ -0,0 +1,314 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".DdosCustomPoliciesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DdosCustomPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DdosCustomPoliciesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DdosCustomPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a DDoS custom policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *DdosCustomPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters DdosCustomPolicy, options *DdosCustomPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ddosCustomPolicyName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified DDoS custom policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DdosCustomPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DdosCustomPoliciesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified DDoS custom policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *DdosCustomPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, options *DdosCustomPoliciesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, ddosCustomPolicyName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, ddosCustomPolicyName, options) + if err != nil { + return DdosCustomPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DdosCustomPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DdosCustomPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, ddosCustomPolicyName, parameters, options) + if err != nil { + return DdosCustomPoliciesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DdosCustomPoliciesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DdosCustomPoliciesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/ddosprotectionplans_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/ddosprotectionplans_client.go new file mode 100644 index 000000000..d8fc5263a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/ddosprotectionplans_client.go @@ -0,0 +1,439 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".DdosProtectionPlansClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DdosProtectionPlansClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DdosProtectionPlansClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DdosProtectionPlansClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a DDoS protection plan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *DdosProtectionPlansClient) createOrUpdate(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters DdosProtectionPlan, options *DdosProtectionPlansClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ddosProtectionPlanName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified DDoS protection plan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DdosProtectionPlansClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DdosProtectionPlansClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified DDoS protection plan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *DdosProtectionPlansClient) deleteOperation(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, options *DdosProtectionPlansClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, ddosProtectionPlanName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, ddosProtectionPlanName, options) + if err != nil { + return DdosProtectionPlansClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DdosProtectionPlansClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DdosProtectionPlansClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - DdosProtectionPlansClientListOptions contains the optional parameters for the DdosProtectionPlansClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - DdosProtectionPlansClientListByResourceGroupOptions contains the optional parameters for the DdosProtectionPlansClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, ddosProtectionPlanName, parameters, options) + if err != nil { + return DdosProtectionPlansClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DdosProtectionPlansClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DdosProtectionPlansClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/defaultsecurityrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/defaultsecurityrules_client.go new file mode 100644 index 000000000..50b21fe78 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/defaultsecurityrules_client.go @@ -0,0 +1,181 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".DefaultSecurityRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DefaultSecurityRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName, options) + if err != nil { + return DefaultSecurityRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DefaultSecurityRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DefaultSecurityRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/dscpconfiguration_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/dscpconfiguration_client.go new file mode 100644 index 000000000..4394ca4bd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/dscpconfiguration_client.go @@ -0,0 +1,374 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".DscpConfigurationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DscpConfigurationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a DSCP Configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DscpConfigurationClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DscpConfigurationClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a DSCP Configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *DscpConfigurationClient) createOrUpdate(ctx context.Context, resourceGroupName string, dscpConfigurationName string, parameters DscpConfiguration, options *DscpConfigurationClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, dscpConfigurationName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a DSCP Configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DscpConfigurationClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DscpConfigurationClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a DSCP Configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *DscpConfigurationClient) deleteOperation(ctx context.Context, resourceGroupName string, dscpConfigurationName string, options *DscpConfigurationClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, dscpConfigurationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, dscpConfigurationName, options) + if err != nil { + return DscpConfigurationClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DscpConfigurationClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DscpConfigurationClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - DscpConfigurationClientListOptions contains the optional parameters for the DscpConfigurationClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - DscpConfigurationClientListAllOptions contains the optional parameters for the DscpConfigurationClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressroutecircuitauthorizations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecircuitauthorizations_client.go new file mode 100644 index 000000000..dd4058dd3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecircuitauthorizations_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteCircuitAuthorizationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCircuitAuthorizationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitAuthorizationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitAuthorizationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCircuitAuthorizationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, options *ExpressRouteCircuitAuthorizationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, circuitName, authorizationName, authorizationParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, authorizationParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitAuthorizationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitAuthorizationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCircuitAuthorizationsClient) deleteOperation(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, options *ExpressRouteCircuitAuthorizationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, circuitName, authorizationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, authorizationName, options) + if err != nil { + return ExpressRouteCircuitAuthorizationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCircuitAuthorizationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCircuitAuthorizationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - circuitName - The name of the circuit. +// - options - ExpressRouteCircuitAuthorizationsClientListOptions contains the optional parameters for the ExpressRouteCircuitAuthorizationsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressroutecircuitconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecircuitconnections_client.go new file mode 100644 index 000000000..6418a6761 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecircuitconnections_client.go @@ -0,0 +1,356 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteCircuitConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCircuitConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCircuitConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, expressRouteCircuitConnectionParameters ExpressRouteCircuitConnection, options *ExpressRouteCircuitConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, expressRouteCircuitConnectionParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCircuitConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, options *ExpressRouteCircuitConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, circuitName, peeringName, connectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, peeringName, connectionName, options) + if err != nil { + return ExpressRouteCircuitConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCircuitConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCircuitConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressroutecircuitpeerings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecircuitpeerings_client.go new file mode 100644 index 000000000..af49b8922 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecircuitpeerings_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteCircuitPeeringsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCircuitPeeringsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitPeeringsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitPeeringsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCircuitPeeringsClient) createOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, options *ExpressRouteCircuitPeeringsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, circuitName, peeringName, peeringParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, peeringParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitPeeringsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitPeeringsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCircuitPeeringsClient) deleteOperation(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitPeeringsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, circuitName, peeringName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, peeringName, options) + if err != nil { + return ExpressRouteCircuitPeeringsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCircuitPeeringsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCircuitPeeringsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressroutecircuits_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecircuits_client.go new file mode 100644 index 000000000..689c1024d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecircuits_client.go @@ -0,0 +1,810 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteCircuitsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCircuitsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates an express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ExpressRouteCircuitsClient) createOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, options *ExpressRouteCircuitsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, circuitName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ExpressRouteCircuitsClient) deleteOperation(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, circuitName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, options) + if err != nil { + return ExpressRouteCircuitsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCircuitsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCircuitsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getPeeringStatsCreateRequest(ctx, resourceGroupName, circuitName, peeringName, options) + if err != nil { + return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err + } + resp, err := client.getPeeringStatsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getStatsCreateRequest(ctx, resourceGroupName, circuitName, options) + if err != nil { + return ExpressRouteCircuitsClientGetStatsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCircuitsClientGetStatsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCircuitsClientGetStatsResponse{}, err + } + resp, err := client.getStatsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - ExpressRouteCircuitsClientListOptions contains the optional parameters for the ExpressRouteCircuitsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ExpressRouteCircuitsClientListAllOptions contains the optional parameters for the ExpressRouteCircuitsClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientListArpTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientListArpTableResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCircuitsClient) listArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListArpTableOptions) (*http.Response, error) { + var err error + req, err := client.listArpTableCreateRequest(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientListRoutesTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientListRoutesTableResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCircuitsClient) listRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableOptions) (*http.Response, error) { + var err error + req, err := client.listRoutesTableCreateRequest(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientListRoutesTableSummaryResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientListRoutesTableSummaryResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCircuitsClient) listRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions) (*http.Response, error) { + var err error + req, err := client.listRoutesTableSummaryCreateRequest(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, circuitName, parameters, options) + if err != nil { + return ExpressRouteCircuitsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCircuitsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCircuitsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/expressrouteconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteconnections_client.go new file mode 100644 index 000000000..b96b91628 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteconnections_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, putExpressRouteConnectionParameters ExpressRouteConnection, options *ExpressRouteConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, putExpressRouteConnectionParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a connection to a ExpressRoute circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a connection to a ExpressRoute circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ExpressRouteConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, options *ExpressRouteConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, connectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, connectionName, options) + if err != nil { + return ExpressRouteConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.listCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, options) + if err != nil { + return ExpressRouteConnectionsClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteConnectionsClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressroutecrossconnectionpeerings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecrossconnectionpeerings_client.go new file mode 100644 index 000000000..7fe9b5b69 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecrossconnectionpeerings_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteCrossConnectionPeeringsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCrossConnectionPeeringsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCrossConnectionPeeringsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionPeeringsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCrossConnectionPeeringsClient) createOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, peeringParameters ExpressRouteCrossConnectionPeering, options *ExpressRouteCrossConnectionPeeringsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, peeringParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, peeringParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified peering from the ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCrossConnectionPeeringsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionPeeringsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified peering from the ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ExpressRouteCrossConnectionPeeringsClient) deleteOperation(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, options *ExpressRouteCrossConnectionPeeringsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, options) + if err != nil { + return ExpressRouteCrossConnectionPeeringsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCrossConnectionPeeringsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCrossConnectionPeeringsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - crossConnectionName - The name of the ExpressRouteCrossConnection. +// - options - ExpressRouteCrossConnectionPeeringsClientListOptions contains the optional parameters for the ExpressRouteCrossConnectionPeeringsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressroutecrossconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecrossconnections_client.go new file mode 100644 index 000000000..8594fdff7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutecrossconnections_client.go @@ -0,0 +1,616 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteCrossConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCrossConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Update the specified ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCrossConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Update the specified ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ExpressRouteCrossConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection, options *ExpressRouteCrossConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, crossConnectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// Get - Gets details about the specified ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, crossConnectionName, options) + if err != nil { + return ExpressRouteCrossConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCrossConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCrossConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ExpressRouteCrossConnectionsClientListOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCrossConnectionsClientListArpTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionsClientListArpTableResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCrossConnectionsClient) listArpTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListArpTableOptions) (*http.Response, error) { + var err error + req, err := client.listArpTableCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - ExpressRouteCrossConnectionsClientListByResourceGroupOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCrossConnectionsClientListRoutesTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionsClientListRoutesTableResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCrossConnectionsClient) listRoutesTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListRoutesTableOptions) (*http.Response, error) { + var err error + req, err := client.listRoutesTableCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCrossConnectionsClientListRoutesTableSummaryResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionsClientListRoutesTableSummaryResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteCrossConnectionsClient) listRoutesTableSummary(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListRoutesTableSummaryOptions) (*http.Response, error) { + var err error + req, err := client.listRoutesTableSummaryCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, crossConnectionName, crossConnectionParameters, options) + if err != nil { + return ExpressRouteCrossConnectionsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteCrossConnectionsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteCrossConnectionsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, crossConnectionParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/expressroutegateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutegateways_client.go new file mode 100644 index 000000000..0bb66be65 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutegateways_client.go @@ -0,0 +1,433 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteGatewaysClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteGatewaysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, putExpressRouteGatewayParameters ExpressRouteGateway, options *ExpressRouteGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, putExpressRouteGatewayParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteGatewaysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRouteGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, options *ExpressRouteGatewaysClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, options) + if err != nil { + return ExpressRouteGatewaysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteGatewaysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ExpressRouteGatewaysClientListByResourceGroupResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteGatewaysClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteGatewaysClientListByResourceGroupResponse{}, err + } + resp, err := client.listByResourceGroupHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ExpressRouteGatewaysClientListBySubscriptionOptions contains the optional parameters for the ExpressRouteGatewaysClient.ListBySubscription +// method. +func (client *ExpressRouteGatewaysClient) ListBySubscription(ctx context.Context, options *ExpressRouteGatewaysClientListBySubscriptionOptions) (ExpressRouteGatewaysClientListBySubscriptionResponse, error) { + var err error + req, err := client.listBySubscriptionCreateRequest(ctx, options) + if err != nil { + return ExpressRouteGatewaysClientListBySubscriptionResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteGatewaysClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteGatewaysClientListBySubscriptionResponse{}, err + } + resp, err := client.listBySubscriptionHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteGatewaysClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteGatewaysClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateTags - Updates express route gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ExpressRouteGatewaysClient) updateTags(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, expressRouteGatewayParameters TagsObject, options *ExpressRouteGatewaysClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, expressRouteGatewayParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, expressRouteGatewayParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutelinks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutelinks_client.go new file mode 100644 index 000000000..e1343453c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressroutelinks_client.go @@ -0,0 +1,180 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteLinksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteLinksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Retrieves the specified ExpressRouteLink resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRoutePortName, linkName, options) + if err != nil { + return ExpressRouteLinksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteLinksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteLinksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressrouteportauthorizations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteportauthorizations_client.go new file mode 100644 index 000000000..53fcb6126 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteportauthorizations_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRoutePortAuthorizationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRoutePortAuthorizationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRoutePortAuthorizationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRoutePortAuthorizationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRoutePortAuthorizationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, authorizationParameters ExpressRoutePortAuthorization, options *ExpressRoutePortAuthorizationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, expressRoutePortName, authorizationName, authorizationParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, authorizationParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRoutePortAuthorizationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRoutePortAuthorizationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ExpressRoutePortAuthorizationsClient) deleteOperation(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, options *ExpressRoutePortAuthorizationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, expressRoutePortName, authorizationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRoutePortName, authorizationName, options) + if err != nil { + return ExpressRoutePortAuthorizationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRoutePortAuthorizationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRoutePortAuthorizationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressrouteports_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteports_client.go new file mode 100644 index 000000000..9fea55ab2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteports_client.go @@ -0,0 +1,504 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRoutePortsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRoutePortsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRoutePortsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRoutePortsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified ExpressRoutePort resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ExpressRoutePortsClient) createOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters ExpressRoutePort, options *ExpressRoutePortsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, expressRoutePortName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified ExpressRoutePort resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRoutePortsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExpressRoutePortsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified ExpressRoutePort resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ExpressRoutePortsClient) deleteOperation(ctx context.Context, resourceGroupName string, expressRoutePortName string, options *ExpressRoutePortsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, expressRoutePortName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.generateLOACreateRequest(ctx, resourceGroupName, expressRoutePortName, request, options) + if err != nil { + return ExpressRoutePortsClientGenerateLOAResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRoutePortsClientGenerateLOAResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRoutePortsClientGenerateLOAResponse{}, err + } + resp, err := client.generateLOAHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, request); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRoutePortName, options) + if err != nil { + return ExpressRoutePortsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRoutePortsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRoutePortsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ExpressRoutePortsClientListOptions contains the optional parameters for the ExpressRoutePortsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - ExpressRoutePortsClientListByResourceGroupOptions contains the optional parameters for the ExpressRoutePortsClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, expressRoutePortName, parameters, options) + if err != nil { + return ExpressRoutePortsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRoutePortsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRoutePortsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/expressrouteportslocations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteportslocations_client.go new file mode 100644 index 000000000..cf95f3272 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteportslocations_client.go @@ -0,0 +1,163 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRoutePortsLocationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRoutePortsLocationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, locationName, options) + if err != nil { + return ExpressRoutePortsLocationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRoutePortsLocationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRoutePortsLocationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ExpressRoutePortsLocationsClientListOptions contains the optional parameters for the ExpressRoutePortsLocationsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressrouteproviderportslocation_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteproviderportslocation_client.go new file mode 100644 index 000000000..078531a8f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteproviderportslocation_client.go @@ -0,0 +1,99 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteProviderPortsLocationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteProviderPortsLocationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-05-01 +// - options - ExpressRouteProviderPortsLocationClientListOptions contains the optional parameters for the ExpressRouteProviderPortsLocationClient.List +// method. +func (client *ExpressRouteProviderPortsLocationClient) List(ctx context.Context, options *ExpressRouteProviderPortsLocationClientListOptions) (ExpressRouteProviderPortsLocationClientListResponse, error) { + var err error + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return ExpressRouteProviderPortsLocationClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExpressRouteProviderPortsLocationClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExpressRouteProviderPortsLocationClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/expressrouteserviceproviders_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteserviceproviders_client.go new file mode 100644 index 000000000..35769d711 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/expressrouteserviceproviders_client.go @@ -0,0 +1,105 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ExpressRouteServiceProvidersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExpressRouteServiceProvidersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets all the available express route service providers. +// +// Generated from API version 2023-05-01 +// - options - ExpressRouteServiceProvidersClientListOptions contains the optional parameters for the ExpressRouteServiceProvidersClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/firewallpolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicies_client.go new file mode 100644 index 000000000..a76c5c665 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicies_client.go @@ -0,0 +1,442 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".FirewallPoliciesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallPoliciesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FirewallPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Firewall Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *FirewallPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters FirewallPolicy, options *FirewallPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified Firewall Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FirewallPoliciesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified Firewall Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *FirewallPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPoliciesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return FirewallPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - FirewallPoliciesClientListOptions contains the optional parameters for the FirewallPoliciesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - FirewallPoliciesClientListAllOptions contains the optional parameters for the FirewallPoliciesClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPoliciesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallPoliciesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallPoliciesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/firewallpolicyidpssignatures_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicyidpssignatures_client.go new file mode 100644 index 000000000..a86af8905 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicyidpssignatures_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".FirewallPolicyIdpsSignaturesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallPolicyIdpsSignaturesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallPolicyIdpsSignaturesClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/firewallpolicyidpssignaturesfiltervalues_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicyidpssignaturesfiltervalues_client.go new file mode 100644 index 000000000..a7b396d7c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicyidpssignaturesfiltervalues_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".FirewallPolicyIdpsSignaturesFilterValuesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallPolicyIdpsSignaturesFilterValuesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesFilterValuesClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesFilterValuesClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallPolicyIdpsSignaturesFilterValuesClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/firewallpolicyidpssignaturesoverrides_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicyidpssignaturesoverrides_client.go new file mode 100644 index 000000000..e71a33e51 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicyidpssignaturesoverrides_client.go @@ -0,0 +1,297 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".FirewallPolicyIdpsSignaturesOverridesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallPolicyIdpsSignaturesOverridesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallPolicyIdpsSignaturesOverridesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallPolicyIdpsSignaturesOverridesClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.patchCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPatchResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPatchResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallPolicyIdpsSignaturesOverridesClientPatchResponse{}, err + } + resp, err := client.patchHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.putCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallPolicyIdpsSignaturesOverridesClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/firewallpolicyrulecollectiongroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicyrulecollectiongroups_client.go new file mode 100644 index 000000000..da03590ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/firewallpolicyrulecollectiongroups_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".FirewallPolicyRuleCollectionGroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallPolicyRuleCollectionGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified FirewallPolicyRuleCollectionGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallPolicyRuleCollectionGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FirewallPolicyRuleCollectionGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified FirewallPolicyRuleCollectionGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *FirewallPolicyRuleCollectionGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, parameters FirewallPolicyRuleCollectionGroup, options *FirewallPolicyRuleCollectionGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified FirewallPolicyRuleCollectionGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallPolicyRuleCollectionGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FirewallPolicyRuleCollectionGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified FirewallPolicyRuleCollectionGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *FirewallPolicyRuleCollectionGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, options *FirewallPolicyRuleCollectionGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName, options) + if err != nil { + return FirewallPolicyRuleCollectionGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallPolicyRuleCollectionGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallPolicyRuleCollectionGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/flowlogs_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/flowlogs_client.go new file mode 100644 index 000000000..465e86008 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/flowlogs_client.go @@ -0,0 +1,401 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".FlowLogsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FlowLogsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FlowLogsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FlowLogsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *FlowLogsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters FlowLog, options *FlowLogsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkWatcherName, flowLogName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified flow log resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FlowLogsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FlowLogsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified flow log resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *FlowLogsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, options *FlowLogsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkWatcherName, flowLogName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkWatcherName, flowLogName, options) + if err != nil { + return FlowLogsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FlowLogsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FlowLogsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkWatcherName, flowLogName, parameters, options) + if err != nil { + return FlowLogsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FlowLogsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FlowLogsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/groups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/groups_client.go new file mode 100644 index 000000000..7c1521aae --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/groups_client.go @@ -0,0 +1,338 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".GroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a network group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, parameters, options) + if err != nil { + return GroupsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return GroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[GroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a network group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *GroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, options *GroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, options) + if err != nil { + return GroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/hubroutetables_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/hubroutetables_client.go new file mode 100644 index 000000000..831c44840 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/hubroutetables_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".HubRouteTablesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HubRouteTablesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubRouteTablesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[HubRouteTablesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *HubRouteTablesClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, routeTableParameters HubRouteTable, options *HubRouteTablesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, routeTableParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, routeTableParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a RouteTable. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubRouteTablesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[HubRouteTablesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a RouteTable. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *HubRouteTablesClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *HubRouteTablesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return HubRouteTablesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HubRouteTablesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HubRouteTablesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/hubvirtualnetworkconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/hubvirtualnetworkconnections_client.go new file mode 100644 index 000000000..d967eea8c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/hubvirtualnetworkconnections_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".HubVirtualNetworkConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HubVirtualNetworkConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubVirtualNetworkConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[HubVirtualNetworkConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *HubVirtualNetworkConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, hubVirtualNetworkConnectionParameters HubVirtualNetworkConnection, options *HubVirtualNetworkConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, hubVirtualNetworkConnectionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, hubVirtualNetworkConnectionParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a HubVirtualNetworkConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubVirtualNetworkConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[HubVirtualNetworkConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a HubVirtualNetworkConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *HubVirtualNetworkConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *HubVirtualNetworkConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return HubVirtualNetworkConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HubVirtualNetworkConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HubVirtualNetworkConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/inboundnatrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/inboundnatrules_client.go new file mode 100644 index 000000000..89906fcbc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/inboundnatrules_client.go @@ -0,0 +1,337 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".InboundNatRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &InboundNatRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InboundNatRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[InboundNatRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *InboundNatRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule, options *InboundNatRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, inboundNatRuleParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified load balancer inbound NAT rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InboundNatRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[InboundNatRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified load balancer inbound NAT rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *InboundNatRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, options *InboundNatRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, options) + if err != nil { + return InboundNatRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InboundNatRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InboundNatRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/inboundsecurityrule_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/inboundsecurityrule_client.go new file mode 100644 index 000000000..ca53f620f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/inboundsecurityrule_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".InboundSecurityRuleClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &InboundSecurityRuleClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InboundSecurityRuleClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[InboundSecurityRuleClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *InboundSecurityRuleClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, ruleCollectionName string, parameters InboundSecurityRule, options *InboundSecurityRuleClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, ruleCollectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaceipconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaceipconfigurations_client.go new file mode 100644 index 000000000..26a48e5b4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaceipconfigurations_client.go @@ -0,0 +1,181 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".InterfaceIPConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &InterfaceIPConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkInterfaceName, ipConfigurationName, options) + if err != nil { + return InterfaceIPConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InterfaceIPConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InterfaceIPConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/interfaceloadbalancers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaceloadbalancers_client.go new file mode 100644 index 000000000..3db51e4ba --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaceloadbalancers_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".InterfaceLoadBalancersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &InterfaceLoadBalancersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List all load balancers in a network interface. +// +// Generated from API version 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/interfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaces.go new file mode 100644 index 000000000..a153dd576 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaces.go @@ -0,0 +1,54 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaces_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaces_client.go new file mode 100644 index 000000000..43e9d6843 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfaces_client.go @@ -0,0 +1,1182 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".InterfacesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &InterfacesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfacesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[InterfacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *InterfacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface, options *InterfacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkInterfaceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfacesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[InterfacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *InterfacesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return InterfacesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InterfacesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InterfacesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCloudServiceNetworkInterfaceCreateRequest(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, options) + if err != nil { + return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err + } + resp, err := client.getCloudServiceNetworkInterfaceHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfacesClientGetEffectiveRouteTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[InterfacesClientGetEffectiveRouteTableResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *InterfacesClient) getEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginGetEffectiveRouteTableOptions) (*http.Response, error) { + var err error + req, err := client.getEffectiveRouteTableCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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) { + var err error + req, err := client.getVirtualMachineScaleSetIPConfigurationCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options) + if err != nil { + return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err + } + resp, err := client.getVirtualMachineScaleSetIPConfigurationHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + req, err := client.getVirtualMachineScaleSetNetworkInterfaceCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options) + if err != nil { + return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err + } + resp, err := client.getVirtualMachineScaleSetNetworkInterfaceHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - InterfacesClientListOptions contains the optional parameters for the InterfacesClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - InterfacesClientListAllOptions contains the optional parameters for the InterfacesClient.NewListAllPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListCloudServiceNetworkInterfacesPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListCloudServiceRoleInstanceNetworkInterfacesPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfacesClientListEffectiveNetworkSecurityGroupsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[InterfacesClientListEffectiveNetworkSecurityGroupsResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *InterfacesClient) listEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions) (*http.Response, error) { + var err error + req, err := client.listEffectiveNetworkSecurityGroupsCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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.NewListVirtualMachineScaleSetIPConfigurationsPager +// 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.internal.Pipeline().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.internal.Endpoint(), 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.NewListVirtualMachineScaleSetNetworkInterfacesPager +// 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.internal.Pipeline().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.internal.Endpoint(), 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.NewListVirtualMachineScaleSetVMNetworkInterfacesPager 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.internal.Pipeline().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.internal.Endpoint(), 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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkInterfaceName, parameters, options) + if err != nil { + return InterfacesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InterfacesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InterfacesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/interfacetapconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfacetapconfigurations_client.go new file mode 100644 index 000000000..eb334b62a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/interfacetapconfigurations_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".InterfaceTapConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &InterfaceTapConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfaceTapConfigurationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[InterfaceTapConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *InterfaceTapConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, tapConfigurationParameters InterfaceTapConfiguration, options *InterfaceTapConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, tapConfigurationParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified tap configuration from the NetworkInterface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfaceTapConfigurationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[InterfaceTapConfigurationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified tap configuration from the NetworkInterface. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *InterfaceTapConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, options *InterfaceTapConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName, options) + if err != nil { + return InterfaceTapConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InterfaceTapConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InterfaceTapConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/ipallocations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/ipallocations_client.go new file mode 100644 index 000000000..4bed5730b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/ipallocations_client.go @@ -0,0 +1,441 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".IPAllocationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IPAllocationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IPAllocationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[IPAllocationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *IPAllocationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters IPAllocation, options *IPAllocationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ipAllocationName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified IpAllocation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IPAllocationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[IPAllocationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified IpAllocation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *IPAllocationsClient) deleteOperation(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, ipAllocationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, ipAllocationName, options) + if err != nil { + return IPAllocationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IPAllocationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IPAllocationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - IPAllocationsClientListOptions contains the optional parameters for the IPAllocationsClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - IPAllocationsClientListByResourceGroupOptions contains the optional parameters for the IPAllocationsClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, ipAllocationName, parameters, options) + if err != nil { + return IPAllocationsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IPAllocationsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IPAllocationsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/ipgroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/ipgroups_client.go new file mode 100644 index 000000000..c64351ce1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/ipgroups_client.go @@ -0,0 +1,439 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".IPGroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IPGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IPGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[IPGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *IPGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters IPGroup, options *IPGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ipGroupsName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified ipGroups. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IPGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[IPGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified ipGroups. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *IPGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, ipGroupsName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, ipGroupsName, options) + if err != nil { + return IPGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IPGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IPGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - IPGroupsClientListOptions contains the optional parameters for the IPGroupsClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - IPGroupsClientListByResourceGroupOptions contains the optional parameters for the IPGroupsClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateGroupsCreateRequest(ctx, resourceGroupName, ipGroupsName, parameters, options) + if err != nil { + return IPGroupsClientUpdateGroupsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IPGroupsClientUpdateGroupsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IPGroupsClientUpdateGroupsResponse{}, err + } + resp, err := client.updateGroupsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/loadbalancerbackendaddresspools_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancerbackendaddresspools_client.go new file mode 100644 index 000000000..1ce4047e6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancerbackendaddresspools_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".LoadBalancerBackendAddressPoolsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LoadBalancerBackendAddressPoolsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LoadBalancerBackendAddressPoolsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LoadBalancerBackendAddressPoolsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *LoadBalancerBackendAddressPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, parameters BackendAddressPool, options *LoadBalancerBackendAddressPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified load balancer backend address pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LoadBalancerBackendAddressPoolsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LoadBalancerBackendAddressPoolsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified load balancer backend address pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *LoadBalancerBackendAddressPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, options *LoadBalancerBackendAddressPoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName, options) + if err != nil { + return LoadBalancerBackendAddressPoolsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LoadBalancerBackendAddressPoolsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LoadBalancerBackendAddressPoolsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/loadbalancerfrontendipconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancerfrontendipconfigurations_client.go new file mode 100644 index 000000000..6a09ff1d3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancerfrontendipconfigurations_client.go @@ -0,0 +1,181 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".LoadBalancerFrontendIPConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LoadBalancerFrontendIPConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets load balancer frontend IP configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, frontendIPConfigurationName, options) + if err != nil { + return LoadBalancerFrontendIPConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LoadBalancerFrontendIPConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LoadBalancerFrontendIPConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/loadbalancerloadbalancingrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancerloadbalancingrules_client.go new file mode 100644 index 000000000..6e07bbafc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancerloadbalancingrules_client.go @@ -0,0 +1,181 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".LoadBalancerLoadBalancingRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LoadBalancerLoadBalancingRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, loadBalancingRuleName, options) + if err != nil { + return LoadBalancerLoadBalancingRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LoadBalancerLoadBalancingRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LoadBalancerLoadBalancingRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/loadbalancernetworkinterfaces_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancernetworkinterfaces_client.go new file mode 100644 index 000000000..cf44ee9f9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancernetworkinterfaces_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".LoadBalancerNetworkInterfacesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LoadBalancerNetworkInterfacesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets associated load balancer network interfaces. +// +// Generated from API version 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/loadbalanceroutboundrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalanceroutboundrules_client.go new file mode 100644 index 000000000..538ae3abb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalanceroutboundrules_client.go @@ -0,0 +1,181 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".LoadBalancerOutboundRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LoadBalancerOutboundRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, outboundRuleName, options) + if err != nil { + return LoadBalancerOutboundRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LoadBalancerOutboundRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LoadBalancerOutboundRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/loadbalancerprobes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancerprobes_client.go new file mode 100644 index 000000000..573246dff --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancerprobes_client.go @@ -0,0 +1,180 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".LoadBalancerProbesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LoadBalancerProbesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets load balancer probe. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, probeName, options) + if err != nil { + return LoadBalancerProbesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LoadBalancerProbesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LoadBalancerProbesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/loadbalancers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancers_client.go new file mode 100644 index 000000000..7ebced80b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/loadbalancers_client.go @@ -0,0 +1,656 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".LoadBalancersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LoadBalancersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a load balancer. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LoadBalancersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LoadBalancersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a load balancer. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *LoadBalancersClient) createOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer, options *LoadBalancersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, loadBalancerName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified load balancer. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LoadBalancersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LoadBalancersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified load balancer. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *LoadBalancersClient) deleteOperation(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancersClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + if err != nil { + return LoadBalancersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LoadBalancersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LoadBalancersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - LoadBalancersClientListOptions contains the optional parameters for the LoadBalancersClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - LoadBalancersClientListAllOptions contains the optional parameters for the LoadBalancersClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LoadBalancersClientListInboundNatRulePortMappingsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LoadBalancersClientListInboundNatRulePortMappingsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// ListInboundNatRulePortMappings - List of inbound NAT rule port mappings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *LoadBalancersClient) listInboundNatRulePortMappings(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters QueryInboundNatRulePortMappingRequest, options *LoadBalancersClientBeginListInboundNatRulePortMappingsOptions) (*http.Response, error) { + var err error + req, err := client.listInboundNatRulePortMappingsCreateRequest(ctx, groupName, loadBalancerName, backendPoolName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// MigrateToIPBased - Migrate load balancer to IP Based +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +// - groupName - The name of the resource group. +// - loadBalancerName - The name of the load balancer. +// - options - LoadBalancersClientMigrateToIPBasedOptions contains the optional parameters for the LoadBalancersClient.MigrateToIPBased +// method. +func (client *LoadBalancersClient) MigrateToIPBased(ctx context.Context, groupName string, loadBalancerName string, options *LoadBalancersClientMigrateToIPBasedOptions) (LoadBalancersClientMigrateToIPBasedResponse, error) { + var err error + req, err := client.migrateToIPBasedCreateRequest(ctx, groupName, loadBalancerName, options) + if err != nil { + return LoadBalancersClientMigrateToIPBasedResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LoadBalancersClientMigrateToIPBasedResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LoadBalancersClientMigrateToIPBasedResponse{}, err + } + resp, err := client.migrateToIPBasedHandleResponse(httpResp) + return resp, err +} + +// migrateToIPBasedCreateRequest creates the MigrateToIPBased request. +func (client *LoadBalancersClient) migrateToIPBasedCreateRequest(ctx context.Context, groupName string, loadBalancerName string, options *LoadBalancersClientMigrateToIPBasedOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/migrateToIpBased" + 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 client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// migrateToIPBasedHandleResponse handles the MigrateToIPBased response. +func (client *LoadBalancersClient) migrateToIPBasedHandleResponse(resp *http.Response) (LoadBalancersClientMigrateToIPBasedResponse, error) { + result := LoadBalancersClientMigrateToIPBasedResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MigratedPools); err != nil { + return LoadBalancersClientMigrateToIPBasedResponse{}, err + } + return result, nil +} + +// BeginSwapPublicIPAddresses - Swaps VIPs between two load balancers. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LoadBalancersClientSwapPublicIPAddressesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LoadBalancersClientSwapPublicIPAddressesResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// SwapPublicIPAddresses - Swaps VIPs between two load balancers. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *LoadBalancersClient) swapPublicIPAddresses(ctx context.Context, location string, parameters LoadBalancerVipSwapRequest, options *LoadBalancersClientBeginSwapPublicIPAddressesOptions) (*http.Response, error) { + var err error + req, err := client.swapPublicIPAddressesCreateRequest(ctx, location, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// UpdateTags - Updates a load balancer tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, loadBalancerName, parameters, options) + if err != nil { + return LoadBalancersClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LoadBalancersClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LoadBalancersClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/localnetworkgateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/localnetworkgateways_client.go new file mode 100644 index 000000000..e4424dbb5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/localnetworkgateways_client.go @@ -0,0 +1,380 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".LocalNetworkGatewaysClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LocalNetworkGatewaysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LocalNetworkGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LocalNetworkGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *LocalNetworkGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, options *LocalNetworkGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, localNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified local network gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LocalNetworkGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LocalNetworkGatewaysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified local network gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *LocalNetworkGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, options *LocalNetworkGatewaysClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, localNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, localNetworkGatewayName, options) + if err != nil { + return LocalNetworkGatewaysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalNetworkGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocalNetworkGatewaysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - LocalNetworkGatewaysClientListOptions contains the optional parameters for the LocalNetworkGatewaysClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, localNetworkGatewayName, parameters, options) + if err != nil { + return LocalNetworkGatewaysClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalNetworkGatewaysClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocalNetworkGatewaysClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/management_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/management_client.go new file mode 100644 index 000000000..b2c5e9510 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/management_client.go @@ -0,0 +1,994 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ManagementClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagementClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.checkDNSNameAvailabilityCreateRequest(ctx, location, domainNameLabel, options) + if err != nil { + return ManagementClientCheckDNSNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementClientCheckDNSNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientCheckDNSNameAvailabilityResponse{}, err + } + resp, err := client.checkDNSNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("domainNameLabel", domainNameLabel) + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientDeleteBastionShareableLinkResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagementClientDeleteBastionShareableLinkResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ManagementClient) deleteBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginDeleteBastionShareableLinkOptions) (*http.Response, error) { + var err error + req, err := client.deleteBastionShareableLinkCreateRequest(ctx, resourceGroupName, bastionHostName, bslRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, bslRequest); err != nil { + return nil, err + } + return req, nil +} + +// NewDisconnectActiveSessionsPager - Returns the list of currently active sessions on the Bastion. +// +// Generated from API version 2023-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.NewDisconnectActiveSessionsPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, sessionIDs); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.expressRouteProviderPortCreateRequest(ctx, providerport, options) + if err != nil { + return ManagementClientExpressRouteProviderPortResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementClientExpressRouteProviderPortResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientExpressRouteProviderPortResponse{}, err + } + resp, err := client.expressRouteProviderPortHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ManagementClient) generatevirtualwanvpnserverconfigurationvpnprofile(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVPNProfileParameters, options *ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions) (*http.Response, error) { + var err error + req, err := client.generatevirtualwanvpnserverconfigurationvpnprofileCreateRequest(ctx, resourceGroupName, virtualWANName, vpnClientParams, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnClientParams); err != nil { + return nil, err + } + return req, nil +} + +// BeginGetActiveSessions - Returns the list of currently active sessions on the Bastion. +// +// Generated from API version 2023-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.internal.Pipeline().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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[*runtime.Pager[ManagementClientGetActiveSessionsResponse]]{ + FinalStateVia: runtime.FinalStateViaLocation, + Response: &pager, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[*runtime.Pager[ManagementClientGetActiveSessionsResponse]]{ + Response: &pager, + }) + } +} + +// GetActiveSessions - Returns the list of currently active sessions on the Bastion. +// +// Generated from API version 2023-05-01 +func (client *ManagementClient) getActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string, options *ManagementClientBeginGetActiveSessionsOptions) (*http.Response, error) { + var err error + req, err := client.getActiveSessionsCreateRequest(ctx, resourceGroupName, bastionHostName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewGetBastionShareableLinkPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, bslRequest); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.listActiveConnectivityConfigurationsCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagementClientListActiveConnectivityConfigurationsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementClientListActiveConnectivityConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientListActiveConnectivityConfigurationsResponse{}, err + } + resp, err := client.listActiveConnectivityConfigurationsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.listActiveSecurityAdminRulesCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagementClientListActiveSecurityAdminRulesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementClientListActiveSecurityAdminRulesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientListActiveSecurityAdminRulesResponse{}, err + } + resp, err := client.listActiveSecurityAdminRulesHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.listNetworkManagerEffectiveConnectivityConfigurationsCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) + if err != nil { + return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err + } + resp, err := client.listNetworkManagerEffectiveConnectivityConfigurationsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.listNetworkManagerEffectiveSecurityAdminRulesCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) + if err != nil { + return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err + } + resp, err := client.listNetworkManagerEffectiveSecurityAdminRulesHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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.internal.Pipeline().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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[*runtime.Pager[ManagementClientPutBastionShareableLinkResponse]]{ + FinalStateVia: runtime.FinalStateViaLocation, + Response: &pager, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &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 2023-05-01 +func (client *ManagementClient) putBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginPutBastionShareableLinkOptions) (*http.Response, error) { + var err error + req, err := client.putBastionShareableLinkCreateRequest(ctx, resourceGroupName, bastionHostName, bslRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, bslRequest); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.supportedSecurityProvidersCreateRequest(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return ManagementClientSupportedSecurityProvidersResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementClientSupportedSecurityProvidersResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientSupportedSecurityProvidersResponse{}, err + } + resp, err := client.supportedSecurityProvidersHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/managementgroupnetworkmanagerconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/managementgroupnetworkmanagerconnections_client.go new file mode 100644 index 000000000..5af5d9aec --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/managementgroupnetworkmanagerconnections_client.go @@ -0,0 +1,274 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ManagementGroupNetworkManagerConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagementGroupNetworkManagerConnectionsClient{ + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, managementGroupID, networkManagerConnectionName, parameters, options) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.deleteCreateRequest(ctx, managementGroupID, networkManagerConnectionName, options) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ManagementGroupNetworkManagerConnectionsClientDeleteResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, managementGroupID, networkManagerConnectionName, options) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementGroupNetworkManagerConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - managementGroupID - The management group Id which uniquely identify the Microsoft Azure management group. +// - options - ManagementGroupNetworkManagerConnectionsClientListOptions contains the optional parameters for the ManagementGroupNetworkManagerConnectionsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/managercommits_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/managercommits_client.go new file mode 100644 index 000000000..1b99c05cd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/managercommits_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ManagerCommitsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagerCommitsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginPost - Post a Network Manager Commit. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagerCommitsClientPostResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagerCommitsClientPostResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Post - Post a Network Manager Commit. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ManagerCommitsClient) post(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ManagerCommit, options *ManagerCommitsClientBeginPostOptions) (*http.Response, error) { + var err error + req, err := client.postCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/managerdeploymentstatus_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/managerdeploymentstatus_client.go new file mode 100644 index 000000000..896c44131 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/managerdeploymentstatus_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ManagerDeploymentStatusClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagerDeploymentStatusClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.listCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagerDeploymentStatusClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagerDeploymentStatusClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagerDeploymentStatusClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/managers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/managers_client.go new file mode 100644 index 000000000..77237d574 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/managers_client.go @@ -0,0 +1,442 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ManagersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a Network Manager. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagersClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagersClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagersClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a network manager. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ManagersClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, options) + if err != nil { + return ManagersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - ManagersClientListOptions contains the optional parameters for the ManagersClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ManagersClientListBySubscriptionOptions contains the optional parameters for the ManagersClient.NewListBySubscriptionPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.patchCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagersClientPatchResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagersClientPatchResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagersClientPatchResponse{}, err + } + resp, err := client.patchHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/models.go new file mode 100644 index 000000000..da6f49537 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/models.go @@ -0,0 +1,13941 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import "time" + +// AADAuthenticationParameters - AAD Vpn authentication type related parameters. +type AADAuthenticationParameters struct { + // AAD Vpn authentication parameter AAD audience. + AADAudience *string + + // AAD Vpn authentication parameter AAD issuer. + AADIssuer *string + + // AAD Vpn authentication parameter AAD tenant. + AADTenant *string +} + +// 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 + + // Type of action to be taken. Supported types are 'Remove', 'Add', 'Replace', and 'Drop.' + Type *RouteMapActionType +} + +// ActiveBaseSecurityAdminRule - Network base admin rule. +type ActiveBaseSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind + + // Deployment time string. + CommitTime *time.Time + + // A description of the security admin configuration. + ConfigurationDescription *string + + // Resource ID. + ID *string + + // Deployment region. + Region *string + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem + + // A description of the rule collection. + RuleCollectionDescription *string + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup +} + +// 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 + + // 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 +} + +// ActiveConnectivityConfiguration - Active connectivity configuration. +type ActiveConnectivityConfiguration struct { + // Deployment time string. + CommitTime *time.Time + + // Effective configuration groups. + ConfigurationGroups []*ConfigurationGroup + + // Connectivity configuration ID. + ID *string + + // Properties of a network manager connectivity configuration + Properties *ConnectivityConfigurationProperties + + // Deployment region. + Region *string +} + +// 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 + + // Gets a page of active connectivity configurations. + Value []*ActiveConnectivityConfiguration +} + +// ActiveDefaultSecurityAdminRule - Network default admin rule. +type ActiveDefaultSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind + + // Deployment time string. + CommitTime *time.Time + + // A description of the security admin configuration. + ConfigurationDescription *string + + // Resource ID. + ID *string + + // Indicates the properties of the default security admin rule + Properties *DefaultAdminPropertiesFormat + + // Deployment region. + Region *string + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem + + // A description of the rule collection. + RuleCollectionDescription *string + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup +} + +// GetActiveBaseSecurityAdminRule implements the ActiveBaseSecurityAdminRuleClassification interface for type ActiveDefaultSecurityAdminRule. +func (a *ActiveDefaultSecurityAdminRule) GetActiveBaseSecurityAdminRule() *ActiveBaseSecurityAdminRule { + return &ActiveBaseSecurityAdminRule{ + CommitTime: a.CommitTime, + ConfigurationDescription: a.ConfigurationDescription, + ID: a.ID, + Kind: a.Kind, + Region: a.Region, + RuleCollectionAppliesToGroups: a.RuleCollectionAppliesToGroups, + RuleCollectionDescription: a.RuleCollectionDescription, + RuleGroups: a.RuleGroups, + } +} + +// ActiveSecurityAdminRule - Network admin rule. +type ActiveSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind + + // Deployment time string. + CommitTime *time.Time + + // A description of the security admin configuration. + ConfigurationDescription *string + + // Resource ID. + ID *string + + // Indicates the properties of the security admin rule + Properties *AdminPropertiesFormat + + // Deployment region. + Region *string + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem + + // A description of the rule collection. + RuleCollectionDescription *string + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup +} + +// GetActiveBaseSecurityAdminRule implements the ActiveBaseSecurityAdminRuleClassification interface for type ActiveSecurityAdminRule. +func (a *ActiveSecurityAdminRule) GetActiveBaseSecurityAdminRule() *ActiveBaseSecurityAdminRule { + return &ActiveBaseSecurityAdminRule{ + CommitTime: a.CommitTime, + ConfigurationDescription: a.ConfigurationDescription, + ID: a.ID, + Kind: a.Kind, + Region: a.Region, + RuleCollectionAppliesToGroups: a.RuleCollectionAppliesToGroups, + RuleCollectionDescription: a.RuleCollectionDescription, + RuleGroups: a.RuleGroups, + } +} + +// 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 + + // Gets a page of active security admin rules. + Value []ActiveBaseSecurityAdminRuleClassification +} + +// AddressPrefixItem - Address prefix item. +type AddressPrefixItem struct { + // Address prefix. + AddressPrefix *string + + // Address prefix type. + AddressPrefixType *AddressPrefixType +} + +// 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 +} + +// AdminPropertiesFormat - Security admin rule resource. +type AdminPropertiesFormat struct { + // REQUIRED; Indicates the access allowed for this particular rule + Access *SecurityConfigurationRuleAccess + + // REQUIRED; Indicates if the traffic matched against the rule in inbound or outbound. + Direction *SecurityConfigurationRuleDirection + + // 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 + + // REQUIRED; Network protocol this rule applies to. + Protocol *SecurityConfigurationRuleProtocol + + // A description for this rule. Restricted to 140 chars. + Description *string + + // The destination port ranges. + DestinationPortRanges []*string + + // The destination address prefixes. CIDR or destination IP ranges. + Destinations []*AddressPrefixItem + + // The source port ranges. + SourcePortRanges []*string + + // The CIDR or source IP ranges. + Sources []*AddressPrefixItem + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Unique identifier for this resource. + ResourceGUID *string +} + +// AdminRule - Network admin rule. +type AdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *AdminRuleKind + + // Indicates the properties of the security admin rule + Properties *AdminPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// GetBaseAdminRule implements the BaseAdminRuleClassification interface for type AdminRule. +func (a *AdminRule) GetBaseAdminRule() *BaseAdminRule { + return &BaseAdminRule{ + Etag: a.Etag, + ID: a.ID, + Kind: a.Kind, + Name: a.Name, + SystemData: a.SystemData, + Type: a.Type, + } +} + +// AdminRuleCollection - Defines the admin rule collection. +type AdminRuleCollection struct { + // Indicates the properties for the network manager admin rule collection. + Properties *AdminRuleCollectionPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// AdminRuleCollectionListResult - Security admin configuration rule collection list result. +type AdminRuleCollectionListResult struct { + // Gets the URL to get the next set of results. + NextLink *string + + // A list of network manager security admin configuration rule collections + Value []*AdminRuleCollection +} + +// AdminRuleCollectionPropertiesFormat - Defines the admin rule collection properties. +type AdminRuleCollectionPropertiesFormat struct { + // REQUIRED; Groups for configuration + AppliesToGroups []*ManagerSecurityGroupItem + + // A description of the admin rule collection. + Description *string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Unique identifier for this resource. + ResourceGUID *string +} + +// AdminRuleListResult - security configuration admin rule list result. +type AdminRuleListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of admin rules + Value []BaseAdminRuleClassification +} + +// ApplicationGateway - Application gateway resource. +type ApplicationGateway struct { + // Resource ID. + ID *string + + // The identity of the application gateway, if configured. + Identity *ManagedServiceIdentity + + // Resource location. + Location *string + + // Properties of the application gateway. + Properties *ApplicationGatewayPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // A list of availability zones denoting where the resource needs to come from. + Zones []*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ApplicationGatewayAuthenticationCertificate - Authentication certificates of an application gateway. +type ApplicationGatewayAuthenticationCertificate struct { + // Resource ID. + ID *string + + // Name of the authentication certificate that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway authentication certificate. + Properties *ApplicationGatewayAuthenticationCertificatePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayAuthenticationCertificatePropertiesFormat - Authentication certificates properties of an application +// gateway. +type ApplicationGatewayAuthenticationCertificatePropertiesFormat struct { + // Certificate public data. + Data *string + + // READ-ONLY; The provisioning state of the authentication certificate resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayAutoscaleConfiguration - Application Gateway autoscale configuration. +type ApplicationGatewayAutoscaleConfiguration struct { + // REQUIRED; Lower bound on number of Application Gateway capacity. + MinCapacity *int32 + + // Upper bound on number of Application Gateway capacity. + MaxCapacity *int32 +} + +// ApplicationGatewayAvailableSSLOptions - Response for ApplicationGatewayAvailableSslOptions API service call. +type ApplicationGatewayAvailableSSLOptions struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the application gateway available SSL options. + Properties *ApplicationGatewayAvailableSSLOptionsPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ApplicationGatewayAvailableSSLOptionsPropertiesFormat - Properties of ApplicationGatewayAvailableSslOptions. +type ApplicationGatewayAvailableSSLOptionsPropertiesFormat struct { + // List of available Ssl cipher suites. + AvailableCipherSuites []*ApplicationGatewaySSLCipherSuite + + // List of available Ssl protocols. + AvailableProtocols []*ApplicationGatewaySSLProtocol + + // Name of the Ssl predefined policy applied by default to application gateway. + DefaultPolicy *ApplicationGatewaySSLPolicyName + + // List of available Ssl predefined policy. + PredefinedPolicies []*SubResource +} + +// ApplicationGatewayAvailableSSLPredefinedPolicies - Response for ApplicationGatewayAvailableSslOptions API service call. +type ApplicationGatewayAvailableSSLPredefinedPolicies struct { + // URL to get the next set of results. + NextLink *string + + // List of available Ssl predefined policy. + Value []*ApplicationGatewaySSLPredefinedPolicy +} + +// ApplicationGatewayAvailableWafRuleSetsResult - Response for ApplicationGatewayAvailableWafRuleSets API service call. +type ApplicationGatewayAvailableWafRuleSetsResult struct { + // The list of application gateway rule sets. + Value []*ApplicationGatewayFirewallRuleSet +} + +// ApplicationGatewayBackendAddress - Backend address of an application gateway. +type ApplicationGatewayBackendAddress struct { + // Fully qualified domain name (FQDN). + Fqdn *string + + // IP address. + IPAddress *string +} + +// ApplicationGatewayBackendAddressPool - Backend Address Pool of an application gateway. +type ApplicationGatewayBackendAddressPool struct { + // Resource ID. + ID *string + + // Name of the backend address pool that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway backend address pool. + Properties *ApplicationGatewayBackendAddressPoolPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayBackendAddressPoolPropertiesFormat - Properties of Backend Address Pool of an application gateway. +type ApplicationGatewayBackendAddressPoolPropertiesFormat struct { + // Backend addresses. + BackendAddresses []*ApplicationGatewayBackendAddress + + // READ-ONLY; Collection of references to IPs defined in network interfaces. + BackendIPConfigurations []*InterfaceIPConfiguration + + // READ-ONLY; The provisioning state of the backend address pool resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayBackendHTTPSettings - Backend address pool settings of an application gateway. +type ApplicationGatewayBackendHTTPSettings struct { + // Resource ID. + ID *string + + // Name of the backend http settings that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway backend HTTP settings. + Properties *ApplicationGatewayBackendHTTPSettingsPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayBackendHTTPSettingsPropertiesFormat - Properties of Backend address pool settings of an application gateway. +type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct { + // Cookie name to use for the affinity cookie. + AffinityCookieName *string + + // Array of references to application gateway authentication certificates. + AuthenticationCertificates []*SubResource + + // Connection draining of the backend http settings resource. + ConnectionDraining *ApplicationGatewayConnectionDraining + + // Cookie based affinity. + CookieBasedAffinity *ApplicationGatewayCookieBasedAffinity + + // Host header to be sent to the backend servers. + HostName *string + + // 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 + + // Whether to pick host header should be picked from the host name of the backend server. Default value is false. + PickHostNameFromBackendAddress *bool + + // The destination port on the backend. + Port *int32 + + // Probe resource of an application gateway. + Probe *SubResource + + // Whether the probe is enabled. Default value is false. + ProbeEnabled *bool + + // The protocol used to communicate with the backend. + Protocol *ApplicationGatewayProtocol + + // 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 + + // Array of references to application gateway trusted root certificates. + TrustedRootCertificates []*SubResource + + // READ-ONLY; The provisioning state of the backend HTTP settings resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayBackendHealth - Response for ApplicationGatewayBackendHealth API service call. +type ApplicationGatewayBackendHealth struct { + // A list of ApplicationGatewayBackendHealthPool resources. + BackendAddressPools []*ApplicationGatewayBackendHealthPool +} + +// ApplicationGatewayBackendHealthHTTPSettings - Application gateway BackendHealthHttp settings. +type ApplicationGatewayBackendHealthHTTPSettings struct { + // Reference to an ApplicationGatewayBackendHttpSettings resource. + BackendHTTPSettings *ApplicationGatewayBackendHTTPSettings + + // List of ApplicationGatewayBackendHealthServer resources. + Servers []*ApplicationGatewayBackendHealthServer +} + +// ApplicationGatewayBackendHealthOnDemand - Result of on demand test probe. +type ApplicationGatewayBackendHealthOnDemand struct { + // Reference to an ApplicationGatewayBackendAddressPool resource. + BackendAddressPool *ApplicationGatewayBackendAddressPool + + // Application gateway BackendHealthHttp settings. + BackendHealthHTTPSettings *ApplicationGatewayBackendHealthHTTPSettings +} + +// ApplicationGatewayBackendHealthPool - Application gateway BackendHealth pool. +type ApplicationGatewayBackendHealthPool struct { + // Reference to an ApplicationGatewayBackendAddressPool resource. + BackendAddressPool *ApplicationGatewayBackendAddressPool + + // List of ApplicationGatewayBackendHealthHttpSettings resources. + BackendHTTPSettingsCollection []*ApplicationGatewayBackendHealthHTTPSettings +} + +// ApplicationGatewayBackendHealthServer - Application gateway backendhealth http settings. +type ApplicationGatewayBackendHealthServer struct { + // IP address or FQDN of backend server. + Address *string + + // Health of backend server. + Health *ApplicationGatewayBackendHealthServerHealth + + // Health Probe Log. + HealthProbeLog *string + + // Reference to IP configuration of backend server. + IPConfiguration *InterfaceIPConfiguration +} + +// ApplicationGatewayBackendSettings - Backend address pool settings of an application gateway. +type ApplicationGatewayBackendSettings struct { + // Resource ID. + ID *string + + // Name of the backend settings that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway backend settings. + Properties *ApplicationGatewayBackendSettingsPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // Whether to pick server name indication from the host name of the backend server for Tls protocol. Default value is false. + PickHostNameFromBackendAddress *bool + + // The destination port on the backend. + Port *int32 + + // Probe resource of an application gateway. + Probe *SubResource + + // The protocol used to communicate with the backend. + Protocol *ApplicationGatewayProtocol + + // 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 + + // Array of references to application gateway trusted root certificates. + TrustedRootCertificates []*SubResource + + // READ-ONLY; The provisioning state of the backend HTTP settings resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayClientAuthConfiguration - Application gateway client authentication configuration. +type ApplicationGatewayClientAuthConfiguration struct { + // Verify client certificate issuer name on the application gateway. + VerifyClientCertIssuerDN *bool + + // Verify client certificate revocation status. + VerifyClientRevocation *ApplicationGatewayClientRevocationOptions +} + +// 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 + + // REQUIRED; Whether connection draining is enabled or not. + Enabled *bool +} + +// ApplicationGatewayCustomError - Custom error of an application gateway. +type ApplicationGatewayCustomError struct { + // Error page URL of the application gateway custom error. + CustomErrorPageURL *string + + // Status code of the application gateway custom error. + StatusCode *ApplicationGatewayCustomErrorStatusCode +} + +// 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 + + // The list of rules that will be disabled. If null, all rules of the rule group will be disabled. + Rules []*int32 +} + +// ApplicationGatewayFirewallExclusion - Allow to exclude some variable satisfy the condition for the WAF check. +type ApplicationGatewayFirewallExclusion struct { + // REQUIRED; The variable to be excluded. + MatchVariable *string + + // REQUIRED; When matchVariable is a collection, operator used to specify which elements in the collection this exclusion + // applies to. + Selector *string + + // REQUIRED; When matchVariable is a collection, operate on the selector to specify which elements in the collection this + // exclusion applies to. + SelectorMatchOperator *string +} + +// 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 + + // REQUIRED; The type of the web application firewall rule set. + RuleSetType *string + + // REQUIRED; The version of the web application firewall rule set type. + RuleSetVersion *string + + // The rule set status + Status *ApplicationGatewayRuleSetStatusOptions + + // Tier of an application gateway that support the rule set. + Tiers []*ApplicationGatewayTierTypes +} + +// ApplicationGatewayFirewallRule - A web application firewall rule. +type ApplicationGatewayFirewallRule struct { + // REQUIRED; The identifier of the web application firewall rule. + RuleID *int32 + + // The string representation of the web application firewall rule action. + Action *ApplicationGatewayWafRuleActionTypes + + // The description of the web application firewall rule. + Description *string + + // The string representation of the web application firewall rule identifier. + RuleIDString *string + + // The string representation of the web application firewall rule state. + State *ApplicationGatewayWafRuleStateTypes +} + +// ApplicationGatewayFirewallRuleGroup - A web application firewall rule group. +type ApplicationGatewayFirewallRuleGroup struct { + // REQUIRED; The name of the web application firewall rule group. + RuleGroupName *string + + // REQUIRED; The rules of the web application firewall rule group. + Rules []*ApplicationGatewayFirewallRule + + // The description of the web application firewall rule group. + Description *string +} + +// ApplicationGatewayFirewallRuleSet - A web application firewall rule set. +type ApplicationGatewayFirewallRuleSet struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the application gateway firewall rule set. + Properties *ApplicationGatewayFirewallRuleSetPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// 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 + + // REQUIRED; The type of the web application firewall rule set. + RuleSetType *string + + // REQUIRED; The version of the web application firewall rule set type. + RuleSetVersion *string + + // Tier of an application gateway that support the rule set. + Tiers []*ApplicationGatewayTierTypes + + // READ-ONLY; The provisioning state of the web application firewall rule set. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayFrontendIPConfiguration - Frontend IP configuration of an application gateway. +type ApplicationGatewayFrontendIPConfiguration struct { + // Resource ID. + ID *string + + // Name of the frontend IP configuration that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway frontend IP configuration. + Properties *ApplicationGatewayFrontendIPConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayFrontendIPConfigurationPropertiesFormat - Properties of Frontend IP configuration of an application gateway. +type ApplicationGatewayFrontendIPConfigurationPropertiesFormat struct { + // PrivateIPAddress of the network interface IP Configuration. + PrivateIPAddress *string + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod + + // Reference to the application gateway private link configuration. + PrivateLinkConfiguration *SubResource + + // Reference to the PublicIP resource. + PublicIPAddress *SubResource + + // Reference to the subnet resource. + Subnet *SubResource + + // READ-ONLY; The provisioning state of the frontend IP configuration resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayFrontendPort - Frontend port of an application gateway. +type ApplicationGatewayFrontendPort struct { + // Resource ID. + ID *string + + // Name of the frontend port that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway frontend port. + Properties *ApplicationGatewayFrontendPortPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayFrontendPortPropertiesFormat - Properties of Frontend port of an application gateway. +type ApplicationGatewayFrontendPortPropertiesFormat struct { + // Frontend port. + Port *int32 + + // READ-ONLY; The provisioning state of the frontend port resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayGlobalConfiguration - Application Gateway global configuration. +type ApplicationGatewayGlobalConfiguration struct { + // Enable request buffering. + EnableRequestBuffering *bool + + // Enable response buffering. + EnableResponseBuffering *bool +} + +// ApplicationGatewayHTTPListener - Http listener of an application gateway. +type ApplicationGatewayHTTPListener struct { + // Resource ID. + ID *string + + // Name of the HTTP listener that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway HTTP listener. + Properties *ApplicationGatewayHTTPListenerPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayHTTPListenerPropertiesFormat - Properties of HTTP listener of an application gateway. +type ApplicationGatewayHTTPListenerPropertiesFormat struct { + // Custom error configurations of the HTTP listener. + CustomErrorConfigurations []*ApplicationGatewayCustomError + + // Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource + + // Frontend IP configuration resource of an application gateway. + FrontendIPConfiguration *SubResource + + // Frontend port resource of an application gateway. + FrontendPort *SubResource + + // Host name of HTTP listener. + HostName *string + + // List of Host names for HTTP Listener that allows special wildcard characters as well. + HostNames []*string + + // Protocol of the HTTP listener. + Protocol *ApplicationGatewayProtocol + + // Applicable only if protocol is https. Enables SNI for multi-hosting. + RequireServerNameIndication *bool + + // SSL certificate resource of an application gateway. + SSLCertificate *SubResource + + // SSL profile resource of the application gateway. + SSLProfile *SubResource + + // READ-ONLY; The provisioning state of the HTTP listener resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayHeaderConfiguration - Header configuration of the Actions set in Application Gateway. +type ApplicationGatewayHeaderConfiguration struct { + // Header name of the header configuration. + HeaderName *string + + // Header value of the header configuration. + HeaderValue *string +} + +// ApplicationGatewayIPConfiguration - IP configuration of an application gateway. Currently 1 public and 1 private IP configuration +// is allowed. +type ApplicationGatewayIPConfiguration struct { + // Resource ID. + ID *string + + // Name of the IP configuration that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway IP configuration. + Properties *ApplicationGatewayIPConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // READ-ONLY; The provisioning state of the application gateway IP configuration resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayListResult - Response for ListApplicationGateways API service call. +type ApplicationGatewayListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of an application gateways in a resource group. + Value []*ApplicationGateway +} + +// ApplicationGatewayListener - Listener of an application gateway. +type ApplicationGatewayListener struct { + // Resource ID. + ID *string + + // Name of the listener that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway listener. + Properties *ApplicationGatewayListenerPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayListenerPropertiesFormat - Properties of listener of an application gateway. +type ApplicationGatewayListenerPropertiesFormat struct { + // Frontend IP configuration resource of an application gateway. + FrontendIPConfiguration *SubResource + + // Frontend port resource of an application gateway. + FrontendPort *SubResource + + // Protocol of the listener. + Protocol *ApplicationGatewayProtocol + + // SSL certificate resource of an application gateway. + SSLCertificate *SubResource + + // SSL profile resource of the application gateway. + SSLProfile *SubResource + + // READ-ONLY; The provisioning state of the listener resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayLoadDistributionPolicy - Load Distribution Policy of an application gateway. +type ApplicationGatewayLoadDistributionPolicy struct { + // Resource ID. + ID *string + + // Name of the load distribution policy that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway load distribution policy. + Properties *ApplicationGatewayLoadDistributionPolicyPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayLoadDistributionPolicyPropertiesFormat - Properties of Load Distribution Policy of an application gateway. +type ApplicationGatewayLoadDistributionPolicyPropertiesFormat struct { + // Load Distribution Targets resource of an application gateway. + LoadDistributionAlgorithm *ApplicationGatewayLoadDistributionAlgorithm + + // Load Distribution Targets resource of an application gateway. + LoadDistributionTargets []*ApplicationGatewayLoadDistributionTarget + + // READ-ONLY; The provisioning state of the Load Distribution Policy resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayLoadDistributionTarget - Load Distribution Target of an application gateway. +type ApplicationGatewayLoadDistributionTarget struct { + // Resource ID. + ID *string + + // Name of the load distribution policy that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway load distribution target. + Properties *ApplicationGatewayLoadDistributionTargetPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +type ApplicationGatewayLoadDistributionTargetPropertiesFormat struct { + // Backend address pool resource of the application gateway. + BackendAddressPool *SubResource + + // Weight per server. Range between 1 and 100. + WeightPerServer *int32 +} + +// 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 + + // Reference to backend http setting of application gateway to be used for test probe. + BackendHTTPSettings *SubResource + + // Host name to send the probe to. + Host *string + + // Criterion for classifying a healthy probe response. + Match *ApplicationGatewayProbeHealthResponseMatch + + // Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. + Path *string + + // Whether the host header should be picked from the backend http settings. Default value is false. + PickHostNameFromBackendHTTPSettings *bool + + // The protocol used for the probe. + Protocol *ApplicationGatewayProtocol + + // 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 +} + +// ApplicationGatewayPathRule - Path rule of URL path map of an application gateway. +type ApplicationGatewayPathRule struct { + // Resource ID. + ID *string + + // Name of the path rule that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway path rule. + Properties *ApplicationGatewayPathRulePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayPathRulePropertiesFormat - Properties of path rule of an application gateway. +type ApplicationGatewayPathRulePropertiesFormat struct { + // Backend address pool resource of URL path map path rule. + BackendAddressPool *SubResource + + // Backend http settings resource of URL path map path rule. + BackendHTTPSettings *SubResource + + // Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource + + // Load Distribution Policy resource of URL path map path rule. + LoadDistributionPolicy *SubResource + + // Path rules of URL path map. + Paths []*string + + // Redirect configuration resource of URL path map path rule. + RedirectConfiguration *SubResource + + // Rewrite rule set resource of URL path map path rule. + RewriteRuleSet *SubResource + + // READ-ONLY; The provisioning state of the path rule resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayPrivateEndpointConnection - Private Endpoint connection on an application gateway. +type ApplicationGatewayPrivateEndpointConnection struct { + // Resource ID. + ID *string + + // Name of the private endpoint connection on an application gateway. + Name *string + + // Properties of the application gateway private endpoint connection. + Properties *ApplicationGatewayPrivateEndpointConnectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // List of private endpoint connections on an application gateway. + Value []*ApplicationGatewayPrivateEndpointConnection +} + +// 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 + + // READ-ONLY; The consumer link id. + LinkIdentifier *string + + // READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The provisioning state of the application gateway private endpoint connection resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayPrivateLinkConfiguration - Private Link Configuration on an application gateway. +type ApplicationGatewayPrivateLinkConfiguration struct { + // Resource ID. + ID *string + + // Name of the private link configuration that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway private link configuration. + Properties *ApplicationGatewayPrivateLinkConfigurationProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayPrivateLinkConfigurationProperties - Properties of private link configuration on an application gateway. +type ApplicationGatewayPrivateLinkConfigurationProperties struct { + // An array of application gateway private link ip configurations. + IPConfigurations []*ApplicationGatewayPrivateLinkIPConfiguration + + // READ-ONLY; The provisioning state of the application gateway private link configuration. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayPrivateLinkIPConfiguration - The application gateway private link ip configuration. +type ApplicationGatewayPrivateLinkIPConfiguration struct { + // Resource ID. + ID *string + + // The name of application gateway private link ip configuration. + Name *string + + // Properties of an application gateway private link ip configuration. + Properties *ApplicationGatewayPrivateLinkIPConfigurationProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; The resource type. + Type *string +} + +// ApplicationGatewayPrivateLinkIPConfigurationProperties - Properties of an application gateway private link IP configuration. +type ApplicationGatewayPrivateLinkIPConfigurationProperties struct { + // Whether the ip configuration is primary or not. + Primary *bool + + // The private IP address of the IP configuration. + PrivateIPAddress *string + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod + + // Reference to the subnet resource. + Subnet *SubResource + + // READ-ONLY; The provisioning state of the application gateway private link IP configuration. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayPrivateLinkResource - PrivateLink Resource of an application gateway. +type ApplicationGatewayPrivateLinkResource struct { + // Resource ID. + ID *string + + // Name of the private link resource that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway private link resource. + Properties *ApplicationGatewayPrivateLinkResourceProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // List of private link resources of an application gateway. + Value []*ApplicationGatewayPrivateLinkResource +} + +// ApplicationGatewayPrivateLinkResourceProperties - Properties of a private link resource. +type ApplicationGatewayPrivateLinkResourceProperties struct { + // Required DNS zone names of the the private link resource. + RequiredZoneNames []*string + + // READ-ONLY; Group identifier of private link resource. + GroupID *string + + // READ-ONLY; Required member names of private link resource. + RequiredMembers []*string +} + +// ApplicationGatewayProbe - Probe of the application gateway. +type ApplicationGatewayProbe struct { + // Resource ID. + ID *string + + // Name of the probe that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway probe. + Properties *ApplicationGatewayProbePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // Allowed ranges of healthy status codes. Default range of healthy status codes is 200-399. + StatusCodes []*string +} + +// ApplicationGatewayProbePropertiesFormat - Properties of probe of an application gateway. +type ApplicationGatewayProbePropertiesFormat struct { + // Host name to send the probe to. + Host *string + + // 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 + + // Criterion for classifying a healthy probe response. + Match *ApplicationGatewayProbeHealthResponseMatch + + // Minimum number of servers that are always marked healthy. Default value is 0. + MinServers *int32 + + // Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. + Path *string + + // Whether the host header should be picked from the backend http settings. Default value is false. + PickHostNameFromBackendHTTPSettings *bool + + // Whether the server name indication should be picked from the backend settings for Tls protocol. Default value is false. + PickHostNameFromBackendSettings *bool + + // 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 Basic, + // Standardv2 and WAFv2 only. + Port *int32 + + // The protocol used for the probe. + Protocol *ApplicationGatewayProtocol + + // 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 + + // 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 + + // READ-ONLY; The provisioning state of the probe resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // Autoscale Configuration. + AutoscaleConfiguration *ApplicationGatewayAutoscaleConfiguration + + // 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 + + // 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 + + // 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 + + // Custom error configurations of the application gateway resource. + CustomErrorConfigurations []*ApplicationGatewayCustomError + + // Whether FIPS is enabled on the application gateway resource. + EnableFips *bool + + // Whether HTTP2 is enabled on the application gateway resource. + EnableHTTP2 *bool + + // Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource + + // If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config. + ForceFirewallPolicyAssociation *bool + + // 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 + + // 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 + + // 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 + + // Global Configuration. + GlobalConfiguration *ApplicationGatewayGlobalConfiguration + + // 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 + + // 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 + + // Load distribution policies of the application gateway resource. + LoadDistributionPolicies []*ApplicationGatewayLoadDistributionPolicy + + // PrivateLink configurations on application gateway. + PrivateLinkConfigurations []*ApplicationGatewayPrivateLinkConfiguration + + // Probes of the application gateway resource. + Probes []*ApplicationGatewayProbe + + // 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 + + // Request routing rules of the application gateway resource. + RequestRoutingRules []*ApplicationGatewayRequestRoutingRule + + // Rewrite rules for the application gateway resource. + RewriteRuleSets []*ApplicationGatewayRewriteRuleSet + + // Routing rules of the application gateway resource. + RoutingRules []*ApplicationGatewayRoutingRule + + // SKU of the application gateway resource. + SKU *ApplicationGatewaySKU + + // 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 + + // SSL policy of the application gateway resource. + SSLPolicy *ApplicationGatewaySSLPolicy + + // 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 + + // 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 + + // 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 + + // 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 + + // Web application firewall configuration. + WebApplicationFirewallConfiguration *ApplicationGatewayWebApplicationFirewallConfiguration + + // READ-ONLY; The default predefined SSL Policy applied on the application gateway resource. + DefaultPredefinedSSLPolicy *ApplicationGatewaySSLPolicyName + + // READ-ONLY; Operational state of the application gateway resource. + OperationalState *ApplicationGatewayOperationalState + + // READ-ONLY; Private Endpoint connections on application gateway. + PrivateEndpointConnections []*ApplicationGatewayPrivateEndpointConnection + + // READ-ONLY; The provisioning state of the application gateway resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the application gateway resource. + ResourceGUID *string +} + +// ApplicationGatewayRedirectConfiguration - Redirect configuration of an application gateway. +type ApplicationGatewayRedirectConfiguration struct { + // Resource ID. + ID *string + + // Name of the redirect configuration that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway redirect configuration. + Properties *ApplicationGatewayRedirectConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayRedirectConfigurationPropertiesFormat - Properties of redirect configuration of the application gateway. +type ApplicationGatewayRedirectConfigurationPropertiesFormat struct { + // Include path in the redirected url. + IncludePath *bool + + // Include query string in the redirected url. + IncludeQueryString *bool + + // Path rules specifying redirect configuration. + PathRules []*SubResource + + // HTTP redirection type. + RedirectType *ApplicationGatewayRedirectType + + // Request routing specifying redirect configuration. + RequestRoutingRules []*SubResource + + // Reference to a listener to redirect the request to. + TargetListener *SubResource + + // Url to redirect the request to. + TargetURL *string + + // Url path maps specifying default redirect configuration. + URLPathMaps []*SubResource +} + +// ApplicationGatewayRequestRoutingRule - Request routing rule of an application gateway. +type ApplicationGatewayRequestRoutingRule struct { + // Resource ID. + ID *string + + // Name of the request routing rule that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway request routing rule. + Properties *ApplicationGatewayRequestRoutingRulePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayRequestRoutingRulePropertiesFormat - Properties of request routing rule of the application gateway. +type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { + // Backend address pool resource of the application gateway. + BackendAddressPool *SubResource + + // Backend http settings resource of the application gateway. + BackendHTTPSettings *SubResource + + // Http listener resource of the application gateway. + HTTPListener *SubResource + + // Load Distribution Policy resource of the application gateway. + LoadDistributionPolicy *SubResource + + // Priority of the request routing rule. + Priority *int32 + + // Redirect configuration resource of the application gateway. + RedirectConfiguration *SubResource + + // Rewrite Rule Set resource in Basic rule of the application gateway. + RewriteRuleSet *SubResource + + // Rule type. + RuleType *ApplicationGatewayRequestRoutingRuleType + + // URL path map resource of the application gateway. + URLPathMap *SubResource + + // READ-ONLY; The provisioning state of the request routing rule resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayRewriteRule - Rewrite rule of an application gateway. +type ApplicationGatewayRewriteRule struct { + // Set of actions to be done as part of the rewrite Rule. + ActionSet *ApplicationGatewayRewriteRuleActionSet + + // Conditions based on which the action set execution will be evaluated. + Conditions []*ApplicationGatewayRewriteRuleCondition + + // Name of the rewrite rule that is unique within an Application Gateway. + Name *string + + // Rule Sequence of the rewrite rule that determines the order of execution of a particular rule in a RewriteRuleSet. + RuleSequence *int32 +} + +// ApplicationGatewayRewriteRuleActionSet - Set of actions in the Rewrite Rule in Application Gateway. +type ApplicationGatewayRewriteRuleActionSet struct { + // Request Header Actions in the Action Set. + RequestHeaderConfigurations []*ApplicationGatewayHeaderConfiguration + + // Response Header Actions in the Action Set. + ResponseHeaderConfigurations []*ApplicationGatewayHeaderConfiguration + + // Url Configuration Action in the Action Set. + URLConfiguration *ApplicationGatewayURLConfiguration +} + +// 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 + + // Setting this value as truth will force to check the negation of the condition given by the user. + Negate *bool + + // The pattern, either fixed string or regular expression, that evaluates the truthfulness of the condition. + Pattern *string + + // The condition parameter of the RewriteRuleCondition. + Variable *string +} + +// ApplicationGatewayRewriteRuleSet - Rewrite rule set of an application gateway. +type ApplicationGatewayRewriteRuleSet struct { + // Resource ID. + ID *string + + // Name of the rewrite rule set that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway rewrite rule set. + Properties *ApplicationGatewayRewriteRuleSetPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// ApplicationGatewayRewriteRuleSetPropertiesFormat - Properties of rewrite rule set of the application gateway. +type ApplicationGatewayRewriteRuleSetPropertiesFormat struct { + // Rewrite rules in the rewrite rule set. + RewriteRules []*ApplicationGatewayRewriteRule + + // READ-ONLY; The provisioning state of the rewrite rule set resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayRoutingRule - Routing rule of an application gateway. +type ApplicationGatewayRoutingRule struct { + // Resource ID. + ID *string + + // Name of the routing rule that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway routing rule. + Properties *ApplicationGatewayRoutingRulePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayRoutingRulePropertiesFormat - Properties of routing rule of the application gateway. +type ApplicationGatewayRoutingRulePropertiesFormat struct { + // REQUIRED; Priority of the routing rule. + Priority *int32 + + // Backend address pool resource of the application gateway. + BackendAddressPool *SubResource + + // Backend settings resource of the application gateway. + BackendSettings *SubResource + + // Listener resource of the application gateway. + Listener *SubResource + + // Rule type. + RuleType *ApplicationGatewayRequestRoutingRuleType + + // READ-ONLY; The provisioning state of the request routing rule resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewaySKU - SKU of an application gateway. +type ApplicationGatewaySKU struct { + // Capacity (instance count) of an application gateway. + Capacity *int32 + + // Name of an application gateway SKU. + Name *ApplicationGatewaySKUName + + // Tier of an application gateway. + Tier *ApplicationGatewayTier +} + +// ApplicationGatewaySSLCertificate - SSL certificates of an application gateway. +type ApplicationGatewaySSLCertificate struct { + // Resource ID. + ID *string + + // Name of the SSL certificate that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway SSL certificate. + Properties *ApplicationGatewaySSLCertificatePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewaySSLCertificatePropertiesFormat - Properties of SSL certificates of an application gateway. +type ApplicationGatewaySSLCertificatePropertiesFormat struct { + // Base-64 encoded pfx certificate. Only applicable in PUT Request. + Data *string + + // Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string + + // Password for the pfx file specified in data. Only applicable in PUT request. + Password *string + + // READ-ONLY; The provisioning state of the SSL certificate resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Base-64 encoded Public cert data corresponding to pfx specified in data. Only applicable in GET request. + PublicCertData *string +} + +// ApplicationGatewaySSLPolicy - Application Gateway Ssl policy. +type ApplicationGatewaySSLPolicy struct { + // Ssl cipher suites to be enabled in the specified order to application gateway. + CipherSuites []*ApplicationGatewaySSLCipherSuite + + // Ssl protocols to be disabled on application gateway. + DisabledSSLProtocols []*ApplicationGatewaySSLProtocol + + // Minimum version of Ssl protocol to be supported on application gateway. + MinProtocolVersion *ApplicationGatewaySSLProtocol + + // Name of Ssl predefined policy. + PolicyName *ApplicationGatewaySSLPolicyName + + // Type of Ssl Policy. + PolicyType *ApplicationGatewaySSLPolicyType +} + +// ApplicationGatewaySSLPredefinedPolicy - An Ssl predefined policy. +type ApplicationGatewaySSLPredefinedPolicy struct { + // Resource ID. + ID *string + + // Name of the Ssl predefined policy. + Name *string + + // Properties of the application gateway SSL predefined policy. + Properties *ApplicationGatewaySSLPredefinedPolicyPropertiesFormat +} + +// ApplicationGatewaySSLPredefinedPolicyPropertiesFormat - Properties of ApplicationGatewaySslPredefinedPolicy. +type ApplicationGatewaySSLPredefinedPolicyPropertiesFormat struct { + // Ssl cipher suites to be enabled in the specified order for application gateway. + CipherSuites []*ApplicationGatewaySSLCipherSuite + + // Minimum version of Ssl protocol to be supported on application gateway. + MinProtocolVersion *ApplicationGatewaySSLProtocol +} + +// ApplicationGatewaySSLProfile - SSL profile of an application gateway. +type ApplicationGatewaySSLProfile struct { + // Resource ID. + ID *string + + // Name of the SSL profile that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway SSL profile. + Properties *ApplicationGatewaySSLProfilePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewaySSLProfilePropertiesFormat - Properties of SSL profile of an application gateway. +type ApplicationGatewaySSLProfilePropertiesFormat struct { + // Client authentication configuration of the application gateway resource. + ClientAuthConfiguration *ApplicationGatewayClientAuthConfiguration + + // SSL policy of the application gateway resource. + SSLPolicy *ApplicationGatewaySSLPolicy + + // Array of references to application gateway trusted client certificates. + TrustedClientCertificates []*SubResource + + // READ-ONLY; The provisioning state of the HTTP listener resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayTrustedClientCertificate - Trusted client certificates of an application gateway. +type ApplicationGatewayTrustedClientCertificate struct { + // Resource ID. + ID *string + + // Name of the trusted client certificate that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway trusted client certificate. + Properties *ApplicationGatewayTrustedClientCertificatePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayTrustedClientCertificatePropertiesFormat - Trusted client certificates properties of an application gateway. +type ApplicationGatewayTrustedClientCertificatePropertiesFormat struct { + // Certificate public data. + Data *string + + // READ-ONLY; Distinguished name of client certificate issuer. + ClientCertIssuerDN *string + + // READ-ONLY; The provisioning state of the trusted client certificate resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Validated certificate data. + ValidatedCertData *string +} + +// ApplicationGatewayTrustedRootCertificate - Trusted Root certificates of an application gateway. +type ApplicationGatewayTrustedRootCertificate struct { + // Resource ID. + ID *string + + // Name of the trusted root certificate that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway trusted root certificate. + Properties *ApplicationGatewayTrustedRootCertificatePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayTrustedRootCertificatePropertiesFormat - Trusted Root certificates properties of an application gateway. +type ApplicationGatewayTrustedRootCertificatePropertiesFormat struct { + // Certificate public data. + Data *string + + // Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string + + // READ-ONLY; The provisioning state of the trusted root certificate resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // Query string which user has provided for url rewrite. Null means no query string will be updated. Default value is null. + ModifiedQueryString *string + + // 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 +} + +// ApplicationGatewayURLPathMap - UrlPathMaps give a url path to the backend mapping information for PathBasedRouting. +type ApplicationGatewayURLPathMap struct { + // Resource ID. + ID *string + + // Name of the URL path map that is unique within an Application Gateway. + Name *string + + // Properties of the application gateway URL path map. + Properties *ApplicationGatewayURLPathMapPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ApplicationGatewayURLPathMapPropertiesFormat - Properties of UrlPathMap of the application gateway. +type ApplicationGatewayURLPathMapPropertiesFormat struct { + // Default backend address pool resource of URL path map. + DefaultBackendAddressPool *SubResource + + // Default backend http settings resource of URL path map. + DefaultBackendHTTPSettings *SubResource + + // Default Load Distribution Policy resource of URL path map. + DefaultLoadDistributionPolicy *SubResource + + // Default redirect configuration resource of URL path map. + DefaultRedirectConfiguration *SubResource + + // Default Rewrite rule set resource of URL path map. + DefaultRewriteRuleSet *SubResource + + // Path rule of URL path map resource. + PathRules []*ApplicationGatewayPathRule + + // READ-ONLY; The provisioning state of the URL path map resource. + ProvisioningState *ProvisioningState +} + +// ApplicationGatewayWafDynamicManifestPropertiesResult - Properties of ApplicationGatewayWafDynamicManifest. +type ApplicationGatewayWafDynamicManifestPropertiesResult struct { + // The available rulesets. + AvailableRuleSets []*ApplicationGatewayFirewallManifestRuleSet + + // The default ruleset. + DefaultRuleSet *DefaultRuleSetPropertyFormat +} + +// ApplicationGatewayWafDynamicManifestResult - Response for ApplicationGatewayWafDynamicManifest API service call. +type ApplicationGatewayWafDynamicManifestResult struct { + // Resource ID. + ID *string + + // Properties of the ApplicationGatewayWafDynamicManifest . + Properties *ApplicationGatewayWafDynamicManifestPropertiesResult + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ApplicationGatewayWafDynamicManifestResultList - Response for ApplicationGatewayWafDynamicManifests API service call. +type ApplicationGatewayWafDynamicManifestResultList struct { + // URL to get the next set of results. + NextLink *string + + // The list of application gateway waf manifest. + Value []*ApplicationGatewayWafDynamicManifestResult +} + +// ApplicationGatewayWebApplicationFirewallConfiguration - Application gateway web application firewall configuration. +type ApplicationGatewayWebApplicationFirewallConfiguration struct { + // REQUIRED; Whether the web application firewall is enabled or not. + Enabled *bool + + // REQUIRED; Web application firewall mode. + FirewallMode *ApplicationGatewayFirewallMode + + // REQUIRED; The type of the web application firewall rule set. Possible values are: 'OWASP'. + RuleSetType *string + + // REQUIRED; The version of the rule set type. + RuleSetVersion *string + + // The disabled rule groups. + DisabledRuleGroups []*ApplicationGatewayFirewallDisabledRuleGroup + + // The exclusion list. + Exclusions []*ApplicationGatewayFirewallExclusion + + // Maximum file upload size in Mb for WAF. + FileUploadLimitInMb *int32 + + // Maximum request body size for WAF. + MaxRequestBodySize *int32 + + // Maximum request body size in Kb for WAF. + MaxRequestBodySizeInKb *int32 + + // Whether allow WAF to check request Body. + RequestBodyCheck *bool +} + +// ApplicationRule - Rule of type application. +type ApplicationRule struct { + // REQUIRED; Rule Type. + RuleType *FirewallPolicyRuleType + + // Description of the rule. + Description *string + + // List of destination IP addresses or Service Tags. + DestinationAddresses []*string + + // List of FQDN Tags for this rule. + FqdnTags []*string + + // List of HTTP/S headers to insert. + HTTPHeadersToInsert []*FirewallPolicyHTTPHeaderToInsert + + // Name of the rule. + Name *string + + // Array of Application Protocols. + Protocols []*FirewallPolicyRuleApplicationProtocol + + // List of source IP addresses for this rule. + SourceAddresses []*string + + // List of source IpGroups for this rule. + SourceIPGroups []*string + + // List of FQDNs for this rule. + TargetFqdns []*string + + // List of Urls for this rule condition. + TargetUrls []*string + + // Terminate TLS connections for this rule. + TerminateTLS *bool + + // List of destination azure web categories. + WebCategories []*string +} + +// GetFirewallPolicyRule implements the FirewallPolicyRuleClassification interface for type ApplicationRule. +func (a *ApplicationRule) GetFirewallPolicyRule() *FirewallPolicyRule { + return &FirewallPolicyRule{ + Description: a.Description, + Name: a.Name, + RuleType: a.RuleType, + } +} + +// ApplicationSecurityGroup - An application security group in a resource group. +type ApplicationSecurityGroup struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the application security group. + Properties *ApplicationSecurityGroupPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ApplicationSecurityGroupListResult - A list of application security groups. +type ApplicationSecurityGroupListResult struct { + // A list of application security groups. + Value []*ApplicationSecurityGroup + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// ApplicationSecurityGroupPropertiesFormat - Application security group properties. +type ApplicationSecurityGroupPropertiesFormat struct { + // READ-ONLY; The provisioning state of the application security group resource. + ProvisioningState *ProvisioningState + + // 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 +} + +// 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 + + // The authorizations in an ExpressRoute Circuit. + Value []*ExpressRouteCircuitAuthorization +} + +// AuthorizationPropertiesFormat - Properties of ExpressRouteCircuitAuthorization. +type AuthorizationPropertiesFormat struct { + // The authorization key. + AuthorizationKey *string + + // The authorization use status. + AuthorizationUseStatus *AuthorizationUseStatus + + // READ-ONLY; The provisioning state of the authorization resource. + ProvisioningState *ProvisioningState +} + +// AutoApprovedPrivateLinkService - The information of an AutoApprovedPrivateLinkService. +type AutoApprovedPrivateLinkService struct { + // The id of the private link service resource. + PrivateLinkService *string +} + +// 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 + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// Availability of the metric. +type Availability struct { + // Duration of the availability blob. + BlobDuration *string + + // The retention of the availability. + Retention *string + + // The time grain of the availability. + TimeGrain *string +} + +// 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 + + // A unique identifier of the AvailableDelegation resource. + ID *string + + // The name of the AvailableDelegation resource. + Name *string + + // The name of the service and resource. + ServiceName *string + + // Resource type. + Type *string +} + +// AvailableDelegationsResult - An array of available delegations. +type AvailableDelegationsResult struct { + // An array of available delegations. + Value []*AvailableDelegation + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// AvailablePrivateEndpointType - The information of an AvailablePrivateEndpointType. +type AvailablePrivateEndpointType struct { + // Display name of the resource. + DisplayName *string + + // A unique identifier of the AvailablePrivateEndpoint Type resource. + ID *string + + // The name of the service and resource. + Name *string + + // The name of the service and resource. + ResourceName *string + + // Resource type. + Type *string +} + +// AvailablePrivateEndpointTypesResult - An array of available PrivateEndpoint types. +type AvailablePrivateEndpointTypesResult struct { + // An array of available privateEndpoint type. + Value []*AvailablePrivateEndpointType + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// AvailableProvidersList - List of available countries with details. +type AvailableProvidersList struct { + // REQUIRED; List of available countries. + Countries []*AvailableProvidersListCountry +} + +// AvailableProvidersListCity - City or town details. +type AvailableProvidersListCity struct { + // The city or town name. + CityName *string + + // A list of Internet service providers. + Providers []*string +} + +// AvailableProvidersListCountry - Country details. +type AvailableProvidersListCountry struct { + // The country name. + CountryName *string + + // A list of Internet service providers. + Providers []*string + + // List of available states in the country. + States []*AvailableProvidersListState +} + +// AvailableProvidersListParameters - Constraints that determine the list of available Internet service providers. +type AvailableProvidersListParameters struct { + // A list of Azure regions. + AzureLocations []*string + + // The city or town for available providers list. + City *string + + // The country for available providers list. + Country *string + + // The state for available providers list. + State *string +} + +// AvailableProvidersListState - State details. +type AvailableProvidersListState struct { + // List of available cities or towns in the state. + Cities []*AvailableProvidersListCity + + // A list of Internet service providers. + Providers []*string + + // The state name. + StateName *string +} + +// AvailableServiceAlias - The available service alias. +type AvailableServiceAlias struct { + // The ID of the service alias. + ID *string + + // The name of the service alias. + Name *string + + // The resource name of the service alias. + ResourceName *string + + // The type of the resource. + Type *string +} + +// AvailableServiceAliasesResult - An array of available service aliases. +type AvailableServiceAliasesResult struct { + // An array of available service aliases. + Value []*AvailableServiceAlias + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// 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 + + // Status of the Azure async operation. + Status *NetworkOperationStatus +} + +// AzureFirewall - Azure Firewall resource. +type AzureFirewall struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the azure firewall. + Properties *AzureFirewallPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // A list of availability zones denoting where the resource needs to come from. + Zones []*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// AzureFirewallApplicationRule - Properties of an application rule. +type AzureFirewallApplicationRule struct { + // Description of the rule. + Description *string + + // List of FQDN Tags for this rule. + FqdnTags []*string + + // Name of the application rule. + Name *string + + // Array of ApplicationRuleProtocols. + Protocols []*AzureFirewallApplicationRuleProtocol + + // List of source IP addresses for this rule. + SourceAddresses []*string + + // List of source IpGroups for this rule. + SourceIPGroups []*string + + // List of FQDNs for this rule. + TargetFqdns []*string +} + +// AzureFirewallApplicationRuleCollection - Application rule collection resource. +type AzureFirewallApplicationRuleCollection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string + + // Properties of the azure firewall application rule collection. + Properties *AzureFirewallApplicationRuleCollectionPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// AzureFirewallApplicationRuleCollectionPropertiesFormat - Properties of the application rule collection. +type AzureFirewallApplicationRuleCollectionPropertiesFormat struct { + // The action type of a rule collection. + Action *AzureFirewallRCAction + + // Priority of the application rule collection resource. + Priority *int32 + + // Collection of rules used by a application rule collection. + Rules []*AzureFirewallApplicationRule + + // READ-ONLY; The provisioning state of the application rule collection resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // Protocol type. + ProtocolType *AzureFirewallApplicationRuleProtocolType +} + +// AzureFirewallFqdnTag - Azure Firewall FQDN Tag Resource. +type AzureFirewallFqdnTag struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the azure firewall FQDN tag. + Properties *AzureFirewallFqdnTagPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// AzureFirewallFqdnTagListResult - Response for ListAzureFirewallFqdnTags API service call. +type AzureFirewallFqdnTagListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Azure Firewall FQDN Tags in a resource group. + Value []*AzureFirewallFqdnTag +} + +// AzureFirewallFqdnTagPropertiesFormat - Azure Firewall FQDN Tag Properties. +type AzureFirewallFqdnTagPropertiesFormat struct { + // READ-ONLY; The name of this FQDN Tag. + FqdnTagName *string + + // READ-ONLY; The provisioning state of the Azure firewall FQDN tag resource. + ProvisioningState *ProvisioningState +} + +// AzureFirewallIPConfiguration - IP configuration of an Azure Firewall. +type AzureFirewallIPConfiguration struct { + // Resource ID. + ID *string + + // Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the azure firewall IP configuration. + Properties *AzureFirewallIPConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // Reference to the subnet resource. This resource must be named 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. + Subnet *SubResource + + // READ-ONLY; The Firewall Internal Load Balancer IP to be used as the next hop in User Defined Routes. + PrivateIPAddress *string + + // READ-ONLY; The provisioning state of the Azure firewall IP configuration resource. + ProvisioningState *ProvisioningState +} + +// AzureFirewallIPGroups - IpGroups associated with azure firewall. +type AzureFirewallIPGroups struct { + // READ-ONLY; The iteration number. + ChangeNumber *string + + // READ-ONLY; Resource ID. + ID *string +} + +// AzureFirewallListResult - Response for ListAzureFirewalls API service call. +type AzureFirewallListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Azure Firewalls in a resource group. + Value []*AzureFirewall +} + +// AzureFirewallNatRCAction - AzureFirewall NAT Rule Collection Action. +type AzureFirewallNatRCAction struct { + // The type of action. + Type *AzureFirewallNatRCActionType +} + +// AzureFirewallNatRule - Properties of a NAT rule. +type AzureFirewallNatRule struct { + // Description of the rule. + Description *string + + // List of destination IP addresses for this rule. Supports IP ranges, prefixes, and service tags. + DestinationAddresses []*string + + // List of destination ports. + DestinationPorts []*string + + // Name of the NAT rule. + Name *string + + // Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. + Protocols []*AzureFirewallNetworkRuleProtocol + + // List of source IP addresses for this rule. + SourceAddresses []*string + + // List of source IpGroups for this rule. + SourceIPGroups []*string + + // The translated address for this NAT rule. + TranslatedAddress *string + + // The translated FQDN for this NAT rule. + TranslatedFqdn *string + + // The translated port for this NAT rule. + TranslatedPort *string +} + +// AzureFirewallNatRuleCollection - NAT rule collection resource. +type AzureFirewallNatRuleCollection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string + + // Properties of the azure firewall NAT rule collection. + Properties *AzureFirewallNatRuleCollectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// AzureFirewallNatRuleCollectionProperties - Properties of the NAT rule collection. +type AzureFirewallNatRuleCollectionProperties struct { + // The action type of a NAT rule collection. + Action *AzureFirewallNatRCAction + + // Priority of the NAT rule collection resource. + Priority *int32 + + // Collection of rules used by a NAT rule collection. + Rules []*AzureFirewallNatRule + + // READ-ONLY; The provisioning state of the NAT rule collection resource. + ProvisioningState *ProvisioningState +} + +// AzureFirewallNetworkRule - Properties of the network rule. +type AzureFirewallNetworkRule struct { + // Description of the rule. + Description *string + + // List of destination IP addresses. + DestinationAddresses []*string + + // List of destination FQDNs. + DestinationFqdns []*string + + // List of destination IpGroups for this rule. + DestinationIPGroups []*string + + // List of destination ports. + DestinationPorts []*string + + // Name of the network rule. + Name *string + + // Array of AzureFirewallNetworkRuleProtocols. + Protocols []*AzureFirewallNetworkRuleProtocol + + // List of source IP addresses for this rule. + SourceAddresses []*string + + // List of source IpGroups for this rule. + SourceIPGroups []*string +} + +// AzureFirewallNetworkRuleCollection - Network rule collection resource. +type AzureFirewallNetworkRuleCollection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string + + // Properties of the azure firewall network rule collection. + Properties *AzureFirewallNetworkRuleCollectionPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// AzureFirewallNetworkRuleCollectionPropertiesFormat - Properties of the network rule collection. +type AzureFirewallNetworkRuleCollectionPropertiesFormat struct { + // The action type of a rule collection. + Action *AzureFirewallRCAction + + // Priority of the network rule collection resource. + Priority *int32 + + // Collection of rules used by a network rule collection. + Rules []*AzureFirewallNetworkRule + + // READ-ONLY; The provisioning state of the network rule collection resource. + ProvisioningState *ProvisioningState +} + +// AzureFirewallPacketCaptureFlags - Properties of the AzureFirewallRCAction. +type AzureFirewallPacketCaptureFlags struct { + // Flags to capture + Type *AzureFirewallPacketCaptureFlagsType +} + +// AzureFirewallPacketCaptureRule - Group of src/dest ips and ports to be captured. +type AzureFirewallPacketCaptureRule struct { + // List of ports to be captured. + DestinationPorts []*string + + // List of destination IP addresses/subnets to be captured. + Destinations []*string + + // List of source IP addresses/subnets to be captured. + Sources []*string +} + +// AzureFirewallPropertiesFormat - Properties of the Azure Firewall. +type AzureFirewallPropertiesFormat struct { + // The additional properties used to further config this azure firewall. + AdditionalProperties map[string]*string + + // Collection of application rule collections used by Azure Firewall. + ApplicationRuleCollections []*AzureFirewallApplicationRuleCollection + + // The firewallPolicy associated with this azure firewall. + FirewallPolicy *SubResource + + // IP addresses associated with AzureFirewall. + HubIPAddresses *HubIPAddresses + + // IP configuration of the Azure Firewall resource. + IPConfigurations []*AzureFirewallIPConfiguration + + // IP configuration of the Azure Firewall used for management traffic. + ManagementIPConfiguration *AzureFirewallIPConfiguration + + // Collection of NAT rule collections used by Azure Firewall. + NatRuleCollections []*AzureFirewallNatRuleCollection + + // Collection of network rule collections used by Azure Firewall. + NetworkRuleCollections []*AzureFirewallNetworkRuleCollection + + // The Azure Firewall Resource SKU. + SKU *AzureFirewallSKU + + // The operation mode for Threat Intelligence. + ThreatIntelMode *AzureFirewallThreatIntelMode + + // The virtualHub to which the firewall belongs. + VirtualHub *SubResource + + // READ-ONLY; IpGroups associated with AzureFirewall. + IPGroups []*AzureFirewallIPGroups + + // READ-ONLY; The provisioning state of the Azure firewall resource. + ProvisioningState *ProvisioningState +} + +// AzureFirewallPublicIPAddress - Public IP Address associated with azure firewall. +type AzureFirewallPublicIPAddress struct { + // Public IP Address value. + Address *string +} + +// AzureFirewallRCAction - Properties of the AzureFirewallRCAction. +type AzureFirewallRCAction struct { + // The type of action. + Type *AzureFirewallRCActionType +} + +// AzureFirewallSKU - SKU of an Azure Firewall. +type AzureFirewallSKU struct { + // Name of an Azure Firewall SKU. + Name *AzureFirewallSKUName + + // Tier of an Azure Firewall. + Tier *AzureFirewallSKUTier +} + +// AzureReachabilityReport - Azure reachability report details. +type AzureReachabilityReport struct { + // REQUIRED; The aggregation level of Azure reachability report. Can be Country, State or City. + AggregationLevel *string + + // REQUIRED; Parameters that define a geographic location. + ProviderLocation *AzureReachabilityReportLocation + + // REQUIRED; List of Azure reachability report items. + ReachabilityReport []*AzureReachabilityReportItem +} + +// AzureReachabilityReportItem - Azure reachability report details for a given provider location. +type AzureReachabilityReportItem struct { + // The Azure region. + AzureLocation *string + + // List of latency details for each of the time series. + Latencies []*AzureReachabilityReportLatencyInfo + + // The Internet service provider. + Provider *string +} + +// 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 + + // The time stamp. + TimeStamp *time.Time +} + +// AzureReachabilityReportLocation - Parameters that define a geographic location. +type AzureReachabilityReportLocation struct { + // REQUIRED; The name of the country. + Country *string + + // The name of the city or town. + City *string + + // The name of the state. + State *string +} + +// AzureReachabilityReportParameters - Geographic and time constraints for Azure reachability report. +type AzureReachabilityReportParameters struct { + // REQUIRED; The end time for the Azure reachability report. + EndTime *time.Time + + // REQUIRED; Parameters that define a geographic location. + ProviderLocation *AzureReachabilityReportLocation + + // REQUIRED; The start time for the Azure reachability report. + StartTime *time.Time + + // Optional Azure regions to scope the query to. + AzureLocations []*string + + // List of Internet service providers. + Providers []*string +} + +// AzureWebCategory - Azure Web Category Resource. +type AzureWebCategory struct { + // Resource ID. + ID *string + + // Properties of the Azure Web Category. + Properties *AzureWebCategoryPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// AzureWebCategoryListResult - Response for ListAzureWebCategories API service call. +type AzureWebCategoryListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Azure Web Categories for a given Subscription. + Value []*AzureWebCategory +} + +// AzureWebCategoryPropertiesFormat - Azure Web Category Properties. +type AzureWebCategoryPropertiesFormat struct { + // READ-ONLY; The name of the group that the category belongs to. + Group *string +} + +// BGPCommunity - Contains bgp community information offered in Service Community resources. +type BGPCommunity struct { + // The name of the bgp community. e.g. Skype. + CommunityName *string + + // The prefixes that the bgp community contains. + CommunityPrefixes []*string + + // The value of the bgp community. For more information: https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. + CommunityValue *string + + // Customer is authorized to use bgp community or not. + IsAuthorizedToUse *bool + + // The service group of the bgp community contains. + ServiceGroup *string + + // The region which the service support. e.g. For O365, region is Global. + ServiceSupportedRegion *string +} + +// BackendAddressInboundNatRulePortMappings - The response for a QueryInboundNatRulePortMapping API. +type BackendAddressInboundNatRulePortMappings struct { + // Collection of inbound NAT rule port mappings. + InboundNatRulePortMappings []*InboundNatRulePortMapping +} + +// BackendAddressPool - Pool of backend IP addresses. +type BackendAddressPool struct { + // Resource ID. + ID *string + + // 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 + + // Properties of load balancer backend address pool. + Properties *BackendAddressPoolPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // An array of backend addresses. + LoadBalancerBackendAddresses []*LoadBalancerBackendAddress + + // The location of the backend address pool. + Location *string + + // Backend address synchronous mode for the backend pool + SyncMode *SyncMode + + // An array of gateway load balancer tunnel interfaces. + TunnelInterfaces []*GatewayLoadBalancerTunnelInterface + + // A reference to a virtual network. + VirtualNetwork *SubResource + + // READ-ONLY; An array of references to IP addresses defined in network interfaces. + BackendIPConfigurations []*InterfaceIPConfiguration + + // READ-ONLY; An array of references to inbound NAT rules that use this backend address pool. + InboundNatRules []*SubResource + + // READ-ONLY; An array of references to load balancing rules that use this backend address pool. + LoadBalancingRules []*SubResource + + // READ-ONLY; A reference to an outbound rule that uses this backend address pool. + OutboundRule *SubResource + + // READ-ONLY; An array of references to outbound rules that use this backend address pool. + OutboundRules []*SubResource + + // READ-ONLY; The provisioning state of the backend address pool resource. + ProvisioningState *ProvisioningState +} + +// BaseAdminRule - Network base admin rule. +type BaseAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *AdminRuleKind + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// 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 + + // READ-ONLY; The type of the resource. + ResourceType *string + + // READ-ONLY; Duration in mins the session has been active. + SessionDurationInMins *float32 + + // READ-ONLY; A unique id for the session. + SessionID *string + + // READ-ONLY; The time when the session started. + StartTime any + + // READ-ONLY; The host name of the target. + TargetHostName *string + + // READ-ONLY; The IP Address of the target. + TargetIPAddress *string + + // READ-ONLY; The resource group of the target. + TargetResourceGroup *string + + // READ-ONLY; The resource id of the target. + TargetResourceID *string + + // READ-ONLY; The subscription id for the target virtual machine. + TargetSubscriptionID *string + + // READ-ONLY; The user name who is active on this session. + UserName *string +} + +// BastionActiveSessionListResult - Response for GetActiveSessions. +type BastionActiveSessionListResult struct { + // The URL to get the next set of results. + NextLink *string + + // List of active sessions on the bastion. + Value []*BastionActiveSession +} + +// BastionHost - Bastion Host resource. +type BastionHost struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Represents the bastion host resource. + Properties *BastionHostPropertiesFormat + + // The sku of this Bastion Host. + SKU *SKU + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// BastionHostIPConfiguration - IP configuration of an Bastion Host. +type BastionHostIPConfiguration struct { + // Resource ID. + ID *string + + // Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Represents the ip configuration associated with the resource. + Properties *BastionHostIPConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Ip configuration type. + Type *string +} + +// BastionHostIPConfigurationPropertiesFormat - Properties of IP configuration of an Bastion Host. +type BastionHostIPConfigurationPropertiesFormat struct { + // REQUIRED; Reference of the PublicIP resource. + PublicIPAddress *SubResource + + // REQUIRED; Reference of the subnet resource. + Subnet *SubResource + + // Private IP allocation method. + PrivateIPAllocationMethod *IPAllocationMethod + + // READ-ONLY; The provisioning state of the bastion host IP configuration resource. + ProvisioningState *ProvisioningState +} + +// BastionHostListResult - Response for ListBastionHosts API service call. +type BastionHostListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Bastion Hosts in a resource group. + Value []*BastionHost +} + +// BastionHostPropertiesFormat - Properties of the Bastion Host. +type BastionHostPropertiesFormat struct { + // FQDN for the endpoint on which bastion host is accessible. + DNSName *string + + // Enable/Disable Copy/Paste feature of the Bastion Host resource. + DisableCopyPaste *bool + + // Enable/Disable File Copy feature of the Bastion Host resource. + EnableFileCopy *bool + + // Enable/Disable IP Connect feature of the Bastion Host resource. + EnableIPConnect *bool + + // Enable/Disable Kerberos feature of the Bastion Host resource. + EnableKerberos *bool + + // Enable/Disable Shareable Link of the Bastion Host resource. + EnableShareableLink *bool + + // Enable/Disable Tunneling feature of the Bastion Host resource. + EnableTunneling *bool + + // IP configuration of the Bastion Host resource. + IPConfigurations []*BastionHostIPConfiguration + NetworkACLs *BastionHostPropertiesFormatNetworkACLs + + // The scale units for the Bastion Host resource. + ScaleUnits *int32 + + // Reference to an existing virtual network required for Developer Bastion Host only. + VirtualNetwork *SubResource + + // READ-ONLY; The provisioning state of the bastion host resource. + ProvisioningState *ProvisioningState +} + +type BastionHostPropertiesFormatNetworkACLs struct { + // Sets the IP ACL rules for Developer Bastion Host. + IPRules []*IPRule +} + +// BastionSessionDeleteResult - Response for DisconnectActiveSessions. +type BastionSessionDeleteResult struct { + // The URL to get the next set of results. + NextLink *string + + // List of sessions with their corresponding state. + Value []*BastionSessionState +} + +// BastionSessionState - The session state detail for a target. +type BastionSessionState struct { + // READ-ONLY; Used for extra information. + Message *string + + // READ-ONLY; A unique id for the session. + SessionID *string + + // READ-ONLY; The state of the session. Disconnected/Failed/NotFound. + State *string +} + +// BastionShareableLink - Bastion Shareable Link. +type BastionShareableLink struct { + // REQUIRED; Reference of the virtual machine resource. + VM *VM + + // READ-ONLY; The unique Bastion Shareable Link to the virtual machine. + Bsl *string + + // READ-ONLY; The time when the link was created. + CreatedAt *string + + // READ-ONLY; Optional field indicating the warning or error message related to the vm in case of partial failure. + Message *string +} + +// BastionShareableLinkListRequest - Post request for all the Bastion Shareable Link endpoints. +type BastionShareableLinkListRequest struct { + // List of VM references. + VMs []*BastionShareableLink +} + +// BastionShareableLinkListResult - Response for all the Bastion Shareable Link endpoints. +type BastionShareableLinkListResult struct { + // The URL to get the next set of results. + NextLink *string + + // List of Bastion Shareable Links for the request. + Value []*BastionShareableLink +} + +// BgpConnection - Virtual Appliance Site resource. +type BgpConnection struct { + // Resource ID. + ID *string + + // Name of the connection. + Name *string + + // The properties of the Bgp connections. + Properties *BgpConnectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Connection type. + Type *string +} + +// BgpConnectionProperties - Properties of the bgp connection. +type BgpConnectionProperties struct { + // The reference to the HubVirtualNetworkConnection resource. + HubVirtualNetworkConnection *SubResource + + // Peer ASN. + PeerAsn *int64 + + // Peer IP. + PeerIP *string + + // READ-ONLY; The current state of the VirtualHub to Peer. + ConnectionState *HubBgpConnectionStatus + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// BgpPeerStatus - BGP peer status details. +type BgpPeerStatus struct { + // READ-ONLY; The autonomous system number of the remote BGP peer. + Asn *int64 + + // READ-ONLY; For how long the peering has been up. + ConnectedDuration *string + + // READ-ONLY; The virtual network gateway's local address. + LocalAddress *string + + // READ-ONLY; The number of BGP messages received. + MessagesReceived *int64 + + // READ-ONLY; The number of BGP messages sent. + MessagesSent *int64 + + // READ-ONLY; The remote BGP peer. + Neighbor *string + + // READ-ONLY; The number of routes learned from this peer. + RoutesReceived *int64 + + // READ-ONLY; The BGP peer state. + State *BgpPeerState +} + +// BgpPeerStatusListResult - Response for list BGP peer status API service call. +type BgpPeerStatusListResult struct { + // List of BGP peers. + Value []*BgpPeerStatus +} + +// BgpServiceCommunity - Service Community Properties. +type BgpServiceCommunity struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the BGP service community. + Properties *BgpServiceCommunityPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// BgpServiceCommunityListResult - Response for the ListServiceCommunity API service call. +type BgpServiceCommunityListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of service community resources. + Value []*BgpServiceCommunity +} + +// BgpServiceCommunityPropertiesFormat - Properties of Service Community. +type BgpServiceCommunityPropertiesFormat struct { + // A list of bgp communities. + BgpCommunities []*BGPCommunity + + // The name of the bgp community. e.g. Skype. + ServiceName *string +} + +// BgpSettings - BGP settings details. +type BgpSettings struct { + // The BGP speaker's ASN. + Asn *int64 + + // The BGP peering address and BGP identifier of this BGP speaker. + BgpPeeringAddress *string + + // BGP peering address with IP configuration ID for virtual network gateway. + BgpPeeringAddresses []*IPConfigurationBgpPeeringAddress + + // The weight added to routes learned from this BGP speaker. + PeerWeight *int32 +} + +// BreakOutCategoryPolicies - Network Virtual Appliance Sku Properties. +type BreakOutCategoryPolicies struct { + // Flag to control breakout of o365 allow category. + Allow *bool + + // Flag to control breakout of o365 default category. + Default *bool + + // Flag to control breakout of o365 optimize category. + Optimize *bool +} + +// CheckPrivateLinkServiceVisibilityRequest - Request body of the CheckPrivateLinkServiceVisibility API service call. +type CheckPrivateLinkServiceVisibilityRequest struct { + // The alias of the private link service. + PrivateLinkServiceAlias *string +} + +// ChildResource - Proxy resource representation. +type ChildResource struct { + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string +} + +// ConfigurationDiagnosticParameters - Parameters to get network configuration diagnostic. +type ConfigurationDiagnosticParameters struct { + // REQUIRED; List of network configuration diagnostic profiles. + Profiles []*ConfigurationDiagnosticProfile + + // REQUIRED; The ID of the target resource to perform network configuration diagnostic. Valid options are VM, NetworkInterface, + // VMSS/NetworkInterface and Application Gateway. + TargetResourceID *string + + // Verbosity level. + VerbosityLevel *VerbosityLevel +} + +// ConfigurationDiagnosticProfile - Parameters to compare with network configuration. +type ConfigurationDiagnosticProfile struct { + // REQUIRED; Traffic destination. Accepted values are: '*', IP Address/CIDR, Service Tag. + Destination *string + + // REQUIRED; Traffic destination port. Accepted values are '*' and a single port in the range (0 - 65535). + DestinationPort *string + + // REQUIRED; The direction of the traffic. + Direction *Direction + + // REQUIRED; Protocol to be verified on. Accepted values are '*', TCP, UDP. + Protocol *string + + // REQUIRED; Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag. + Source *string +} + +// ConfigurationDiagnosticResponse - Results of network configuration diagnostic on the target resource. +type ConfigurationDiagnosticResponse struct { + // READ-ONLY; List of network configuration diagnostic results. + Results []*ConfigurationDiagnosticResult +} + +// ConfigurationDiagnosticResult - Network configuration diagnostic result corresponded to provided traffic query. +type ConfigurationDiagnosticResult struct { + // Network security group result. + NetworkSecurityGroupResult *SecurityGroupResult + + // Network configuration diagnostic profile. + Profile *ConfigurationDiagnosticProfile +} + +// ConfigurationGroup - The network configuration group resource +type ConfigurationGroup struct { + // Network group ID. + ID *string + + // The network configuration group properties + Properties *GroupProperties +} + +// ConnectionMonitor - Parameters that define the operation to create a connection monitor. +type ConnectionMonitor struct { + // REQUIRED; Properties of the connection monitor. + Properties *ConnectionMonitorParameters + + // Connection monitor location. + Location *string + + // Connection monitor tags. + Tags map[string]*string +} + +// ConnectionMonitorDestination - Describes the destination of connection monitor. +type ConnectionMonitorDestination struct { + // Address of the connection monitor destination (IP or domain name). + Address *string + + // The destination port used by connection monitor. + Port *int32 + + // The ID of the resource used as the destination by connection monitor. + ResourceID *string +} + +// ConnectionMonitorEndpoint - Describes the connection monitor endpoint. +type ConnectionMonitorEndpoint struct { + // REQUIRED; The name of the connection monitor endpoint. + Name *string + + // Address of the connection monitor endpoint (IP or domain name). + Address *string + + // Test coverage for the endpoint. + CoverageLevel *CoverageLevel + + // Filter for sub-items within the endpoint. + Filter *ConnectionMonitorEndpointFilter + + // Resource ID of the connection monitor endpoint. + ResourceID *string + + // Endpoint scope. + Scope *ConnectionMonitorEndpointScope + + // The endpoint type. + Type *EndpointType +} + +// ConnectionMonitorEndpointFilter - Describes the connection monitor endpoint filter. +type ConnectionMonitorEndpointFilter struct { + // List of items in the filter. + Items []*ConnectionMonitorEndpointFilterItem + + // The behavior of the endpoint filter. Currently only 'Include' is supported. + Type *ConnectionMonitorEndpointFilterType +} + +// ConnectionMonitorEndpointFilterItem - Describes the connection monitor endpoint filter item. +type ConnectionMonitorEndpointFilterItem struct { + // The address of the filter item. + Address *string + + // The type of item included in the filter. Currently only 'AgentAddress' is supported. + Type *ConnectionMonitorEndpointFilterItemType +} + +// ConnectionMonitorEndpointScope - Describes the connection monitor endpoint scope. +type ConnectionMonitorEndpointScope struct { + // List of items which needs to be excluded from the endpoint scope. + Exclude []*ConnectionMonitorEndpointScopeItem + + // List of items which needs to be included to the endpoint scope. + Include []*ConnectionMonitorEndpointScopeItem +} + +// 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 +} + +// ConnectionMonitorHTTPConfiguration - Describes the HTTP configuration. +type ConnectionMonitorHTTPConfiguration struct { + // The HTTP method to use. + Method *HTTPConfigurationMethod + + // The path component of the URI. For instance, "/dir1/dir2". + Path *string + + // The port to connect to. + Port *int32 + + // Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. + PreferHTTPS *bool + + // The HTTP headers to transmit with the request. + RequestHeaders []*HTTPHeader + + // HTTP status codes to consider successful. For instance, "2xx,301-304,418". + ValidStatusCodeRanges []*string +} + +// ConnectionMonitorIcmpConfiguration - Describes the ICMP configuration. +type ConnectionMonitorIcmpConfiguration struct { + // Value indicating whether path evaluation with trace route should be disabled. + DisableTraceRoute *bool +} + +// ConnectionMonitorListResult - List of connection monitors. +type ConnectionMonitorListResult struct { + // Information about connection monitors. + Value []*ConnectionMonitorResult +} + +// ConnectionMonitorOutput - Describes a connection monitor output destination. +type ConnectionMonitorOutput struct { + // Connection monitor output destination type. Currently, only "Workspace" is supported. + Type *OutputType + + // Describes the settings for producing output into a log analytics workspace. + WorkspaceSettings *ConnectionMonitorWorkspaceSettings +} + +// 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 + + // Describes the destination of connection monitor. + Destination *ConnectionMonitorDestination + + // List of connection monitor endpoints. + Endpoints []*ConnectionMonitorEndpoint + + // Monitoring interval in seconds. + MonitoringIntervalInSeconds *int32 + + // Optional notes to be associated with the connection monitor. + Notes *string + + // List of connection monitor outputs. + Outputs []*ConnectionMonitorOutput + + // Describes the source of connection monitor. + Source *ConnectionMonitorSource + + // List of connection monitor test configurations. + TestConfigurations []*ConnectionMonitorTestConfiguration + + // List of connection monitor test groups. + TestGroups []*ConnectionMonitorTestGroup +} + +// ConnectionMonitorQueryResult - List of connection states snapshots. +type ConnectionMonitorQueryResult struct { + // Status of connection monitor source. + SourceStatus *ConnectionMonitorSourceStatus + + // Information about connection states. + States []*ConnectionStateSnapshot +} + +// ConnectionMonitorResult - Information about the connection monitor. +type ConnectionMonitorResult struct { + // Connection monitor location. + Location *string + + // Properties of the connection monitor result. + Properties *ConnectionMonitorResultProperties + + // Connection monitor tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; ID of the connection monitor. + ID *string + + // READ-ONLY; Name of the connection monitor. + Name *string + + // READ-ONLY; Connection monitor type. + Type *string +} + +// ConnectionMonitorResultProperties - Describes the properties of a connection monitor. +type ConnectionMonitorResultProperties struct { + // Determines if the connection monitor will start automatically once created. + AutoStart *bool + + // Describes the destination of connection monitor. + Destination *ConnectionMonitorDestination + + // List of connection monitor endpoints. + Endpoints []*ConnectionMonitorEndpoint + + // Monitoring interval in seconds. + MonitoringIntervalInSeconds *int32 + + // Optional notes to be associated with the connection monitor. + Notes *string + + // List of connection monitor outputs. + Outputs []*ConnectionMonitorOutput + + // Describes the source of connection monitor. + Source *ConnectionMonitorSource + + // List of connection monitor test configurations. + TestConfigurations []*ConnectionMonitorTestConfiguration + + // List of connection monitor test groups. + TestGroups []*ConnectionMonitorTestGroup + + // READ-ONLY; Type of connection monitor. + ConnectionMonitorType *ConnectionMonitorType + + // READ-ONLY; The monitoring status of the connection monitor. + MonitoringStatus *string + + // READ-ONLY; The provisioning state of the connection monitor. + ProvisioningState *ProvisioningState + + // READ-ONLY; The date and time when the connection monitor was started. + StartTime *time.Time +} + +// 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 + + // The source port used by connection monitor. + Port *int32 +} + +// 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 + + // The maximum round-trip time in milliseconds permitted for a test to evaluate as successful. + RoundTripTimeMs *float32 +} + +// ConnectionMonitorTCPConfiguration - Describes the TCP configuration. +type ConnectionMonitorTCPConfiguration struct { + // Destination port behavior. + DestinationPortBehavior *DestinationPortBehavior + + // Value indicating whether path evaluation with trace route should be disabled. + DisableTraceRoute *bool + + // The port to connect to. + Port *int32 +} + +// ConnectionMonitorTestConfiguration - Describes a connection monitor test configuration. +type ConnectionMonitorTestConfiguration struct { + // REQUIRED; The name of the connection monitor test configuration. + Name *string + + // REQUIRED; The protocol to use in test evaluation. + Protocol *ConnectionMonitorTestConfigurationProtocol + + // The parameters used to perform test evaluation over HTTP. + HTTPConfiguration *ConnectionMonitorHTTPConfiguration + + // The parameters used to perform test evaluation over ICMP. + IcmpConfiguration *ConnectionMonitorIcmpConfiguration + + // 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 + + // The threshold for declaring a test successful. + SuccessThreshold *ConnectionMonitorSuccessThreshold + + // The parameters used to perform test evaluation over TCP. + TCPConfiguration *ConnectionMonitorTCPConfiguration + + // The frequency of test evaluation, in seconds. + TestFrequencySec *int32 +} + +// ConnectionMonitorTestGroup - Describes the connection monitor test group. +type ConnectionMonitorTestGroup struct { + // REQUIRED; List of destination endpoint names. + Destinations []*string + + // REQUIRED; The name of the connection monitor test group. + Name *string + + // REQUIRED; List of source endpoint names. + Sources []*string + + // REQUIRED; List of test configuration names. + TestConfigurations []*string + + // Value indicating whether test group is disabled. + Disable *bool +} + +// ConnectionMonitorWorkspaceSettings - Describes the settings for producing output into a log analytics workspace. +type ConnectionMonitorWorkspaceSettings struct { + // Log analytics workspace resource ID. + WorkspaceResourceID *string +} + +// 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 +} + +// ConnectionSharedKey - Response for GetConnectionSharedKey API service call. +type ConnectionSharedKey struct { + // REQUIRED; The virtual network connection shared key value. + Value *string + + // Resource ID. + ID *string +} + +// ConnectionStateSnapshot - Connection state snapshot. +type ConnectionStateSnapshot struct { + // Average latency in ms. + AvgLatencyInMs *int64 + + // The connection state. + ConnectionState *ConnectionState + + // The end time of the connection snapshot. + EndTime *time.Time + + // Connectivity analysis evaluation state. + EvaluationState *EvaluationState + + // Maximum latency in ms. + MaxLatencyInMs *int64 + + // Minimum latency in ms. + MinLatencyInMs *int64 + + // The number of failed probes. + ProbesFailed *int64 + + // The number of sent probes. + ProbesSent *int64 + + // The start time of the connection snapshot. + StartTime *time.Time + + // READ-ONLY; List of hops between the source and the destination. + Hops []*ConnectivityHop +} + +// ConnectivityConfiguration - The network manager connectivity configuration resource +type ConnectivityConfiguration struct { + // Properties of a network manager connectivity configuration + Properties *ConnectivityConfigurationProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// 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 + + // Gets a page of Connectivity Configurations + Value []*ConnectivityConfiguration +} + +// ConnectivityConfigurationProperties - Properties of network manager connectivity configuration +type ConnectivityConfigurationProperties struct { + // REQUIRED; Groups for configuration + AppliesToGroups []*ConnectivityGroupItem + + // REQUIRED; Connectivity topology type. + ConnectivityTopology *ConnectivityTopology + + // Flag if need to remove current existing peerings. + DeleteExistingPeering *DeleteExistingPeering + + // A description of the connectivity configuration. + Description *string + + // List of hubItems + Hubs []*Hub + + // Flag if global mesh is supported. + IsGlobal *IsGlobal + + // READ-ONLY; The provisioning state of the connectivity configuration resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Unique identifier for this resource. + ResourceGUID *string +} + +// 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 + + // Port on which check connectivity will be performed. + Port *int32 + + // The ID of the resource to which a connection attempt will be made. + ResourceID *string +} + +// ConnectivityGroupItem - Connectivity group item. +type ConnectivityGroupItem struct { + // REQUIRED; Group connectivity type. + GroupConnectivity *GroupConnectivity + + // REQUIRED; Network group Id. + NetworkGroupID *string + + // Flag if global is supported. + IsGlobal *IsGlobal + + // Flag if need to use hub gateway. + UseHubGateway *UseHubGateway +} + +// ConnectivityHop - Information about a hop between the source and the destination. +type ConnectivityHop struct { + // READ-ONLY; The IP address of the hop. + Address *string + + // READ-ONLY; The ID of the hop. + ID *string + + // READ-ONLY; List of issues. + Issues []*ConnectivityIssue + + // READ-ONLY; List of hop links. + Links []*HopLink + + // READ-ONLY; List of next hop identifiers. + NextHopIDs []*string + + // READ-ONLY; List of previous hop identifiers. + PreviousHopIDs []*string + + // READ-ONLY; List of previous hop links. + PreviousLinks []*HopLink + + // READ-ONLY; The ID of the resource corresponding to this hop. + ResourceID *string + + // READ-ONLY; The type of the hop. + Type *string +} + +// ConnectivityInformation - Information on the connectivity status. +type ConnectivityInformation struct { + // READ-ONLY; Average latency in milliseconds. + AvgLatencyInMs *int32 + + // READ-ONLY; The connection status. + ConnectionStatus *ConnectionStatus + + // READ-ONLY; List of hops between the source and the destination. + Hops []*ConnectivityHop + + // READ-ONLY; Maximum latency in milliseconds. + MaxLatencyInMs *int32 + + // READ-ONLY; Minimum latency in milliseconds. + MinLatencyInMs *int32 + + // READ-ONLY; Number of failed probes. + ProbesFailed *int32 + + // READ-ONLY; Total number of probes sent. + ProbesSent *int32 +} + +// 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 + + // READ-ONLY; The origin of the issue. + Origin *Origin + + // READ-ONLY; The severity of the issue. + Severity *Severity + + // READ-ONLY; The type of issue. + Type *IssueType +} + +// ConnectivityParameters - Parameters that determine how the connectivity check will be performed. +type ConnectivityParameters struct { + // REQUIRED; The destination of connection. + Destination *ConnectivityDestination + + // REQUIRED; The source of the connection. + Source *ConnectivitySource + + // Preferred IP version of the connection. + PreferredIPVersion *IPVersion + + // Network protocol. + Protocol *Protocol + + // Configuration of the protocol. + ProtocolConfiguration *ProtocolConfiguration +} + +// 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 + + // The source port from which a connectivity check will be performed. + Port *int32 +} + +// Container - Reference to container resource in remote resource provider. +type Container struct { + // Resource ID. + ID *string +} + +// ContainerNetworkInterface - Container network interface child resource. +type ContainerNetworkInterface struct { + // Resource ID. + ID *string + + // The name of the resource. This name can be used to access the resource. + Name *string + + // Container network interface properties. + Properties *ContainerNetworkInterfacePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Sub Resource type. + Type *string +} + +// ContainerNetworkInterfaceConfiguration - Container network interface configuration child resource. +type ContainerNetworkInterfaceConfiguration struct { + // Resource ID. + ID *string + + // The name of the resource. This name can be used to access the resource. + Name *string + + // Container network interface configuration properties. + Properties *ContainerNetworkInterfaceConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Sub Resource type. + Type *string +} + +// ContainerNetworkInterfaceConfigurationPropertiesFormat - Container network interface configuration properties. +type ContainerNetworkInterfaceConfigurationPropertiesFormat struct { + // A list of container network interfaces created from this container network interface configuration. + ContainerNetworkInterfaces []*SubResource + + // A list of ip configurations of the container network interface configuration. + IPConfigurations []*IPConfigurationProfile + + // READ-ONLY; The provisioning state of the container network interface configuration resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // Properties of the container network interface IP configuration. + Properties *ContainerNetworkInterfaceIPConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Sub Resource type. + Type *string +} + +// 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 +} + +// ContainerNetworkInterfacePropertiesFormat - Properties of container network interface. +type ContainerNetworkInterfacePropertiesFormat struct { + // Reference to the container to which this container network interface is attached. + Container *Container + + // READ-ONLY; Container network interface configuration from which this container network interface is created. + ContainerNetworkInterfaceConfiguration *ContainerNetworkInterfaceConfiguration + + // READ-ONLY; Reference to the ip configuration on this container nic. + IPConfigurations []*ContainerNetworkInterfaceIPConfiguration + + // READ-ONLY; The provisioning state of the container network interface resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // List of BGP communities which this criteria matches. + Community []*string + + // Match condition to apply RouteMap rules. + MatchCondition *RouteMapMatchCondition + + // List of route prefixes which this criteria matches. + RoutePrefix []*string +} + +// CrossTenantScopes - Cross tenant scopes. +type CrossTenantScopes struct { + // READ-ONLY; List of management groups. + ManagementGroups []*string + + // READ-ONLY; List of subscriptions. + Subscriptions []*string + + // READ-ONLY; Tenant ID. + TenantID *string +} + +// CustomDNSConfigPropertiesFormat - Contains custom Dns resolution configuration from customer. +type CustomDNSConfigPropertiesFormat struct { + // Fqdn that resolves to private endpoint ip address. + Fqdn *string + + // A list of private ip addresses of the private endpoint. + IPAddresses []*string +} + +// CustomIPPrefix - Custom IP prefix resource. +type CustomIPPrefix struct { + // The extended location of the custom IP prefix. + ExtendedLocation *ExtendedLocation + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Custom IP prefix properties. + Properties *CustomIPPrefixPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones []*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// CustomIPPrefixListResult - Response for ListCustomIpPrefixes API service call. +type CustomIPPrefixListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of Custom IP prefixes that exists in a resource group. + Value []*CustomIPPrefix +} + +// CustomIPPrefixPropertiesFormat - Custom IP prefix properties. +type CustomIPPrefixPropertiesFormat struct { + // The ASN for CIDR advertising. Should be an integer as string. + Asn *string + + // Authorization message for WAN validation. + AuthorizationMessage *string + + // The prefix range in CIDR notation. Should include the start address and the prefix length. + Cidr *string + + // The commissioned state of the Custom IP Prefix. + CommissionedState *CommissionedState + + // The Parent CustomIpPrefix for IPv6 /64 CustomIpPrefix. + CustomIPPrefixParent *SubResource + + // Whether to do express route advertise. + ExpressRouteAdvertise *bool + + // The Geo for CIDR advertising. Should be an Geo code. + Geo *Geo + + // Whether to Advertise the range to Internet. + NoInternetAdvertise *bool + + // Type of custom IP prefix. Should be Singular, Parent, or Child. + PrefixType *CustomIPPrefixType + + // Signed message for WAN validation. + SignedMessage *string + + // READ-ONLY; The list of all Children for IPv6 /48 CustomIpPrefix. + ChildCustomIPPrefixes []*SubResource + + // READ-ONLY; The reason why resource is in failed state. + FailedReason *string + + // READ-ONLY; The provisioning state of the custom IP prefix resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The list of all referenced PublicIpPrefixes. + PublicIPPrefixes []*SubResource + + // READ-ONLY; The resource GUID property of the custom IP prefix resource. + ResourceGUID *string +} + +// DNSNameAvailabilityResult - Response for the CheckDnsNameAvailability API service call. +type DNSNameAvailabilityResult struct { + // Domain availability (True/False). + Available *bool +} + +// DNSSettings - DNS Proxy Settings in Firewall Policy. +type DNSSettings struct { + // Enable DNS Proxy on Firewalls attached to the Firewall Policy. + EnableProxy *bool + + // FQDNs in Network Rules are supported when set to true. + RequireProxyForNetworkRules *bool + + // List of Custom DNS Servers. + Servers []*string +} + +// DdosCustomPolicy - A DDoS custom policy in a resource group. +type DdosCustomPolicy struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the DDoS custom policy. + Properties *DdosCustomPolicyPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// DdosCustomPolicyPropertiesFormat - DDoS custom policy properties. +type DdosCustomPolicyPropertiesFormat struct { + // READ-ONLY; The provisioning state of the DDoS custom policy resource. + ProvisioningState *ProvisioningState + + // 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 +} + +// DdosProtectionPlan - A DDoS protection plan in a resource group. +type DdosProtectionPlan struct { + // Resource location. + Location *string + + // Properties of the DDoS protection plan. + Properties *DdosProtectionPlanPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// DdosProtectionPlanListResult - A list of DDoS protection plans. +type DdosProtectionPlanListResult struct { + // A list of DDoS protection plans. + Value []*DdosProtectionPlan + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// DdosProtectionPlanPropertiesFormat - DDoS protection plan properties. +type DdosProtectionPlanPropertiesFormat struct { + // READ-ONLY; The provisioning state of the DDoS protection plan resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The list of public IPs associated with the DDoS protection plan resource. This list is read-only. + PublicIPAddresses []*SubResource + + // 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 + + // READ-ONLY; The list of virtual networks associated with the DDoS protection plan resource. This list is read-only. + VirtualNetworks []*SubResource +} + +// 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 + + // The DDoS protection mode of the public IP + ProtectionMode *DdosSettingsProtectionMode +} + +// DefaultAdminPropertiesFormat - Security default admin rule resource. +type DefaultAdminPropertiesFormat struct { + // Default rule flag. + Flag *string + + // READ-ONLY; Indicates the access allowed for this particular rule + Access *SecurityConfigurationRuleAccess + + // READ-ONLY; A description for this rule. Restricted to 140 chars. + Description *string + + // READ-ONLY; The destination port ranges. + DestinationPortRanges []*string + + // READ-ONLY; The destination address prefixes. CIDR or destination IP ranges. + Destinations []*AddressPrefixItem + + // READ-ONLY; Indicates if the traffic matched against the rule in inbound or outbound. + Direction *SecurityConfigurationRuleDirection + + // 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 + + // READ-ONLY; Network protocol this rule applies to. + Protocol *SecurityConfigurationRuleProtocol + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Unique identifier for this resource. + ResourceGUID *string + + // READ-ONLY; The source port ranges. + SourcePortRanges []*string + + // READ-ONLY; The CIDR or source IP ranges. + Sources []*AddressPrefixItem +} + +// DefaultAdminRule - Network default admin rule. +type DefaultAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *AdminRuleKind + + // Indicates the properties of the security admin rule + Properties *DefaultAdminPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// GetBaseAdminRule implements the BaseAdminRuleClassification interface for type DefaultAdminRule. +func (d *DefaultAdminRule) GetBaseAdminRule() *BaseAdminRule { + return &BaseAdminRule{ + Etag: d.Etag, + ID: d.ID, + Kind: d.Kind, + Name: d.Name, + SystemData: d.SystemData, + Type: d.Type, + } +} + +// DefaultRuleSetPropertyFormat - the default web application firewall rule set. +type DefaultRuleSetPropertyFormat struct { + // The type of the web application firewall rule set. + RuleSetType *string + + // The version of the web application firewall rule set type. + RuleSetVersion *string +} + +// Delegation - Details the service to which the subnet is delegated. +type Delegation struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a subnet. This name can be used to access the resource. + Name *string + + // Properties of the subnet. + Properties *ServiceDelegationPropertiesFormat + + // Resource type. + Type *string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// DelegationProperties - Properties of the delegation. +type DelegationProperties struct { + // The service name to which the NVA is delegated. + ServiceName *string + + // READ-ONLY; The current provisioning state. + ProvisioningState *ProvisioningState +} + +// DeviceProperties - List of properties of the device. +type DeviceProperties struct { + // Model of the device. + DeviceModel *string + + // Name of the device Vendor. + DeviceVendor *string + + // Link speed. + LinkSpeedInMbps *int32 +} + +// 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 +} + +// Dimension of the metric. +type Dimension struct { + // The display name of the dimension. + DisplayName *string + + // The internal name of the dimension. + InternalName *string + + // The name of the dimension. + Name *string +} + +// DscpConfiguration - Differentiated Services Code Point configuration for any given network interface +type DscpConfiguration struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the network interface. + Properties *DscpConfigurationPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// DscpConfigurationListResult - Response for the DscpConfigurationList API service call. +type DscpConfigurationListResult struct { + // A list of dscp configurations in a resource group. + Value []*DscpConfiguration + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// DscpConfigurationPropertiesFormat - Differentiated Services Code Point configuration properties. +type DscpConfigurationPropertiesFormat struct { + // Destination IP ranges. + DestinationIPRanges []*QosIPRange + + // Destination port ranges. + DestinationPortRanges []*QosPortRange + + // List of markings to be used in the configuration. + Markings []*int32 + + // RNM supported protocol types. + Protocol *ProtocolType + + // QoS object definitions + QosDefinitionCollection []*QosDefinition + + // Source IP ranges. + SourceIPRanges []*QosIPRange + + // Sources port ranges. + SourcePortRanges []*QosPortRange + + // READ-ONLY; Associated Network Interfaces to the DSCP Configuration. + AssociatedNetworkInterfaces []*Interface + + // READ-ONLY; The provisioning state of the DSCP Configuration resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Qos Collection ID generated by RNM. + QosCollectionID *string + + // READ-ONLY; The resource GUID property of the DSCP Configuration resource. + ResourceGUID *string +} + +// EffectiveBaseSecurityAdminRule - Network base admin rule. +type EffectiveBaseSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind + + // A description of the security admin configuration. + ConfigurationDescription *string + + // Resource ID. + ID *string + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem + + // A description of the rule collection. + RuleCollectionDescription *string + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup +} + +// 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 + + // Connectivity configuration ID. + ID *string + + // Properties of a network manager connectivity configuration + Properties *ConnectivityConfigurationProperties +} + +// EffectiveDefaultSecurityAdminRule - Network default admin rule. +type EffectiveDefaultSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind + + // A description of the security admin configuration. + ConfigurationDescription *string + + // Resource ID. + ID *string + + // Indicates the properties of the default security admin rule + Properties *DefaultAdminPropertiesFormat + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem + + // A description of the rule collection. + RuleCollectionDescription *string + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup +} + +// GetEffectiveBaseSecurityAdminRule implements the EffectiveBaseSecurityAdminRuleClassification interface for type EffectiveDefaultSecurityAdminRule. +func (e *EffectiveDefaultSecurityAdminRule) GetEffectiveBaseSecurityAdminRule() *EffectiveBaseSecurityAdminRule { + return &EffectiveBaseSecurityAdminRule{ + ConfigurationDescription: e.ConfigurationDescription, + ID: e.ID, + Kind: e.Kind, + RuleCollectionAppliesToGroups: e.RuleCollectionAppliesToGroups, + RuleCollectionDescription: e.RuleCollectionDescription, + RuleGroups: e.RuleGroups, + } +} + +// EffectiveNetworkSecurityGroup - Effective network security group. +type EffectiveNetworkSecurityGroup struct { + // Associated resources. + Association *EffectiveNetworkSecurityGroupAssociation + + // A collection of effective security rules. + EffectiveSecurityRules []*EffectiveNetworkSecurityRule + + // The ID of network security group that is applied. + NetworkSecurityGroup *SubResource + + // Mapping of tags to list of IP Addresses included within the tag. + TagMap *string +} + +// EffectiveNetworkSecurityGroupAssociation - The effective network security group association. +type EffectiveNetworkSecurityGroupAssociation struct { + // The ID of the network interface if assigned. + NetworkInterface *SubResource + + // The ID of the Azure network manager if assigned. + NetworkManager *SubResource + + // The ID of the subnet if assigned. + Subnet *SubResource +} + +// EffectiveNetworkSecurityGroupListResult - Response for list effective network security groups API service call. +type EffectiveNetworkSecurityGroupListResult struct { + // A list of effective network security groups. + Value []*EffectiveNetworkSecurityGroup + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// EffectiveNetworkSecurityRule - Effective network security rules. +type EffectiveNetworkSecurityRule struct { + // Whether network traffic is allowed or denied. + Access *SecurityRuleAccess + + // The destination address prefix. + DestinationAddressPrefix *string + + // The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, + // Internet), System Tags, and the asterisk (*). + DestinationAddressPrefixes []*string + + // The destination port or range. + DestinationPortRange *string + + // 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 + + // The direction of the rule. + Direction *SecurityRuleDirection + + // Expanded destination address prefix. + ExpandedDestinationAddressPrefix []*string + + // The expanded source address prefix. + ExpandedSourceAddressPrefix []*string + + // The name of the security rule specified by the user (if created by the user). + Name *string + + // The priority of the rule. + Priority *int32 + + // The network protocol this rule applies to. + Protocol *EffectiveSecurityRuleProtocol + + // The source address prefix. + SourceAddressPrefix *string + + // The source address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), + // System Tags, and the asterisk (*). + SourceAddressPrefixes []*string + + // The source port or range. + SourcePortRange *string + + // 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 +} + +// EffectiveRoute - Effective Route. +type EffectiveRoute struct { + // The address prefixes of the effective routes in CIDR notation. + AddressPrefix []*string + + // If true, on-premises routes are not propagated to the network interfaces in the subnet. + DisableBgpRoutePropagation *bool + + // The name of the user defined route. This is optional. + Name *string + + // The IP address of the next hop of the effective route. + NextHopIPAddress []*string + + // The type of Azure hop the packet should be sent to. + NextHopType *RouteNextHopType + + // Who created the route. + Source *EffectiveRouteSource + + // The value of effective route. + State *EffectiveRouteState +} + +// EffectiveRouteListResult - Response for list effective route API service call. +type EffectiveRouteListResult struct { + // A list of effective routes. + Value []*EffectiveRoute + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// EffectiveRouteMapRoute - The effective RouteMap route configured on the connection resource. +type EffectiveRouteMapRoute struct { + // The ASPath of this route. + AsPath *string + + // BGP communities of the route. + BgpCommunities *string + + // The address prefix of the route. + Prefix *string +} + +// EffectiveRouteMapRouteList - EffectiveRouteMapRoute List. +type EffectiveRouteMapRouteList struct { + // The list of Effective RouteMap Routes configured on the connection resource. + Value []*EffectiveRouteMapRoute +} + +// 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 + + // The type of the specified resource like RouteTable, ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection + // and P2SConnection. + VirtualWanResourceType *string +} + +// EffectiveSecurityAdminRule - Network admin rule. +type EffectiveSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind + + // A description of the security admin configuration. + ConfigurationDescription *string + + // Resource ID. + ID *string + + // Indicates the properties of the security admin rule + Properties *AdminPropertiesFormat + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem + + // A description of the rule collection. + RuleCollectionDescription *string + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup +} + +// GetEffectiveBaseSecurityAdminRule implements the EffectiveBaseSecurityAdminRuleClassification interface for type EffectiveSecurityAdminRule. +func (e *EffectiveSecurityAdminRule) GetEffectiveBaseSecurityAdminRule() *EffectiveBaseSecurityAdminRule { + return &EffectiveBaseSecurityAdminRule{ + ConfigurationDescription: e.ConfigurationDescription, + ID: e.ID, + Kind: e.Kind, + RuleCollectionAppliesToGroups: e.RuleCollectionAppliesToGroups, + RuleCollectionDescription: e.RuleCollectionDescription, + RuleGroups: e.RuleGroups, + } +} + +// EndpointServiceResult - Endpoint service. +type EndpointServiceResult struct { + // Resource ID. + ID *string + + // READ-ONLY; Name of the endpoint service. + Name *string + + // READ-ONLY; Type of the endpoint service. + Type *string +} + +// EndpointServicesListResult - Response for the ListAvailableEndpointServices API service call. +type EndpointServicesListResult struct { + // The URL to get the next set of results. + NextLink *string + + // List of available endpoint services in a region. + Value []*EndpointServiceResult +} + +// Error - Common error representation. +type Error struct { + // Error code. + Code *string + + // Error details. + Details []*ErrorDetails + + // Inner error message. + InnerError *string + + // Error message. + Message *string + + // Error target. + Target *string +} + +// ErrorDetails - Common error details representation. +type ErrorDetails struct { + // Error code. + Code *string + + // Error message. + Message *string + + // Error target. + Target *string +} + +// ErrorResponse - The error object. +type ErrorResponse struct { + // The error details object. + Error *ErrorDetails +} + +// 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 + + // Matched network security rule. + MatchedRule *MatchedRule + + // Network security group ID. + NetworkSecurityGroupID *string + + // READ-ONLY; List of network security rules evaluation results. + RulesEvaluationResult []*SecurityRulesEvaluationResult +} + +// ExclusionManagedRule - Defines a managed rule to use for exclusion. +type ExclusionManagedRule struct { + // REQUIRED; Identifier for the managed rule. + RuleID *string +} + +// ExclusionManagedRuleGroup - Defines a managed rule group to use for exclusion. +type ExclusionManagedRuleGroup struct { + // REQUIRED; The managed rule group for exclusion. + RuleGroupName *string + + // List of rules that will be excluded. If none specified, all rules in the group will be excluded. + Rules []*ExclusionManagedRule +} + +// ExclusionManagedRuleSet - Defines a managed rule set for Exclusions. +type ExclusionManagedRuleSet struct { + // REQUIRED; Defines the rule set type to use. + RuleSetType *string + + // REQUIRED; Defines the version of the rule set to use. + RuleSetVersion *string + + // Defines the rule groups to apply to the rule set. + RuleGroups []*ExclusionManagedRuleGroup +} + +// ExplicitProxySettings - Explicit Proxy Settings in Firewall Policy. +type ExplicitProxySettings struct { + // When set to true, explicit proxy mode is enabled. + EnableExplicitProxy *bool + + // When set to true, pac file port and url needs to be provided. + EnablePacFile *bool + + // Port number for explicit proxy http protocol, cannot be greater than 64000. + HTTPPort *int32 + + // Port number for explicit proxy https protocol, cannot be greater than 64000. + HTTPSPort *int32 + + // SAS URL for PAC file. + PacFile *string + + // Port number for firewall to serve PAC file. + PacFilePort *int32 +} + +// ExpressRouteCircuit resource. +type ExpressRouteCircuit struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the express route circuit. + Properties *ExpressRouteCircuitPropertiesFormat + + // The SKU. + SKU *ExpressRouteCircuitSKU + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ExpressRouteCircuitArpTable - The ARP table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitArpTable struct { + // Entry age in minutes. + Age *int32 + + // The IP address. + IPAddress *string + + // Interface address. + Interface *string + + // The MAC address. + MacAddress *string +} + +// ExpressRouteCircuitAuthorization - Authorization in an ExpressRouteCircuit resource. +type ExpressRouteCircuitAuthorization struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the express route circuit authorization. + Properties *AuthorizationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ExpressRouteCircuitConnection - Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. +type ExpressRouteCircuitConnection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the express route circuit connection. + Properties *ExpressRouteCircuitConnectionPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // The global reach connection associated with Private Peering in an ExpressRoute Circuit. + Value []*ExpressRouteCircuitConnection +} + +// ExpressRouteCircuitConnectionPropertiesFormat - Properties of the express route circuit connection. +type ExpressRouteCircuitConnectionPropertiesFormat struct { + // /29 IP address space to carve out Customer addresses for tunnels. + AddressPrefix *string + + // The authorization key. + AuthorizationKey *string + + // Reference to Express Route Circuit Private Peering Resource of the circuit initiating connection. + ExpressRouteCircuitPeering *SubResource + + // IPv6 Address PrefixProperties of the express route circuit connection. + IPv6CircuitConnectionConfig *IPv6CircuitConnectionConfig + + // Reference to Express Route Circuit Private Peering Resource of the peered circuit. + PeerExpressRouteCircuitPeering *SubResource + + // READ-ONLY; Express Route Circuit connection state. + CircuitConnectionStatus *CircuitConnectionStatus + + // READ-ONLY; The provisioning state of the express route circuit connection resource. + ProvisioningState *ProvisioningState +} + +// ExpressRouteCircuitListResult - Response for ListExpressRouteCircuit API service call. +type ExpressRouteCircuitListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of ExpressRouteCircuits in a resource group. + Value []*ExpressRouteCircuit +} + +// ExpressRouteCircuitPeering - Peering in an ExpressRouteCircuit resource. +type ExpressRouteCircuitPeering struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the express route circuit peering. + Properties *ExpressRouteCircuitPeeringPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ExpressRouteCircuitPeeringConfig - Specifies the peering configuration. +type ExpressRouteCircuitPeeringConfig struct { + // The communities of bgp peering. Specified for microsoft peering. + AdvertisedCommunities []*string + + // The reference to AdvertisedPublicPrefixes. + AdvertisedPublicPrefixes []*string + + // The CustomerASN of the peering. + CustomerASN *int32 + + // The legacy mode of the peering. + LegacyMode *int32 + + // The RoutingRegistryName of the configuration. + RoutingRegistryName *string + + // READ-ONLY; The advertised public prefix state of the Peering resource. + AdvertisedPublicPrefixesState *ExpressRouteCircuitPeeringAdvertisedPublicPrefixState +} + +// ExpressRouteCircuitPeeringID - ExpressRoute circuit peering identifier. +type ExpressRouteCircuitPeeringID struct { + // The ID of the ExpressRoute circuit peering. + ID *string +} + +// 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 + + // The peerings in an express route circuit. + Value []*ExpressRouteCircuitPeering +} + +// ExpressRouteCircuitPeeringPropertiesFormat - Properties of the express route circuit peering. +type ExpressRouteCircuitPeeringPropertiesFormat struct { + // The Azure ASN. + AzureASN *int32 + + // The list of circuit connections associated with Azure Private Peering for this circuit. + Connections []*ExpressRouteCircuitConnection + + // The ExpressRoute connection. + ExpressRouteConnection *ExpressRouteConnectionID + + // The GatewayManager Etag. + GatewayManagerEtag *string + + // The IPv6 peering configuration. + IPv6PeeringConfig *IPv6ExpressRouteCircuitPeeringConfig + + // The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig + + // The peer ASN. + PeerASN *int64 + + // The peering type. + PeeringType *ExpressRoutePeeringType + + // The primary port. + PrimaryAzurePort *string + + // The primary address prefix. + PrimaryPeerAddressPrefix *string + + // The reference to the RouteFilter resource. + RouteFilter *SubResource + + // The secondary port. + SecondaryAzurePort *string + + // The secondary address prefix. + SecondaryPeerAddressPrefix *string + + // The shared key. + SharedKey *string + + // The peering state. + State *ExpressRoutePeeringState + + // The peering stats of express route circuit. + Stats *ExpressRouteCircuitStats + + // The VLAN ID. + VlanID *int32 + + // READ-ONLY; Who was the last to modify the peering. + LastModifiedBy *string + + // READ-ONLY; The list of peered circuit connections associated with Azure Private Peering for this circuit. + PeeredConnections []*PeerExpressRouteCircuitConnection + + // READ-ONLY; The provisioning state of the express route circuit peering resource. + ProvisioningState *ProvisioningState +} + +// ExpressRouteCircuitPropertiesFormat - Properties of ExpressRouteCircuit. +type ExpressRouteCircuitPropertiesFormat struct { + // Allow classic operations. + AllowClassicOperations *bool + + // The authorizationKey. + AuthorizationKey *string + + // The list of authorizations. + Authorizations []*ExpressRouteCircuitAuthorization + + // The bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource. + BandwidthInGbps *float32 + + // The CircuitProvisioningState state of the resource. + CircuitProvisioningState *string + + // The reference to the ExpressRoutePort resource when the circuit is provisioned on an ExpressRoutePort resource. + ExpressRoutePort *SubResource + + // The GatewayManager Etag. + GatewayManagerEtag *string + + // Flag denoting global reach status. + GlobalReachEnabled *bool + + // The list of peerings. + Peerings []*ExpressRouteCircuitPeering + + // The ServiceKey. + ServiceKey *string + + // The ServiceProviderNotes. + ServiceProviderNotes *string + + // The ServiceProviderProperties. + ServiceProviderProperties *ExpressRouteCircuitServiceProviderProperties + + // The ServiceProviderProvisioningState state of the resource. + ServiceProviderProvisioningState *ServiceProviderProvisioningState + + // READ-ONLY; The authorization status of the Circuit. + AuthorizationStatus *string + + // READ-ONLY; The provisioning state of the express route circuit resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The identifier of the circuit traffic. Outer tag for QinQ encapsulation. + Stag *int32 +} + +// ExpressRouteCircuitReference - Reference to an express route circuit. +type ExpressRouteCircuitReference struct { + // Corresponding Express Route Circuit Id. + ID *string +} + +// 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 + + // IP address of a network entity. + Network *string + + // NextHop address. + NextHop *string + + // Autonomous system paths to the destination network. + Path *string + + // Route Weight. + Weight *int32 +} + +// ExpressRouteCircuitRoutesTableSummary - The routes table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitRoutesTableSummary struct { + // Autonomous system number. + As *int32 + + // IP address of the neighbor. + Neighbor *string + + // Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. + StatePfxRcd *string + + // 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 + + // BGP version number spoken to the neighbor. + V *int32 +} + +// ExpressRouteCircuitSKU - Contains SKU in an ExpressRouteCircuit. +type ExpressRouteCircuitSKU struct { + // The family of the SKU. + Family *ExpressRouteCircuitSKUFamily + + // The name of the SKU. + Name *string + + // The tier of the SKU. + Tier *ExpressRouteCircuitSKUTier +} + +// ExpressRouteCircuitServiceProviderProperties - Contains ServiceProviderProperties in an ExpressRouteCircuit. +type ExpressRouteCircuitServiceProviderProperties struct { + // The BandwidthInMbps. + BandwidthInMbps *int32 + + // The peering location. + PeeringLocation *string + + // The serviceProviderName. + ServiceProviderName *string +} + +// ExpressRouteCircuitStats - Contains stats associated with the peering. +type ExpressRouteCircuitStats struct { + // The Primary BytesIn of the peering. + PrimarybytesIn *int64 + + // The primary BytesOut of the peering. + PrimarybytesOut *int64 + + // The secondary BytesIn of the peering. + SecondarybytesIn *int64 + + // The secondary BytesOut of the peering. + SecondarybytesOut *int64 +} + +// 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 + + // A list of the ARP tables. + Value []*ExpressRouteCircuitArpTable +} + +// 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 + + // The list of routes table. + Value []*ExpressRouteCircuitRoutesTable +} + +// 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 + + // A list of the routes table. + Value []*ExpressRouteCircuitRoutesTableSummary +} + +// ExpressRouteConnection resource. +type ExpressRouteConnection struct { + // REQUIRED; The name of the resource. + Name *string + + // Resource ID. + ID *string + + // Properties of the express route connection. + Properties *ExpressRouteConnectionProperties +} + +// ExpressRouteConnectionID - The ID of the ExpressRouteConnection. +type ExpressRouteConnectionID struct { + // READ-ONLY; The ID of the ExpressRouteConnection. + ID *string +} + +// ExpressRouteConnectionList - ExpressRouteConnection list. +type ExpressRouteConnectionList struct { + // The list of ExpressRoute connections. + Value []*ExpressRouteConnection +} + +// ExpressRouteConnectionProperties - Properties of the ExpressRouteConnection subresource. +type ExpressRouteConnectionProperties struct { + // REQUIRED; The ExpressRoute circuit peering. + ExpressRouteCircuitPeering *ExpressRouteCircuitPeeringID + + // Authorization key to establish the connection. + AuthorizationKey *string + + // Enable internet security. + EnableInternetSecurity *bool + + // Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be + // enabled. + EnablePrivateLinkFastPath *bool + + // Enable FastPath to vWan Firewall hub. + ExpressRouteGatewayBypass *bool + + // The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration + + // The routing weight associated to the connection. + RoutingWeight *int32 + + // READ-ONLY; The provisioning state of the express route connection resource. + ProvisioningState *ProvisioningState +} + +// ExpressRouteCrossConnection resource. +type ExpressRouteCrossConnection struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the express route cross connection. + Properties *ExpressRouteCrossConnectionProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ExpressRouteCrossConnectionListResult - Response for ListExpressRouteCrossConnection API service call. +type ExpressRouteCrossConnectionListResult struct { + // A list of ExpressRouteCrossConnection resources. + Value []*ExpressRouteCrossConnection + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// ExpressRouteCrossConnectionPeering - Peering in an ExpressRoute Cross Connection resource. +type ExpressRouteCrossConnectionPeering struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the express route cross connection peering. + Properties *ExpressRouteCrossConnectionPeeringProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// 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 + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// ExpressRouteCrossConnectionPeeringProperties - Properties of express route cross connection peering. +type ExpressRouteCrossConnectionPeeringProperties struct { + // The GatewayManager Etag. + GatewayManagerEtag *string + + // The IPv6 peering configuration. + IPv6PeeringConfig *IPv6ExpressRouteCircuitPeeringConfig + + // The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig + + // The peer ASN. + PeerASN *int64 + + // The peering type. + PeeringType *ExpressRoutePeeringType + + // The primary address prefix. + PrimaryPeerAddressPrefix *string + + // The secondary address prefix. + SecondaryPeerAddressPrefix *string + + // The shared key. + SharedKey *string + + // The peering state. + State *ExpressRoutePeeringState + + // The VLAN ID. + VlanID *int32 + + // READ-ONLY; The Azure ASN. + AzureASN *int32 + + // READ-ONLY; Who was the last to modify the peering. + LastModifiedBy *string + + // READ-ONLY; The primary port. + PrimaryAzurePort *string + + // READ-ONLY; The provisioning state of the express route cross connection peering resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The secondary port. + SecondaryAzurePort *string +} + +// ExpressRouteCrossConnectionProperties - Properties of ExpressRouteCrossConnection. +type ExpressRouteCrossConnectionProperties struct { + // The ExpressRouteCircuit. + ExpressRouteCircuit *ExpressRouteCircuitReference + + // The list of peerings. + Peerings []*ExpressRouteCrossConnectionPeering + + // Additional read only notes set by the connectivity provider. + ServiceProviderNotes *string + + // The provisioning state of the circuit in the connectivity provider system. + ServiceProviderProvisioningState *ServiceProviderProvisioningState + + // READ-ONLY; The circuit bandwidth In Mbps. + BandwidthInMbps *int32 + + // READ-ONLY; The peering location of the ExpressRoute circuit. + PeeringLocation *string + + // READ-ONLY; The name of the primary port. + PrimaryAzurePort *string + + // READ-ONLY; The provisioning state of the express route cross connection resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The identifier of the circuit traffic. + STag *int32 + + // READ-ONLY; The name of the secondary port. + SecondaryAzurePort *string +} + +// ExpressRouteCrossConnectionRoutesTableSummary - The routes table associated with the ExpressRouteCircuit. +type ExpressRouteCrossConnectionRoutesTableSummary struct { + // Autonomous system number. + Asn *int32 + + // IP address of Neighbor router. + Neighbor *string + + // Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. + StateOrPrefixesReceived *string + + // 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 +} + +// ExpressRouteCrossConnectionsRoutesTableSummaryListResult - Response for ListRoutesTable associated with the Express Route +// Cross Connections. +type ExpressRouteCrossConnectionsRoutesTableSummaryListResult struct { + // A list of the routes table. + Value []*ExpressRouteCrossConnectionRoutesTableSummary + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// ExpressRouteGateway - ExpressRoute gateway resource. +type ExpressRouteGateway struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the express route gateway. + Properties *ExpressRouteGatewayProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ExpressRouteGatewayList - List of ExpressRoute gateways. +type ExpressRouteGatewayList struct { + // List of ExpressRoute gateways. + Value []*ExpressRouteGateway +} + +// ExpressRouteGatewayProperties - ExpressRoute gateway resource properties. +type ExpressRouteGatewayProperties struct { + // REQUIRED; The Virtual Hub where the ExpressRoute gateway is or will be deployed. + VirtualHub *VirtualHubID + + // Configures this gateway to accept traffic from non Virtual WAN networks. + AllowNonVirtualWanTraffic *bool + + // Configuration for auto scaling. + AutoScaleConfiguration *ExpressRouteGatewayPropertiesAutoScaleConfiguration + + // List of ExpressRoute connections to the ExpressRoute gateway. + ExpressRouteConnections []*ExpressRouteConnection + + // READ-ONLY; The provisioning state of the express route gateway resource. + ProvisioningState *ProvisioningState +} + +// ExpressRouteGatewayPropertiesAutoScaleConfiguration - Configuration for auto scaling. +type ExpressRouteGatewayPropertiesAutoScaleConfiguration struct { + // Minimum and maximum number of scale units to deploy. + Bounds *ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds +} + +// ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds - Minimum and maximum number of scale units to deploy. +type ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds struct { + // Maximum number of scale units deployed for ExpressRoute gateway. + Max *int32 + + // Minimum number of scale units deployed for ExpressRoute gateway. + Min *int32 +} + +// ExpressRouteLink child resource definition. +type ExpressRouteLink struct { + // Resource ID. + ID *string + + // Name of child port resource that is unique among child port resources of the parent. + Name *string + + // ExpressRouteLink properties. + Properties *ExpressRouteLinkPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// ExpressRouteLinkListResult - Response for ListExpressRouteLinks API service call. +type ExpressRouteLinkListResult struct { + // The URL to get the next set of results. + NextLink *string + + // The list of ExpressRouteLink sub-resources. + Value []*ExpressRouteLink +} + +// ExpressRouteLinkMacSecConfig - ExpressRouteLink Mac Security Configuration. +type ExpressRouteLinkMacSecConfig struct { + // Keyvault Secret Identifier URL containing Mac security CAK key. + CakSecretIdentifier *string + + // Mac security cipher. + Cipher *ExpressRouteLinkMacSecCipher + + // Keyvault Secret Identifier URL containing Mac security CKN key. + CknSecretIdentifier *string + + // Sci mode enabled/disabled. + SciState *ExpressRouteLinkMacSecSciState +} + +// ExpressRouteLinkPropertiesFormat - Properties specific to ExpressRouteLink resources. +type ExpressRouteLinkPropertiesFormat struct { + // Administrative state of the physical port. + AdminState *ExpressRouteLinkAdminState + + // MacSec configuration. + MacSecConfig *ExpressRouteLinkMacSecConfig + + // READ-ONLY; Cololocation for ExpressRoute Hybrid Direct. + ColoLocation *string + + // READ-ONLY; Physical fiber port type. + ConnectorType *ExpressRouteLinkConnectorType + + // READ-ONLY; Name of Azure router interface. + InterfaceName *string + + // READ-ONLY; Mapping between physical port to patch panel port. + PatchPanelID *string + + // READ-ONLY; The provisioning state of the express route link resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Mapping of physical patch panel to rack. + RackID *string + + // READ-ONLY; Name of Azure router associated with physical port. + RouterName *string +} + +// ExpressRoutePort resource definition. +type ExpressRoutePort struct { + // Resource ID. + ID *string + + // The identity of ExpressRoutePort, if configured. + Identity *ManagedServiceIdentity + + // Resource location. + Location *string + + // ExpressRoutePort properties. + Properties *ExpressRoutePortPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ExpressRoutePortAuthorization - ExpressRoutePort Authorization resource definition. +type ExpressRoutePortAuthorization struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // ExpressRoutePort properties. + Properties *ExpressRoutePortAuthorizationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// ExpressRoutePortAuthorizationListResult - Response for ListExpressRoutePortAuthorizations API service call. +type ExpressRoutePortAuthorizationListResult struct { + // The URL to get the next set of results. + NextLink *string + + // The authorizations in an ExpressRoute Port. + Value []*ExpressRoutePortAuthorization +} + +// ExpressRoutePortAuthorizationPropertiesFormat - Properties of ExpressRoutePort Authorization. +type ExpressRoutePortAuthorizationPropertiesFormat struct { + // READ-ONLY; The authorization key. + AuthorizationKey *string + + // READ-ONLY; The authorization use status. + AuthorizationUseStatus *ExpressRoutePortAuthorizationUseStatus + + // READ-ONLY; The reference to the ExpressRoute circuit resource using the authorization. + CircuitResourceURI *string + + // READ-ONLY; The provisioning state of the authorization resource. + ProvisioningState *ProvisioningState +} + +// ExpressRoutePortListResult - Response for ListExpressRoutePorts API service call. +type ExpressRoutePortListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of ExpressRoutePort resources. + Value []*ExpressRoutePort +} + +// ExpressRoutePortPropertiesFormat - Properties specific to ExpressRoutePort resources. +type ExpressRoutePortPropertiesFormat struct { + // Bandwidth of procured ports in Gbps. + BandwidthInGbps *int32 + + // The billing type of the ExpressRoutePort resource. + BillingType *ExpressRoutePortsBillingType + + // Encapsulation method on physical ports. + Encapsulation *ExpressRoutePortsEncapsulation + + // The set of physical links of the ExpressRoutePort resource. + Links []*ExpressRouteLink + + // The name of the peering location that the ExpressRoutePort is mapped to physically. + PeeringLocation *string + + // READ-ONLY; Date of the physical port allocation to be used in Letter of Authorization. + AllocationDate *string + + // READ-ONLY; Reference the ExpressRoute circuit(s) that are provisioned on this ExpressRoutePort resource. + Circuits []*SubResource + + // READ-ONLY; Ether type of the physical port. + EtherType *string + + // READ-ONLY; Maximum transmission unit of the physical port pair(s). + Mtu *string + + // READ-ONLY; Aggregate Gbps of associated circuit bandwidths. + ProvisionedBandwidthInGbps *float32 + + // READ-ONLY; The provisioning state of the express route port resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the express route port resource. + ResourceGUID *string +} + +// ExpressRoutePortsLocation - Definition of the ExpressRoutePorts peering location resource. +type ExpressRoutePortsLocation struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // ExpressRoutePort peering location properties. + Properties *ExpressRoutePortsLocationPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ExpressRoutePortsLocationBandwidths - Real-time inventory of available ExpressRoute port bandwidths. +type ExpressRoutePortsLocationBandwidths struct { + // READ-ONLY; Bandwidth descriptive name. + OfferName *string + + // READ-ONLY; Bandwidth value in Gbps. + ValueInGbps *int32 +} + +// ExpressRoutePortsLocationListResult - Response for ListExpressRoutePortsLocations API service call. +type ExpressRoutePortsLocationListResult struct { + // The URL to get the next set of results. + NextLink *string + + // The list of all ExpressRoutePort peering locations. + Value []*ExpressRoutePortsLocation +} + +// ExpressRoutePortsLocationPropertiesFormat - Properties specific to ExpressRoutePorts peering location resources. +type ExpressRoutePortsLocationPropertiesFormat struct { + // The inventory of available ExpressRoutePort bandwidths. + AvailableBandwidths []*ExpressRoutePortsLocationBandwidths + + // READ-ONLY; Address of peering location. + Address *string + + // READ-ONLY; Contact details of peering locations. + Contact *string + + // READ-ONLY; The provisioning state of the express route port location resource. + ProvisioningState *ProvisioningState +} + +// ExpressRouteProviderPort resource. +type ExpressRouteProviderPort struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the express route Service Provider Port. + Properties *ExpressRouteProviderPortProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ExpressRouteProviderPortListResult - Response for ListExpressRouteProviderPort API service call. +type ExpressRouteProviderPortListResult struct { + // A list of ExpressRouteProviderPort resources. + Value []*ExpressRouteProviderPort + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// ExpressRouteProviderPortProperties - Properties of ExpressRouteProviderPort. +type ExpressRouteProviderPortProperties struct { + // Overprovisioning factor for the port pair. + OverprovisionFactor *int32 + + // The peering location of the port pair. + PeeringLocation *string + + // Bandwidth of the port in Mbps + PortBandwidthInMbps *int32 + + // Remaining Bandwidth of the port in Mbps + RemainingBandwidthInMbps *int32 + + // Used Bandwidth of the port in Mbps + UsedBandwidthInMbps *int32 + + // READ-ONLY; The name of the port pair. + PortPairDescriptor *string + + // READ-ONLY; The name of the primary port. + PrimaryAzurePort *string + + // READ-ONLY; The name of the secondary port. + SecondaryAzurePort *string +} + +// ExpressRouteServiceProvider - A ExpressRouteResourceProvider object. +type ExpressRouteServiceProvider struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the express route service provider. + Properties *ExpressRouteServiceProviderPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ExpressRouteServiceProviderBandwidthsOffered - Contains bandwidths offered in ExpressRouteServiceProvider resources. +type ExpressRouteServiceProviderBandwidthsOffered struct { + // The OfferName. + OfferName *string + + // The ValueInMbps. + ValueInMbps *int32 +} + +// ExpressRouteServiceProviderListResult - Response for the ListExpressRouteServiceProvider API service call. +type ExpressRouteServiceProviderListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of ExpressRouteResourceProvider resources. + Value []*ExpressRouteServiceProvider +} + +// ExpressRouteServiceProviderPropertiesFormat - Properties of ExpressRouteServiceProvider. +type ExpressRouteServiceProviderPropertiesFormat struct { + // A list of bandwidths offered. + BandwidthsOffered []*ExpressRouteServiceProviderBandwidthsOffered + + // A list of peering locations. + PeeringLocations []*string + + // READ-ONLY; The provisioning state of the express route service provider resource. + ProvisioningState *ProvisioningState +} + +// ExtendedLocation complex type. +type ExtendedLocation struct { + // The name of the extended location. + Name *string + + // The type of the extended location. + Type *ExtendedLocationTypes +} + +// 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 + + // List of values to filter the current field by + Values []*string +} + +// FirewallPacketCaptureParameters - Azure Firewall Packet Capture Parameters resource. +type FirewallPacketCaptureParameters struct { + // Resource ID. + ID *string + + // Properties of the azure firewall. + Properties *FirewallPacketCaptureParametersFormat +} + +// FirewallPacketCaptureParametersFormat - Packet capture parameters on azure firewall. +type FirewallPacketCaptureParametersFormat struct { + // Duration of packet capture in seconds. + DurationInSeconds *int32 + + // Name of file to be uploaded to sasURL + FileName *string + + // Rules to filter packet captures. + Filters []*AzureFirewallPacketCaptureRule + + // The tcp-flag type to be captured. Used with protocol TCP + Flags []*AzureFirewallPacketCaptureFlags + + // Number of packets to be captured. + NumberOfPacketsToCapture *int32 + + // The protocol of packets to capture + Protocol *AzureFirewallNetworkRuleProtocol + + // Upload capture location + SasURL *string +} + +// FirewallPolicy Resource. +type FirewallPolicy struct { + // Resource ID. + ID *string + + // The identity of the firewall policy. + Identity *ManagedServiceIdentity + + // Resource location. + Location *string + + // Properties of the firewall policy. + Properties *FirewallPolicyPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// 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 + + // Name of the CA certificate. + Name *string +} + +// FirewallPolicyFilterRuleCollection - Firewall Policy Filter Rule Collection. +type FirewallPolicyFilterRuleCollection struct { + // REQUIRED; The type of the rule collection. + RuleCollectionType *FirewallPolicyRuleCollectionType + + // The action type of a Filter rule collection. + Action *FirewallPolicyFilterRuleCollectionAction + + // The name of the rule collection. + Name *string + + // Priority of the Firewall Policy Rule Collection resource. + Priority *int32 + + // List of rules included in a rule collection. + Rules []FirewallPolicyRuleClassification +} + +// GetFirewallPolicyRuleCollection implements the FirewallPolicyRuleCollectionClassification interface for type FirewallPolicyFilterRuleCollection. +func (f *FirewallPolicyFilterRuleCollection) GetFirewallPolicyRuleCollection() *FirewallPolicyRuleCollection { + return &FirewallPolicyRuleCollection{ + Name: f.Name, + Priority: f.Priority, + RuleCollectionType: f.RuleCollectionType, + } +} + +// FirewallPolicyFilterRuleCollectionAction - Properties of the FirewallPolicyFilterRuleCollectionAction. +type FirewallPolicyFilterRuleCollectionAction struct { + // The type of action. + Type *FirewallPolicyFilterRuleCollectionActionType +} + +// FirewallPolicyHTTPHeaderToInsert - name and value of HTTP/S header to insert +type FirewallPolicyHTTPHeaderToInsert struct { + // Contains the name of the header + HeaderName *string + + // Contains the value of the header + HeaderValue *string +} + +// FirewallPolicyInsights - Firewall Policy Insights. +type FirewallPolicyInsights struct { + // A flag to indicate if the insights are enabled on the policy. + IsEnabled *bool + + // Workspaces needed to configure the Firewall Policy Insights. + LogAnalyticsResources *FirewallPolicyLogAnalyticsResources + + // Number of days the insights should be enabled on the policy. + RetentionDays *int32 +} + +// FirewallPolicyIntrusionDetection - Configuration for intrusion detection mode and rules. +type FirewallPolicyIntrusionDetection struct { + // Intrusion detection configuration properties. + Configuration *FirewallPolicyIntrusionDetectionConfiguration + + // Intrusion detection general state. + Mode *FirewallPolicyIntrusionDetectionStateType +} + +// FirewallPolicyIntrusionDetectionBypassTrafficSpecifications - Intrusion detection bypass traffic specification. +type FirewallPolicyIntrusionDetectionBypassTrafficSpecifications struct { + // Description of the bypass traffic rule. + Description *string + + // List of destination IP addresses or ranges for this rule. + DestinationAddresses []*string + + // List of destination IpGroups for this rule. + DestinationIPGroups []*string + + // List of destination ports or ranges. + DestinationPorts []*string + + // Name of the bypass traffic rule. + Name *string + + // The rule bypass protocol. + Protocol *FirewallPolicyIntrusionDetectionProtocol + + // List of source IP addresses or ranges for this rule. + SourceAddresses []*string + + // List of source IpGroups for this rule. + SourceIPGroups []*string +} + +// FirewallPolicyIntrusionDetectionConfiguration - The operation for configuring intrusion detection. +type FirewallPolicyIntrusionDetectionConfiguration struct { + // List of rules for traffic to bypass. + BypassTrafficSettings []*FirewallPolicyIntrusionDetectionBypassTrafficSpecifications + + // 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 + + // List of specific signatures states. + SignatureOverrides []*FirewallPolicyIntrusionDetectionSignatureSpecification +} + +// FirewallPolicyIntrusionDetectionSignatureSpecification - Intrusion detection signatures specification states. +type FirewallPolicyIntrusionDetectionSignatureSpecification struct { + // Signature id. + ID *string + + // The signature state. + Mode *FirewallPolicyIntrusionDetectionStateType +} + +// FirewallPolicyListResult - Response for ListFirewallPolicies API service call. +type FirewallPolicyListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Firewall Policies in a resource group. + Value []*FirewallPolicy +} + +// FirewallPolicyLogAnalyticsResources - Log Analytics Resources for Firewall Policy Insights. +type FirewallPolicyLogAnalyticsResources struct { + // The default workspace Id for Firewall Policy Insights. + DefaultWorkspaceID *SubResource + + // List of workspaces for Firewall Policy Insights. + Workspaces []*FirewallPolicyLogAnalyticsWorkspace +} + +// FirewallPolicyLogAnalyticsWorkspace - Log Analytics Workspace for Firewall Policy Insights. +type FirewallPolicyLogAnalyticsWorkspace struct { + // Region to configure the Workspace. + Region *string + + // The workspace Id for Firewall Policy Insights. + WorkspaceID *SubResource +} + +// FirewallPolicyNatRuleCollection - Firewall Policy NAT Rule Collection. +type FirewallPolicyNatRuleCollection struct { + // REQUIRED; The type of the rule collection. + RuleCollectionType *FirewallPolicyRuleCollectionType + + // The action type of a Nat rule collection. + Action *FirewallPolicyNatRuleCollectionAction + + // The name of the rule collection. + Name *string + + // Priority of the Firewall Policy Rule Collection resource. + Priority *int32 + + // List of rules included in a rule collection. + Rules []FirewallPolicyRuleClassification +} + +// GetFirewallPolicyRuleCollection implements the FirewallPolicyRuleCollectionClassification interface for type FirewallPolicyNatRuleCollection. +func (f *FirewallPolicyNatRuleCollection) GetFirewallPolicyRuleCollection() *FirewallPolicyRuleCollection { + return &FirewallPolicyRuleCollection{ + Name: f.Name, + Priority: f.Priority, + RuleCollectionType: f.RuleCollectionType, + } +} + +// FirewallPolicyNatRuleCollectionAction - Properties of the FirewallPolicyNatRuleCollectionAction. +type FirewallPolicyNatRuleCollectionAction struct { + // The type of action. + Type *FirewallPolicyNatRuleCollectionActionType +} + +// FirewallPolicyPropertiesFormat - Firewall Policy definition. +type FirewallPolicyPropertiesFormat struct { + // The parent firewall policy from which rules are inherited. + BasePolicy *SubResource + + // DNS Proxy Settings definition. + DNSSettings *DNSSettings + + // Explicit Proxy Settings definition. + ExplicitProxySettings *ExplicitProxySettings + + // Insights on Firewall Policy. + Insights *FirewallPolicyInsights + + // The configuration for Intrusion detection. + IntrusionDetection *FirewallPolicyIntrusionDetection + + // The Firewall Policy SKU. + SKU *FirewallPolicySKU + + // SQL Settings definition. + SQL *FirewallPolicySQL + + // The private IP addresses/IP ranges to which traffic will not be SNAT. + Snat *FirewallPolicySNAT + + // The operation mode for Threat Intelligence. + ThreatIntelMode *AzureFirewallThreatIntelMode + + // ThreatIntel Whitelist for Firewall Policy. + ThreatIntelWhitelist *FirewallPolicyThreatIntelWhitelist + + // TLS Configuration definition. + TransportSecurity *FirewallPolicyTransportSecurity + + // READ-ONLY; List of references to Child Firewall Policies. + ChildPolicies []*SubResource + + // READ-ONLY; List of references to Azure Firewalls that this Firewall Policy is associated with. + Firewalls []*SubResource + + // READ-ONLY; The provisioning state of the firewall policy resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; List of references to FirewallPolicyRuleCollectionGroups. + RuleCollectionGroups []*SubResource + + // READ-ONLY; A read-only string that represents the size of the FirewallPolicyPropertiesFormat in MB. (ex 0.5MB) + Size *string +} + +// FirewallPolicyRule - Properties of a rule. +type FirewallPolicyRule struct { + // REQUIRED; Rule Type. + RuleType *FirewallPolicyRuleType + + // Description of the rule. + Description *string + + // Name of the rule. + Name *string +} + +// 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 + + // Protocol type. + ProtocolType *FirewallPolicyRuleApplicationProtocolType +} + +// FirewallPolicyRuleCollection - Properties of the rule collection. +type FirewallPolicyRuleCollection struct { + // REQUIRED; The type of the rule collection. + RuleCollectionType *FirewallPolicyRuleCollectionType + + // The name of the rule collection. + Name *string + + // Priority of the Firewall Policy Rule Collection resource. + Priority *int32 +} + +// 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 + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // The properties of the firewall policy rule collection group. + Properties *FirewallPolicyRuleCollectionGroupProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Rule Group type. + Type *string +} + +// FirewallPolicyRuleCollectionGroupListResult - Response for ListFirewallPolicyRuleCollectionGroups API service call. +type FirewallPolicyRuleCollectionGroupListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of FirewallPolicyRuleCollectionGroups in a FirewallPolicy. + Value []*FirewallPolicyRuleCollectionGroup +} + +// FirewallPolicyRuleCollectionGroupProperties - Properties of the rule collection group. +type FirewallPolicyRuleCollectionGroupProperties struct { + // Priority of the Firewall Policy Rule Collection Group resource. + Priority *int32 + + // Group of Firewall Policy rule collections. + RuleCollections []FirewallPolicyRuleCollectionClassification + + // READ-ONLY; The provisioning state of the firewall policy rule collection group resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; A read-only string that represents the size of the FirewallPolicyRuleCollectionGroupProperties in MB. (ex 1.2MB) + Size *string +} + +// FirewallPolicySKU - SKU of Firewall policy. +type FirewallPolicySKU struct { + // Tier of Firewall Policy. + Tier *FirewallPolicySKUTier +} + +// 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 + + // List of private IP addresses/IP address ranges to not be SNAT. + PrivateRanges []*string +} + +// 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 +} + +// FirewallPolicyThreatIntelWhitelist - ThreatIntel Whitelist for Firewall Policy. +type FirewallPolicyThreatIntelWhitelist struct { + // List of FQDNs for the ThreatIntel Whitelist. + Fqdns []*string + + // List of IP addresses for the ThreatIntel Whitelist. + IPAddresses []*string +} + +// FirewallPolicyTransportSecurity - Configuration needed to perform TLS termination & initiation. +type FirewallPolicyTransportSecurity struct { + // The CA used for intermediate CA generation. + CertificateAuthority *FirewallPolicyCertificateAuthority +} + +// FlowLog - A flow log resource. +type FlowLog struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the flow log. + Properties *FlowLogPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// FlowLogFormatParameters - Parameters that define the flow log format. +type FlowLogFormatParameters struct { + // The file type of flow log. + Type *FlowLogFormatType + + // The version (revision) of the flow log. + Version *int32 +} + +// FlowLogInformation - Information on the configuration of flow log and traffic analytics (optional) . +type FlowLogInformation struct { + // REQUIRED; Properties of the flow log. + Properties *FlowLogProperties + + // REQUIRED; The ID of the resource to configure for flow log and traffic analytics (optional) . + TargetResourceID *string + + // Parameters that define the configuration of traffic analytics. + FlowAnalyticsConfiguration *TrafficAnalyticsProperties +} + +// FlowLogListResult - List of flow logs. +type FlowLogListResult struct { + // Information about flow log resource. + Value []*FlowLog + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// FlowLogProperties - Parameters that define the configuration of flow log. +type FlowLogProperties struct { + // REQUIRED; Flag to enable/disable flow logging. + Enabled *bool + + // REQUIRED; ID of the storage account which is used to store the flow log. + StorageID *string + + // Parameters that define the flow log format. + Format *FlowLogFormatParameters + + // Parameters that define the retention policy for flow log. + RetentionPolicy *RetentionPolicyParameters +} + +// 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 + + // REQUIRED; ID of network security group to which flow log will be applied. + TargetResourceID *string + + // Flag to enable/disable flow logging. + Enabled *bool + + // Parameters that define the configuration of traffic analytics. + FlowAnalyticsConfiguration *TrafficAnalyticsProperties + + // Parameters that define the flow log format. + Format *FlowLogFormatParameters + + // Parameters that define the retention policy for flow log. + RetentionPolicy *RetentionPolicyParameters + + // READ-ONLY; The provisioning state of the flow log. + ProvisioningState *ProvisioningState + + // READ-ONLY; Guid of network security group to which flow log will be applied. + TargetResourceGUID *string +} + +// 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 +} + +// FrontendIPConfiguration - Frontend IP address of the load balancer. +type FrontendIPConfiguration struct { + // Resource ID. + ID *string + + // 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 + + // Properties of the load balancer probe. + Properties *FrontendIPConfigurationPropertiesFormat + + // A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones []*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// FrontendIPConfigurationPropertiesFormat - Properties of Frontend IP Configuration of the load balancer. +type FrontendIPConfigurationPropertiesFormat struct { + // The reference to gateway load balancer frontend IP. + GatewayLoadBalancer *SubResource + + // The private IP address of the IP configuration. + PrivateIPAddress *string + + // Whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + PrivateIPAddressVersion *IPVersion + + // The Private IP allocation method. + PrivateIPAllocationMethod *IPAllocationMethod + + // The reference to the Public IP resource. + PublicIPAddress *PublicIPAddress + + // The reference to the Public IP Prefix resource. + PublicIPPrefix *SubResource + + // The reference to the subnet resource. + Subnet *Subnet + + // READ-ONLY; An array of references to inbound pools that use this frontend IP. + InboundNatPools []*SubResource + + // READ-ONLY; An array of references to inbound rules that use this frontend IP. + InboundNatRules []*SubResource + + // READ-ONLY; An array of references to load balancing rules that use this frontend IP. + LoadBalancingRules []*SubResource + + // READ-ONLY; An array of references to outbound rules that use this frontend IP. + OutboundRules []*SubResource + + // READ-ONLY; The provisioning state of the frontend IP configuration resource. + ProvisioningState *ProvisioningState +} + +// GatewayCustomBgpIPAddressIPConfiguration - GatewayCustomBgpIpAddressIpConfiguration for a virtual network gateway connection. +type GatewayCustomBgpIPAddressIPConfiguration struct { + // REQUIRED; The custom BgpPeeringAddress which belongs to IpconfigurationId. + CustomBgpIPAddress *string + + // REQUIRED; The IpconfigurationId of ipconfiguration which belongs to gateway. + IPConfigurationID *string +} + +// 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 + + // Port of gateway load balancer tunnel interface. + Port *int32 + + // Protocol of gateway load balancer tunnel interface. + Protocol *GatewayLoadBalancerTunnelProtocol + + // Traffic type of gateway load balancer tunnel interface. + Type *GatewayLoadBalancerTunnelInterfaceType +} + +// GatewayRoute - Gateway routing details. +type GatewayRoute struct { + // READ-ONLY; The route's AS path sequence. + AsPath *string + + // READ-ONLY; The gateway's local address. + LocalAddress *string + + // READ-ONLY; The route's network prefix. + Network *string + + // READ-ONLY; The route's next hop. + NextHop *string + + // READ-ONLY; The source this route was learned from. + Origin *string + + // READ-ONLY; The peer this route was learned from. + SourcePeer *string + + // READ-ONLY; The route's weight. + Weight *int32 +} + +// GatewayRouteListResult - List of virtual network gateway routes. +type GatewayRouteListResult struct { + // List of gateway routes. + Value []*GatewayRoute +} + +// GenerateExpressRoutePortsLOARequest - The customer name to be printed on a letter of authorization. +type GenerateExpressRoutePortsLOARequest struct { + // REQUIRED; The customer name. + CustomerName *string +} + +// GenerateExpressRoutePortsLOAResult - Response for GenerateExpressRoutePortsLOA API service call. +type GenerateExpressRoutePortsLOAResult struct { + // The content as a base64 encoded string. + EncodedContent *string +} + +// 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 + + // The connection resource whose inbound routes are being requested. + ResourceURI *string +} + +// 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 + + // The connection resource whose outbound routes are being requested. + ResourceURI *string +} + +// GetVPNSitesConfigurationRequest - List of Vpn-Sites. +type GetVPNSitesConfigurationRequest struct { + // REQUIRED; The sas-url to download the configurations for vpn-sites. + OutputBlobSasURL *string + + // List of resource-ids of the vpn-sites for which config is to be downloaded. + VPNSites []*string +} + +// Group - The network group resource +type Group struct { + // The Network Group properties + Properties *GroupProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// GroupByUserSession - Define user session identifier group by clauses. +type GroupByUserSession struct { + // REQUIRED; List of group by clause variables. + GroupByVariables []*GroupByVariable +} + +// GroupByVariable - Define user session group by clause variables. +type GroupByVariable struct { + // REQUIRED; User Session clause variable. + VariableName *ApplicationGatewayFirewallUserSessionVariable +} + +// 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 + + // Gets a page of NetworkGroup + Value []*Group +} + +// GroupProperties - Properties of network group +type GroupProperties struct { + // A description of the network group. + Description *string + + // READ-ONLY; The provisioning state of the scope assignment resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Unique identifier for this resource. + ResourceGUID *string +} + +// HTTPConfiguration - HTTP configuration of the connectivity check. +type HTTPConfiguration struct { + // List of HTTP headers. + Headers []*HTTPHeader + + // HTTP method. + Method *HTTPMethod + + // Valid status codes. + ValidStatusCodes []*int32 +} + +// HTTPHeader - The HTTP header. +type HTTPHeader struct { + // The name in HTTP header. + Name *string + + // The value in HTTP header. + Value *string +} + +// HopLink - Hop link. +type HopLink struct { + // Hop link properties. + Properties *HopLinkProperties + + // READ-ONLY; Provides additional context on links. + Context map[string]*string + + // READ-ONLY; List of issues. + Issues []*ConnectivityIssue + + // READ-ONLY; Link type. + LinkType *string + + // READ-ONLY; The ID of the next hop. + NextHopID *string + + // READ-ONLY; Resource ID. + ResourceID *string +} + +// HopLinkProperties - Hop link properties. +type HopLinkProperties struct { + // READ-ONLY; Average roundtrip time in milliseconds. + RoundTripTimeAvg *int64 + + // READ-ONLY; Maximum roundtrip time in milliseconds. + RoundTripTimeMax *int64 + + // READ-ONLY; Minimum roundtrip time in milliseconds. + RoundTripTimeMin *int64 +} + +// Hub Item. +type Hub struct { + // Resource Id. + ResourceID *string + + // Resource Type. + ResourceType *string +} + +// HubIPAddresses - IP addresses associated with azure firewall. +type HubIPAddresses struct { + // Private IP Address associated with azure firewall. + PrivateIPAddress *string + + // Public IP addresses associated with azure firewall. + PublicIPs *HubPublicIPAddresses +} + +// HubIPConfiguration - IpConfigurations. +type HubIPConfiguration struct { + // Resource ID. + ID *string + + // Name of the Ip Configuration. + Name *string + + // The properties of the Virtual Hub IPConfigurations. + Properties *HubIPConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Ipconfiguration type. + Type *string +} + +// HubIPConfigurationPropertiesFormat - Properties of IP configuration. +type HubIPConfigurationPropertiesFormat struct { + // The private IP address of the IP configuration. + PrivateIPAddress *string + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod + + // The reference to the public IP resource. + PublicIPAddress *PublicIPAddress + + // The reference to the subnet resource. + Subnet *Subnet + + // READ-ONLY; The provisioning state of the IP configuration resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // The number of Public IP addresses associated with azure firewall. + Count *int32 +} + +// HubRoute - RouteTable route. +type HubRoute struct { + // REQUIRED; The type of destinations (eg: CIDR, ResourceId, Service). + DestinationType *string + + // REQUIRED; List of all destinations. + Destinations []*string + + // REQUIRED; The name of the Route that is unique within a RouteTable. This name can be used to access this route. + Name *string + + // REQUIRED; NextHop resource ID. + NextHop *string + + // REQUIRED; The type of next hop (eg: ResourceId). + NextHopType *string +} + +// HubRouteTable - RouteTable resource in a virtual hub. +type HubRouteTable struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the RouteTable resource. + Properties *HubRouteTableProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource type. + Type *string +} + +// HubRouteTableProperties - Parameters for RouteTable. +type HubRouteTableProperties struct { + // List of labels associated with this route table. + Labels []*string + + // List of all routes. + Routes []*HubRoute + + // READ-ONLY; List of all connections associated with this route table. + AssociatedConnections []*string + + // READ-ONLY; List of all connections that advertise to this route table. + PropagatingConnections []*string + + // READ-ONLY; The provisioning state of the RouteTable resource. + ProvisioningState *ProvisioningState +} + +// HubVirtualNetworkConnection Resource. +type HubVirtualNetworkConnection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the hub virtual network connection. + Properties *HubVirtualNetworkConnectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// HubVirtualNetworkConnectionProperties - Parameters for HubVirtualNetworkConnection. +type HubVirtualNetworkConnectionProperties struct { + // Deprecated: VirtualHub to RemoteVnet transit to enabled or not. + AllowHubToRemoteVnetTransit *bool + + // Deprecated: Allow RemoteVnet to use Virtual Hub's gateways. + AllowRemoteVnetToUseHubVnetGateways *bool + + // Enable internet security. + EnableInternetSecurity *bool + + // Reference to the remote virtual network. + RemoteVirtualNetwork *SubResource + + // The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration + + // READ-ONLY; The provisioning state of the hub virtual network connection resource. + ProvisioningState *ProvisioningState +} + +// IDPSQueryObject - Will describe the query to run against the IDPS signatures DB +type IDPSQueryObject struct { + // Contain all filters names and values + Filters []*FilterItems + + // Column to sort response by + OrderBy *OrderBy + + // The number of the results to return in each page + ResultsPerPage *int32 + + // Search term in all columns + Search *string + + // The number of records matching the filter to skip + Skip *int32 +} + +// IPAddressAvailabilityResult - Response for CheckIPAddressAvailability API service call. +type IPAddressAvailabilityResult struct { + // Private IP address availability. + Available *bool + + // Contains other available private IP addresses if the asked for address is taken. + AvailableIPAddresses []*string + + // Private IP address platform reserved. + IsPlatformReserved *bool +} + +// IPAllocation - IpAllocation resource. +type IPAllocation struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the IpAllocation. + Properties *IPAllocationPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// IPAllocationListResult - Response for the ListIpAllocations API service call. +type IPAllocationListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of IpAllocation resources. + Value []*IPAllocation +} + +// IPAllocationPropertiesFormat - Properties of the IpAllocation. +type IPAllocationPropertiesFormat struct { + // IpAllocation tags. + AllocationTags map[string]*string + + // The IPAM allocation ID. + IpamAllocationID *string + + // The address prefix for the IpAllocation. + Prefix *string + + // The address prefix length for the IpAllocation. + PrefixLength *int32 + + // The address prefix Type for the IpAllocation. + PrefixType *IPVersion + + // The type for the IpAllocation. + Type *IPAllocationType + + // READ-ONLY; The Subnet that using the prefix of this IpAllocation resource. + Subnet *SubResource + + // READ-ONLY; The VirtualNetwork that using the prefix of this IpAllocation resource. + VirtualNetwork *SubResource +} + +// IPConfiguration - IP configuration. +type IPConfiguration struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the IP configuration. + Properties *IPConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// IPConfigurationBgpPeeringAddress - Properties of IPConfigurationBgpPeeringAddress. +type IPConfigurationBgpPeeringAddress struct { + // The list of custom BGP peering addresses which belong to IP configuration. + CustomBgpIPAddresses []*string + + // The ID of IP configuration which belongs to gateway. + IPConfigurationID *string + + // READ-ONLY; The list of default BGP peering addresses which belong to IP configuration. + DefaultBgpIPAddresses []*string + + // READ-ONLY; The list of tunnel public IP addresses which belong to IP configuration. + TunnelIPAddresses []*string +} + +// IPConfigurationProfile - IP configuration profile child resource. +type IPConfigurationProfile struct { + // Resource ID. + ID *string + + // The name of the resource. This name can be used to access the resource. + Name *string + + // Properties of the IP configuration profile. + Properties *IPConfigurationProfilePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Sub Resource type. + Type *string +} + +// IPConfigurationProfilePropertiesFormat - IP configuration profile properties. +type IPConfigurationProfilePropertiesFormat struct { + // The reference to the subnet resource to create a container network interface ip configuration. + Subnet *Subnet + + // READ-ONLY; The provisioning state of the IP configuration profile resource. + ProvisioningState *ProvisioningState +} + +// IPConfigurationPropertiesFormat - Properties of IP configuration. +type IPConfigurationPropertiesFormat struct { + // The private IP address of the IP configuration. + PrivateIPAddress *string + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod + + // The reference to the public IP resource. + PublicIPAddress *PublicIPAddress + + // The reference to the subnet resource. + Subnet *Subnet + + // READ-ONLY; The provisioning state of the IP configuration resource. + ProvisioningState *ProvisioningState +} + +// IPGroup - The IpGroups resource information. +type IPGroup struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the IpGroups. + Properties *IPGroupPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// IPGroupListResult - Response for the ListIpGroups API service call. +type IPGroupListResult struct { + // URL to get the next set of results. + NextLink *string + + // The list of IpGroups information resources. + Value []*IPGroup +} + +// IPGroupPropertiesFormat - The IpGroups property information. +type IPGroupPropertiesFormat struct { + // IpAddresses/IpAddressPrefixes in the IpGroups resource. + IPAddresses []*string + + // READ-ONLY; List of references to Firewall Policies resources that this IpGroups is associated with. + FirewallPolicies []*SubResource + + // READ-ONLY; List of references to Firewall resources that this IpGroups is associated with. + Firewalls []*SubResource + + // READ-ONLY; The provisioning state of the IpGroups resource. + ProvisioningState *ProvisioningState +} + +// IPPrefixesList - List of SNAT IP Prefixes learnt by firewall to not SNAT +type IPPrefixesList struct { + // IP Prefix value. + IPPrefixes []*string +} + +type IPRule struct { + // Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. + AddressPrefix *string +} + +// 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 + + // REQUIRED; The IPSec encryption algorithm (IKE phase 1). + IPSecEncryption *IPSecEncryption + + // REQUIRED; The IPSec integrity algorithm (IKE phase 1). + IPSecIntegrity *IPSecIntegrity + + // REQUIRED; The IKE encryption algorithm (IKE phase 2). + IkeEncryption *IkeEncryption + + // REQUIRED; The IKE integrity algorithm (IKE phase 2). + IkeIntegrity *IkeIntegrity + + // REQUIRED; The Pfs Group used in IKE Phase 2 for new child SA. + PfsGroup *PfsGroup + + // 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 + + // 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 +} + +// IPTag - Contains the IpTag associated with the object. +type IPTag struct { + // The IP tag type. Example: FirstPartyUsage. + IPTagType *string + + // The value of the IP tag associated with the public IP. Example: SQL. + Tag *string +} + +// 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 + + // READ-ONLY; Express Route Circuit connection state. + CircuitConnectionStatus *CircuitConnectionStatus +} + +// IPv6ExpressRouteCircuitPeeringConfig - Contains IPv6 peering config. +type IPv6ExpressRouteCircuitPeeringConfig struct { + // The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig + + // The primary address prefix. + PrimaryPeerAddressPrefix *string + + // The reference to the RouteFilter resource. + RouteFilter *SubResource + + // The secondary address prefix. + SecondaryPeerAddressPrefix *string + + // The state of peering. + State *ExpressRouteCircuitPeeringState +} + +// InboundNatPool - Inbound NAT pool of the load balancer. +type InboundNatPool struct { + // Resource ID. + ID *string + + // 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 + + // Properties of load balancer inbound nat pool. + Properties *InboundNatPoolPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // 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 + + // 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 + + // REQUIRED; The reference to the transport protocol used by the inbound NAT pool. + Protocol *TransportProtocol + + // 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 + + // 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 + + // A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource + + // 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 + + // READ-ONLY; The provisioning state of the inbound NAT pool resource. + ProvisioningState *ProvisioningState +} + +// InboundNatRule - Inbound NAT rule of the load balancer. +type InboundNatRule struct { + // Resource ID. + ID *string + + // 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 + + // Properties of load balancer inbound NAT rule. + Properties *InboundNatRulePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// InboundNatRuleListResult - Response for ListInboundNatRule API service call. +type InboundNatRuleListResult struct { + // A list of inbound NAT rules in a load balancer. + Value []*InboundNatRule + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// InboundNatRulePortMapping - Individual port mappings for inbound NAT rule created for backend pool. +type InboundNatRulePortMapping struct { + // READ-ONLY; Backend port. + BackendPort *int32 + + // READ-ONLY; Frontend port. + FrontendPort *int32 + + // READ-ONLY; Name of inbound NAT rule. + InboundNatRuleName *string + + // READ-ONLY; The reference to the transport protocol used by the inbound NAT rule. + Protocol *TransportProtocol +} + +// InboundNatRulePropertiesFormat - Properties of the inbound NAT rule. +type InboundNatRulePropertiesFormat struct { + // A reference to backendAddressPool resource. + BackendAddressPool *SubResource + + // The port used for the internal endpoint. Acceptable values range from 1 to 65535. + BackendPort *int32 + + // 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 + + // 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 + + // A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource + + // 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 + + // 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 + + // 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 + + // 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 + + // The reference to the transport protocol used by the load balancing rule. + Protocol *TransportProtocol + + // 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 + + // READ-ONLY; The provisioning state of the inbound NAT rule resource. + ProvisioningState *ProvisioningState +} + +// InboundSecurityRule - NVA Inbound Security Rule resource. +type InboundSecurityRule struct { + // Resource ID. + ID *string + + // Name of security rule collection. + Name *string + + // The properties of the Inbound Security Rules. + Properties *InboundSecurityRuleProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; NVA inbound security rule type. + Type *string +} + +// InboundSecurityRuleProperties - Properties of the Inbound Security Rules resource. +type InboundSecurityRuleProperties struct { + // List of allowed rules. + Rules []*InboundSecurityRules + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // Protocol. This should be either TCP or UDP. + Protocol *InboundSecurityRulesProtocol + + // The CIDR or source IP range. Only /30, /31 and /32 Ip ranges are allowed. + SourceAddressPrefix *string +} + +// IntentPolicy - Network Intent Policy resource. +type IntentPolicy struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// IntentPolicyConfiguration - Details of NetworkIntentPolicyConfiguration for PrepareNetworkPoliciesRequest. +type IntentPolicyConfiguration struct { + // The name of the Network Intent Policy for storing in target subscription. + NetworkIntentPolicyName *string + + // Source network intent policy. + SourceNetworkIntentPolicy *IntentPolicy +} + +// Interface - A network interface in a resource group. +type Interface struct { + // The extended location of the network interface. + ExtendedLocation *ExtendedLocation + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the network interface. + Properties *InterfacePropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// InterfaceAssociation - Network interface and its custom security rules. +type InterfaceAssociation struct { + // Collection of custom security rules. + SecurityRules []*SecurityRule + + // READ-ONLY; Network interface ID. + ID *string +} + +// 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 + + // Relative DNS name for this NIC used for internal communications between VMs in the same virtual network. + InternalDNSNameLabel *string + + // 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 + + // 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 + + // READ-ONLY; Fully qualified DNS name supporting internal communications between VMs in the same virtual network. + InternalFqdn *string +} + +// InterfaceIPConfiguration - IPConfiguration in a network interface. +type InterfaceIPConfiguration struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Network interface IP configuration properties. + Properties *InterfaceIPConfigurationPropertiesFormat + + // Resource type. + Type *string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// InterfaceIPConfigurationListResult - Response for list ip configurations API service call. +type InterfaceIPConfigurationListResult struct { + // A list of ip configurations. + Value []*InterfaceIPConfiguration + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// InterfaceIPConfigurationPrivateLinkConnectionProperties - PrivateLinkConnection properties for the network interface. +type InterfaceIPConfigurationPrivateLinkConnectionProperties struct { + // READ-ONLY; List of FQDNs for current private link connection. + Fqdns []*string + + // READ-ONLY; The group ID for current private link connection. + GroupID *string + + // READ-ONLY; The required member name for current private link connection. + RequiredMemberName *string +} + +// InterfaceIPConfigurationPropertiesFormat - Properties of IP configuration. +type InterfaceIPConfigurationPropertiesFormat struct { + // The reference to ApplicationGatewayBackendAddressPool resource. + ApplicationGatewayBackendAddressPools []*ApplicationGatewayBackendAddressPool + + // Application security groups in which the IP configuration is included. + ApplicationSecurityGroups []*ApplicationSecurityGroup + + // The reference to gateway load balancer frontend IP. + GatewayLoadBalancer *SubResource + + // The reference to LoadBalancerBackendAddressPool resource. + LoadBalancerBackendAddressPools []*BackendAddressPool + + // A list of references of LoadBalancerInboundNatRules. + LoadBalancerInboundNatRules []*InboundNatRule + + // Whether this is a primary customer address on the network interface. + Primary *bool + + // Private IP address of the IP configuration. + PrivateIPAddress *string + + // Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. + PrivateIPAddressVersion *IPVersion + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod + + // Public IP address bound to the IP configuration. + PublicIPAddress *PublicIPAddress + + // Subnet bound to the IP configuration. + Subnet *Subnet + + // The reference to Virtual Network Taps. + VirtualNetworkTaps []*VirtualNetworkTap + + // READ-ONLY; PrivateLinkConnection properties for the network interface. + PrivateLinkConnectionProperties *InterfaceIPConfigurationPrivateLinkConnectionProperties + + // READ-ONLY; The provisioning state of the network interface IP configuration. + ProvisioningState *ProvisioningState +} + +// InterfaceListResult - Response for the ListNetworkInterface API service call. +type InterfaceListResult struct { + // A list of network interfaces in a resource group. + Value []*Interface + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// InterfaceLoadBalancerListResult - Response for list ip configurations API service call. +type InterfaceLoadBalancerListResult struct { + // A list of load balancers. + Value []*LoadBalancer + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// InterfacePropertiesFormat - NetworkInterface properties. +type InterfacePropertiesFormat struct { + // Auxiliary mode of Network Interface resource. + AuxiliaryMode *NetworkInterfaceAuxiliaryMode + + // Auxiliary sku of Network Interface resource. + AuxiliarySKU *NetworkInterfaceAuxiliarySKU + + // The DNS settings in network interface. + DNSSettings *InterfaceDNSSettings + + // Indicates whether to disable tcp state tracking. + DisableTCPStateTracking *bool + + // If the network interface is configured for accelerated networking. Not applicable to VM sizes which require accelerated + // networking. + EnableAcceleratedNetworking *bool + + // Indicates whether IP forwarding is enabled on this network interface. + EnableIPForwarding *bool + + // A list of IPConfigurations of the network interface. + IPConfigurations []*InterfaceIPConfiguration + + // Migration phase of Network Interface resource. + MigrationPhase *NetworkInterfaceMigrationPhase + + // The reference to the NetworkSecurityGroup resource. + NetworkSecurityGroup *SecurityGroup + + // Type of Network Interface resource. + NicType *NetworkInterfaceNicType + + // Privatelinkservice of the network interface resource. + PrivateLinkService *PrivateLinkService + + // WorkloadType of the NetworkInterface for BareMetal resources + WorkloadType *string + + // READ-ONLY; A reference to the dscp configuration to which the network interface is linked. + DscpConfiguration *SubResource + + // READ-ONLY; A list of references to linked BareMetal resources. + HostedWorkloads []*string + + // READ-ONLY; The MAC address of the network interface. + MacAddress *string + + // READ-ONLY; Whether this is a primary network interface on a virtual machine. + Primary *bool + + // READ-ONLY; A reference to the private endpoint to which the network interface is linked. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The provisioning state of the network interface resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the network interface resource. + ResourceGUID *string + + // READ-ONLY; A list of TapConfigurations of the network interface. + TapConfigurations []*InterfaceTapConfiguration + + // READ-ONLY; The reference to a virtual machine. + VirtualMachine *SubResource + + // READ-ONLY; Whether the virtual machine this nic is attached to supports encryption. + VnetEncryptionSupported *bool +} + +// InterfaceTapConfiguration - Tap configuration in a Network Interface. +type InterfaceTapConfiguration struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the Virtual Network Tap configuration. + Properties *InterfaceTapConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Sub Resource type. + Type *string +} + +// InterfaceTapConfigurationListResult - Response for list tap configurations API service call. +type InterfaceTapConfigurationListResult struct { + // A list of tap configurations. + Value []*InterfaceTapConfiguration + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// InterfaceTapConfigurationPropertiesFormat - Properties of Virtual Network Tap configuration. +type InterfaceTapConfigurationPropertiesFormat struct { + // The reference to the Virtual Network Tap resource. + VirtualNetworkTap *VirtualNetworkTap + + // READ-ONLY; The provisioning state of the network interface tap configuration resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // List of RouteTables. + Value []*HubRouteTable +} + +// 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 + + // List of HubVirtualNetworkConnections. + Value []*HubVirtualNetworkConnection +} + +// 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 + + // List of P2SVpnGateways. + Value []*P2SVPNGateway +} + +// 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 + + // List of RouteMaps. + Value []*RouteMap +} + +// 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 + + // List of RoutingIntent resource. + Value []*RoutingIntent +} + +// 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 + + // List of Vpn Connections. + Value []*VPNConnection +} + +// 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 + + // List of Nat Rules. + Value []*VPNGatewayNatRule +} + +// 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 + + // List of VpnGateways. + Value []*VPNGateway +} + +// 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 + + // List of VpnServerConfigurationPolicyGroups. + Value []*VPNServerConfigurationPolicyGroup +} + +// 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 + + // List of VpnServerConfigurations. + Value []*VPNServerConfiguration +} + +// 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 + + // List of VpnSiteLinkConnections. + Value []*VPNSiteLinkConnection +} + +// 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 + + // List of VpnSitesLinks. + Value []*VPNSiteLink +} + +// 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 + + // List of VpnSites. + Value []*VPNSite +} + +// ListVirtualHubBgpConnectionResults - VirtualHubBgpConnections list. +type ListVirtualHubBgpConnectionResults struct { + // URL to get the next set of results. + NextLink *string + + // The list of VirtualHubBgpConnections. + Value []*BgpConnection +} + +// ListVirtualHubIPConfigurationResults - VirtualHubIpConfigurations list. +type ListVirtualHubIPConfigurationResults struct { + // URL to get the next set of results. + NextLink *string + + // The list of VirtualHubIpConfigurations. + Value []*HubIPConfiguration +} + +// 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 + + // List of VirtualHubRouteTableV2s. + Value []*VirtualHubRouteTableV2 +} + +// 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 + + // List of VirtualHubs. + Value []*VirtualHub +} + +// 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 + + // List of Nat Rules. + Value []*VirtualNetworkGatewayNatRule +} + +// 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 + + // List of VirtualWANs. + Value []*VirtualWAN +} + +// LoadBalancer resource. +type LoadBalancer struct { + // The extended location of the load balancer. + ExtendedLocation *ExtendedLocation + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of load balancer. + Properties *LoadBalancerPropertiesFormat + + // The load balancer SKU. + SKU *LoadBalancerSKU + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// LoadBalancerBackendAddress - Load balancer backend addresses. +type LoadBalancerBackendAddress struct { + // Name of the backend address. + Name *string + + // Properties of load balancer backend address pool. + Properties *LoadBalancerBackendAddressPropertiesFormat +} + +// LoadBalancerBackendAddressPoolListResult - Response for ListBackendAddressPool API service call. +type LoadBalancerBackendAddressPoolListResult struct { + // A list of backend address pools in a load balancer. + Value []*BackendAddressPool + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// 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 + + // IP Address belonging to the referenced virtual network. + IPAddress *string + + // Reference to the frontend ip address configuration defined in regional loadbalancer. + LoadBalancerFrontendIPConfiguration *SubResource + + // Reference to an existing subnet. + Subnet *SubResource + + // Reference to an existing virtual network. + VirtualNetwork *SubResource + + // READ-ONLY; Collection of inbound NAT rule port mappings. + InboundNatRulesPortMapping []*NatRulePortMapping + + // READ-ONLY; Reference to IP address defined in network interfaces. + NetworkInterfaceIPConfiguration *SubResource +} + +// LoadBalancerFrontendIPConfigurationListResult - Response for ListFrontendIPConfiguration API service call. +type LoadBalancerFrontendIPConfigurationListResult struct { + // A list of frontend IP configurations in a load balancer. + Value []*FrontendIPConfiguration + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// LoadBalancerListResult - Response for ListLoadBalancers API service call. +type LoadBalancerListResult struct { + // A list of load balancers in a resource group. + Value []*LoadBalancer + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// LoadBalancerLoadBalancingRuleListResult - Response for ListLoadBalancingRule API service call. +type LoadBalancerLoadBalancingRuleListResult struct { + // A list of load balancing rules in a load balancer. + Value []*LoadBalancingRule + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// LoadBalancerOutboundRuleListResult - Response for ListOutboundRule API service call. +type LoadBalancerOutboundRuleListResult struct { + // A list of outbound rules in a load balancer. + Value []*OutboundRule + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// LoadBalancerProbeListResult - Response for ListProbe API service call. +type LoadBalancerProbeListResult struct { + // A list of probes in a load balancer. + Value []*Probe + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// LoadBalancerPropertiesFormat - Properties of the load balancer. +type LoadBalancerPropertiesFormat struct { + // Collection of backend address pools used by a load balancer. + BackendAddressPools []*BackendAddressPool + + // Object representing the frontend IPs to be used for the load balancer. + FrontendIPConfigurations []*FrontendIPConfiguration + + // 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 + + // 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 + + // Object collection representing the load balancing rules Gets the provisioning. + LoadBalancingRules []*LoadBalancingRule + + // The outbound rules. + OutboundRules []*OutboundRule + + // Collection of probe objects used in the load balancer. + Probes []*Probe + + // READ-ONLY; The provisioning state of the load balancer resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the load balancer resource. + ResourceGUID *string +} + +// LoadBalancerSKU - SKU of a load balancer. +type LoadBalancerSKU struct { + // Name of a load balancer SKU. + Name *LoadBalancerSKUName + + // Tier of a load balancer SKU. + Tier *LoadBalancerSKUTier +} + +// LoadBalancerVipSwapRequest - The request for a VIP swap. +type LoadBalancerVipSwapRequest struct { + // A list of frontend IP configuration resources that should swap VIPs. + FrontendIPConfigurations []*LoadBalancerVipSwapRequestFrontendIPConfiguration +} + +// LoadBalancerVipSwapRequestFrontendIPConfiguration - VIP swap request's frontend IP configuration object. +type LoadBalancerVipSwapRequestFrontendIPConfiguration struct { + // The ID of frontend IP configuration resource. + ID *string + + // The properties of VIP swap request's frontend IP configuration object. + Properties *LoadBalancerVipSwapRequestFrontendIPConfigurationProperties +} + +// LoadBalancerVipSwapRequestFrontendIPConfigurationProperties - The properties of VIP swap request's frontend IP configuration +// object. +type LoadBalancerVipSwapRequestFrontendIPConfigurationProperties struct { + // A reference to public IP address resource. + PublicIPAddress *SubResource +} + +// LoadBalancingRule - A load balancing rule for a load balancer. +type LoadBalancingRule struct { + // Resource ID. + ID *string + + // 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 + + // Properties of load balancer load balancing rule. + Properties *LoadBalancingRulePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // REQUIRED; The reference to the transport protocol used by the load balancing rule. + Protocol *TransportProtocol + + // A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs. + BackendAddressPool *SubResource + + // An array of references to pool of DIPs. + BackendAddressPools []*SubResource + + // 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 + + // 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 + + // 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 + + // 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 + + // A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource + + // 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 + + // The load distribution policy for this rule. + LoadDistribution *LoadDistribution + + // The reference to the load balancer probe used by the load balancing rule. + Probe *SubResource + + // READ-ONLY; The provisioning state of the load balancing rule resource. + ProvisioningState *ProvisioningState +} + +// LocalNetworkGateway - A common class for general resource information. +type LocalNetworkGateway struct { + // REQUIRED; Properties of the local network gateway. + Properties *LocalNetworkGatewayPropertiesFormat + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// LocalNetworkGatewayListResult - Response for ListLocalNetworkGateways API service call. +type LocalNetworkGatewayListResult struct { + // A list of local network gateways that exists in a resource group. + Value []*LocalNetworkGateway + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// LocalNetworkGatewayPropertiesFormat - LocalNetworkGateway properties. +type LocalNetworkGatewayPropertiesFormat struct { + // Local network gateway's BGP speaker settings. + BgpSettings *BgpSettings + + // FQDN of local network gateway. + Fqdn *string + + // IP address of local network gateway. + GatewayIPAddress *string + + // Local network site address space. + LocalNetworkAddressSpace *AddressSpace + + // READ-ONLY; The provisioning state of the local network gateway resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the local network gateway resource. + ResourceGUID *string +} + +// LogSpecification - Description of logging specification. +type LogSpecification struct { + // Duration of the blob. + BlobDuration *string + + // The display name of the specification. + DisplayName *string + + // The name of the specification. + Name *string +} + +// ManagedRuleGroupOverride - Defines a managed rule group override setting. +type ManagedRuleGroupOverride struct { + // REQUIRED; The managed rule group to override. + RuleGroupName *string + + // List of rules that will be disabled. If none specified, all rules in the group will be disabled. + Rules []*ManagedRuleOverride +} + +// ManagedRuleOverride - Defines a managed rule group override setting. +type ManagedRuleOverride struct { + // REQUIRED; Identifier for the managed rule. + RuleID *string + + // Describes the override action to be applied when rule matches. + Action *ActionType + + // The state of the managed rule. Defaults to Disabled if not specified. + State *ManagedRuleEnabledState +} + +// ManagedRuleSet - Defines a managed rule set. +type ManagedRuleSet struct { + // REQUIRED; Defines the rule set type to use. + RuleSetType *string + + // REQUIRED; Defines the version of the rule set to use. + RuleSetVersion *string + + // Defines the rule group overrides to apply to the rule set. + RuleGroupOverrides []*ManagedRuleGroupOverride +} + +// 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 + + // The Exclusions that are applied on the policy. + Exclusions []*OwaspCrsExclusionEntry +} + +// 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 + + // 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 + + // READ-ONLY; The principal id of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// Manager - The Managed Network resource +type Manager struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // The network manager properties + Properties *ManagerProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// ManagerCommit - Network Manager Commit. +type ManagerCommit struct { + // REQUIRED; Commit Type. + CommitType *ConfigurationType + + // REQUIRED; List of target locations. + TargetLocations []*string + + // List of configuration ids. + ConfigurationIDs []*string + + // READ-ONLY; Commit Id. + CommitID *string +} + +// ManagerConnection - The Network Manager Connection resource +type ManagerConnection struct { + // The scope connection properties + Properties *ManagerConnectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// ManagerConnectionListResult - List of network manager connections. +type ManagerConnectionListResult struct { + // Gets the URL to get the next page of results. + NextLink *string + + // List of network manager connections. + Value []*ManagerConnection +} + +// ManagerConnectionProperties - Information about the network manager connection. +type ManagerConnectionProperties struct { + // A description of the network manager connection. + Description *string + + // Network Manager Id. + NetworkManagerID *string + + // READ-ONLY; Connection state. + ConnectionState *ScopeConnectionState +} + +// ManagerDeploymentStatus - Network Manager Deployment Status. +type ManagerDeploymentStatus struct { + // Commit Time. + CommitTime *time.Time + + // List of configuration ids. + ConfigurationIDs []*string + + // Deployment Status. + DeploymentStatus *DeploymentStatus + + // Configuration Deployment Type. + DeploymentType *ConfigurationType + + // Error Message. + ErrorMessage *string + + // Region Name. + Region *string +} + +// 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 + + // Gets a page of Network Manager Deployment Status + Value []*ManagerDeploymentStatus +} + +// ManagerDeploymentStatusParameter - Network Manager Deployment Status Parameter. +type ManagerDeploymentStatusParameter struct { + // List of deployment types. + DeploymentTypes []*ConfigurationType + + // List of locations. + Regions []*string + + // Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. + SkipToken *string +} + +// 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 + + // Gets a page of NetworkManagerEffectiveConnectivityConfiguration + Value []*EffectiveConnectivityConfiguration +} + +// 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 + + // Gets a page of NetworkManagerEffectiveSecurityAdminRules + Value []EffectiveBaseSecurityAdminRuleClassification +} + +// 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 + + // Gets a page of NetworkManager + Value []*Manager +} + +// ManagerProperties - Properties of Managed Network +type ManagerProperties struct { + // REQUIRED; Scope Access. + NetworkManagerScopeAccesses []*ConfigurationType + + // REQUIRED; Scope of Network Manager. + NetworkManagerScopes *ManagerPropertiesNetworkManagerScopes + + // A description of the network manager. + Description *string + + // READ-ONLY; The provisioning state of the network manager resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Unique identifier for this resource. + ResourceGUID *string +} + +// ManagerPropertiesNetworkManagerScopes - Scope of Network Manager. +type ManagerPropertiesNetworkManagerScopes struct { + // List of management groups. + ManagementGroups []*string + + // List of subscriptions. + Subscriptions []*string + + // READ-ONLY; List of cross tenant scopes. + CrossTenantScopes []*CrossTenantScopes +} + +// ManagerSecurityGroupItem - Network manager security group item. +type ManagerSecurityGroupItem struct { + // REQUIRED; Network manager group Id. + NetworkGroupID *string +} + +// MatchCondition - Define match conditions. +type MatchCondition struct { + // REQUIRED; Match value. + MatchValues []*string + + // REQUIRED; List of match variables. + MatchVariables []*MatchVariable + + // REQUIRED; The operator to be matched. + Operator *WebApplicationFirewallOperator + + // Whether this is negate condition or not. + NegationConditon *bool + + // List of transforms. + Transforms []*WebApplicationFirewallTransform +} + +// MatchVariable - Define match variables. +type MatchVariable struct { + // REQUIRED; Match Variable. + VariableName *WebApplicationFirewallMatchVariable + + // The selector of match variable. + Selector *string +} + +// MatchedRule - Matched rule. +type MatchedRule struct { + // The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'. + Action *string + + // Name of the matched network security rule. + RuleName *string +} + +// MetricSpecification - Description of metrics specification. +type MetricSpecification struct { + // The aggregation type. + AggregationType *string + + // List of availability. + Availabilities []*Availability + + // List of dimensions. + Dimensions []*Dimension + + // The description of the metric. + DisplayDescription *string + + // The display name of the metric. + DisplayName *string + + // Whether regional MDM account enabled. + EnableRegionalMdmAccount *bool + + // Whether gaps would be filled with zeros. + FillGapWithZero *bool + + // Whether the metric is internal. + IsInternal *bool + + // Pattern for the filter of the metric. + MetricFilterPattern *string + + // The name of the metric. + Name *string + + // The resource Id dimension name override. + ResourceIDDimensionNameOverride *string + + // The source MDM account. + SourceMdmAccount *string + + // The source MDM namespace. + SourceMdmNamespace *string + + // Units the metric to be displayed in. + Unit *string +} + +// MigrateLoadBalancerToIPBasedRequest - The request for a migrateToIpBased API. +type MigrateLoadBalancerToIPBasedRequest struct { + // A list of pool names that should be migrated from Nic based to IP based pool + Pools []*string +} + +// MigratedPools - The response for a migrateToIpBased API. +type MigratedPools struct { + // A list of pools migrated from Nic based to IP based pool + MigratedPools []*string +} + +// NatGateway - Nat Gateway resource. +type NatGateway struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Nat Gateway properties. + Properties *NatGatewayPropertiesFormat + + // The nat gateway SKU. + SKU *NatGatewaySKU + + // Resource tags. + Tags map[string]*string + + // A list of availability zones denoting the zone in which Nat Gateway should be deployed. + Zones []*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// NatGatewayListResult - Response for ListNatGateways API service call. +type NatGatewayListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of Nat Gateways that exists in a resource group. + Value []*NatGateway +} + +// NatGatewayPropertiesFormat - Nat Gateway properties. +type NatGatewayPropertiesFormat struct { + // The idle timeout of the nat gateway. + IdleTimeoutInMinutes *int32 + + // An array of public ip addresses associated with the nat gateway resource. + PublicIPAddresses []*SubResource + + // An array of public ip prefixes associated with the nat gateway resource. + PublicIPPrefixes []*SubResource + + // READ-ONLY; The provisioning state of the NAT gateway resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the NAT gateway resource. + ResourceGUID *string + + // READ-ONLY; An array of references to the subnets using this nat gateway resource. + Subnets []*SubResource +} + +// NatGatewaySKU - SKU of nat gateway. +type NatGatewaySKU struct { + // Name of Nat Gateway SKU. + Name *NatGatewaySKUName +} + +// NatRule - Rule of type nat. +type NatRule struct { + // REQUIRED; Rule Type. + RuleType *FirewallPolicyRuleType + + // Description of the rule. + Description *string + + // List of destination IP addresses or Service Tags. + DestinationAddresses []*string + + // List of destination ports. + DestinationPorts []*string + + // Array of FirewallPolicyRuleNetworkProtocols. + IPProtocols []*FirewallPolicyRuleNetworkProtocol + + // Name of the rule. + Name *string + + // List of source IP addresses for this rule. + SourceAddresses []*string + + // List of source IpGroups for this rule. + SourceIPGroups []*string + + // The translated address for this NAT rule. + TranslatedAddress *string + + // The translated FQDN for this NAT rule. + TranslatedFqdn *string + + // The translated port for this NAT rule. + TranslatedPort *string +} + +// GetFirewallPolicyRule implements the FirewallPolicyRuleClassification interface for type NatRule. +func (n *NatRule) GetFirewallPolicyRule() *FirewallPolicyRule { + return &FirewallPolicyRule{ + Description: n.Description, + Name: n.Name, + RuleType: n.RuleType, + } +} + +// NatRulePortMapping - Individual port mappings for inbound NAT rule created for backend pool. +type NatRulePortMapping struct { + // Backend port. + BackendPort *int32 + + // Frontend port. + FrontendPort *int32 + + // Name of inbound NAT rule. + InboundNatRuleName *string +} + +// NextHopParameters - Parameters that define the source and destination endpoint. +type NextHopParameters struct { + // REQUIRED; The destination IP address. + DestinationIPAddress *string + + // REQUIRED; The source IP address. + SourceIPAddress *string + + // REQUIRED; The resource identifier of the target resource against which the action is to be performed. + TargetResourceID *string + + // 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 +} + +// NextHopResult - The information about next hop from the specified VM. +type NextHopResult struct { + // Next hop IP Address. + NextHopIPAddress *string + + // Next hop type. + NextHopType *NextHopType + + // 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 +} + +// O365BreakOutCategoryPolicies - Office365 breakout categories. +type O365BreakOutCategoryPolicies struct { + // Flag to control allow category. + Allow *bool + + // Flag to control default category. + Default *bool + + // Flag to control optimize category. + Optimize *bool +} + +// O365PolicyProperties - The Office365 breakout policy. +type O365PolicyProperties struct { + // Office365 breakout categories. + BreakOutCategories *O365BreakOutCategoryPolicies +} + +// Office365PolicyProperties - Network Virtual Appliance Sku Properties. +type Office365PolicyProperties struct { + // Office 365 breakout categories. + BreakOutCategories *BreakOutCategoryPolicies +} + +// Operation - Network REST API operation definition. +type Operation struct { + // Display metadata associated with the operation. + Display *OperationDisplay + + // Operation name: {provider}/{resource}/{operation}. + Name *string + + // Origin of the operation. + Origin *string + + // Operation properties format. + Properties *OperationPropertiesFormat +} + +// OperationDisplay - Display metadata associated with the operation. +type OperationDisplay struct { + // Description of the operation. + Description *string + + // Type of the operation: get, read, delete, etc. + Operation *string + + // Service provider: Microsoft Network. + Provider *string + + // Resource on which the operation is performed. + Resource *string +} + +// 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 + + // List of Network operations supported by the Network resource provider. + Value []*Operation +} + +// OperationPropertiesFormat - Description of operation properties format. +type OperationPropertiesFormat struct { + // Specification of the service. + ServiceSpecification *OperationPropertiesFormatServiceSpecification +} + +// OperationPropertiesFormatServiceSpecification - Specification of the service. +type OperationPropertiesFormatServiceSpecification struct { + // Operation log specification. + LogSpecifications []*LogSpecification + + // Operation service specification. + MetricSpecifications []*MetricSpecification +} + +// OrderBy - Describes a column to sort +type OrderBy struct { + // Describes the actual column name to sort by + Field *string + + // Describes if results should be in ascending/descending order + Order *FirewallPolicyIDPSQuerySortOrder +} + +// OutboundRule - Outbound rule of the load balancer. +type OutboundRule struct { + // Resource ID. + ID *string + + // 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 + + // Properties of load balancer outbound rule. + Properties *OutboundRulePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // REQUIRED; The Frontend IP addresses of the load balancer. + FrontendIPConfigurations []*SubResource + + // REQUIRED; The protocol for the outbound rule in load balancer. + Protocol *LoadBalancerOutboundRuleProtocol + + // The number of outbound ports to be used for NAT. + AllocatedOutboundPorts *int32 + + // 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 + + // The timeout for the TCP idle connection. + IdleTimeoutInMinutes *int32 + + // READ-ONLY; The provisioning state of the outbound rule resource. + ProvisioningState *ProvisioningState +} + +// OwaspCrsExclusionEntry - Allow to exclude some variable satisfy the condition for the WAF check. +type OwaspCrsExclusionEntry struct { + // REQUIRED; The variable to be excluded. + MatchVariable *OwaspCrsExclusionEntryMatchVariable + + // REQUIRED; When matchVariable is a collection, operator used to specify which elements in the collection this exclusion + // applies to. + Selector *string + + // REQUIRED; When matchVariable is a collection, operate on the selector to specify which elements in the collection this + // exclusion applies to. + SelectorMatchOperator *OwaspCrsExclusionEntrySelectorMatchOperator + + // The managed rule sets that are associated with the exclusion. + ExclusionManagedRuleSets []*ExclusionManagedRuleSet +} + +// P2SConnectionConfiguration Resource. +type P2SConnectionConfiguration struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the P2S connection configuration. + Properties *P2SConnectionConfigurationProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// 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 + + // The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration + + // The reference to the address space resource which represents Address space for P2S VpnClient. + VPNClientAddressPool *AddressSpace + + // READ-ONLY; List of Configuration Policy Groups that this P2SConnectionConfiguration is attached to. + ConfigurationPolicyGroupAssociations []*SubResource + + // READ-ONLY; List of previous Configuration Policy Groups that this P2SConnectionConfiguration was attached to. + PreviousConfigurationPolicyGroupAssociations []*VPNServerConfigurationPolicyGroup + + // READ-ONLY; The provisioning state of the P2SConnectionConfiguration resource. + ProvisioningState *ProvisioningState +} + +// 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 +} + +// P2SVPNConnectionHealthRequest - List of P2S Vpn connection health request. +type P2SVPNConnectionHealthRequest struct { + // The sas-url to download the P2S Vpn connection health detail. + OutputBlobSasURL *string + + // The list of p2s vpn user names whose p2s vpn connection detailed health to retrieve for. + VPNUserNamesFilter []*string +} + +// P2SVPNConnectionRequest - List of p2s vpn connections to be disconnected. +type P2SVPNConnectionRequest struct { + // List of p2s vpn connection Ids. + VPNConnectionIDs []*string +} + +// P2SVPNGateway - P2SVpnGateway Resource. +type P2SVPNGateway struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the P2SVpnGateway. + Properties *P2SVPNGatewayProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// P2SVPNGatewayProperties - Parameters for P2SVpnGateway. +type P2SVPNGatewayProperties struct { + // List of all customer specified DNS servers IP addresses. + CustomDNSServers []*string + + // Enable Routing Preference property for the Public IP Interface of the P2SVpnGateway. + IsRoutingPreferenceInternet *bool + + // List of all p2s connection configurations of the gateway. + P2SConnectionConfigurations []*P2SConnectionConfiguration + + // The scale unit for this p2s vpn gateway. + VPNGatewayScaleUnit *int32 + + // The VpnServerConfiguration to which the p2sVpnGateway is attached to. + VPNServerConfiguration *SubResource + + // The VirtualHub to which the gateway belongs. + VirtualHub *SubResource + + // READ-ONLY; The provisioning state of the P2S VPN gateway resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; All P2S VPN clients' connection health status. + VPNClientConnectionHealth *VPNClientConnectionHealth +} + +// P2SVPNProfileParameters - Vpn Client Parameters for package generation. +type P2SVPNProfileParameters struct { + // VPN client authentication method. + AuthenticationMethod *AuthenticationMethod +} + +// PacketCapture - Parameters that define the create packet capture operation. +type PacketCapture struct { + // REQUIRED; Properties of the packet capture. + Properties *PacketCaptureParameters +} + +// 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 + + // 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 + + // Protocol to be filtered on. + Protocol *PcProtocol + + // 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 + + // 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 +} + +// PacketCaptureListResult - List of packet capture sessions. +type PacketCaptureListResult struct { + // Information about packet capture sessions. + Value []*PacketCaptureResult +} + +// 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 + + // List of AzureVMSS instances to run packet capture on. + Include []*string +} + +// PacketCaptureParameters - Parameters that define the create packet capture operation. +type PacketCaptureParameters struct { + // REQUIRED; The storage location for a packet capture session. + StorageLocation *PacketCaptureStorageLocation + + // REQUIRED; The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported. + Target *string + + // Number of bytes captured per packet, the remaining bytes are truncated. + BytesToCapturePerPacket *int64 + + // A list of packet capture filters. + Filters []*PacketCaptureFilter + + // 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 + + // Target type of the resource provided. + TargetType *PacketCaptureTargetType + + // Maximum duration of the capture session in seconds. + TimeLimitInSeconds *int32 + + // Maximum size of the capture output. + TotalBytesPerSession *int64 +} + +// PacketCaptureQueryStatusResult - Status of packet capture session. +type PacketCaptureQueryStatusResult struct { + // The start time of the packet capture session. + CaptureStartTime *time.Time + + // The ID of the packet capture resource. + ID *string + + // The name of the packet capture resource. + Name *string + + // List of errors of packet capture session. + PacketCaptureError []*PcError + + // The status of the packet capture session. + PacketCaptureStatus *PcStatus + + // The reason the current packet capture session was stopped. + StopReason *string +} + +// PacketCaptureResult - Information about packet capture session. +type PacketCaptureResult struct { + // Properties of the packet capture result. + Properties *PacketCaptureResultProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; ID of the packet capture operation. + ID *string + + // READ-ONLY; Name of the packet capture session. + Name *string +} + +// PacketCaptureResultProperties - The properties of a packet capture session. +type PacketCaptureResultProperties struct { + // REQUIRED; The storage location for a packet capture session. + StorageLocation *PacketCaptureStorageLocation + + // REQUIRED; The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported. + Target *string + + // Number of bytes captured per packet, the remaining bytes are truncated. + BytesToCapturePerPacket *int64 + + // A list of packet capture filters. + Filters []*PacketCaptureFilter + + // 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 + + // Target type of the resource provided. + TargetType *PacketCaptureTargetType + + // Maximum duration of the capture session in seconds. + TimeLimitInSeconds *int32 + + // Maximum size of the capture output. + TotalBytesPerSession *int64 + + // READ-ONLY; The provisioning state of the packet capture session. + ProvisioningState *ProvisioningState +} + +// 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 + + // The ID of the storage account to save the packet capture session. Required if no local file path is provided. + StorageID *string + + // 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 +} + +// Parameters for an Action. +type Parameter struct { + // List of AS paths. + AsPath []*string + + // List of BGP communities. + Community []*string + + // List of route prefixes. + RoutePrefix []*string +} + +// PartnerManagedResourceProperties - Properties of the partner managed resource. +type PartnerManagedResourceProperties struct { + // READ-ONLY; The partner managed resource id. + ID *string + + // READ-ONLY; The partner managed ILB resource id + InternalLoadBalancerID *string + + // READ-ONLY; The partner managed SLB resource id + StandardLoadBalancerID *string +} + +// PatchObject - Object for patch operations. +type PatchObject struct { + // Resource tags. + Tags map[string]*string +} + +// PatchRouteFilter - Route Filter Resource. +type PatchRouteFilter struct { + // Resource ID. + ID *string + + // Properties of the route filter. + Properties *RouteFilterPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // 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 + + // READ-ONLY; Resource type. + Type *string +} + +// PatchRouteFilterRule - Route Filter Rule Resource. +type PatchRouteFilterRule struct { + // Resource ID. + ID *string + + // Properties of the route filter rule. + Properties *RouteFilterRulePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // 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 +} + +// PeerExpressRouteCircuitConnection - Peer Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. +type PeerExpressRouteCircuitConnection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the peer express route circuit connection. + Properties *PeerExpressRouteCircuitConnectionPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // The global reach peer circuit connection associated with Private Peering in an ExpressRoute Circuit. + Value []*PeerExpressRouteCircuitConnection +} + +// 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 + + // The resource guid of the authorization used for the express route circuit connection. + AuthResourceGUID *string + + // The name of the express route circuit connection resource. + ConnectionName *string + + // Reference to Express Route Circuit Private Peering Resource of the circuit. + ExpressRouteCircuitPeering *SubResource + + // Reference to Express Route Circuit Private Peering Resource of the peered circuit. + PeerExpressRouteCircuitPeering *SubResource + + // READ-ONLY; Express Route Circuit connection state. + CircuitConnectionStatus *CircuitConnectionStatus + + // READ-ONLY; The provisioning state of the peer express route circuit connection resource. + ProvisioningState *ProvisioningState +} + +// PeerRoute - Peer routing details. +type PeerRoute struct { + // READ-ONLY; The route's AS path sequence. + AsPath *string + + // READ-ONLY; The peer's local address. + LocalAddress *string + + // READ-ONLY; The route's network prefix. + Network *string + + // READ-ONLY; The route's next hop. + NextHop *string + + // READ-ONLY; The source this route was learned from. + Origin *string + + // READ-ONLY; The peer this route was learned from. + SourcePeer *string + + // READ-ONLY; The route's weight. + Weight *int32 +} + +// PolicySettings - Defines contents of a web application firewall global configuration. +type PolicySettings struct { + // If the action type is block, customer can override the response body. The body must be specified in base64 encoding. + CustomBlockResponseBody *string + + // If the action type is block, customer can override the response status code. + CustomBlockResponseStatusCode *int32 + + // Whether allow WAF to enforce file upload limits. + FileUploadEnforcement *bool + + // Maximum file upload size in Mb for WAF. + FileUploadLimitInMb *int32 + + // To scrub sensitive log fields + LogScrubbing *PolicySettingsLogScrubbing + + // Maximum request body size in Kb for WAF. + MaxRequestBodySizeInKb *int32 + + // The mode of the policy. + Mode *WebApplicationFirewallMode + + // Whether to allow WAF to check request Body. + RequestBodyCheck *bool + + // Whether allow WAF to enforce request body limits. + RequestBodyEnforcement *bool + + // Max inspection limit in KB for request body inspection for WAF. + RequestBodyInspectLimitInKB *int32 + + // The state of the policy. + State *WebApplicationFirewallEnabledState +} + +// PolicySettingsLogScrubbing - To scrub sensitive log fields +type PolicySettingsLogScrubbing struct { + // The rules that are applied to the logs for scrubbing. + ScrubbingRules []*WebApplicationFirewallScrubbingRules + + // State of the log scrubbing config. Default value is Enabled. + State *WebApplicationFirewallScrubbingState +} + +// PrepareNetworkPoliciesRequest - Details of PrepareNetworkPolicies for Subnet. +type PrepareNetworkPoliciesRequest struct { + // A list of NetworkIntentPolicyConfiguration. + NetworkIntentPolicyConfigurations []*IntentPolicyConfiguration + + // The name of the service for which subnet is being prepared for. + ServiceName *string +} + +// 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 + + // Properties of the private dns zone configuration. + Properties *PrivateDNSZonePropertiesFormat +} + +// PrivateDNSZoneGroup - Private dns zone group resource. +type PrivateDNSZoneGroup struct { + // Resource ID. + ID *string + + // Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the private dns zone group. + Properties *PrivateDNSZoneGroupPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// 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 + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// 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 + + // READ-ONLY; The provisioning state of the private dns zone group resource. + ProvisioningState *ProvisioningState +} + +// PrivateDNSZonePropertiesFormat - Properties of the private dns zone configuration resource. +type PrivateDNSZonePropertiesFormat struct { + // The resource id of the private dns zone. + PrivateDNSZoneID *string + + // READ-ONLY; A collection of information regarding a recordSet, holding information to identify private resources. + RecordSets []*RecordSet +} + +// PrivateEndpoint - Private endpoint resource. +type PrivateEndpoint struct { + // The extended location of the load balancer. + ExtendedLocation *ExtendedLocation + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the private endpoint. + Properties *PrivateEndpointProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// PrivateEndpointConnection resource. +type PrivateEndpointConnection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the private end point connection. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; The resource type. + Type *string +} + +// PrivateEndpointConnectionListResult - Response for the ListPrivateEndpointConnection API service call. +type PrivateEndpointConnectionListResult struct { + // A list of PrivateEndpointConnection resources for a specific private link service. + Value []*PrivateEndpointConnection + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// 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 + + // READ-ONLY; The consumer link id. + LinkIdentifier *string + + // READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The location of the private endpoint. + PrivateEndpointLocation *string + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // Properties of private endpoint IP configurations. + Properties *PrivateEndpointIPConfigurationProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; The resource type. + Type *string +} + +// 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 + + // The member name of a group obtained from the remote resource that this private endpoint should connect to. + MemberName *string + + // A private ip address obtained from the private endpoint's subnet. + PrivateIPAddress *string +} + +// PrivateEndpointListResult - Response for the ListPrivateEndpoints API service call. +type PrivateEndpointListResult struct { + // A list of private endpoint resources in a resource group. + Value []*PrivateEndpoint + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// PrivateEndpointProperties - Properties of the private endpoint. +type PrivateEndpointProperties struct { + // Application security groups in which the private endpoint IP configuration is included. + ApplicationSecurityGroups []*ApplicationSecurityGroup + + // An array of custom dns configurations. + CustomDNSConfigs []*CustomDNSConfigPropertiesFormat + + // The custom name of the network interface attached to the private endpoint. + CustomNetworkInterfaceName *string + + // A list of IP configurations of the private endpoint. This will be used to map to the First Party Service's endpoints. + IPConfigurations []*PrivateEndpointIPConfiguration + + // 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 + + // A grouping of information about the connection to the remote resource. + PrivateLinkServiceConnections []*PrivateLinkServiceConnection + + // The ID of the subnet from which the private IP will be allocated. + Subnet *Subnet + + // READ-ONLY; An array of references to the network interfaces created for this private endpoint. + NetworkInterfaces []*Interface + + // READ-ONLY; The provisioning state of the private endpoint resource. + ProvisioningState *ProvisioningState +} + +// PrivateLinkService - Private link service resource. +type PrivateLinkService struct { + // The extended location of the load balancer. + ExtendedLocation *ExtendedLocation + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the private link service. + Properties *PrivateLinkServiceProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// PrivateLinkServiceConnection resource. +type PrivateLinkServiceConnection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the private link service connection. + Properties *PrivateLinkServiceConnectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; The resource type. + Type *string +} + +// 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 + + // A collection of read-only information about the state of the connection to the remote resource. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The resource id of private link service. + PrivateLinkServiceID *string + + // A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars. + RequestMessage *string + + // READ-ONLY; The provisioning state of the private link service connection resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // The reason for approval/rejection of the connection. + Description *string + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *string +} + +// PrivateLinkServiceIPConfiguration - The private link service ip configuration. +type PrivateLinkServiceIPConfiguration struct { + // Resource ID. + ID *string + + // The name of private link service ip configuration. + Name *string + + // Properties of the private link service ip configuration. + Properties *PrivateLinkServiceIPConfigurationProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; The resource type. + Type *string +} + +// PrivateLinkServiceIPConfigurationProperties - Properties of private link service IP configuration. +type PrivateLinkServiceIPConfigurationProperties struct { + // Whether the ip configuration is primary or not. + Primary *bool + + // The private IP address of the IP configuration. + PrivateIPAddress *string + + // Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. + PrivateIPAddressVersion *IPVersion + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod + + // The reference to the subnet resource. + Subnet *Subnet + + // READ-ONLY; The provisioning state of the private link service IP configuration resource. + ProvisioningState *ProvisioningState +} + +// PrivateLinkServiceListResult - Response for the ListPrivateLinkService API service call. +type PrivateLinkServiceListResult struct { + // A list of PrivateLinkService resources in a resource group. + Value []*PrivateLinkService + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// PrivateLinkServiceProperties - Properties of the private link service. +type PrivateLinkServiceProperties struct { + // The auto-approval list of the private link service. + AutoApproval *PrivateLinkServicePropertiesAutoApproval + + // Whether the private link service is enabled for proxy protocol or not. + EnableProxyProtocol *bool + + // The list of Fqdn. + Fqdns []*string + + // An array of private link service IP configurations. + IPConfigurations []*PrivateLinkServiceIPConfiguration + + // An array of references to the load balancer IP configurations. + LoadBalancerFrontendIPConfigurations []*FrontendIPConfiguration + + // The visibility list of the private link service. + Visibility *PrivateLinkServicePropertiesVisibility + + // READ-ONLY; The alias of the private link service. + Alias *string + + // READ-ONLY; An array of references to the network interfaces created for this private link service. + NetworkInterfaces []*Interface + + // READ-ONLY; An array of list about connections to the private endpoint. + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; The provisioning state of the private link service resource. + ProvisioningState *ProvisioningState +} + +// PrivateLinkServicePropertiesAutoApproval - The auto-approval list of the private link service. +type PrivateLinkServicePropertiesAutoApproval struct { + // The list of subscriptions. + Subscriptions []*string +} + +// PrivateLinkServicePropertiesVisibility - The visibility list of the private link service. +type PrivateLinkServicePropertiesVisibility struct { + // The list of subscriptions. + Subscriptions []*string +} + +// PrivateLinkServiceVisibility - Response for the CheckPrivateLinkServiceVisibility API service call. +type PrivateLinkServiceVisibility struct { + // Private Link Service Visibility (True/False). + Visible *bool +} + +// Probe - A load balancer probe. +type Probe struct { + // Resource ID. + ID *string + + // 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 + + // Properties of load balancer probe. + Properties *ProbePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Type of the resource. + Type *string +} + +// 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 + + // 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 + + // 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 + + // 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 + + // 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 + + // 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 + + // READ-ONLY; The load balancer rules that use this probe. + LoadBalancingRules []*SubResource + + // READ-ONLY; The provisioning state of the probe resource. + ProvisioningState *ProvisioningState +} + +// Profile - Network profile resource. +type Profile struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Network profile properties. + Properties *ProfilePropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ProfileListResult - Response for ListNetworkProfiles API service call. +type ProfileListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of network profiles that exist in a resource group. + Value []*Profile +} + +// ProfilePropertiesFormat - Network profile properties. +type ProfilePropertiesFormat struct { + // List of chid container network interface configurations. + ContainerNetworkInterfaceConfigurations []*ContainerNetworkInterfaceConfiguration + + // READ-ONLY; List of child container network interfaces. + ContainerNetworkInterfaces []*ContainerNetworkInterface + + // READ-ONLY; The provisioning state of the network profile resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the network profile resource. + ResourceGUID *string +} + +// PropagatedRouteTable - The list of RouteTables to advertise the routes to. +type PropagatedRouteTable struct { + // The list of resource ids of all the RouteTables. + IDs []*SubResource + + // The list of labels. + Labels []*string +} + +// PropagatedRouteTableNfv - Nfv version of the list of RouteTables to advertise the routes to. +type PropagatedRouteTableNfv struct { + // The list of resource ids of all the RouteTables. + IDs []*RoutingConfigurationNfvSubResource + + // The list of labels. + Labels []*string +} + +// ProtocolConfiguration - Configuration of the protocol. +type ProtocolConfiguration struct { + // HTTP configuration of the connectivity check. + HTTPConfiguration *HTTPConfiguration +} + +// PublicIPAddress - Public IP address resource. +type PublicIPAddress struct { + // The extended location of the public ip address. + ExtendedLocation *ExtendedLocation + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Public IP address properties. + Properties *PublicIPAddressPropertiesFormat + + // The public IP address SKU. + SKU *PublicIPAddressSKU + + // Resource tags. + Tags map[string]*string + + // A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones []*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// 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 + + // The domain name label scope. If a domain name label and a domain name label scope are specified, an A DNS record is created + // for the public IP in the Microsoft Azure DNS system with a hashed value + // includes in FQDN. + DomainNameLabelScope *PublicIPAddressDNSSettingsDomainNameLabelScope + + // 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 + + // 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 +} + +// PublicIPAddressListResult - Response for ListPublicIpAddresses API service call. +type PublicIPAddressListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of public IP addresses that exists in a resource group. + Value []*PublicIPAddress +} + +// PublicIPAddressPropertiesFormat - Public IP address properties. +type PublicIPAddressPropertiesFormat struct { + // The FQDN of the DNS record associated with the public IP address. + DNSSettings *PublicIPAddressDNSSettings + + // The DDoS protection custom policy associated with the public IP address. + DdosSettings *DdosSettings + + // Specify what happens to the public IP address when the VM using it is deleted + DeleteOption *DeleteOptions + + // The IP address associated with the public IP address resource. + IPAddress *string + + // The list of tags associated with the public IP address. + IPTags []*IPTag + + // The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 + + // The linked public IP address of the public IP address resource. + LinkedPublicIPAddress *PublicIPAddress + + // Migration phase of Public IP Address. + MigrationPhase *PublicIPAddressMigrationPhase + + // The NatGateway for the Public IP address. + NatGateway *NatGateway + + // The public IP address version. + PublicIPAddressVersion *IPVersion + + // The public IP address allocation method. + PublicIPAllocationMethod *IPAllocationMethod + + // The Public IP Prefix this Public IP Address should be allocated from. + PublicIPPrefix *SubResource + + // The service public IP address of the public IP address resource. + ServicePublicIPAddress *PublicIPAddress + + // READ-ONLY; The IP configuration associated with the public IP address. + IPConfiguration *IPConfiguration + + // READ-ONLY; The provisioning state of the public IP address resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the public IP address resource. + ResourceGUID *string +} + +// PublicIPAddressSKU - SKU of a public IP address. +type PublicIPAddressSKU struct { + // Name of a public IP address SKU. + Name *PublicIPAddressSKUName + + // Tier of a public IP address SKU. + Tier *PublicIPAddressSKUTier +} + +// 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 + + // Value indicating whether the IP address is DDoS workload protected or not. + IsWorkloadProtected *IsWorkloadProtected + + // IP Address of the Public IP Resource + PublicIPAddress *string + + // Public IP ARM resource ID + PublicIPAddressID *string +} + +// PublicIPPrefix - Public IP prefix resource. +type PublicIPPrefix struct { + // The extended location of the public ip address. + ExtendedLocation *ExtendedLocation + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Public IP prefix properties. + Properties *PublicIPPrefixPropertiesFormat + + // The public IP prefix SKU. + SKU *PublicIPPrefixSKU + + // Resource tags. + Tags map[string]*string + + // A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones []*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// PublicIPPrefixListResult - Response for ListPublicIpPrefixes API service call. +type PublicIPPrefixListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of public IP prefixes that exists in a resource group. + Value []*PublicIPPrefix +} + +// PublicIPPrefixPropertiesFormat - Public IP prefix properties. +type PublicIPPrefixPropertiesFormat struct { + // The customIpPrefix that this prefix is associated with. + CustomIPPrefix *SubResource + + // The list of tags associated with the public IP prefix. + IPTags []*IPTag + + // NatGateway of Public IP Prefix. + NatGateway *NatGateway + + // The Length of the Public IP Prefix. + PrefixLength *int32 + + // The public IP address version. + PublicIPAddressVersion *IPVersion + + // READ-ONLY; The allocated Prefix. + IPPrefix *string + + // READ-ONLY; The reference to load balancer frontend IP configuration associated with the public IP prefix. + LoadBalancerFrontendIPConfiguration *SubResource + + // READ-ONLY; The provisioning state of the public IP prefix resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The list of all referenced PublicIPAddresses. + PublicIPAddresses []*ReferencedPublicIPAddress + + // READ-ONLY; The resource GUID property of the public IP prefix resource. + ResourceGUID *string +} + +// PublicIPPrefixSKU - SKU of a public IP prefix. +type PublicIPPrefixSKU struct { + // Name of a public IP prefix SKU. + Name *PublicIPPrefixSKUName + + // Tier of a public IP prefix SKU. + Tier *PublicIPPrefixSKUTier +} + +// QosDefinition - Quality of Service defines the traffic configuration between endpoints. Mandatory to have one marking. +type QosDefinition struct { + // Destination IP ranges. + DestinationIPRanges []*QosIPRange + + // Destination port ranges. + DestinationPortRanges []*QosPortRange + + // List of markings to be used in the configuration. + Markings []*int32 + + // RNM supported protocol types. + Protocol *ProtocolType + + // Source IP ranges. + SourceIPRanges []*QosIPRange + + // Sources port ranges. + SourcePortRanges []*QosPortRange +} + +// QosIPRange - Qos Traffic Profiler IP Range properties. +type QosIPRange struct { + // End IP Address. + EndIP *string + + // Start IP Address. + StartIP *string +} + +// QosPortRange - Qos Traffic Profiler Port range properties. +type QosPortRange struct { + // Qos Port Range end. + End *int32 + + // Qos Port Range start. + Start *int32 +} + +// 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 + + // NetworkInterfaceIPConfiguration set in load balancer backend address. + IPConfiguration *SubResource +} + +// 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 +} + +// QueryResults - Query result +type QueryResults struct { + // Number of total records matching the query. + MatchingRecordsCount *int64 + + // Array containing the results of the query + Signatures []*SingleQueryResult +} + +// 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 +} + +// RadiusServer - Radius Server Settings. +type RadiusServer struct { + // REQUIRED; The address of this radius server. + RadiusServerAddress *string + + // The initial score assigned to this radius server. + RadiusServerScore *int64 + + // The secret used for this radius server. + RadiusServerSecret *string +} + +// RecordSet - A collective group of information about the record set information. +type RecordSet struct { + // Fqdn that resolves to private endpoint ip address. + Fqdn *string + + // The private ip address of the private endpoint. + IPAddresses []*string + + // Recordset name. + RecordSetName *string + + // Resource record type. + RecordType *string + + // Recordset time to live. + TTL *int32 + + // READ-ONLY; The provisioning state of the recordset. + ProvisioningState *ProvisioningState +} + +// ReferencedPublicIPAddress - Reference to a public IP address. +type ReferencedPublicIPAddress struct { + // The PublicIPAddress Reference. + ID *string +} + +// Resource - Common resource representation. +type Resource struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ResourceNavigationLink resource. +type ResourceNavigationLink struct { + // Resource ID. + ID *string + + // Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Resource navigation link properties format. + Properties *ResourceNavigationLinkFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource type. + Type *string +} + +// ResourceNavigationLinkFormat - Properties of ResourceNavigationLink. +type ResourceNavigationLinkFormat struct { + // Link to the external resource. + Link *string + + // Resource type of the linked resource. + LinkedResourceType *string + + // READ-ONLY; The provisioning state of the resource navigation link resource. + ProvisioningState *ProvisioningState +} + +// ResourceNavigationLinksListResult - Response for ResourceNavigationLinks_List operation. +type ResourceNavigationLinksListResult struct { + // The resource navigation links in a subnet. + Value []*ResourceNavigationLink + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// ResourceSet - The base resource set for visibility and auto-approval. +type ResourceSet struct { + // The list of subscriptions. + Subscriptions []*string +} + +// RetentionPolicyParameters - Parameters that define the retention policy for flow log. +type RetentionPolicyParameters struct { + // Number of days to retain flow log records. + Days *int32 + + // Flag to enable/disable retention. + Enabled *bool +} + +// Route resource. +type Route struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the route. + Properties *RoutePropertiesFormat + + // The type of the resource. + Type *string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// RouteFilter - Route Filter Resource. +type RouteFilter struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the route filter. + Properties *RouteFilterPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// RouteFilterListResult - Response for the ListRouteFilters API service call. +type RouteFilterListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of route filters in a resource group. + Value []*RouteFilter +} + +// RouteFilterPropertiesFormat - Route Filter Resource. +type RouteFilterPropertiesFormat struct { + // Collection of RouteFilterRules contained within a route filter. + Rules []*RouteFilterRule + + // READ-ONLY; A collection of references to express route circuit ipv6 peerings. + IPv6Peerings []*ExpressRouteCircuitPeering + + // READ-ONLY; A collection of references to express route circuit peerings. + Peerings []*ExpressRouteCircuitPeering + + // READ-ONLY; The provisioning state of the route filter resource. + ProvisioningState *ProvisioningState +} + +// RouteFilterRule - Route Filter Rule Resource. +type RouteFilterRule struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the route filter rule. + Properties *RouteFilterRulePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// RouteFilterRuleListResult - Response for the ListRouteFilterRules API service call. +type RouteFilterRuleListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of RouteFilterRules in a resource group. + Value []*RouteFilterRule +} + +// RouteFilterRulePropertiesFormat - Route Filter Rule Resource. +type RouteFilterRulePropertiesFormat struct { + // REQUIRED; The access type of the rule. + Access *Access + + // REQUIRED; The collection for bgp community values to filter on. e.g. ['12076:5010','12076:5020']. + Communities []*string + + // REQUIRED; The rule type of the rule. + RouteFilterRuleType *RouteFilterRuleType + + // READ-ONLY; The provisioning state of the route filter rule resource. + ProvisioningState *ProvisioningState +} + +// RouteListResult - Response for the ListRoute API service call. +type RouteListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of routes in a resource group. + Value []*Route +} + +// RouteMap - The RouteMap child resource of a Virtual hub. +type RouteMap struct { + // Resource ID. + ID *string + + // Properties of the RouteMap resource. + Properties *RouteMapProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // 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 + + // READ-ONLY; Resource type. + Type *string +} + +// RouteMapProperties - Properties of RouteMap resource +type RouteMapProperties struct { + // List of connections which have this RoutMap associated for inbound traffic. + AssociatedInboundConnections []*string + + // List of connections which have this RoutMap associated for outbound traffic. + AssociatedOutboundConnections []*string + + // List of RouteMap rules to be applied. + Rules []*RouteMapRule + + // READ-ONLY; The provisioning state of the RouteMap resource. + ProvisioningState *ProvisioningState +} + +// RouteMapRule - A RouteMap Rule. +type RouteMapRule struct { + // List of actions which will be applied on a match. + Actions []*Action + + // List of matching criterion which will be applied to traffic. + MatchCriteria []*Criterion + + // The unique name for the rule. + Name *string + + // Next step after rule is evaluated. Current supported behaviors are 'Continue'(to next rule) and 'Terminate'. + NextStepIfMatched *NextStep +} + +// RoutePropertiesFormat - Route resource. +type RoutePropertiesFormat struct { + // REQUIRED; The type of Azure hop the packet should be sent to. + NextHopType *RouteNextHopType + + // The destination CIDR to which the route applies. + AddressPrefix *string + + // A value indicating whether this route overrides overlapping BGP routes regardless of LPM. + HasBgpOverride *bool + + // 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 + + // READ-ONLY; The provisioning state of the route resource. + ProvisioningState *ProvisioningState +} + +// RouteTable - Route table resource. +type RouteTable struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the route table. + Properties *RouteTablePropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// RouteTableListResult - Response for the ListRouteTable API service call. +type RouteTableListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of route tables in a resource group. + Value []*RouteTable +} + +// RouteTablePropertiesFormat - Route Table resource. +type RouteTablePropertiesFormat struct { + // Whether to disable the routes learned by BGP on that route table. True means disable. + DisableBgpRoutePropagation *bool + + // Collection of routes contained within a route table. + Routes []*Route + + // READ-ONLY; The provisioning state of the route table resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the route table. + ResourceGUID *string + + // READ-ONLY; A collection of references to subnets. + Subnets []*Subnet +} + +// 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 + + // The resource id of the RouteMap associated with this RoutingConfiguration for inbound learned routes. + InboundRouteMap *SubResource + + // The resource id of theRouteMap associated with this RoutingConfiguration for outbound advertised routes. + OutboundRouteMap *SubResource + + // The list of RouteTables to advertise the routes to. + PropagatedRouteTables *PropagatedRouteTable + + // List of routes that control routing from VirtualHub into a virtual network connection. + VnetRoutes *VnetRoute +} + +// RoutingConfigurationNfv - NFV version of Routing Configuration indicating the associated and propagated route tables for +// this connection. +type RoutingConfigurationNfv struct { + // The resource id RouteTable associated with this RoutingConfiguration. + AssociatedRouteTable *RoutingConfigurationNfvSubResource + + // The resource id of the RouteMap associated with this RoutingConfiguration for inbound learned routes. + InboundRouteMap *RoutingConfigurationNfvSubResource + + // The resource id of the RouteMap associated with this RoutingConfiguration for outbound advertised routes. + OutboundRouteMap *RoutingConfigurationNfvSubResource + + // The list of RouteTables to advertise the routes to. + PropagatedRouteTables *PropagatedRouteTableNfv +} + +// RoutingConfigurationNfvSubResource - Reference to RouteTableV3 associated with the connection. +type RoutingConfigurationNfvSubResource struct { + // Resource ID. + ResourceURI *string +} + +// RoutingIntent - The routing intent child resource of a Virtual hub. +type RoutingIntent struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the RoutingIntent resource. + Properties *RoutingIntentProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource type. + Type *string +} + +// RoutingIntentProperties - The properties of a RoutingIntent resource. +type RoutingIntentProperties struct { + // List of routing policies. + RoutingPolicies []*RoutingPolicy + + // READ-ONLY; The provisioning state of the RoutingIntent resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // REQUIRED; The unique name for the routing policy. + Name *string + + // REQUIRED; The next hop resource id on which this routing policy is applicable to. + NextHop *string +} + +// Rule of type network. +type Rule struct { + // REQUIRED; Rule Type. + RuleType *FirewallPolicyRuleType + + // Description of the rule. + Description *string + + // List of destination IP addresses or Service Tags. + DestinationAddresses []*string + + // List of destination FQDNs. + DestinationFqdns []*string + + // List of destination IpGroups for this rule. + DestinationIPGroups []*string + + // List of destination ports. + DestinationPorts []*string + + // Array of FirewallPolicyRuleNetworkProtocols. + IPProtocols []*FirewallPolicyRuleNetworkProtocol + + // Name of the rule. + Name *string + + // List of source IP addresses for this rule. + SourceAddresses []*string + + // List of source IpGroups for this rule. + SourceIPGroups []*string +} + +// GetFirewallPolicyRule implements the FirewallPolicyRuleClassification interface for type Rule. +func (r *Rule) GetFirewallPolicyRule() *FirewallPolicyRule { + return &FirewallPolicyRule{ + Description: r.Description, + Name: r.Name, + RuleType: r.RuleType, + } +} + +// SKU - The sku of this Bastion Host. +type SKU struct { + // The name of this Bastion Host. + Name *BastionHostSKUName +} + +// ScopeConnection - The Scope Connections resource +type ScopeConnection struct { + // The scope connection properties + Properties *ScopeConnectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// ScopeConnectionListResult - List of scope connections. +type ScopeConnectionListResult struct { + // Gets the URL to get the next page of results. + NextLink *string + + // List of scope connections. + Value []*ScopeConnection +} + +// ScopeConnectionProperties - Scope connection. +type ScopeConnectionProperties struct { + // A description of the scope connection. + Description *string + + // Resource ID. + ResourceID *string + + // Tenant ID. + TenantID *string + + // READ-ONLY; Connection State + ConnectionState *ScopeConnectionState +} + +// SecurityAdminConfiguration - Defines the security admin configuration +type SecurityAdminConfiguration struct { + // Indicates the properties for the network manager security admin configuration. + Properties *SecurityAdminConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// SecurityAdminConfigurationListResult - A list of network manager security admin configurations +type SecurityAdminConfigurationListResult struct { + // Gets the URL to get the next page of results. + NextLink *string + + // Gets a page of security admin configurations + Value []*SecurityAdminConfiguration +} + +// SecurityAdminConfigurationPropertiesFormat - Defines the security admin configuration properties. +type SecurityAdminConfigurationPropertiesFormat struct { + // Enum list of network intent policy based services. + ApplyOnNetworkIntentPolicyBasedServices []*NetworkIntentPolicyBasedService + + // A description of the security configuration. + Description *string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Unique identifier for this resource. + ResourceGUID *string +} + +// SecurityGroup - NetworkSecurityGroup resource. +type SecurityGroup struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the network security group. + Properties *SecurityGroupPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// SecurityGroupListResult - Response for ListNetworkSecurityGroups API service call. +type SecurityGroupListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of NetworkSecurityGroup resources. + Value []*SecurityGroup +} + +// SecurityGroupNetworkInterface - Network interface and all its associated security rules. +type SecurityGroupNetworkInterface struct { + // ID of the network interface. + ID *string + + // All security rules associated with the network interface. + SecurityRuleAssociations *SecurityRuleAssociations +} + +// 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 + + // A collection of security rules of the network security group. + SecurityRules []*SecurityRule + + // READ-ONLY; The default security rules of network security group. + DefaultSecurityRules []*SecurityRule + + // READ-ONLY; A collection of references to flow log resources. + FlowLogs []*FlowLog + + // READ-ONLY; A collection of references to network interfaces. + NetworkInterfaces []*Interface + + // READ-ONLY; The provisioning state of the network security group resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the network security group resource. + ResourceGUID *string + + // READ-ONLY; A collection of references to subnets. + Subnets []*Subnet +} + +// SecurityGroupResult - Network configuration diagnostic result corresponded provided traffic query. +type SecurityGroupResult struct { + // The network traffic is allowed or denied. + SecurityRuleAccessResult *SecurityRuleAccess + + // READ-ONLY; List of results network security groups diagnostic. + EvaluatedNetworkSecurityGroups []*EvaluatedNetworkSecurityGroup +} + +// SecurityGroupViewParameters - Parameters that define the VM to check security groups for. +type SecurityGroupViewParameters struct { + // REQUIRED; ID of the target VM. + TargetResourceID *string +} + +// SecurityGroupViewResult - The information about security rules applied to the specified VM. +type SecurityGroupViewResult struct { + // List of network interfaces on the specified VM. + NetworkInterfaces []*SecurityGroupNetworkInterface +} + +// SecurityPartnerProvider - Security Partner Provider resource. +type SecurityPartnerProvider struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the Security Partner Provider. + Properties *SecurityPartnerProviderPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// SecurityPartnerProviderListResult - Response for ListSecurityPartnerProviders API service call. +type SecurityPartnerProviderListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Security Partner Providers in a resource group. + Value []*SecurityPartnerProvider +} + +// SecurityPartnerProviderPropertiesFormat - Properties of the Security Partner Provider. +type SecurityPartnerProviderPropertiesFormat struct { + // The security provider name. + SecurityProviderName *SecurityProviderName + + // The virtualHub to which the Security Partner Provider belongs. + VirtualHub *SubResource + + // READ-ONLY; The connection status with the Security Partner Provider. + ConnectionStatus *SecurityPartnerProviderConnectionStatus + + // READ-ONLY; The provisioning state of the Security Partner Provider resource. + ProvisioningState *ProvisioningState +} + +// SecurityRule - Network security rule. +type SecurityRule struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the security rule. + Properties *SecurityRulePropertiesFormat + + // The type of the resource. + Type *string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// SecurityRuleAssociations - All security rules associated with the network interface. +type SecurityRuleAssociations struct { + // Collection of default security rules of the network security group. + DefaultSecurityRules []*SecurityRule + + // Collection of effective security rules. + EffectiveSecurityRules []*EffectiveNetworkSecurityRule + + // Network interface and it's custom security rules. + NetworkInterfaceAssociation *InterfaceAssociation + + // Subnet and it's custom security rules. + SubnetAssociation *SubnetAssociation +} + +// 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 + + // The security rules in a network security group. + Value []*SecurityRule +} + +// SecurityRulePropertiesFormat - Security rule resource. +type SecurityRulePropertiesFormat struct { + // REQUIRED; The network traffic is allowed or denied. + Access *SecurityRuleAccess + + // REQUIRED; The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. + Direction *SecurityRuleDirection + + // REQUIRED; 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 + + // REQUIRED; Network protocol this rule applies to. + Protocol *SecurityRuleProtocol + + // A description for this rule. Restricted to 140 chars. + Description *string + + // 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 + + // The destination address prefixes. CIDR or destination IP ranges. + DestinationAddressPrefixes []*string + + // The application security group specified as destination. + DestinationApplicationSecurityGroups []*ApplicationSecurityGroup + + // The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. + DestinationPortRange *string + + // The destination port ranges. + DestinationPortRanges []*string + + // 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 + + // The CIDR or source IP ranges. + SourceAddressPrefixes []*string + + // The application security group specified as source. + SourceApplicationSecurityGroups []*ApplicationSecurityGroup + + // The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. + SourcePortRange *string + + // The source port ranges. + SourcePortRanges []*string + + // READ-ONLY; The provisioning state of the security rule resource. + ProvisioningState *ProvisioningState +} + +// SecurityRulesEvaluationResult - Network security rules evaluation result. +type SecurityRulesEvaluationResult struct { + // Value indicating whether destination is matched. + DestinationMatched *bool + + // Value indicating whether destination port is matched. + DestinationPortMatched *bool + + // Name of the network security rule. + Name *string + + // Value indicating whether protocol is matched. + ProtocolMatched *bool + + // Value indicating whether source is matched. + SourceMatched *bool + + // Value indicating whether source port is matched. + SourcePortMatched *bool +} + +// ServiceAssociationLink resource. +type ServiceAssociationLink struct { + // Resource ID. + ID *string + + // Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Resource navigation link properties format. + Properties *ServiceAssociationLinkPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource type. + Type *string +} + +// ServiceAssociationLinkPropertiesFormat - Properties of ServiceAssociationLink. +type ServiceAssociationLinkPropertiesFormat struct { + // If true, the resource can be deleted. + AllowDelete *bool + + // Link to the external resource. + Link *string + + // Resource type of the linked resource. + LinkedResourceType *string + + // A list of locations. + Locations []*string + + // READ-ONLY; The provisioning state of the service association link resource. + ProvisioningState *ProvisioningState +} + +// ServiceAssociationLinksListResult - Response for ServiceAssociationLinks_List operation. +type ServiceAssociationLinksListResult struct { + // The service association links in a subnet. + Value []*ServiceAssociationLink + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// 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 + + // READ-ONLY; The actions permitted to the service upon delegation. + Actions []*string + + // READ-ONLY; The provisioning state of the service delegation resource. + ProvisioningState *ProvisioningState +} + +// ServiceEndpointPolicy - Service End point policy resource. +type ServiceEndpointPolicy struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the service end point policy. + Properties *ServiceEndpointPolicyPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Kind of service endpoint policy. This is metadata used for the Azure portal experience. + Kind *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ServiceEndpointPolicyDefinition - Service Endpoint policy definitions. +type ServiceEndpointPolicyDefinition struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the service endpoint policy definition. + Properties *ServiceEndpointPolicyDefinitionPropertiesFormat + + // The type of the resource. + Type *string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// 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 + + // The service endpoint policy definition in a service endpoint policy. + Value []*ServiceEndpointPolicyDefinition +} + +// ServiceEndpointPolicyDefinitionPropertiesFormat - Service Endpoint policy definition resource. +type ServiceEndpointPolicyDefinitionPropertiesFormat struct { + // A description for this rule. Restricted to 140 chars. + Description *string + + // Service endpoint name. + Service *string + + // A list of service resources. + ServiceResources []*string + + // READ-ONLY; The provisioning state of the service endpoint policy definition resource. + ProvisioningState *ProvisioningState +} + +// ServiceEndpointPolicyListResult - Response for ListServiceEndpointPolicies API service call. +type ServiceEndpointPolicyListResult struct { + // A list of ServiceEndpointPolicy resources. + Value []*ServiceEndpointPolicy + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// ServiceEndpointPolicyPropertiesFormat - Service Endpoint Policy resource. +type ServiceEndpointPolicyPropertiesFormat struct { + // A collection of contextual service endpoint policy. + ContextualServiceEndpointPolicies []*string + + // The alias indicating if the policy belongs to a service + ServiceAlias *string + + // A collection of service endpoint policy definitions of the service endpoint policy. + ServiceEndpointPolicyDefinitions []*ServiceEndpointPolicyDefinition + + // READ-ONLY; The provisioning state of the service endpoint policy resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the service endpoint policy resource. + ResourceGUID *string + + // READ-ONLY; A collection of references to subnets. + Subnets []*Subnet +} + +// ServiceEndpointPropertiesFormat - The service endpoint properties. +type ServiceEndpointPropertiesFormat struct { + // A list of locations. + Locations []*string + + // The type of the endpoint service. + Service *string + + // READ-ONLY; The provisioning state of the service endpoint resource. + ProvisioningState *ProvisioningState +} + +// ServiceTagInformation - The service tag information. +type ServiceTagInformation struct { + // READ-ONLY; The ID of service tag. + ID *string + + // READ-ONLY; The name of service tag. + Name *string + + // READ-ONLY; Properties of the service tag information. + Properties *ServiceTagInformationPropertiesFormat + + // READ-ONLY; The iteration number of service tag object for region. + ServiceTagChangeNumber *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 + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// ServiceTagInformationPropertiesFormat - Properties of the service tag information. +type ServiceTagInformationPropertiesFormat struct { + // READ-ONLY; The list of IP address prefixes. + AddressPrefixes []*string + + // READ-ONLY; The iteration number of service tag. + ChangeNumber *string + + // READ-ONLY; The region of service tag. + Region *string + + // READ-ONLY; The state of the service tag. + State *string + + // READ-ONLY; The name of system service. + SystemService *string +} + +// ServiceTagsListResult - Response for the ListServiceTags API service call. +type ServiceTagsListResult struct { + // READ-ONLY; The iteration number. + ChangeNumber *string + + // READ-ONLY; The name of the cloud. + Cloud *string + + // READ-ONLY; The ID of the cloud. + ID *string + + // READ-ONLY; The name of the cloud. + Name *string + + // READ-ONLY; The URL to get next page of service tag information resources. + NextLink *string + + // READ-ONLY; The azure resource type. + Type *string + + // READ-ONLY; The list of service tag information resources. + Values []*ServiceTagInformation +} + +// SessionIDs - List of session IDs. +type SessionIDs struct { + // List of session IDs. + SessionIDs []*string +} + +// 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 +} + +// SignatureOverridesFilterValuesResponse - Describes the list of all possible values for a specific filter value +type SignatureOverridesFilterValuesResponse struct { + // Describes the possible values + FilterValues []*string +} + +// 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 + + // Contains the name of the resource (default) + Name *string + + // Will contain the properties of the resource (the actual signature overrides) + Properties *SignaturesOverridesProperties + + // Will contain the type of the resource: Microsoft.Network/firewallPolicies/intrusionDetectionSignaturesOverrides + Type *string +} + +// 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 +} + +// SignaturesOverridesProperties - Will contain the properties of the resource (the actual signature overrides) +type SignaturesOverridesProperties struct { + // Dictionary of + Signatures map[string]*string +} + +type SingleQueryResult struct { + // Describes what is the signature enforces + Description *string + + // Describes the list of destination ports related to this signature + DestinationPorts []*string + + // Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, 2 - Bidirectional + Direction *FirewallPolicyIDPSSignatureDirection + + // Describes the groups the signature belongs to + Group *string + + // Describes if this override is inherited from base policy or not + InheritedFromParentPolicy *bool + + // Describes the last updated time of the signature (provided from 3rd party vendor) + LastUpdated *string + + // The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny + Mode *FirewallPolicyIDPSSignatureMode + + // Describes the protocol the signatures is being enforced in + Protocol *string + + // Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High + Severity *FirewallPolicyIDPSSignatureSeverity + + // The ID of the signature + SignatureID *int32 + + // Describes the list of source ports related to this signature + SourcePorts []*string +} + +// StaticMember Item. +type StaticMember struct { + // The Static Member properties + Properties *StaticMemberProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// 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 + + // Gets a page of StaticMember + Value []*StaticMember +} + +// StaticMemberProperties - Properties of static member. +type StaticMemberProperties struct { + // Resource Id. + ResourceID *string + + // READ-ONLY; The provisioning state of the scope assignment resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Resource region. + Region *string +} + +// StaticRoute - List of all Static Routes. +type StaticRoute struct { + // List of all address prefixes. + AddressPrefixes []*string + + // The name of the StaticRoute that is unique within a VnetRoute. + Name *string + + // The ip address of the next hop. + NextHopIPAddress *string +} + +// 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 + + // READ-ONLY; Boolean indicating whether static routes on this connection are automatically propagate to route tables which + // this connection propagates to. + PropagateStaticRoutes *bool +} + +// SubResource - Reference to another subresource. +type SubResource struct { + // Resource ID. + ID *string +} + +// Subnet in a virtual network resource. +type Subnet struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the subnet. + Properties *SubnetPropertiesFormat + + // Resource type. + Type *string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// SubnetAssociation - Subnet and it's custom security rules. +type SubnetAssociation struct { + // Collection of custom security rules. + SecurityRules []*SecurityRule + + // READ-ONLY; Subnet ID. + ID *string +} + +// 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 + + // The subnets in a virtual network. + Value []*Subnet +} + +// SubnetPropertiesFormat - Properties of the subnet. +type SubnetPropertiesFormat struct { + // The address prefix for the subnet. + AddressPrefix *string + + // List of address prefixes for the subnet. + AddressPrefixes []*string + + // Application gateway IP configurations of virtual network resource. + ApplicationGatewayIPConfigurations []*ApplicationGatewayIPConfiguration + + // Set this property to false to disable default outbound connectivity for all VMs in the subnet. This property can only be + // set at the time of subnet creation and cannot be updated for an existing + // subnet. + DefaultOutboundAccess *bool + + // An array of references to the delegations on the subnet. + Delegations []*Delegation + + // Array of IpAllocation which reference this subnet. + IPAllocations []*SubResource + + // Nat gateway associated with this subnet. + NatGateway *SubResource + + // The reference to the NetworkSecurityGroup resource. + NetworkSecurityGroup *SecurityGroup + + // Enable or Disable apply network policies on private end point in the subnet. + PrivateEndpointNetworkPolicies *VirtualNetworkPrivateEndpointNetworkPolicies + + // Enable or Disable apply network policies on private link service in the subnet. + PrivateLinkServiceNetworkPolicies *VirtualNetworkPrivateLinkServiceNetworkPolicies + + // The reference to the RouteTable resource. + RouteTable *RouteTable + + // An array of service endpoint policies. + ServiceEndpointPolicies []*ServiceEndpointPolicy + + // An array of service endpoints. + ServiceEndpoints []*ServiceEndpointPropertiesFormat + + // READ-ONLY; Array of IP configuration profiles which reference this subnet. + IPConfigurationProfiles []*IPConfigurationProfile + + // READ-ONLY; An array of references to the network interface IP configurations using subnet. + IPConfigurations []*IPConfiguration + + // READ-ONLY; An array of references to private endpoints. + PrivateEndpoints []*PrivateEndpoint + + // READ-ONLY; The provisioning state of the subnet resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; A read-only string identifying the intention of use for this subnet based on delegations and other user-defined + // properties. + Purpose *string + + // READ-ONLY; An array of references to the external resources using subnet. + ResourceNavigationLinks []*ResourceNavigationLink + + // READ-ONLY; An array of references to services injecting into this subnet. + ServiceAssociationLinks []*ServiceAssociationLink +} + +// SwapResource to represent slot type on the specified cloud service. +type SwapResource struct { + // Swap resource properties + Properties *SwapResourceProperties + + // READ-ONLY; Resource Id. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// SwapResourceListResult - SwapResource List with single entry to represent slot type on the specified cloud service. +type SwapResourceListResult struct { + Value []*SwapResource +} + +// SwapResourceProperties - Swap resource properties +type SwapResourceProperties struct { + // Specifies slot info on a cloud service + SlotType *SlotType +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The type of identity that last modified the resource. + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// TagsObject - Tags object for patch operations. +type TagsObject struct { + // Resource tags. + Tags map[string]*string +} + +// Topology of the specified resource group. +type Topology struct { + // A list of topology resources. + Resources []*TopologyResource + + // READ-ONLY; The datetime when the topology was initially created for the resource group. + CreatedDateTime *time.Time + + // READ-ONLY; GUID representing the operation id. + ID *string + + // READ-ONLY; The datetime when the topology was last modified. + LastModified *time.Time +} + +// 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 + + // The name of the resource that is associated with the parent resource. + Name *string + + // The ID of the resource that is associated with the parent resource. + ResourceID *string +} + +// TopologyParameters - Parameters that define the representation of topology. +type TopologyParameters struct { + // The name of the target resource group to perform topology on. + TargetResourceGroupName *string + + // The reference to the Subnet resource. + TargetSubnet *SubResource + + // The reference to the Virtual Network resource. + TargetVirtualNetwork *SubResource +} + +// 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 + + // ID of the resource. + ID *string + + // Resource location. + Location *string + + // Name of the resource. + Name *string +} + +// TrafficAnalyticsConfigurationProperties - Parameters that define the configuration of traffic analytics. +type TrafficAnalyticsConfigurationProperties struct { + // Flag to enable/disable traffic analytics. + Enabled *bool + + // The interval in minutes which would decide how frequently TA service should do flow analytics. + TrafficAnalyticsInterval *int32 + + // The resource guid of the attached workspace. + WorkspaceID *string + + // The location of the attached workspace. + WorkspaceRegion *string + + // Resource Id of the attached workspace. + WorkspaceResourceID *string +} + +// TrafficAnalyticsProperties - Parameters that define the configuration of traffic analytics. +type TrafficAnalyticsProperties struct { + // Parameters that define the configuration of traffic analytics. + NetworkWatcherFlowAnalyticsConfiguration *TrafficAnalyticsConfigurationProperties +} + +// 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 + + // REQUIRED; A collection of remote address spaces in CIDR format. + RemoteAddressRanges []*string +} + +// TroubleshootingDetails - Information gained from troubleshooting of specified resource. +type TroubleshootingDetails struct { + // Details on troubleshooting results. + Detail *string + + // The id of the get troubleshoot operation. + ID *string + + // Reason type of failure. + ReasonType *string + + // List of recommended actions. + RecommendedActions []*TroubleshootingRecommendedActions + + // A summary of troubleshooting. + Summary *string +} + +// TroubleshootingParameters - Parameters that define the resource to troubleshoot. +type TroubleshootingParameters struct { + // REQUIRED; Properties of the troubleshooting resource. + Properties *TroubleshootingProperties + + // REQUIRED; The target resource to troubleshoot. + TargetResourceID *string +} + +// TroubleshootingProperties - Storage location provided for troubleshoot. +type TroubleshootingProperties struct { + // REQUIRED; The ID for the storage account to save the troubleshoot result. + StorageID *string + + // REQUIRED; The path to the blob to save the troubleshoot result in. + StoragePath *string +} + +// TroubleshootingRecommendedActions - Recommended actions based on discovered issues. +type TroubleshootingRecommendedActions struct { + // ID of the recommended action. + ActionID *string + + // Description of recommended actions. + ActionText *string + + // The uri linking to a documentation for the recommended troubleshooting actions. + ActionURI *string + + // The information from the URI for the recommended troubleshooting actions. + ActionURIText *string +} + +// TroubleshootingResult - Troubleshooting information gained from specified resource. +type TroubleshootingResult struct { + // The result code of the troubleshooting. + Code *string + + // The end time of the troubleshooting. + EndTime *time.Time + + // Information from troubleshooting. + Results []*TroubleshootingDetails + + // The start time of the troubleshooting. + StartTime *time.Time +} + +// TunnelConnectionHealth - VirtualNetworkGatewayConnection properties. +type TunnelConnectionHealth struct { + // READ-ONLY; Virtual Network Gateway connection status. + ConnectionStatus *VirtualNetworkGatewayConnectionStatus + + // READ-ONLY; The Egress Bytes Transferred in this connection. + EgressBytesTransferred *int64 + + // READ-ONLY; The Ingress Bytes Transferred in this connection. + IngressBytesTransferred *int64 + + // READ-ONLY; The time at which connection was established in Utc format. + LastConnectionEstablishedUTCTime *string + + // READ-ONLY; Tunnel name. + Tunnel *string +} + +// UnprepareNetworkPoliciesRequest - Details of UnprepareNetworkPolicies for Subnet. +type UnprepareNetworkPoliciesRequest struct { + // The name of the service for which subnet is being unprepared for. + ServiceName *string +} + +// Usage - The network resource usage. +type Usage struct { + // REQUIRED; The current value of the usage. + CurrentValue *int64 + + // REQUIRED; The limit of usage. + Limit *int64 + + // REQUIRED; The name of the type of usage. + Name *UsageName + + // REQUIRED; An enum describing the unit of measurement. + Unit *UsageUnit + + // READ-ONLY; Resource identifier. + ID *string +} + +// UsageName - The usage names. +type UsageName struct { + // A localized string describing the resource name. + LocalizedValue *string + + // A string describing the resource name. + Value *string +} + +// UsagesListResult - The list usages operation response. +type UsagesListResult struct { + // URL to get the next set of results. + NextLink *string + + // The list network resource usages. + Value []*Usage +} + +// VM - Describes a Virtual Machine. +type VM struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// 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 + + // The AADIssuer property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AADIssuer *string + + // The AADTenant property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AADTenant *string + + // The radius server address property of the VirtualNetworkGateway resource for vpn client connection. + RadiusServerAddress *string + + // The radius secret property of the VirtualNetworkGateway resource for vpn client connection. + RadiusServerSecret *string + + // The radiusServers property for multiple radius server configuration. + RadiusServers []*RadiusServer + + // VPN authentication types for the virtual network gateway.. + VPNAuthenticationTypes []*VPNAuthenticationType + + // The reference to the address space resource which represents Address space for P2S VpnClient. + VPNClientAddressPool *AddressSpace + + // VpnClientIpsecPolicies for virtual network gateway P2S client. + VPNClientIPSecPolicies []*IPSecPolicy + + // VpnClientProtocols for Virtual network gateway. + VPNClientProtocols []*VPNClientProtocol + + // VpnClientRevokedCertificate for Virtual network gateway. + VPNClientRevokedCertificates []*VPNClientRevokedCertificate + + // VpnClientRootCertificate for virtual network gateway. + VPNClientRootCertificates []*VPNClientRootCertificate + + // per ip address pool connection policy for virtual network gateway P2S client. + VngClientConnectionConfigurations []*VngClientConnectionConfiguration +} + +// VPNClientConnectionHealth - VpnClientConnectionHealth properties. +type VPNClientConnectionHealth struct { + // List of allocated ip addresses to the connected p2s vpn clients. + AllocatedIPAddresses []*string + + // The total of p2s vpn clients connected at this time to this P2SVpnGateway. + VPNClientConnectionsCount *int32 + + // READ-ONLY; Total of the Egress Bytes Transferred in this connection. + TotalEgressBytesTransferred *int64 + + // READ-ONLY; Total of the Ingress Bytes Transferred in this P2S Vpn connection. + TotalIngressBytesTransferred *int64 +} + +// VPNClientConnectionHealthDetail - VPN client connection health detail. +type VPNClientConnectionHealthDetail struct { + // READ-ONLY; The egress bytes per second. + EgressBytesTransferred *int64 + + // READ-ONLY; The egress packets per second. + EgressPacketsTransferred *int64 + + // READ-ONLY; The ingress bytes per second. + IngressBytesTransferred *int64 + + // READ-ONLY; The ingress packets per second. + IngressPacketsTransferred *int64 + + // READ-ONLY; The max band width. + MaxBandwidth *int64 + + // READ-ONLY; The max packets transferred per second. + MaxPacketsPerSecond *int64 + + // READ-ONLY; The assigned private Ip of a connected vpn client. + PrivateIPAddress *string + + // READ-ONLY; The public Ip of a connected vpn client. + PublicIPAddress *string + + // READ-ONLY; The duration time of a connected vpn client. + VPNConnectionDuration *int64 + + // READ-ONLY; The vpn client Id. + VPNConnectionID *string + + // READ-ONLY; The start time of a connected vpn client. + VPNConnectionTime *string + + // READ-ONLY; The user name of a connected vpn client. + VPNUserName *string +} + +// VPNClientConnectionHealthDetailListResult - List of virtual network gateway vpn client connection health. +type VPNClientConnectionHealthDetailListResult struct { + // List of vpn client connection health. + Value []*VPNClientConnectionHealthDetail +} + +// 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 + + // REQUIRED; The IPSec encryption algorithm (IKE phase 1). + IPSecEncryption *IPSecEncryption + + // REQUIRED; The IPSec integrity algorithm (IKE phase 1). + IPSecIntegrity *IPSecIntegrity + + // REQUIRED; The IKE encryption algorithm (IKE phase 2). + IkeEncryption *IkeEncryption + + // REQUIRED; The IKE integrity algorithm (IKE phase 2). + IkeIntegrity *IkeIntegrity + + // REQUIRED; The Pfs Group used in IKE Phase 2 for new child SA. + PfsGroup *PfsGroup + + // REQUIRED; The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for P2S client.. + SaDataSizeKilobytes *int32 + + // REQUIRED; The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for P2S client. + SaLifeTimeSeconds *int32 +} + +// VPNClientParameters - Vpn Client Parameters for package generation. +type VPNClientParameters struct { + // VPN client authentication method. + AuthenticationMethod *AuthenticationMethod + + // 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 + + // VPN client Processor Architecture. + ProcessorArchitecture *ProcessorArchitecture + + // 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 +} + +// VPNClientRevokedCertificate - VPN client revoked certificate of virtual network gateway. +type VPNClientRevokedCertificate struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the vpn client revoked certificate. + Properties *VPNClientRevokedCertificatePropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// VPNClientRevokedCertificatePropertiesFormat - Properties of the revoked VPN client certificate of virtual network gateway. +type VPNClientRevokedCertificatePropertiesFormat struct { + // The revoked VPN client certificate thumbprint. + Thumbprint *string + + // READ-ONLY; The provisioning state of the VPN client revoked certificate resource. + ProvisioningState *ProvisioningState +} + +// VPNClientRootCertificate - VPN client root certificate of virtual network gateway. +type VPNClientRootCertificate struct { + // REQUIRED; Properties of the vpn client root certificate. + Properties *VPNClientRootCertificatePropertiesFormat + + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// VPNClientRootCertificatePropertiesFormat - Properties of SSL certificates of application gateway. +type VPNClientRootCertificatePropertiesFormat struct { + // REQUIRED; The certificate public data. + PublicCertData *string + + // READ-ONLY; The provisioning state of the VPN client root certificate resource. + ProvisioningState *ProvisioningState +} + +// VPNConnection - VpnConnection Resource. +type VPNConnection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the VPN connection. + Properties *VPNConnectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// 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 + + // List of site link connection names. + LinkConnectionNames []*string +} + +// 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 + + // SAS url for packet capture on vpn connection. + SasURL *string +} + +// VPNConnectionProperties - Parameters for VpnConnection. +type VPNConnectionProperties struct { + // Expected bandwidth in MBPS. + ConnectionBandwidth *int32 + + // DPD timeout in seconds for vpn connection. + DpdTimeoutSeconds *int32 + + // EnableBgp flag. + EnableBgp *bool + + // Enable internet security. + EnableInternetSecurity *bool + + // EnableBgp flag. + EnableRateLimiting *bool + + // The IPSec Policies to be considered by this connection. + IPSecPolicies []*IPSecPolicy + + // Id of the connected vpn site. + RemoteVPNSite *SubResource + + // The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration + + // Routing weight for vpn connection. + RoutingWeight *int32 + + // SharedKey for the vpn connection. + SharedKey *string + + // The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies []*TrafficSelectorPolicy + + // Use local azure ip to initiate connection. + UseLocalAzureIPAddress *bool + + // Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool + + // Connection protocol used for this connection. + VPNConnectionProtocolType *VirtualNetworkGatewayConnectionProtocol + + // List of all vpn site link connections to the gateway. + VPNLinkConnections []*VPNSiteLinkConnection + + // READ-ONLY; The connection status. + ConnectionStatus *VPNConnectionStatus + + // READ-ONLY; Egress bytes transferred. + EgressBytesTransferred *int64 + + // READ-ONLY; Ingress bytes transferred. + IngressBytesTransferred *int64 + + // READ-ONLY; The provisioning state of the VPN connection resource. + ProvisioningState *ProvisioningState +} + +// VPNDeviceScriptParameters - Vpn device configuration script generation parameters. +type VPNDeviceScriptParameters struct { + // The device family for the vpn device. + DeviceFamily *string + + // The firmware version for the vpn device. + FirmwareVersion *string + + // The vendor for the vpn device. + Vendor *string +} + +// VPNGateway - VpnGateway Resource. +type VPNGateway struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the VPN gateway. + Properties *VPNGatewayProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VPNGatewayIPConfiguration - IP Configuration of a VPN Gateway Resource. +type VPNGatewayIPConfiguration struct { + // The identifier of the IP configuration for a VPN Gateway. + ID *string + + // The private IP address of this IP configuration. + PrivateIPAddress *string + + // The public IP address of this IP configuration. + PublicIPAddress *string +} + +// VPNGatewayNatRule - VpnGatewayNatRule Resource. +type VPNGatewayNatRule struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the VpnGateway NAT rule. + Properties *VPNGatewayNatRuleProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource type. + Type *string +} + +// VPNGatewayNatRuleProperties - Parameters for VpnGatewayNatRule. +type VPNGatewayNatRuleProperties struct { + // The private IP address external mapping for NAT. + ExternalMappings []*VPNNatRuleMapping + + // The IP Configuration ID this NAT rule applies to. + IPConfigurationID *string + + // The private IP address internal mapping for NAT. + InternalMappings []*VPNNatRuleMapping + + // The Source NAT direction of a VPN NAT. + Mode *VPNNatRuleMode + + // The type of NAT rule for VPN NAT. + Type *VPNNatRuleType + + // READ-ONLY; List of egress VpnSiteLinkConnections. + EgressVPNSiteLinkConnections []*SubResource + + // READ-ONLY; List of ingress VpnSiteLinkConnections. + IngressVPNSiteLinkConnections []*SubResource + + // READ-ONLY; The provisioning state of the NAT Rule resource. + ProvisioningState *ProvisioningState +} + +// VPNGatewayPacketCaptureStartParameters - Start packet capture parameters. +type VPNGatewayPacketCaptureStartParameters struct { + // Start Packet capture parameters on vpn gateway. + FilterData *string +} + +// VPNGatewayPacketCaptureStopParameters - Stop packet capture parameters. +type VPNGatewayPacketCaptureStopParameters struct { + // SAS url for packet capture on vpn gateway. + SasURL *string +} + +// VPNGatewayProperties - Parameters for VpnGateway. +type VPNGatewayProperties struct { + // Local network gateway's BGP speaker settings. + BgpSettings *BgpSettings + + // List of all vpn connections to the gateway. + Connections []*VPNConnection + + // Enable BGP routes translation for NAT on this VpnGateway. + EnableBgpRouteTranslationForNat *bool + + // Enable Routing Preference property for the Public IP Interface of the VpnGateway. + IsRoutingPreferenceInternet *bool + + // List of all the nat Rules associated with the gateway. + NatRules []*VPNGatewayNatRule + + // The scale unit for this vpn gateway. + VPNGatewayScaleUnit *int32 + + // The VirtualHub to which the gateway belongs. + VirtualHub *SubResource + + // READ-ONLY; List of all IPs configured on the gateway. + IPConfigurations []*VPNGatewayIPConfiguration + + // READ-ONLY; The provisioning state of the VPN gateway resource. + ProvisioningState *ProvisioningState +} + +// VPNLinkBgpSettings - BGP settings details for a link. +type VPNLinkBgpSettings struct { + // The BGP speaker's ASN. + Asn *int64 + + // The BGP peering address and BGP identifier of this BGP speaker. + BgpPeeringAddress *string +} + +// VPNLinkProviderProperties - List of properties of a link provider. +type VPNLinkProviderProperties struct { + // Name of the link provider. + LinkProviderName *string + + // Link speed. + LinkSpeedInMbps *int32 +} + +// VPNNatRuleMapping - Vpn NatRule mapping. +type VPNNatRuleMapping struct { + // Address space for Vpn NatRule mapping. + AddressSpace *string + + // Port range for Vpn NatRule mapping. + PortRange *string +} + +// VPNPacketCaptureStartParameters - Start packet capture parameters on virtual network gateway. +type VPNPacketCaptureStartParameters struct { + // Start Packet capture parameters. + FilterData *string +} + +// VPNPacketCaptureStopParameters - Stop packet capture parameters. +type VPNPacketCaptureStopParameters struct { + // SAS url for packet capture on virtual network gateway. + SasURL *string +} + +// VPNProfileResponse - Vpn Profile Response for package generation. +type VPNProfileResponse struct { + // URL to the VPN profile. + ProfileURL *string +} + +// VPNServerConfigRadiusClientRootCertificate - Properties of the Radius client root certificate of VpnServerConfiguration. +type VPNServerConfigRadiusClientRootCertificate struct { + // The certificate name. + Name *string + + // The Radius client root certificate thumbprint. + Thumbprint *string +} + +// VPNServerConfigRadiusServerRootCertificate - Properties of Radius Server root certificate of VpnServerConfiguration. +type VPNServerConfigRadiusServerRootCertificate struct { + // The certificate name. + Name *string + + // The certificate public data. + PublicCertData *string +} + +// VPNServerConfigVPNClientRevokedCertificate - Properties of the revoked VPN client certificate of VpnServerConfiguration. +type VPNServerConfigVPNClientRevokedCertificate struct { + // The certificate name. + Name *string + + // The revoked VPN client certificate thumbprint. + Thumbprint *string +} + +// VPNServerConfigVPNClientRootCertificate - Properties of VPN client root certificate of VpnServerConfiguration. +type VPNServerConfigVPNClientRootCertificate struct { + // The certificate name. + Name *string + + // The certificate public data. + PublicCertData *string +} + +// VPNServerConfiguration - VpnServerConfiguration Resource. +type VPNServerConfiguration struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the P2SVpnServer configuration. + Properties *VPNServerConfigurationProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VPNServerConfigurationPolicyGroup - VpnServerConfigurationPolicyGroup Resource. +type VPNServerConfigurationPolicyGroup struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the VpnServerConfigurationPolicyGroup. + Properties *VPNServerConfigurationPolicyGroupProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource type. + Type *string +} + +// VPNServerConfigurationPolicyGroupMember - VpnServerConfiguration PolicyGroup member +type VPNServerConfigurationPolicyGroupMember struct { + // The Vpn Policy member attribute type. + AttributeType *VPNPolicyMemberAttributeType + + // The value of Attribute used for this VpnServerConfigurationPolicyGroupMember. + AttributeValue *string + + // Name of the VpnServerConfigurationPolicyGroupMember. + Name *string +} + +// VPNServerConfigurationPolicyGroupProperties - Parameters for VpnServerConfigurationPolicyGroup. +type VPNServerConfigurationPolicyGroupProperties struct { + // Shows if this is a Default VpnServerConfigurationPolicyGroup or not. + IsDefault *bool + + // Multiple PolicyMembers for VpnServerConfigurationPolicyGroup. + PolicyMembers []*VPNServerConfigurationPolicyGroupMember + + // Priority for VpnServerConfigurationPolicyGroup. + Priority *int32 + + // READ-ONLY; List of references to P2SConnectionConfigurations. + P2SConnectionConfigurations []*SubResource + + // READ-ONLY; The provisioning state of the VpnServerConfigurationPolicyGroup resource. + ProvisioningState *ProvisioningState +} + +// VPNServerConfigurationProperties - Parameters for VpnServerConfiguration. +type VPNServerConfigurationProperties struct { + // The set of aad vpn authentication parameters. + AADAuthenticationParameters *AADAuthenticationParameters + + // List of all VpnServerConfigurationPolicyGroups. + ConfigurationPolicyGroups []*VPNServerConfigurationPolicyGroup + + // The name of the VpnServerConfiguration that is unique within a resource group. + Name *string + + // Radius client root certificate of VpnServerConfiguration. + RadiusClientRootCertificates []*VPNServerConfigRadiusClientRootCertificate + + // The radius server address property of the VpnServerConfiguration resource for point to site client connection. + RadiusServerAddress *string + + // Radius Server root certificate of VpnServerConfiguration. + RadiusServerRootCertificates []*VPNServerConfigRadiusServerRootCertificate + + // The radius secret property of the VpnServerConfiguration resource for point to site client connection. + RadiusServerSecret *string + + // Multiple Radius Server configuration for VpnServerConfiguration. + RadiusServers []*RadiusServer + + // VPN authentication types for the VpnServerConfiguration. + VPNAuthenticationTypes []*VPNAuthenticationType + + // VpnClientIpsecPolicies for VpnServerConfiguration. + VPNClientIPSecPolicies []*IPSecPolicy + + // VPN client revoked certificate of VpnServerConfiguration. + VPNClientRevokedCertificates []*VPNServerConfigVPNClientRevokedCertificate + + // VPN client root certificate of VpnServerConfiguration. + VPNClientRootCertificates []*VPNServerConfigVPNClientRootCertificate + + // VPN protocols for the VpnServerConfiguration. + VPNProtocols []*VPNGatewayTunnelingProtocol + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; List of references to P2SVpnGateways. + P2SVPNGateways []*P2SVPNGateway + + // READ-ONLY; The provisioning state of the VpnServerConfiguration resource. Possible values are: 'Updating', 'Deleting', + // and 'Failed'. + ProvisioningState *string +} + +// VPNServerConfigurationsResponse - VpnServerConfigurations list associated with VirtualWan Response. +type VPNServerConfigurationsResponse struct { + // List of VpnServerConfigurations associated with VirtualWan. + VPNServerConfigurationResourceIDs []*string +} + +// VPNSite - VpnSite Resource. +type VPNSite struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the VPN site. + Properties *VPNSiteProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VPNSiteID - VpnSite Resource. +type VPNSiteID struct { + // READ-ONLY; The resource-uri of the vpn-site for which config is to be fetched. + VPNSite *string +} + +// VPNSiteLink - VpnSiteLink Resource. +type VPNSiteLink struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the VPN site link. + Properties *VPNSiteLinkProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource type. + Type *string +} + +// VPNSiteLinkConnection - VpnSiteLinkConnection Resource. +type VPNSiteLinkConnection struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the VPN site link connection. + Properties *VPNSiteLinkConnectionProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource type. + Type *string +} + +// VPNSiteLinkConnectionProperties - Parameters for VpnConnection. +type VPNSiteLinkConnectionProperties struct { + // Expected bandwidth in MBPS. + ConnectionBandwidth *int32 + + // List of egress NatRules. + EgressNatRules []*SubResource + + // EnableBgp flag. + EnableBgp *bool + + // EnableBgp flag. + EnableRateLimiting *bool + + // The IPSec Policies to be considered by this connection. + IPSecPolicies []*IPSecPolicy + + // List of ingress NatRules. + IngressNatRules []*SubResource + + // Routing weight for vpn connection. + RoutingWeight *int32 + + // SharedKey for the vpn connection. + SharedKey *string + + // Use local azure ip to initiate connection. + UseLocalAzureIPAddress *bool + + // Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool + + // Connection protocol used for this connection. + VPNConnectionProtocolType *VirtualNetworkGatewayConnectionProtocol + + // vpnGatewayCustomBgpAddresses used by this connection. + VPNGatewayCustomBgpAddresses []*GatewayCustomBgpIPAddressIPConfiguration + + // Vpn link connection mode. + VPNLinkConnectionMode *VPNLinkConnectionMode + + // Id of the connected vpn site link. + VPNSiteLink *SubResource + + // READ-ONLY; The connection status. + ConnectionStatus *VPNConnectionStatus + + // READ-ONLY; Egress bytes transferred. + EgressBytesTransferred *int64 + + // READ-ONLY; Ingress bytes transferred. + IngressBytesTransferred *int64 + + // READ-ONLY; The provisioning state of the VPN site link connection resource. + ProvisioningState *ProvisioningState +} + +// VPNSiteLinkProperties - Parameters for VpnSite. +type VPNSiteLinkProperties struct { + // The set of bgp properties. + BgpProperties *VPNLinkBgpSettings + + // FQDN of vpn-site-link. + Fqdn *string + + // The ip-address for the vpn-site-link. + IPAddress *string + + // The link provider properties. + LinkProperties *VPNLinkProviderProperties + + // READ-ONLY; The provisioning state of the VPN site link resource. + ProvisioningState *ProvisioningState +} + +// VPNSiteProperties - Parameters for VpnSite. +type VPNSiteProperties struct { + // The AddressSpace that contains an array of IP address ranges. + AddressSpace *AddressSpace + + // The set of bgp properties. + BgpProperties *BgpSettings + + // The device properties. + DeviceProperties *DeviceProperties + + // The ip-address for the vpn-site. + IPAddress *string + + // IsSecuritySite flag. + IsSecuritySite *bool + + // Office365 Policy. + O365Policy *O365PolicyProperties + + // The key for vpn-site that can be used for connections. + SiteKey *string + + // List of all vpn site links. + VPNSiteLinks []*VPNSiteLink + + // The VirtualWAN to which the vpnSite belongs. + VirtualWan *SubResource + + // READ-ONLY; The provisioning state of the VPN site resource. + ProvisioningState *ProvisioningState +} + +// 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 + + // REQUIRED; The local IP address. Acceptable values are valid IPv4 addresses. + LocalIPAddress *string + + // 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 + + // REQUIRED; Protocol to be verified on. + Protocol *IPFlowProtocol + + // REQUIRED; The remote IP address. Acceptable values are valid IPv4 addresses. + RemoteIPAddress *string + + // 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 + + // REQUIRED; The ID of the target resource to perform next-hop on. + TargetResourceID *string + + // 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 +} + +// VerificationIPFlowResult - Results of IP flow verification on the target resource. +type VerificationIPFlowResult struct { + // Indicates whether the traffic is allowed or denied. + Access *Access + + // Name of the rule. If input is not matched against any security rule, it is not displayed. + RuleName *string +} + +// VirtualAppliance - NetworkVirtualAppliance Resource. +type VirtualAppliance struct { + // Resource ID. + ID *string + + // The service principal that has read access to cloud-init and config blob. + Identity *ManagedServiceIdentity + + // Resource location. + Location *string + + // Properties of the Network Virtual Appliance. + Properties *VirtualAppliancePropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VirtualApplianceAdditionalNicProperties - Network Virtual Appliance Additional NIC properties. +type VirtualApplianceAdditionalNicProperties struct { + // Flag (true or false) for Intent for Public Ip on additional nic + HasPublicIP *bool + + // Name of additional nic + Name *string +} + +// VirtualApplianceConnection - NetworkVirtualApplianceConnection resource. +type VirtualApplianceConnection struct { + // Resource ID. + ID *string + + // The name of the resource. + Name *string + + // Properties of the express route connection. + Properties *VirtualApplianceConnectionProperties +} + +// VirtualApplianceConnectionList - NetworkVirtualApplianceConnection list. +type VirtualApplianceConnectionList struct { + // URL to get the next set of results. + NextLink *string + + // The list of NetworkVirtualAppliance connections. + Value []*VirtualApplianceConnection +} + +// VirtualApplianceConnectionProperties - Properties of the NetworkVirtualApplianceConnection subresource. +type VirtualApplianceConnectionProperties struct { + // Network Virtual Appliance ASN. + Asn *int64 + + // List of bgpPeerAddresses for the NVA instances + BgpPeerAddress []*string + + // Enable internet security. + EnableInternetSecurity *bool + + // The name of the resource. + Name *string + + // The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfigurationNfv + + // Unique identifier for the connection. + TunnelIdentifier *int64 + + // READ-ONLY; The provisioning state of the NetworkVirtualApplianceConnection resource. + ProvisioningState *ProvisioningState +} + +// VirtualApplianceListResult - Response for ListNetworkVirtualAppliances API service call. +type VirtualApplianceListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Network Virtual Appliances. + Value []*VirtualAppliance +} + +// VirtualApplianceNicProperties - Network Virtual Appliance NIC properties. +type VirtualApplianceNicProperties struct { + // READ-ONLY; Instance on which nic is attached. + InstanceName *string + + // READ-ONLY; NIC name. + Name *string + + // READ-ONLY; Private IP address. + PrivateIPAddress *string + + // READ-ONLY; Public IP address. + PublicIPAddress *string +} + +// VirtualAppliancePropertiesFormat - Network Virtual Appliance definition. +type VirtualAppliancePropertiesFormat struct { + // Details required for Additional Network Interface. + AdditionalNics []*VirtualApplianceAdditionalNicProperties + + // BootStrapConfigurationBlobs storage URLs. + BootStrapConfigurationBlobs []*string + + // CloudInitConfiguration string in plain text. + CloudInitConfiguration *string + + // CloudInitConfigurationBlob storage URLs. + CloudInitConfigurationBlobs []*string + + // The delegation for the Virtual Appliance + Delegation *DelegationProperties + + // Network Virtual Appliance SKU. + NvaSKU *VirtualApplianceSKUProperties + + // The delegation for the Virtual Appliance + PartnerManagedResource *PartnerManagedResourceProperties + + // Public key for SSH login. + SSHPublicKey *string + + // VirtualAppliance ASN. Microsoft private, public and IANA reserved ASN are not supported. + VirtualApplianceAsn *int64 + + // The Virtual Hub where Network Virtual Appliance is being deployed. + VirtualHub *SubResource + + // READ-ONLY; Address Prefix. + AddressPrefix *string + + // READ-ONLY; The deployment type. PartnerManaged for the SaaS NVA + DeploymentType *string + + // READ-ONLY; List of references to InboundSecurityRules. + InboundSecurityRules []*SubResource + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; List of references to VirtualApplianceConnections. + VirtualApplianceConnections []*SubResource + + // READ-ONLY; List of Virtual Appliance Network Interfaces. + VirtualApplianceNics []*VirtualApplianceNicProperties + + // READ-ONLY; List of references to VirtualApplianceSite. + VirtualApplianceSites []*SubResource +} + +// VirtualApplianceSKU - Definition of the NetworkVirtualApplianceSkus resource. +type VirtualApplianceSKU struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // NetworkVirtualApplianceSku properties. + Properties *VirtualApplianceSKUPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VirtualApplianceSKUInstances - List of available Sku and instances. +type VirtualApplianceSKUInstances struct { + // READ-ONLY; Instance Count. + InstanceCount *int32 + + // READ-ONLY; Scale Unit. + ScaleUnit *string +} + +// VirtualApplianceSKUListResult - Response for ListNetworkVirtualApplianceSkus API service call. +type VirtualApplianceSKUListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Network Virtual Appliance Skus that are available. + Value []*VirtualApplianceSKU +} + +// VirtualApplianceSKUProperties - Network Virtual Appliance Sku Properties. +type VirtualApplianceSKUProperties struct { + // Virtual Appliance Scale Unit. + BundledScaleUnit *string + + // Virtual Appliance Version. + MarketPlaceVersion *string + + // Virtual Appliance Vendor. + Vendor *string +} + +// VirtualApplianceSKUPropertiesFormat - Properties specific to NetworkVirtualApplianceSkus. +type VirtualApplianceSKUPropertiesFormat struct { + // The list of scale units available. + AvailableScaleUnits []*VirtualApplianceSKUInstances + + // READ-ONLY; Available Network Virtual Appliance versions. + AvailableVersions []*string + + // READ-ONLY; Network Virtual Appliance Sku vendor. + Vendor *string +} + +// VirtualApplianceSite - Virtual Appliance Site resource. +type VirtualApplianceSite struct { + // Resource ID. + ID *string + + // Name of the virtual appliance site. + Name *string + + // The properties of the Virtual Appliance Sites. + Properties *VirtualApplianceSiteProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Site type. + Type *string +} + +// VirtualApplianceSiteListResult - Response for ListNetworkVirtualApplianceSites API service call. +type VirtualApplianceSiteListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Network Virtual Appliance sites. + Value []*VirtualApplianceSite +} + +// VirtualApplianceSiteProperties - Properties of the rule group. +type VirtualApplianceSiteProperties struct { + // Address Prefix. + AddressPrefix *string + + // Office 365 Policy. + O365Policy *Office365PolicyProperties + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// VirtualHub Resource. +type VirtualHub struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the virtual hub. + Properties *VirtualHubProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Kind of service virtual hub. This is metadata used for the Azure portal experience for Route Server. + Kind *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VirtualHubEffectiveRoute - The effective route configured on the virtual hub or specified resource. +type VirtualHubEffectiveRoute struct { + // The list of address prefixes. + AddressPrefixes []*string + + // The ASPath of this route. + AsPath *string + + // The type of the next hop. + NextHopType *string + + // The list of next hops. + NextHops []*string + + // The origin of this route. + RouteOrigin *string +} + +// VirtualHubEffectiveRouteList - EffectiveRoutes List. +type VirtualHubEffectiveRouteList struct { + // The list of effective routes configured on the virtual hub or the specified resource. + Value []*VirtualHubEffectiveRoute +} + +// 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 +} + +// VirtualHubProperties - Parameters for VirtualHub. +type VirtualHubProperties struct { + // Address-prefix for this VirtualHub. + AddressPrefix *string + + // Flag to control transit for VirtualRouter hub. + AllowBranchToBranchTraffic *bool + + // The azureFirewall associated with this VirtualHub. + AzureFirewall *SubResource + + // The expressRouteGateway associated with this VirtualHub. + ExpressRouteGateway *SubResource + + // The hubRoutingPreference of this VirtualHub. + HubRoutingPreference *HubRoutingPreference + + // The P2SVpnGateway associated with this VirtualHub. + P2SVPNGateway *SubResource + + // The preferred gateway to route on-prem traffic + PreferredRoutingGateway *PreferredRoutingGateway + + // The routeTable associated with this virtual hub. + RouteTable *VirtualHubRouteTable + + // The sku of this VirtualHub. + SKU *string + + // The securityPartnerProvider associated with this VirtualHub. + SecurityPartnerProvider *SubResource + + // The Security Provider name. + SecurityProviderName *string + + // The VpnGateway associated with this VirtualHub. + VPNGateway *SubResource + + // List of all virtual hub route table v2s associated with this VirtualHub. + VirtualHubRouteTableV2S []*VirtualHubRouteTableV2 + + // VirtualRouter ASN. + VirtualRouterAsn *int64 + + // The VirtualHub Router autoscale configuration. + VirtualRouterAutoScaleConfiguration *VirtualRouterAutoScaleConfiguration + + // VirtualRouter IPs. + VirtualRouterIPs []*string + + // The VirtualWAN to which the VirtualHub belongs. + VirtualWan *SubResource + + // READ-ONLY; List of references to Bgp Connections. + BgpConnections []*SubResource + + // READ-ONLY; List of references to IpConfigurations. + IPConfigurations []*SubResource + + // READ-ONLY; The provisioning state of the virtual hub resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; List of references to RouteMaps. + RouteMaps []*SubResource + + // READ-ONLY; The routing state. + RoutingState *RoutingState +} + +// VirtualHubRoute - VirtualHub route. +type VirtualHubRoute struct { + // List of all addressPrefixes. + AddressPrefixes []*string + + // NextHop ip address. + NextHopIPAddress *string +} + +// VirtualHubRouteTable - VirtualHub route table. +type VirtualHubRouteTable struct { + // List of all routes. + Routes []*VirtualHubRoute +} + +// VirtualHubRouteTableV2 Resource. +type VirtualHubRouteTableV2 struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the virtual hub route table v2. + Properties *VirtualHubRouteTableV2Properties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// VirtualHubRouteTableV2Properties - Parameters for VirtualHubRouteTableV2. +type VirtualHubRouteTableV2Properties struct { + // List of all connections attached to this route table v2. + AttachedConnections []*string + + // List of all routes. + Routes []*VirtualHubRouteV2 + + // READ-ONLY; The provisioning state of the virtual hub route table v2 resource. + ProvisioningState *ProvisioningState +} + +// VirtualHubRouteV2 - VirtualHubRouteTableV2 route. +type VirtualHubRouteV2 struct { + // The type of destinations. + DestinationType *string + + // List of all destinations. + Destinations []*string + + // The type of next hops. + NextHopType *string + + // NextHops ip address. + NextHops []*string +} + +// VirtualNetwork - Virtual Network resource. +type VirtualNetwork struct { + // The extended location of the virtual network. + ExtendedLocation *ExtendedLocation + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the virtual network. + Properties *VirtualNetworkPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// 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 + + // READ-ONLY; The BGP community associated with the region of the virtual network. + RegionalCommunity *string +} + +// VirtualNetworkConnectionGatewayReference - A reference to VirtualNetworkGateway or LocalNetworkGateway resource. +type VirtualNetworkConnectionGatewayReference struct { + // REQUIRED; The ID of VirtualNetworkGateway or LocalNetworkGateway resource. + ID *string +} + +// VirtualNetworkDdosProtectionStatusResult - Response for GetVirtualNetworkDdosProtectionStatusOperation. +type VirtualNetworkDdosProtectionStatusResult struct { + // The URL to get the next set of results. + NextLink *string + + // The Ddos Protection Status Result for each public ip under a virtual network. + Value []*PublicIPDdosProtectionStatusResult +} + +// 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 + + // If the encrypted VNet allows VM that does not support encryption + Enforcement *VirtualNetworkEncryptionEnforcement +} + +// VirtualNetworkGateway - A common class for general resource information. +type VirtualNetworkGateway struct { + // REQUIRED; Properties of the virtual network gateway. + Properties *VirtualNetworkGatewayPropertiesFormat + + // The extended location of type local virtual network gateway. + ExtendedLocation *ExtendedLocation + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +type VirtualNetworkGatewayAutoScaleBounds struct { + // Maximum Scale Units for Autoscale configuration + Max *int32 + + // Minimum scale Units for Autoscale configuration + Min *int32 +} + +// VirtualNetworkGatewayAutoScaleConfiguration - Virtual Network Gateway Autoscale Configuration details +type VirtualNetworkGatewayAutoScaleConfiguration struct { + // The bounds of the autoscale configuration + Bounds *VirtualNetworkGatewayAutoScaleBounds +} + +// VirtualNetworkGatewayConnection - A common class for general resource information. +type VirtualNetworkGatewayConnection struct { + // REQUIRED; Properties of the virtual network gateway connection. + Properties *VirtualNetworkGatewayConnectionPropertiesFormat + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VirtualNetworkGatewayConnectionListEntity - A common class for general resource information. +type VirtualNetworkGatewayConnectionListEntity struct { + // REQUIRED; Properties of the virtual network gateway connection. + Properties *VirtualNetworkGatewayConnectionListEntityPropertiesFormat + + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VirtualNetworkGatewayConnectionListEntityPropertiesFormat - VirtualNetworkGatewayConnection properties. +type VirtualNetworkGatewayConnectionListEntityPropertiesFormat struct { + // REQUIRED; Gateway connection type. + ConnectionType *VirtualNetworkGatewayConnectionType + + // REQUIRED; The reference to virtual network gateway resource. + VirtualNetworkGateway1 *VirtualNetworkConnectionGatewayReference + + // The authorizationKey. + AuthorizationKey *string + + // The connection mode for this connection. + ConnectionMode *VirtualNetworkGatewayConnectionMode + + // Connection protocol used for this connection. + ConnectionProtocol *VirtualNetworkGatewayConnectionProtocol + + // EnableBgp flag. + EnableBgp *bool + + // Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be + // enabled. + EnablePrivateLinkFastPath *bool + + // Bypass ExpressRoute Gateway for data forwarding. + ExpressRouteGatewayBypass *bool + + // GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. + GatewayCustomBgpIPAddresses []*GatewayCustomBgpIPAddressIPConfiguration + + // The IPSec Policies to be considered by this connection. + IPSecPolicies []*IPSecPolicy + + // The reference to local network gateway resource. + LocalNetworkGateway2 *VirtualNetworkConnectionGatewayReference + + // The reference to peerings resource. + Peer *SubResource + + // The routing weight. + RoutingWeight *int32 + + // The IPSec shared key. + SharedKey *string + + // The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies []*TrafficSelectorPolicy + + // Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool + + // The reference to virtual network gateway resource. + VirtualNetworkGateway2 *VirtualNetworkConnectionGatewayReference + + // READ-ONLY; Virtual Network Gateway connection status. + ConnectionStatus *VirtualNetworkGatewayConnectionStatus + + // READ-ONLY; The egress bytes transferred in this connection. + EgressBytesTransferred *int64 + + // READ-ONLY; The ingress bytes transferred in this connection. + IngressBytesTransferred *int64 + + // READ-ONLY; The provisioning state of the virtual network gateway connection resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the virtual network gateway connection resource. + ResourceGUID *string + + // READ-ONLY; Collection of all tunnels' connection health status. + TunnelConnectionStatus []*TunnelConnectionHealth +} + +// VirtualNetworkGatewayConnectionListResult - Response for the ListVirtualNetworkGatewayConnections API service call. +type VirtualNetworkGatewayConnectionListResult struct { + // A list of VirtualNetworkGatewayConnection resources that exists in a resource group. + Value []*VirtualNetworkGatewayConnection + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// VirtualNetworkGatewayConnectionPropertiesFormat - VirtualNetworkGatewayConnection properties. +type VirtualNetworkGatewayConnectionPropertiesFormat struct { + // REQUIRED; Gateway connection type. + ConnectionType *VirtualNetworkGatewayConnectionType + + // REQUIRED; The reference to virtual network gateway resource. + VirtualNetworkGateway1 *VirtualNetworkGateway + + // The authorizationKey. + AuthorizationKey *string + + // The connection mode for this connection. + ConnectionMode *VirtualNetworkGatewayConnectionMode + + // Connection protocol used for this connection. + ConnectionProtocol *VirtualNetworkGatewayConnectionProtocol + + // The dead peer detection timeout of this connection in seconds. + DpdTimeoutSeconds *int32 + + // List of egress NatRules. + EgressNatRules []*SubResource + + // EnableBgp flag. + EnableBgp *bool + + // Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be + // enabled. + EnablePrivateLinkFastPath *bool + + // Bypass ExpressRoute Gateway for data forwarding. + ExpressRouteGatewayBypass *bool + + // GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. + GatewayCustomBgpIPAddresses []*GatewayCustomBgpIPAddressIPConfiguration + + // The IPSec Policies to be considered by this connection. + IPSecPolicies []*IPSecPolicy + + // List of ingress NatRules. + IngressNatRules []*SubResource + + // The reference to local network gateway resource. + LocalNetworkGateway2 *LocalNetworkGateway + + // The reference to peerings resource. + Peer *SubResource + + // The routing weight. + RoutingWeight *int32 + + // The IPSec shared key. + SharedKey *string + + // The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies []*TrafficSelectorPolicy + + // Use private local Azure IP for the connection. + UseLocalAzureIPAddress *bool + + // Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool + + // The reference to virtual network gateway resource. + VirtualNetworkGateway2 *VirtualNetworkGateway + + // READ-ONLY; Virtual Network Gateway connection status. + ConnectionStatus *VirtualNetworkGatewayConnectionStatus + + // READ-ONLY; The egress bytes transferred in this connection. + EgressBytesTransferred *int64 + + // READ-ONLY; The ingress bytes transferred in this connection. + IngressBytesTransferred *int64 + + // READ-ONLY; The provisioning state of the virtual network gateway connection resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the virtual network gateway connection resource. + ResourceGUID *string + + // READ-ONLY; Collection of all tunnels' connection health status. + TunnelConnectionStatus []*TunnelConnectionHealth +} + +// VirtualNetworkGatewayIPConfiguration - IP configuration for virtual network gateway. +type VirtualNetworkGatewayIPConfiguration struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the virtual network gateway ip configuration. + Properties *VirtualNetworkGatewayIPConfigurationPropertiesFormat + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// VirtualNetworkGatewayIPConfigurationPropertiesFormat - Properties of VirtualNetworkGatewayIPConfiguration. +type VirtualNetworkGatewayIPConfigurationPropertiesFormat struct { + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod + + // The reference to the public IP resource. + PublicIPAddress *SubResource + + // The reference to the subnet resource. + Subnet *SubResource + + // READ-ONLY; Private IP Address for this gateway. + PrivateIPAddress *string + + // READ-ONLY; The provisioning state of the virtual network gateway IP configuration resource. + ProvisioningState *ProvisioningState +} + +// VirtualNetworkGatewayListConnectionsResult - Response for the VirtualNetworkGatewayListConnections API service call. +type VirtualNetworkGatewayListConnectionsResult struct { + // A list of VirtualNetworkGatewayConnection resources that exists in a resource group. + Value []*VirtualNetworkGatewayConnectionListEntity + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// VirtualNetworkGatewayListResult - Response for the ListVirtualNetworkGateways API service call. +type VirtualNetworkGatewayListResult struct { + // A list of VirtualNetworkGateway resources that exists in a resource group. + Value []*VirtualNetworkGateway + + // READ-ONLY; The URL to get the next set of results. + NextLink *string +} + +// VirtualNetworkGatewayNatRule Resource. +type VirtualNetworkGatewayNatRule struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the Virtual Network Gateway NAT rule. + Properties *VirtualNetworkGatewayNatRuleProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource type. + Type *string +} + +// VirtualNetworkGatewayNatRuleProperties - Parameters for VirtualNetworkGatewayNatRule. +type VirtualNetworkGatewayNatRuleProperties struct { + // The private IP address external mapping for NAT. + ExternalMappings []*VPNNatRuleMapping + + // The IP Configuration ID this NAT rule applies to. + IPConfigurationID *string + + // The private IP address internal mapping for NAT. + InternalMappings []*VPNNatRuleMapping + + // The Source NAT direction of a VPN NAT. + Mode *VPNNatRuleMode + + // The type of NAT rule for VPN NAT. + Type *VPNNatRuleType + + // READ-ONLY; The provisioning state of the NAT Rule resource. + ProvisioningState *ProvisioningState +} + +// VirtualNetworkGatewayPolicyGroup - Parameters for VirtualNetworkGatewayPolicyGroup. +type VirtualNetworkGatewayPolicyGroup struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of tVirtualNetworkGatewayPolicyGroup. + Properties *VirtualNetworkGatewayPolicyGroupProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// VirtualNetworkGatewayPolicyGroupMember - Vpn Client Connection configuration PolicyGroup member +type VirtualNetworkGatewayPolicyGroupMember struct { + // The Vpn Policy member attribute type. + AttributeType *VPNPolicyMemberAttributeType + + // The value of Attribute used for this VirtualNetworkGatewayPolicyGroupMember. + AttributeValue *string + + // Name of the VirtualNetworkGatewayPolicyGroupMember. + Name *string +} + +// VirtualNetworkGatewayPolicyGroupProperties - Properties of VirtualNetworkGatewayPolicyGroup. +type VirtualNetworkGatewayPolicyGroupProperties struct { + // REQUIRED; Shows if this is a Default VirtualNetworkGatewayPolicyGroup or not. + IsDefault *bool + + // REQUIRED; Multiple PolicyMembers for VirtualNetworkGatewayPolicyGroup. + PolicyMembers []*VirtualNetworkGatewayPolicyGroupMember + + // REQUIRED; Priority for VirtualNetworkGatewayPolicyGroup. + Priority *int32 + + // READ-ONLY; The provisioning state of the VirtualNetworkGatewayPolicyGroup resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; List of references to vngClientConnectionConfigurations. + VngClientConnectionConfigurations []*SubResource +} + +// VirtualNetworkGatewayPropertiesFormat - VirtualNetworkGateway properties. +type VirtualNetworkGatewayPropertiesFormat struct { + // ActiveActive flag. + Active *bool + + // Property to indicate if the Express Route Gateway serves traffic when there are multiple Express Route Gateways in the + // vnet + AdminState *AdminState + + // Configure this gateway to accept traffic from other Azure Virtual Networks. This configuration does not support connectivity + // to Azure Virtual WAN. + AllowRemoteVnetTraffic *bool + + // Configures this gateway to accept traffic from remote Virtual WAN networks. + AllowVirtualWanTraffic *bool + + // Autoscale configuration for virutal network gateway + AutoScaleConfiguration *VirtualNetworkGatewayAutoScaleConfiguration + + // Virtual network gateway's BGP speaker settings. + BgpSettings *BgpSettings + + // 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 + + // disableIPSecReplayProtection flag. + DisableIPSecReplayProtection *bool + + // Whether BGP is enabled for this virtual network gateway or not. + EnableBgp *bool + + // EnableBgpRouteTranslationForNat flag. + EnableBgpRouteTranslationForNat *bool + + // Whether dns forwarding is enabled or not. + EnableDNSForwarding *bool + + // Whether private IP needs to be enabled on this gateway for connections or not. + EnablePrivateIPAddress *bool + + // 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 + + // The type of this virtual network gateway. + GatewayType *VirtualNetworkGatewayType + + // IP configurations for virtual network gateway. + IPConfigurations []*VirtualNetworkGatewayIPConfiguration + + // NatRules for virtual network gateway. + NatRules []*VirtualNetworkGatewayNatRule + + // The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway. + SKU *VirtualNetworkGatewaySKU + + // Customer vnet resource id. VirtualNetworkGateway of type local gateway is associated with the customer vnet. + VNetExtendedLocationResourceID *string + + // The reference to the VpnClientConfiguration resource which represents the P2S VpnClient configurations. + VPNClientConfiguration *VPNClientConfiguration + + // The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN. + VPNGatewayGeneration *VPNGatewayGeneration + + // The type of this virtual network gateway. + VPNType *VPNType + + // The reference to the VirtualNetworkGatewayPolicyGroup resource which represents the available VirtualNetworkGatewayPolicyGroup + // for the gateway. + VirtualNetworkGatewayPolicyGroups []*VirtualNetworkGatewayPolicyGroup + + // READ-ONLY; The IP address allocated by the gateway to which dns requests can be sent. + InboundDNSForwardingEndpoint *string + + // READ-ONLY; The provisioning state of the virtual network gateway resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the virtual network gateway resource. + ResourceGUID *string +} + +// VirtualNetworkGatewaySKU - VirtualNetworkGatewaySku details. +type VirtualNetworkGatewaySKU struct { + // Gateway SKU name. + Name *VirtualNetworkGatewaySKUName + + // Gateway SKU tier. + Tier *VirtualNetworkGatewaySKUTier + + // READ-ONLY; The capacity. + Capacity *int32 +} + +// VirtualNetworkListResult - Response for the ListVirtualNetworks API service call. +type VirtualNetworkListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of VirtualNetwork resources in a resource group. + Value []*VirtualNetwork +} + +// VirtualNetworkListUsageResult - Response for the virtual networks GetUsage API service call. +type VirtualNetworkListUsageResult struct { + // The URL to get the next set of results. + NextLink *string + + // READ-ONLY; VirtualNetwork usage stats. + Value []*VirtualNetworkUsage +} + +// VirtualNetworkPeering - Peerings in a virtual network resource. +type VirtualNetworkPeering struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the virtual network peering. + Properties *VirtualNetworkPeeringPropertiesFormat + + // Resource type. + Type *string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// 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 + + // The peerings in a virtual network. + Value []*VirtualNetworkPeering +} + +// 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 + + // If gateway links can be used in remote virtual networking to link to this virtual network. + AllowGatewayTransit *bool + + // Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. + AllowVirtualNetworkAccess *bool + + // If we need to verify the provisioning state of the remote gateway. + DoNotVerifyRemoteGateways *bool + + // The status of the virtual network peering. + PeeringState *VirtualNetworkPeeringState + + // The peering sync status of the virtual network peering. + PeeringSyncLevel *VirtualNetworkPeeringLevel + + // The reference to the address space peered with the remote virtual network. + RemoteAddressSpace *AddressSpace + + // The reference to the remote virtual network's Bgp Communities. + RemoteBgpCommunities *VirtualNetworkBgpCommunities + + // 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 + + // The reference to the current address space of the remote virtual network. + RemoteVirtualNetworkAddressSpace *AddressSpace + + // 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 + + // READ-ONLY; The provisioning state of the virtual network peering resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The reference to the remote virtual network's encryption + RemoteVirtualNetworkEncryption *VirtualNetworkEncryption + + // READ-ONLY; The resourceGuid property of the Virtual Network peering resource. + ResourceGUID *string +} + +// 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 + + // Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. + BgpCommunities *VirtualNetworkBgpCommunities + + // The DDoS protection plan associated with the virtual network. + DdosProtectionPlan *SubResource + + // The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual network. + DhcpOptions *DhcpOptions + + // 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 + + // Indicates if VM protection is enabled for all the subnets in the virtual network. + EnableVMProtection *bool + + // Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet. + Encryption *VirtualNetworkEncryption + + // The FlowTimeout value (in minutes) for the Virtual Network + FlowTimeoutInMinutes *int32 + + // Array of IpAllocation which reference this VNET. + IPAllocations []*SubResource + + // A list of subnets in a Virtual Network. + Subnets []*Subnet + + // A list of peerings in a Virtual Network. + VirtualNetworkPeerings []*VirtualNetworkPeering + + // READ-ONLY; A collection of references to flow log resources. + FlowLogs []*FlowLog + + // READ-ONLY; The provisioning state of the virtual network resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resourceGuid property of the Virtual Network resource. + ResourceGUID *string +} + +// VirtualNetworkTap - Virtual Network Tap resource. +type VirtualNetworkTap struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Virtual Network Tap Properties. + Properties *VirtualNetworkTapPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VirtualNetworkTapListResult - Response for ListVirtualNetworkTap API service call. +type VirtualNetworkTapListResult struct { + // The URL to get the next set of results. + NextLink *string + + // A list of VirtualNetworkTaps in a resource group. + Value []*VirtualNetworkTap +} + +// 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 + + // The reference to the private IP Address of the collector nic that will receive the tap. + DestinationNetworkInterfaceIPConfiguration *InterfaceIPConfiguration + + // The VXLAN destination port that will receive the tapped traffic. + DestinationPort *int32 + + // READ-ONLY; Specifies the list of resource IDs for the network interface IP configuration that needs to be tapped. + NetworkInterfaceTapConfigurations []*InterfaceTapConfiguration + + // READ-ONLY; The provisioning state of the virtual network tap resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The resource GUID property of the virtual network tap resource. + ResourceGUID *string +} + +// VirtualNetworkUsage - Usage details for subnet. +type VirtualNetworkUsage struct { + // READ-ONLY; Indicates number of IPs used from the Subnet. + CurrentValue *float64 + + // READ-ONLY; Subnet identifier. + ID *string + + // READ-ONLY; Indicates the size of the subnet. + Limit *float64 + + // READ-ONLY; The name containing common and localized value for usage. + Name *VirtualNetworkUsageName + + // READ-ONLY; Usage units. Returns 'Count'. + Unit *string +} + +// VirtualNetworkUsageName - Usage strings container. +type VirtualNetworkUsageName struct { + // READ-ONLY; Localized subnet size and usage string. + LocalizedValue *string + + // READ-ONLY; Subnet size and usage string. + Value *string +} + +// VirtualRouter Resource. +type VirtualRouter struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the Virtual Router. + Properties *VirtualRouterPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VirtualRouterAutoScaleConfiguration - The VirtualHub Router autoscale configuration. +type VirtualRouterAutoScaleConfiguration struct { + // The minimum number of scale units for VirtualHub Router. + MinCapacity *int32 +} + +// VirtualRouterListResult - Response for ListVirtualRouters API service call. +type VirtualRouterListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of Virtual Routers. + Value []*VirtualRouter +} + +// VirtualRouterPeering - Virtual Router Peering resource. +type VirtualRouterPeering struct { + // Resource ID. + ID *string + + // Name of the virtual router peering that is unique within a virtual router. + Name *string + + // The properties of the Virtual Router Peering. + Properties *VirtualRouterPeeringProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Peering type. + Type *string +} + +// VirtualRouterPeeringListResult - Response for ListVirtualRouterPeerings API service call. +type VirtualRouterPeeringListResult struct { + // URL to get the next set of results. + NextLink *string + + // List of VirtualRouterPeerings in a VirtualRouter. + Value []*VirtualRouterPeering +} + +// VirtualRouterPeeringProperties - Properties of the rule group. +type VirtualRouterPeeringProperties struct { + // Peer ASN. + PeerAsn *int64 + + // Peer IP. + PeerIP *string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// VirtualRouterPropertiesFormat - Virtual Router definition. +type VirtualRouterPropertiesFormat struct { + // The Gateway on which VirtualRouter is hosted. + HostedGateway *SubResource + + // The Subnet on which VirtualRouter is hosted. + HostedSubnet *SubResource + + // VirtualRouter ASN. + VirtualRouterAsn *int64 + + // VirtualRouter IPs. + VirtualRouterIPs []*string + + // READ-ONLY; List of references to VirtualRouterPeerings. + Peerings []*SubResource + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// VirtualWAN Resource. +type VirtualWAN struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the virtual WAN. + Properties *VirtualWanProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VirtualWanProperties - Parameters for VirtualWAN. +type VirtualWanProperties struct { + // True if branch to branch traffic is allowed. + AllowBranchToBranchTraffic *bool + + // True if Vnet to Vnet traffic is allowed. + AllowVnetToVnetTraffic *bool + + // Vpn encryption to be disabled or not. + DisableVPNEncryption *bool + + // The type of the VirtualWAN. + Type *string + + // READ-ONLY; The office local breakout category. + Office365LocalBreakoutCategory *OfficeTrafficCategory + + // READ-ONLY; The provisioning state of the virtual WAN resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; List of VpnSites in the VirtualWAN. + VPNSites []*SubResource + + // READ-ONLY; List of VirtualHubs in the VirtualWAN. + VirtualHubs []*SubResource +} + +// VirtualWanSecurityProvider - Collection of SecurityProviders. +type VirtualWanSecurityProvider struct { + // Name of the security provider. + Name *string + + // Url of the security provider. + URL *string + + // READ-ONLY; Name of the security provider. + Type *VirtualWanSecurityProviderType +} + +// VirtualWanSecurityProviders - Collection of SecurityProviders. +type VirtualWanSecurityProviders struct { + // List of VirtualWAN security providers. + SupportedProviders []*VirtualWanSecurityProvider +} + +// VirtualWanVPNProfileParameters - Virtual Wan Vpn profile parameters Vpn profile generation. +type VirtualWanVPNProfileParameters struct { + // VPN client authentication method. + AuthenticationMethod *AuthenticationMethod + + // VpnServerConfiguration partial resource uri with which VirtualWan is associated to. + VPNServerConfigurationResourceID *string +} + +// VnetRoute - List of routes that control routing from VirtualHub into a virtual network connection. +type VnetRoute struct { + // List of all Static Routes. + StaticRoutes []*StaticRoute + + // Configuration for static routes on this HubVnetConnection. + StaticRoutesConfig *StaticRoutesConfig + + // READ-ONLY; The list of references to HubBgpConnection objects. + BgpConnections []*SubResource +} + +// VngClientConnectionConfiguration - A vpn client connection configuration for client connection configuration. +type VngClientConnectionConfiguration struct { + // Resource ID. + ID *string + + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // Properties of the vpn client root certificate. + Properties *VngClientConnectionConfigurationProperties + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// VngClientConnectionConfigurationProperties - Properties of VngClientConnectionConfiguration. +type VngClientConnectionConfigurationProperties struct { + // REQUIRED; The reference to the address space resource which represents Address space for P2S VpnClient. + VPNClientAddressPool *AddressSpace + + // REQUIRED; List of references to virtualNetworkGatewayPolicyGroups + VirtualNetworkGatewayPolicyGroups []*SubResource + + // READ-ONLY; The provisioning state of the VngClientConnectionConfiguration resource. + ProvisioningState *ProvisioningState +} + +// Watcher - Network watcher in a resource group. +type Watcher struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the network watcher. + Properties *WatcherPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// WatcherListResult - Response for ListNetworkWatchers API service call. +type WatcherListResult struct { + // List of network watcher resources. + Value []*Watcher +} + +// WatcherPropertiesFormat - The network watcher properties. +type WatcherPropertiesFormat struct { + // READ-ONLY; The provisioning state of the network watcher resource. + ProvisioningState *ProvisioningState +} + +// WebApplicationFirewallCustomRule - Defines contents of a web application rule. +type WebApplicationFirewallCustomRule struct { + // REQUIRED; Type of Actions. + Action *WebApplicationFirewallAction + + // REQUIRED; List of match conditions. + MatchConditions []*MatchCondition + + // REQUIRED; Priority of the rule. Rules with a lower value will be evaluated before rules with a higher value. + Priority *int32 + + // REQUIRED; The rule type. + RuleType *WebApplicationFirewallRuleType + + // List of user session identifier group by clauses. + GroupByUserSession []*GroupByUserSession + + // The name of the resource that is unique within a policy. This name can be used to access the resource. + Name *string + + // Duration over which Rate Limit policy will be applied. Applies only when ruleType is RateLimitRule. + RateLimitDuration *ApplicationGatewayFirewallRateLimitDuration + + // Rate Limit threshold to apply in case ruleType is RateLimitRule. Must be greater than or equal to 1 + RateLimitThreshold *int32 + + // Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. + State *WebApplicationFirewallState + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string +} + +// WebApplicationFirewallPolicy - Defines web application firewall policy. +type WebApplicationFirewallPolicy struct { + // Resource ID. + ID *string + + // Resource location. + Location *string + + // Properties of the web application firewall policy. + Properties *WebApplicationFirewallPolicyPropertiesFormat + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// 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 + + // READ-ONLY; List of WebApplicationFirewallPolicies within a resource group. + Value []*WebApplicationFirewallPolicy +} + +// WebApplicationFirewallPolicyPropertiesFormat - Defines web application firewall policy properties. +type WebApplicationFirewallPolicyPropertiesFormat struct { + // REQUIRED; Describes the managedRules structure. + ManagedRules *ManagedRulesDefinition + + // The custom rules inside the policy. + CustomRules []*WebApplicationFirewallCustomRule + + // The PolicySettings for policy. + PolicySettings *PolicySettings + + // READ-ONLY; A collection of references to application gateways. + ApplicationGateways []*ApplicationGateway + + // READ-ONLY; A collection of references to application gateway http listeners. + HTTPListeners []*SubResource + + // READ-ONLY; A collection of references to application gateway path rules. + PathBasedRules []*SubResource + + // READ-ONLY; The provisioning state of the web application firewall policy resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Resource status of the policy. + ResourceState *WebApplicationFirewallPolicyResourceState +} + +// WebApplicationFirewallScrubbingRules - Allow certain variables to be scrubbed on WAF logs +type WebApplicationFirewallScrubbingRules struct { + // REQUIRED; The variable to be scrubbed from the logs. + MatchVariable *ScrubbingRuleEntryMatchVariable + + // REQUIRED; When matchVariable is a collection, operate on the selector to specify which elements in the collection this + // rule applies to. + SelectorMatchOperator *ScrubbingRuleEntryMatchOperator + + // When matchVariable is a collection, operator used to specify which elements in the collection this rule applies to. + Selector *string + + // Defines the state of log scrubbing rule. Default value is Enabled. + State *ScrubbingRuleEntryState +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/models_serde.go new file mode 100644 index 000000000..125e0c5cf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/models_serde.go @@ -0,0 +1,34501 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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, "resourceGuid", a.ResourceGUID) + 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 "resourceGuid": + err = unpopulate(val, "ResourceGUID", &a.ResourceGUID) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "appliesToGroups", a.AppliesToGroups) + populate(objectMap, "description", a.Description) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "resourceGuid", a.ResourceGUID) + 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) + 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 AdminRuleListResult. +func (a AdminRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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, "defaultPredefinedSslPolicy", a.DefaultPredefinedSSLPolicy) + 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 "defaultPredefinedSslPolicy": + err = unpopulate(val, "DefaultPredefinedSSLPolicy", &a.DefaultPredefinedSSLPolicy) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "description", a.Description) + populate(objectMap, "destinationAddresses", a.DestinationAddresses) + populate(objectMap, "fqdnTags", a.FqdnTags) + populate(objectMap, "httpHeadersToInsert", a.HTTPHeadersToInsert) + 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 "httpHeadersToInsert": + err = unpopulate(val, "HTTPHeadersToInsert", &a.HTTPHeadersToInsert) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 AzureFirewallPacketCaptureFlags. +func (a AzureFirewallPacketCaptureFlags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallPacketCaptureFlags. +func (a *AzureFirewallPacketCaptureFlags) UnmarshalJSON(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 AzureFirewallPacketCaptureRule. +func (a AzureFirewallPacketCaptureRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationPorts", a.DestinationPorts) + populate(objectMap, "destinations", a.Destinations) + populate(objectMap, "sources", a.Sources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallPacketCaptureRule. +func (a *AzureFirewallPacketCaptureRule) UnmarshalJSON(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 "destinationPorts": + err = unpopulate(val, "DestinationPorts", &a.DestinationPorts) + delete(rawMsg, key) + case "destinations": + err = unpopulate(val, "Destinations", &a.Destinations) + 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 AzureFirewallPropertiesFormat. +func (a AzureFirewallPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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, "syncMode", b.SyncMode) + populate(objectMap, "tunnelInterfaces", b.TunnelInterfaces) + populate(objectMap, "virtualNetwork", b.VirtualNetwork) + 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 "syncMode": + err = unpopulate(val, "SyncMode", &b.SyncMode) + delete(rawMsg, key) + case "tunnelInterfaces": + err = unpopulate(val, "TunnelInterfaces", &b.TunnelInterfaces) + delete(rawMsg, key) + case "virtualNetwork": + err = unpopulate(val, "VirtualNetwork", &b.VirtualNetwork) + 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]any) + 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]any) + populate(objectMap, "protocol", b.Protocol) + populate(objectMap, "resourceType", b.ResourceType) + populate(objectMap, "sessionDurationInMins", b.SessionDurationInMins) + populate(objectMap, "sessionId", b.SessionID) + populateAny(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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "dnsName", b.DNSName) + populate(objectMap, "disableCopyPaste", b.DisableCopyPaste) + populate(objectMap, "enableFileCopy", b.EnableFileCopy) + populate(objectMap, "enableIpConnect", b.EnableIPConnect) + populate(objectMap, "enableKerberos", b.EnableKerberos) + populate(objectMap, "enableShareableLink", b.EnableShareableLink) + populate(objectMap, "enableTunneling", b.EnableTunneling) + populate(objectMap, "ipConfigurations", b.IPConfigurations) + populate(objectMap, "networkAcls", b.NetworkACLs) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "scaleUnits", b.ScaleUnits) + populate(objectMap, "virtualNetwork", b.VirtualNetwork) + 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 "enableKerberos": + err = unpopulate(val, "EnableKerberos", &b.EnableKerberos) + 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 "networkAcls": + err = unpopulate(val, "NetworkACLs", &b.NetworkACLs) + 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) + case "virtualNetwork": + err = unpopulate(val, "VirtualNetwork", &b.VirtualNetwork) + 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 BastionHostPropertiesFormatNetworkACLs. +func (b BastionHostPropertiesFormatNetworkACLs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipRules", b.IPRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionHostPropertiesFormatNetworkACLs. +func (b *BastionHostPropertiesFormatNetworkACLs) UnmarshalJSON(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 "ipRules": + err = unpopulate(val, "IPRules", &b.IPRules) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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) + populate(objectMap, "resourceGuid", c.ResourceGUID) + 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) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &c.ResourceGUID) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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, "resourceGuid", d.ResourceGUID) + 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 "resourceGuid": + err = unpopulate(val, "ResourceGUID", &d.ResourceGUID) + 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]any) + 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]any) + 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]any) + 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 DelegationProperties. +func (d DelegationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "serviceName", d.ServiceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DelegationProperties. +func (d *DelegationProperties) UnmarshalJSON(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 "serviceName": + err = unpopulate(val, "ServiceName", &d.ServiceName) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 EffectiveRouteMapRouteList. +func (e EffectiveRouteMapRouteList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveRouteMapRouteList. +func (e *EffectiveRouteMapRouteList) UnmarshalJSON(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 EffectiveRoutesParameters. +func (e EffectiveRoutesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "allowClassicOperations", e.AllowClassicOperations) + populate(objectMap, "authorizationKey", e.AuthorizationKey) + populate(objectMap, "authorizationStatus", e.AuthorizationStatus) + 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 "authorizationStatus": + err = unpopulate(val, "AuthorizationStatus", &e.AuthorizationStatus) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 FirewallPacketCaptureParameters. +func (f FirewallPacketCaptureParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "properties", f.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPacketCaptureParameters. +func (f *FirewallPacketCaptureParameters) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &f.Properties) + 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 FirewallPacketCaptureParametersFormat. +func (f FirewallPacketCaptureParametersFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "durationInSeconds", f.DurationInSeconds) + populate(objectMap, "fileName", f.FileName) + populate(objectMap, "filters", f.Filters) + populate(objectMap, "flags", f.Flags) + populate(objectMap, "numberOfPacketsToCapture", f.NumberOfPacketsToCapture) + populate(objectMap, "protocol", f.Protocol) + populate(objectMap, "sasUrl", f.SasURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPacketCaptureParametersFormat. +func (f *FirewallPacketCaptureParametersFormat) UnmarshalJSON(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 "durationInSeconds": + err = unpopulate(val, "DurationInSeconds", &f.DurationInSeconds) + delete(rawMsg, key) + case "fileName": + err = unpopulate(val, "FileName", &f.FileName) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, "Filters", &f.Filters) + delete(rawMsg, key) + case "flags": + err = unpopulate(val, "Flags", &f.Flags) + delete(rawMsg, key) + case "numberOfPacketsToCapture": + err = unpopulate(val, "NumberOfPacketsToCapture", &f.NumberOfPacketsToCapture) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &f.Protocol) + delete(rawMsg, key) + case "sasUrl": + err = unpopulate(val, "SasURL", &f.SasURL) + 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]any) + 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]any) + 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]any) + 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]any) + 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 FirewallPolicyHTTPHeaderToInsert. +func (f FirewallPolicyHTTPHeaderToInsert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "headerName", f.HeaderName) + populate(objectMap, "headerValue", f.HeaderValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyHTTPHeaderToInsert. +func (f *FirewallPolicyHTTPHeaderToInsert) UnmarshalJSON(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 "headerName": + err = unpopulate(val, "HeaderName", &f.HeaderName) + delete(rawMsg, key) + case "headerValue": + err = unpopulate(val, "HeaderValue", &f.HeaderValue) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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, "size", f.Size) + 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 "size": + err = unpopulate(val, "Size", &f.Size) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "priority", f.Priority) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "ruleCollections", f.RuleCollections) + populate(objectMap, "size", f.Size) + 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) + case "size": + err = unpopulate(val, "Size", &f.Size) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 GroupByUserSession. +func (g GroupByUserSession) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupByVariables", g.GroupByVariables) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupByUserSession. +func (g *GroupByUserSession) UnmarshalJSON(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 "groupByVariables": + err = unpopulate(val, "GroupByVariables", &g.GroupByVariables) + 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 GroupByVariable. +func (g GroupByVariable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "variableName", g.VariableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupByVariable. +func (g *GroupByVariable) UnmarshalJSON(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 "variableName": + err = unpopulate(val, "VariableName", &g.VariableName) + 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]any) + 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]any) + populate(objectMap, "description", g.Description) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "resourceGuid", g.ResourceGUID) + 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) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &g.ResourceGUID) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefix", i.AddressPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) UnmarshalJSON(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) + } + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "auxiliaryMode", i.AuxiliaryMode) + populate(objectMap, "auxiliarySku", i.AuxiliarySKU) + 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 "auxiliarySku": + err = unpopulate(val, "AuxiliarySKU", &i.AuxiliarySKU) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "description", m.Description) + populate(objectMap, "networkManagerScopeAccesses", m.NetworkManagerScopeAccesses) + populate(objectMap, "networkManagerScopes", m.NetworkManagerScopes) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "resourceGuid", m.ResourceGUID) + 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) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &m.ResourceGUID) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 MigrateLoadBalancerToIPBasedRequest. +func (m MigrateLoadBalancerToIPBasedRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "pools", m.Pools) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MigrateLoadBalancerToIPBasedRequest. +func (m *MigrateLoadBalancerToIPBasedRequest) UnmarshalJSON(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 "pools": + err = unpopulate(val, "Pools", &m.Pools) + 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 MigratedPools. +func (m MigratedPools) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "migratedPools", m.MigratedPools) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MigratedPools. +func (m *MigratedPools) UnmarshalJSON(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 "migratedPools": + err = unpopulate(val, "MigratedPools", &m.MigratedPools) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 PartnerManagedResourceProperties. +func (p PartnerManagedResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "internalLoadBalancerId", p.InternalLoadBalancerID) + populate(objectMap, "standardLoadBalancerId", p.StandardLoadBalancerID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerManagedResourceProperties. +func (p *PartnerManagedResourceProperties) UnmarshalJSON(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 "internalLoadBalancerId": + err = unpopulate(val, "InternalLoadBalancerID", &p.InternalLoadBalancerID) + delete(rawMsg, key) + case "standardLoadBalancerId": + err = unpopulate(val, "StandardLoadBalancerID", &p.StandardLoadBalancerID) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 PolicySettings. +func (p PolicySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customBlockResponseBody", p.CustomBlockResponseBody) + populate(objectMap, "customBlockResponseStatusCode", p.CustomBlockResponseStatusCode) + populate(objectMap, "fileUploadEnforcement", p.FileUploadEnforcement) + populate(objectMap, "fileUploadLimitInMb", p.FileUploadLimitInMb) + populate(objectMap, "logScrubbing", p.LogScrubbing) + populate(objectMap, "maxRequestBodySizeInKb", p.MaxRequestBodySizeInKb) + populate(objectMap, "mode", p.Mode) + populate(objectMap, "requestBodyCheck", p.RequestBodyCheck) + populate(objectMap, "requestBodyEnforcement", p.RequestBodyEnforcement) + populate(objectMap, "requestBodyInspectLimitInKB", p.RequestBodyInspectLimitInKB) + 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 "customBlockResponseBody": + err = unpopulate(val, "CustomBlockResponseBody", &p.CustomBlockResponseBody) + delete(rawMsg, key) + case "customBlockResponseStatusCode": + err = unpopulate(val, "CustomBlockResponseStatusCode", &p.CustomBlockResponseStatusCode) + delete(rawMsg, key) + case "fileUploadEnforcement": + err = unpopulate(val, "FileUploadEnforcement", &p.FileUploadEnforcement) + delete(rawMsg, key) + case "fileUploadLimitInMb": + err = unpopulate(val, "FileUploadLimitInMb", &p.FileUploadLimitInMb) + delete(rawMsg, key) + case "logScrubbing": + err = unpopulate(val, "LogScrubbing", &p.LogScrubbing) + 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 "requestBodyEnforcement": + err = unpopulate(val, "RequestBodyEnforcement", &p.RequestBodyEnforcement) + delete(rawMsg, key) + case "requestBodyInspectLimitInKB": + err = unpopulate(val, "RequestBodyInspectLimitInKB", &p.RequestBodyInspectLimitInKB) + 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 PolicySettingsLogScrubbing. +func (p PolicySettingsLogScrubbing) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scrubbingRules", p.ScrubbingRules) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicySettingsLogScrubbing. +func (p *PolicySettingsLogScrubbing) UnmarshalJSON(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 "scrubbingRules": + err = unpopulate(val, "ScrubbingRules", &p.ScrubbingRules) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "linkIdentifier", p.LinkIdentifier) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateEndpointLocation", p.PrivateEndpointLocation) + 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 "privateEndpointLocation": + err = unpopulate(val, "PrivateEndpointLocation", &p.PrivateEndpointLocation) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 PropagatedRouteTableNfv. +func (p PropagatedRouteTableNfv) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ids", p.IDs) + populate(objectMap, "labels", p.Labels) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropagatedRouteTableNfv. +func (p *PropagatedRouteTableNfv) UnmarshalJSON(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]any) + 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]any) + 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]any) + populate(objectMap, "domainNameLabel", p.DomainNameLabel) + populate(objectMap, "domainNameLabelScope", p.DomainNameLabelScope) + 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 "domainNameLabelScope": + err = unpopulate(val, "DomainNameLabelScope", &p.DomainNameLabelScope) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 RoutingConfigurationNfv. +func (r RoutingConfigurationNfv) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "associatedRouteTable", r.AssociatedRouteTable) + populate(objectMap, "inboundRouteMap", r.InboundRouteMap) + populate(objectMap, "outboundRouteMap", r.OutboundRouteMap) + populate(objectMap, "propagatedRouteTables", r.PropagatedRouteTables) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingConfigurationNfv. +func (r *RoutingConfigurationNfv) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingConfigurationNfvSubResource. +func (r RoutingConfigurationNfvSubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceUri", r.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingConfigurationNfvSubResource. +func (r *RoutingConfigurationNfvSubResource) UnmarshalJSON(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 "resourceUri": + err = unpopulate(val, "ResourceURI", &r.ResourceURI) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "applyOnNetworkIntentPolicyBasedServices", s.ApplyOnNetworkIntentPolicyBasedServices) + populate(objectMap, "description", s.Description) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "resourceGuid", s.ResourceGUID) + 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) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &s.ResourceGUID) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "addressPrefix", s.AddressPrefix) + populate(objectMap, "addressPrefixes", s.AddressPrefixes) + populate(objectMap, "applicationGatewayIPConfigurations", s.ApplicationGatewayIPConfigurations) + populate(objectMap, "defaultOutboundAccess", s.DefaultOutboundAccess) + 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 "defaultOutboundAccess": + err = unpopulate(val, "DefaultOutboundAccess", &s.DefaultOutboundAccess) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 VirtualApplianceAdditionalNicProperties. +func (v VirtualApplianceAdditionalNicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hasPublicIp", v.HasPublicIP) + populate(objectMap, "name", v.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceAdditionalNicProperties. +func (v *VirtualApplianceAdditionalNicProperties) UnmarshalJSON(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 "hasPublicIp": + err = unpopulate(val, "HasPublicIP", &v.HasPublicIP) + 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 VirtualApplianceConnection. +func (v VirtualApplianceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 VirtualApplianceConnection. +func (v *VirtualApplianceConnection) UnmarshalJSON(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 VirtualApplianceConnectionList. +func (v VirtualApplianceConnectionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceConnectionList. +func (v *VirtualApplianceConnectionList) UnmarshalJSON(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 VirtualApplianceConnectionProperties. +func (v VirtualApplianceConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "asn", v.Asn) + populate(objectMap, "bgpPeerAddress", v.BgpPeerAddress) + populate(objectMap, "enableInternetSecurity", v.EnableInternetSecurity) + populate(objectMap, "name", v.Name) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "routingConfiguration", v.RoutingConfiguration) + populate(objectMap, "tunnelIdentifier", v.TunnelIdentifier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceConnectionProperties. +func (v *VirtualApplianceConnectionProperties) UnmarshalJSON(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 "bgpPeerAddress": + err = unpopulate(val, "BgpPeerAddress", &v.BgpPeerAddress) + delete(rawMsg, key) + case "enableInternetSecurity": + err = unpopulate(val, "EnableInternetSecurity", &v.EnableInternetSecurity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "routingConfiguration": + err = unpopulate(val, "RoutingConfiguration", &v.RoutingConfiguration) + delete(rawMsg, key) + case "tunnelIdentifier": + err = unpopulate(val, "TunnelIdentifier", &v.TunnelIdentifier) + 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]any) + 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]any) + populate(objectMap, "instanceName", v.InstanceName) + 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 "instanceName": + err = unpopulate(val, "InstanceName", &v.InstanceName) + delete(rawMsg, 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]any) + populate(objectMap, "additionalNics", v.AdditionalNics) + populate(objectMap, "addressPrefix", v.AddressPrefix) + populate(objectMap, "bootStrapConfigurationBlobs", v.BootStrapConfigurationBlobs) + populate(objectMap, "cloudInitConfiguration", v.CloudInitConfiguration) + populate(objectMap, "cloudInitConfigurationBlobs", v.CloudInitConfigurationBlobs) + populate(objectMap, "delegation", v.Delegation) + populate(objectMap, "deploymentType", v.DeploymentType) + populate(objectMap, "inboundSecurityRules", v.InboundSecurityRules) + populate(objectMap, "nvaSku", v.NvaSKU) + populate(objectMap, "partnerManagedResource", v.PartnerManagedResource) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "sshPublicKey", v.SSHPublicKey) + populate(objectMap, "virtualApplianceAsn", v.VirtualApplianceAsn) + populate(objectMap, "virtualApplianceConnections", v.VirtualApplianceConnections) + 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 "additionalNics": + err = unpopulate(val, "AdditionalNics", &v.AdditionalNics) + delete(rawMsg, 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 "delegation": + err = unpopulate(val, "Delegation", &v.Delegation) + delete(rawMsg, key) + case "deploymentType": + err = unpopulate(val, "DeploymentType", &v.DeploymentType) + 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 "partnerManagedResource": + err = unpopulate(val, "PartnerManagedResource", &v.PartnerManagedResource) + 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 "virtualApplianceConnections": + err = unpopulate(val, "VirtualApplianceConnections", &v.VirtualApplianceConnections) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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 VirtualNetworkGatewayAutoScaleBounds. +func (v VirtualNetworkGatewayAutoScaleBounds) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "max", v.Max) + populate(objectMap, "min", v.Min) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayAutoScaleBounds. +func (v *VirtualNetworkGatewayAutoScaleBounds) UnmarshalJSON(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 "max": + err = unpopulate(val, "Max", &v.Max) + delete(rawMsg, key) + case "min": + err = unpopulate(val, "Min", &v.Min) + 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 VirtualNetworkGatewayAutoScaleConfiguration. +func (v VirtualNetworkGatewayAutoScaleConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bounds", v.Bounds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayAutoScaleConfiguration. +func (v *VirtualNetworkGatewayAutoScaleConfiguration) UnmarshalJSON(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 "bounds": + err = unpopulate(val, "Bounds", &v.Bounds) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "activeActive", v.Active) + populate(objectMap, "adminState", v.AdminState) + populate(objectMap, "allowRemoteVnetTraffic", v.AllowRemoteVnetTraffic) + populate(objectMap, "allowVirtualWanTraffic", v.AllowVirtualWanTraffic) + populate(objectMap, "autoScaleConfiguration", v.AutoScaleConfiguration) + 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 "adminState": + err = unpopulate(val, "AdminState", &v.AdminState) + 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 "autoScaleConfiguration": + err = unpopulate(val, "AutoScaleConfiguration", &v.AutoScaleConfiguration) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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, "flowLogs", v.FlowLogs) + 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 "flowLogs": + err = unpopulate(val, "FlowLogs", &v.FlowLogs) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "action", w.Action) + populate(objectMap, "etag", w.Etag) + populate(objectMap, "groupByUserSession", w.GroupByUserSession) + populate(objectMap, "matchConditions", w.MatchConditions) + populate(objectMap, "name", w.Name) + populate(objectMap, "priority", w.Priority) + populate(objectMap, "rateLimitDuration", w.RateLimitDuration) + populate(objectMap, "rateLimitThreshold", w.RateLimitThreshold) + populate(objectMap, "ruleType", w.RuleType) + populate(objectMap, "state", w.State) + 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 "groupByUserSession": + err = unpopulate(val, "GroupByUserSession", &w.GroupByUserSession) + 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 "rateLimitDuration": + err = unpopulate(val, "RateLimitDuration", &w.RateLimitDuration) + delete(rawMsg, key) + case "rateLimitThreshold": + err = unpopulate(val, "RateLimitThreshold", &w.RateLimitThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &w.RuleType) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &w.State) + 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]any) + 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]any) + 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]any) + 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 +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallScrubbingRules. +func (w WebApplicationFirewallScrubbingRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "matchVariable", w.MatchVariable) + populate(objectMap, "selector", w.Selector) + populate(objectMap, "selectorMatchOperator", w.SelectorMatchOperator) + populate(objectMap, "state", w.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallScrubbingRules. +func (w *WebApplicationFirewallScrubbingRules) UnmarshalJSON(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 "matchVariable": + err = unpopulate(val, "MatchVariable", &w.MatchVariable) + delete(rawMsg, key) + case "selector": + err = unpopulate(val, "Selector", &w.Selector) + delete(rawMsg, key) + case "selectorMatchOperator": + err = unpopulate(val, "SelectorMatchOperator", &w.SelectorMatchOperator) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &w.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) 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/v4/natgateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/natgateways_client.go new file mode 100644 index 000000000..01ebb2333 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/natgateways_client.go @@ -0,0 +1,438 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".NatGatewaysClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NatGatewaysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a nat gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NatGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NatGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a nat gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *NatGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, natGatewayName string, parameters NatGateway, options *NatGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, natGatewayName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified nat gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NatGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NatGatewaysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified nat gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *NatGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, natGatewayName string, options *NatGatewaysClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, natGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, natGatewayName, options) + if err != nil { + return NatGatewaysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NatGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NatGatewaysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - NatGatewaysClientListOptions contains the optional parameters for the NatGatewaysClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - NatGatewaysClientListAllOptions contains the optional parameters for the NatGatewaysClient.NewListAllPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, natGatewayName, parameters, options) + if err != nil { + return NatGatewaysClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NatGatewaysClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NatGatewaysClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/natrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/natrules_client.go new file mode 100644 index 000000000..3ba041629 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/natrules_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".NatRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NatRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NatRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NatRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *NatRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, natRuleParameters VPNGatewayNatRule, options *NatRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, gatewayName, natRuleName, natRuleParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, natRuleParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a nat rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NatRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NatRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a nat rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *NatRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, options *NatRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, gatewayName, natRuleName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, natRuleName, options) + if err != nil { + return NatRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NatRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NatRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListByVPNGatewayPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/operations_client.go new file mode 100644 index 000000000..49c25ba18 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/operations_client.go @@ -0,0 +1,93 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "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/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 { + internal *arm.Client +} + +// 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) { + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all of the available Network Rest API operations. +// +// Generated from API version 2023-05-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/options.go new file mode 100644 index 000000000..5efa1c6cc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/options.go @@ -0,0 +1,3927 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +// 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.NewListPager +// 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 +} + +// 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.NewListPager 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 +} + +// 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.NewListPager +// method. +type ApplicationGatewayPrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewayPrivateLinkResourcesClientListOptions contains the optional parameters for the ApplicationGatewayPrivateLinkResourcesClient.NewListPager +// method. +type ApplicationGatewayPrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewayWafDynamicManifestsClientGetOptions contains the optional parameters for the ApplicationGatewayWafDynamicManifestsClient.NewGetPager +// 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 +} + +// 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.NewListAllPager +// 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.NewListAvailableSSLPredefinedPoliciesPager +// 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.NewListPager 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 +} + +// 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.NewListAllPager +// method. +type ApplicationSecurityGroupsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// ApplicationSecurityGroupsClientListOptions contains the optional parameters for the ApplicationSecurityGroupsClient.NewListPager +// 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 +} + +// AvailableDelegationsClientListOptions contains the optional parameters for the AvailableDelegationsClient.NewListPager +// method. +type AvailableDelegationsClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailableEndpointServicesClientListOptions contains the optional parameters for the AvailableEndpointServicesClient.NewListPager +// method. +type AvailableEndpointServicesClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailablePrivateEndpointTypesClientListByResourceGroupOptions contains the optional parameters for the AvailablePrivateEndpointTypesClient.NewListByResourceGroupPager +// method. +type AvailablePrivateEndpointTypesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AvailablePrivateEndpointTypesClientListOptions contains the optional parameters for the AvailablePrivateEndpointTypesClient.NewListPager +// method. +type AvailablePrivateEndpointTypesClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailableResourceGroupDelegationsClientListOptions contains the optional parameters for the AvailableResourceGroupDelegationsClient.NewListPager +// method. +type AvailableResourceGroupDelegationsClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailableServiceAliasesClientListByResourceGroupOptions contains the optional parameters for the AvailableServiceAliasesClient.NewListByResourceGroupPager +// method. +type AvailableServiceAliasesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AvailableServiceAliasesClientListOptions contains the optional parameters for the AvailableServiceAliasesClient.NewListPager +// method. +type AvailableServiceAliasesClientListOptions struct { + // placeholder for future optional parameters +} + +// AzureFirewallFqdnTagsClientListAllOptions contains the optional parameters for the AzureFirewallFqdnTagsClient.NewListAllPager +// method. +type AzureFirewallFqdnTagsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// AzureFirewallsClientBeginPacketCaptureOptions contains the optional parameters for the AzureFirewallsClient.BeginPacketCapture +// method. +type AzureFirewallsClientBeginPacketCaptureOptions 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.NewListAllPager method. +type AzureFirewallsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// AzureFirewallsClientListOptions contains the optional parameters for the AzureFirewallsClient.NewListPager method. +type AzureFirewallsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type BastionHostsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// BastionHostsClientListOptions contains the optional parameters for the BastionHostsClient.NewListPager method. +type BastionHostsClientListOptions struct { + // placeholder for future optional parameters +} + +// BgpServiceCommunitiesClientListOptions contains the optional parameters for the BgpServiceCommunitiesClient.NewListPager +// method. +type BgpServiceCommunitiesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByVPNServerConfigurationPager +// method. +type ConfigurationPolicyGroupsClientListByVPNServerConfigurationOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager 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 +} + +// 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.NewListPager +// 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 +} + +// 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.NewListAllPager method. +type CustomIPPrefixesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// CustomIPPrefixesClientListOptions contains the optional parameters for the CustomIPPrefixesClient.NewListPager 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 +} + +// 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 +} + +// 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.NewListByResourceGroupPager +// method. +type DdosProtectionPlansClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DdosProtectionPlansClientListOptions contains the optional parameters for the DdosProtectionPlansClient.NewListPager 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 +} + +// 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.NewListPager +// method. +type DefaultSecurityRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAllPager +// method. +type DscpConfigurationClientListAllOptions struct { + // placeholder for future optional parameters +} + +// DscpConfigurationClientListOptions contains the optional parameters for the DscpConfigurationClient.NewListPager method. +type DscpConfigurationClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type ExpressRouteCircuitAuthorizationsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type ExpressRouteCircuitConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type ExpressRouteCircuitPeeringsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAllPager +// method. +type ExpressRouteCircuitsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitsClientListOptions contains the optional parameters for the ExpressRouteCircuitsClient.NewListPager +// 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 +} + +// 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 +} + +// 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.NewListPager +// method. +type ExpressRouteCrossConnectionPeeringsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type ExpressRouteCrossConnectionsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCrossConnectionsClientListOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.NewListPager +// 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 +} + +// 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 +} + +// 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.NewListPager method. +type ExpressRouteLinksClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type ExpressRoutePortAuthorizationsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type ExpressRoutePortsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePortsClientListOptions contains the optional parameters for the ExpressRoutePortsClient.NewListPager 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 +} + +// 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.NewListPager +// method. +type ExpressRoutePortsLocationsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// ExpressRouteServiceProvidersClientListOptions contains the optional parameters for the ExpressRouteServiceProvidersClient.NewListPager +// method. +type ExpressRouteServiceProvidersClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAllPager method. +type FirewallPoliciesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// FirewallPoliciesClientListOptions contains the optional parameters for the FirewallPoliciesClient.NewListPager 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 +} + +// 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 +} + +// 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.NewListPager +// method. +type FirewallPolicyRuleCollectionGroupsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager 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 +} + +// 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.NewListPager 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 +} + +// 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.NewListPager method. +type HubRouteTablesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type HubVirtualNetworkConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type IPAllocationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// IPAllocationsClientListOptions contains the optional parameters for the IPAllocationsClient.NewListPager 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 +} + +// 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.NewListByResourceGroupPager +// method. +type IPGroupsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// IPGroupsClientListOptions contains the optional parameters for the IPGroupsClient.NewListPager 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 +} + +// 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.NewListPager method. +type InboundNatRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// InboundSecurityRuleClientBeginCreateOrUpdateOptions contains the optional parameters for the InboundSecurityRuleClient.BeginCreateOrUpdate +// method. +type InboundSecurityRuleClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// 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.NewListPager +// method. +type InterfaceIPConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + +// InterfaceLoadBalancersClientListOptions contains the optional parameters for the InterfaceLoadBalancersClient.NewListPager +// method. +type InterfaceLoadBalancersClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// 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.NewListAllPager method. +type InterfacesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListCloudServiceNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.NewListCloudServiceNetworkInterfacesPager +// method. +type InterfacesClientListCloudServiceNetworkInterfacesOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.NewListCloudServiceRoleInstanceNetworkInterfacesPager +// method. +type InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListOptions contains the optional parameters for the InterfacesClient.NewListPager method. +type InterfacesClientListOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions contains the optional parameters for the InterfacesClient.NewListVirtualMachineScaleSetIPConfigurationsPager +// method. +type InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions struct { + // Expands referenced resources. + Expand *string +} + +// InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.NewListVirtualMachineScaleSetNetworkInterfacesPager +// method. +type InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.NewListVirtualMachineScaleSetVMNetworkInterfacesPager +// 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 +} + +// 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.NewListPager +// method. +type LoadBalancerBackendAddressPoolsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type LoadBalancerFrontendIPConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type LoadBalancerLoadBalancingRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerNetworkInterfacesClientListOptions contains the optional parameters for the LoadBalancerNetworkInterfacesClient.NewListPager +// method. +type LoadBalancerNetworkInterfacesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type LoadBalancerOutboundRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager method. +type LoadBalancerProbesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAllPager method. +type LoadBalancersClientListAllOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancersClientListOptions contains the optional parameters for the LoadBalancersClient.NewListPager method. +type LoadBalancersClientListOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancersClientMigrateToIPBasedOptions contains the optional parameters for the LoadBalancersClient.MigrateToIPBased +// method. +type LoadBalancersClientMigrateToIPBasedOptions struct { + // Parameters supplied to the migrateToIpBased Api. + Parameters *MigrateLoadBalancerToIPBasedRequest +} + +// LoadBalancersClientUpdateTagsOptions contains the optional parameters for the LoadBalancersClient.UpdateTags method. +type LoadBalancersClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// 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 +} + +// 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.NewDisconnectActiveSessionsPager +// 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.NewGetBastionShareableLinkPager +// 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.NewListPager +// 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 +} + +// ManagerCommitsClientBeginPostOptions contains the optional parameters for the ManagerCommitsClient.BeginPost method. +type ManagerCommitsClientBeginPostOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// 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 +} + +// 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.NewListBySubscriptionPager +// 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.NewListPager 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 +} + +// 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.NewListAllPager method. +type NatGatewaysClientListAllOptions struct { + // placeholder for future optional parameters +} + +// NatGatewaysClientListOptions contains the optional parameters for the NatGatewaysClient.NewListPager 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 +} + +// 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.NewListByVPNGatewayPager +// method. +type NatRulesClientListByVPNGatewayOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type P2SVPNGatewaysClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// P2SVPNGatewaysClientListOptions contains the optional parameters for the P2SVPNGatewaysClient.NewListPager method. +type P2SVPNGatewaysClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager method. +type PacketCapturesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type PeerExpressRouteCircuitConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type PrivateDNSZoneGroupsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListBySubscriptionPager +// method. +type PrivateEndpointsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointsClientListOptions contains the optional parameters for the PrivateEndpointsClient.NewListPager method. +type PrivateEndpointsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAutoApprovedPrivateLinkServicesByResourceGroupPager method. +type PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesOptions contains the optional parameters for the PrivateLinkServicesClient.NewListAutoApprovedPrivateLinkServicesPager +// method. +type PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesClientListBySubscriptionOptions contains the optional parameters for the PrivateLinkServicesClient.NewListBySubscriptionPager +// method. +type PrivateLinkServicesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesClientListOptions contains the optional parameters for the PrivateLinkServicesClient.NewListPager method. +type PrivateLinkServicesClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesClientListPrivateEndpointConnectionsOptions contains the optional parameters for the PrivateLinkServicesClient.NewListPrivateEndpointConnectionsPager +// 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 +} + +// 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.NewListAllPager method. +type ProfilesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// ProfilesClientListOptions contains the optional parameters for the ProfilesClient.NewListPager 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 +} + +// 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.NewListAllPager +// method. +type PublicIPAddressesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListCloudServicePublicIPAddressesOptions contains the optional parameters for the PublicIPAddressesClient.NewListCloudServicePublicIPAddressesPager +// method. +type PublicIPAddressesClientListCloudServicePublicIPAddressesOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesOptions contains the optional parameters for the PublicIPAddressesClient.NewListCloudServiceRoleInstancePublicIPAddressesPager +// method. +type PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListOptions contains the optional parameters for the PublicIPAddressesClient.NewListPager method. +type PublicIPAddressesClientListOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesOptions contains the optional parameters for the PublicIPAddressesClient.NewListVirtualMachineScaleSetPublicIPAddressesPager +// method. +type PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesOptions contains the optional parameters for the PublicIPAddressesClient.NewListVirtualMachineScaleSetVMPublicIPAddressesPager +// 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 +} + +// 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.NewListAllPager method. +type PublicIPPrefixesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// PublicIPPrefixesClientListOptions contains the optional parameters for the PublicIPPrefixesClient.NewListPager 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 +} + +// ResourceNavigationLinksClientListOptions contains the optional parameters for the ResourceNavigationLinksClient.List method. +type ResourceNavigationLinksClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByRouteFilterPager +// 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.NewListByResourceGroupPager +// method. +type RouteFiltersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// RouteFiltersClientListOptions contains the optional parameters for the RouteFiltersClient.NewListPager 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 +} + +// 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.NewListPager method. +type RouteMapsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAllPager method. +type RouteTablesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// RouteTablesClientListOptions contains the optional parameters for the RouteTablesClient.NewListPager 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.NewListPager method. +type RoutesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager method. +type RoutingIntentClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager 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 +} + +// 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.NewListPager +// 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 +} + +// 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.NewListAllPager method. +type SecurityGroupsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// SecurityGroupsClientListOptions contains the optional parameters for the SecurityGroupsClient.NewListPager 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 +} + +// 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.NewListByResourceGroupPager +// method. +type SecurityPartnerProvidersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SecurityPartnerProvidersClientListOptions contains the optional parameters for the SecurityPartnerProvidersClient.NewListPager +// 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 +} + +// 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.NewListPager method. +type SecurityRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// ServiceAssociationLinksClientListOptions contains the optional parameters for the ServiceAssociationLinksClient.List method. +type ServiceAssociationLinksClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type ServiceEndpointPoliciesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ServiceEndpointPoliciesClientListOptions contains the optional parameters for the ServiceEndpointPoliciesClient.NewListPager +// 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 +} + +// 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.NewListByResourceGroupPager +// method. +type ServiceEndpointPolicyDefinitionsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ServiceTagInformationClientListOptions contains the optional parameters for the ServiceTagInformationClient.NewListPager +// method. +type ServiceTagInformationClientListOptions struct { + // Do not return address prefixes for the tag(s). + NoAddressPrefixes *bool + + // Return tag information for a particular tag. + TagName *string +} + +// ServiceTagsClientListOptions contains the optional parameters for the ServiceTagsClient.List method. +type ServiceTagsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager 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 +} + +// 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.NewListPager 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.NewListPager +// 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 +} + +// UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. +type UsagesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByVPNGatewayPager +// method. +type VPNConnectionsClientListByVPNGatewayOptions struct { + // placeholder for future optional parameters +} + +// 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 { + // VpnGateway ipConfigurationId to specify the gateway instance. + IPConfigurationID *string + + // 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.NewListByResourceGroupPager +// method. +type VPNGatewaysClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VPNGatewaysClientListOptions contains the optional parameters for the VPNGatewaysClient.NewListPager method. +type VPNGatewaysClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByVPNConnectionPager +// method. +type VPNLinkConnectionsClientListByVPNConnectionOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type VPNServerConfigurationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VPNServerConfigurationsClientListOptions contains the optional parameters for the VPNServerConfigurationsClient.NewListPager +// 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 +} + +// VPNSiteLinkConnectionsClientGetOptions contains the optional parameters for the VPNSiteLinkConnectionsClient.Get method. +type VPNSiteLinkConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByVPNSitePager +// method. +type VPNSiteLinksClientListByVPNSiteOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type VPNSitesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VPNSitesClientListOptions contains the optional parameters for the VPNSitesClient.NewListPager 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 +} + +// 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 +} + +// VirtualApplianceConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualApplianceConnectionsClient.BeginCreateOrUpdate +// method. +type VirtualApplianceConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualApplianceConnectionsClientBeginDeleteOptions contains the optional parameters for the VirtualApplianceConnectionsClient.BeginDelete +// method. +type VirtualApplianceConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualApplianceConnectionsClientGetOptions contains the optional parameters for the VirtualApplianceConnectionsClient.Get +// method. +type VirtualApplianceConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualApplianceConnectionsClientListOptions contains the optional parameters for the VirtualApplianceConnectionsClient.NewListPager +// method. +type VirtualApplianceConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type VirtualApplianceSKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// 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.NewListByResourceGroupPager +// method. +type VirtualAppliancesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualAppliancesClientListOptions contains the optional parameters for the VirtualAppliancesClient.NewListPager 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 +} + +// 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.NewListPager +// method. +type VirtualHubBgpConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type VirtualHubIPConfigurationClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type VirtualHubRouteTableV2SClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type VirtualHubsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubsClientListOptions contains the optional parameters for the VirtualHubsClient.NewListPager 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 +} + +// 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.NewListPager +// method. +type VirtualNetworkGatewayConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByVirtualNetworkGatewayPager +// method. +type VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListConnectionsPager +// method. +type VirtualNetworkGatewaysClientListConnectionsOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewaysClientListOptions contains the optional parameters for the VirtualNetworkGatewaysClient.NewListPager +// 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 +} + +// 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.NewListPager +// method. +type VirtualNetworkPeeringsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAllPager +// method. +type VirtualNetworkTapsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkTapsClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworkTapsClient.NewListByResourceGroupPager +// 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 +} + +// 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.NewListAllPager method. +type VirtualNetworksClientListAllOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.NewListPager method. +type VirtualNetworksClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListUsageOptions contains the optional parameters for the VirtualNetworksClient.NewListUsagePager +// 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 +} + +// 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.NewListPager +// method. +type VirtualRouterPeeringsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type VirtualRoutersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualRoutersClientListOptions contains the optional parameters for the VirtualRoutersClient.NewListPager method. +type VirtualRoutersClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListByResourceGroupPager +// method. +type VirtualWansClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualWansClientListOptions contains the optional parameters for the VirtualWansClient.NewListPager 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 +} + +// 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.NewListAllPager method. +type WatchersClientListAllOptions struct { + // placeholder for future optional parameters +} + +// WatchersClientListOptions contains the optional parameters for the WatchersClient.NewListPager 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 +} + +// 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.NewListAllPager +// method. +type WebApplicationFirewallPoliciesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// WebApplicationFirewallPoliciesClientListOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.NewListPager +// method. +type WebApplicationFirewallPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListBySubscriptionPager +// method. +type WebCategoriesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/p2svpngateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/p2svpngateways_client.go new file mode 100644 index 000000000..546cf35c6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/p2svpngateways_client.go @@ -0,0 +1,815 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".P2SVPNGatewaysClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &P2SVPNGatewaysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[P2SVPNGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *P2SVPNGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters P2SVPNGateway, options *P2SVPNGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, gatewayName, p2SVPNGatewayParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, p2SVPNGatewayParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a virtual wan p2s vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[P2SVPNGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a virtual wan p2s vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *P2SVPNGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *P2SVPNGatewaysClient) disconnectP2SVPNConnections(ctx context.Context, resourceGroupName string, p2SVPNGatewayName string, request P2SVPNConnectionRequest, options *P2SVPNGatewaysClientBeginDisconnectP2SVPNConnectionsOptions) (*http.Response, error) { + var err error + req, err := client.disconnectP2SVPNConnectionsCreateRequest(ctx, resourceGroupName, p2SVPNGatewayName, request, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, request); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[P2SVPNGatewaysClientGenerateVPNProfileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientGenerateVPNProfileResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *P2SVPNGatewaysClient) generateVPNProfile(ctx context.Context, resourceGroupName string, gatewayName string, parameters P2SVPNProfileParameters, options *P2SVPNGatewaysClientBeginGenerateVPNProfileOptions) (*http.Response, error) { + var err error + req, err := client.generateVPNProfileCreateRequest(ctx, resourceGroupName, gatewayName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return P2SVPNGatewaysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return P2SVPNGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return P2SVPNGatewaysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *P2SVPNGatewaysClient) getP2SVPNConnectionHealth(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthOptions) (*http.Response, error) { + var err error + req, err := client.getP2SVPNConnectionHealthCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *P2SVPNGatewaysClient) getP2SVPNConnectionHealthDetailed(ctx context.Context, resourceGroupName string, gatewayName string, request P2SVPNConnectionHealthRequest, options *P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthDetailedOptions) (*http.Response, error) { + var err error + req, err := client.getP2SVPNConnectionHealthDetailedCreateRequest(ctx, resourceGroupName, gatewayName, request, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, request); err != nil { + return nil, err + } + return req, nil +} + +// NewListPager - Lists all the P2SVpnGateways in a subscription. +// +// Generated from API version 2023-05-01 +// - options - P2SVPNGatewaysClientListOptions contains the optional parameters for the P2SVPNGatewaysClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The resource group name of the P2SVpnGateway. +// - options - P2SVPNGatewaysClientListByResourceGroupOptions contains the optional parameters for the P2SVPNGatewaysClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[P2SVPNGatewaysClientResetResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientResetResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *P2SVPNGatewaysClient) reset(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginResetOptions) (*http.Response, error) { + var err error + req, err := client.resetCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[P2SVPNGatewaysClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateTags - Updates virtual wan p2s vpn gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *P2SVPNGatewaysClient) updateTags(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters TagsObject, options *P2SVPNGatewaysClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, gatewayName, p2SVPNGatewayParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, p2SVPNGatewayParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/packetcaptures_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/packetcaptures_client.go new file mode 100644 index 000000000..913af957f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/packetcaptures_client.go @@ -0,0 +1,477 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".PacketCapturesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PacketCapturesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PacketCapturesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PacketCapturesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PacketCapturesClient) create(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, options *PacketCapturesClientBeginCreateOptions) (*http.Response, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified packet capture session. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PacketCapturesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PacketCapturesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified packet capture session. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *PacketCapturesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return PacketCapturesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PacketCapturesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PacketCapturesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PacketCapturesClientGetStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PacketCapturesClientGetStatusResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PacketCapturesClient) getStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginGetStatusOptions) (*http.Response, error) { + var err error + req, err := client.getStatusCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PacketCapturesClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PacketCapturesClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Stop - Stops a specified packet capture session. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *PacketCapturesClient) stop(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginStopOptions) (*http.Response, error) { + var err error + req, err := client.stopCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/peerexpressroutecircuitconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/peerexpressroutecircuitconnections_client.go new file mode 100644 index 000000000..b768b6bd5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/peerexpressroutecircuitconnections_client.go @@ -0,0 +1,191 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".PeerExpressRouteCircuitConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PeerExpressRouteCircuitConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, peeringName, connectionName, options) + if err != nil { + return PeerExpressRouteCircuitConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PeerExpressRouteCircuitConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PeerExpressRouteCircuitConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/polymorphic_helpers.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/polymorphic_helpers.go new file mode 100644 index 000000000..0f6cd182a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/polymorphic_helpers.go @@ -0,0 +1,223 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import "encoding/json" + +func unmarshalActiveBaseSecurityAdminRuleClassification(rawMsg json.RawMessage) (ActiveBaseSecurityAdminRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + 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{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +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]any + 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{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +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]any + 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{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +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]any + 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{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +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]any + 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{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +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/v4/privatednszonegroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/privatednszonegroups_client.go new file mode 100644 index 000000000..917f1d200 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/privatednszonegroups_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".PrivateDNSZoneGroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateDNSZoneGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateDNSZoneGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateDNSZoneGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PrivateDNSZoneGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, parameters PrivateDNSZoneGroup, options *PrivateDNSZoneGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified private dns zone group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateDNSZoneGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateDNSZoneGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified private dns zone group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *PrivateDNSZoneGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName, options) + if err != nil { + return PrivateDNSZoneGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateDNSZoneGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateDNSZoneGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/privateendpoints_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/privateendpoints_client.go new file mode 100644 index 000000000..eda505d6c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/privateendpoints_client.go @@ -0,0 +1,377 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".PrivateEndpointsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateEndpointsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PrivateEndpointsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, parameters PrivateEndpoint, options *PrivateEndpointsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateEndpointName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified private endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateEndpointsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified private endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *PrivateEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateEndpointName string, options *PrivateEndpointsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateEndpointName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, privateEndpointName, options) + if err != nil { + return PrivateEndpointsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - PrivateEndpointsClientListOptions contains the optional parameters for the PrivateEndpointsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - PrivateEndpointsClientListBySubscriptionOptions contains the optional parameters for the PrivateEndpointsClient.NewListBySubscriptionPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/privatelinkservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/privatelinkservices_client.go new file mode 100644 index 000000000..b8574fe6f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/privatelinkservices_client.go @@ -0,0 +1,944 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".PrivateLinkServicesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinkServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PrivateLinkServicesClient) checkPrivateLinkServiceVisibility(ctx context.Context, location string, parameters CheckPrivateLinkServiceVisibilityRequest, options *PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityOptions) (*http.Response, error) { + var err error + req, err := client.checkPrivateLinkServiceVisibilityCreateRequest(ctx, location, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityByResourceGroupResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityByResourceGroupResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PrivateLinkServicesClient) checkPrivateLinkServiceVisibilityByResourceGroup(ctx context.Context, location string, resourceGroupName string, parameters CheckPrivateLinkServiceVisibilityRequest, options *PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityByResourceGroupOptions) (*http.Response, error) { + var err error + req, err := client.checkPrivateLinkServiceVisibilityByResourceGroupCreateRequest(ctx, location, resourceGroupName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkServicesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PrivateLinkServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PrivateLinkService, options *PrivateLinkServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified private link service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkServicesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified private link service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *PrivateLinkServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, serviceName string, options *PrivateLinkServicesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkServicesClientDeletePrivateEndpointConnectionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientDeletePrivateEndpointConnectionResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PrivateLinkServicesClient) deletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, options *PrivateLinkServicesClientBeginDeletePrivateEndpointConnectionOptions) (*http.Response, error) { + var err error + req, err := client.deletePrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, serviceName, peConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, options) + if err != nil { + return PrivateLinkServicesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkServicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkServicesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, serviceName, peConnectionName, options) + if err != nil { + return PrivateLinkServicesClientGetPrivateEndpointConnectionResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkServicesClientGetPrivateEndpointConnectionResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkServicesClientGetPrivateEndpointConnectionResponse{}, err + } + resp, err := client.getPrivateEndpointConnectionHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - PrivateLinkServicesClientListOptions contains the optional parameters for the PrivateLinkServicesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - location - The location of the domain name. +// - options - PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesOptions contains the optional parameters for the +// PrivateLinkServicesClient.NewListAutoApprovedPrivateLinkServicesPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListAutoApprovedPrivateLinkServicesByResourceGroupPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - PrivateLinkServicesClientListBySubscriptionOptions contains the optional parameters for the PrivateLinkServicesClient.NewListBySubscriptionPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPrivateEndpointConnectionsPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updatePrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, serviceName, peConnectionName, parameters, options) + if err != nil { + return PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse{}, err + } + resp, err := client.updatePrivateEndpointConnectionHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/profiles_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/profiles_client.go new file mode 100644 index 000000000..eb4a9d028 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/profiles_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ProfilesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProfilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a network profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkProfileName, parameters, options) + if err != nil { + return ProfilesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProfilesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ProfilesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProfilesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ProfilesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified network profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkProfileName string, options *ProfilesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkProfileName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkProfileName, options) + if err != nil { + return ProfilesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProfilesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProfilesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - ProfilesClientListOptions contains the optional parameters for the ProfilesClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ProfilesClientListAllOptions contains the optional parameters for the ProfilesClient.NewListAllPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkProfileName, parameters, options) + if err != nil { + return ProfilesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProfilesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProfilesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/publicipaddresses_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/publicipaddresses_client.go new file mode 100644 index 000000000..bdfaa98b7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/publicipaddresses_client.go @@ -0,0 +1,993 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".PublicIPAddressesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PublicIPAddressesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PublicIPAddressesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PublicIPAddressesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PublicIPAddressesClient) createOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, options *PublicIPAddressesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, publicIPAddressName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PublicIPAddressesClientDdosProtectionStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PublicIPAddressesClientDdosProtectionStatusResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PublicIPAddressesClient) ddosProtectionStatus(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientBeginDdosProtectionStatusOptions) (*http.Response, error) { + var err error + req, err := client.ddosProtectionStatusCreateRequest(ctx, resourceGroupName, publicIPAddressName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PublicIPAddressesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PublicIPAddressesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified public IP address. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *PublicIPAddressesClient) deleteOperation(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, publicIPAddressName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, publicIPAddressName, options) + if err != nil { + return PublicIPAddressesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicIPAddressesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicIPAddressesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCloudServicePublicIPAddressCreateRequest(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, ipConfigurationName, publicIPAddressName, options) + if err != nil { + return PublicIPAddressesClientGetCloudServicePublicIPAddressResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicIPAddressesClientGetCloudServicePublicIPAddressResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicIPAddressesClientGetCloudServicePublicIPAddressResponse{}, err + } + resp, err := client.getCloudServicePublicIPAddressHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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) { + var err error + req, err := client.getVirtualMachineScaleSetPublicIPAddressCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, publicIPAddressName, options) + if err != nil { + return PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse{}, err + } + resp, err := client.getVirtualMachineScaleSetPublicIPAddressHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - PublicIPAddressesClientListOptions contains the optional parameters for the PublicIPAddressesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - PublicIPAddressesClientListAllOptions contains the optional parameters for the PublicIPAddressesClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListCloudServicePublicIPAddressesPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListCloudServiceRoleInstancePublicIPAddressesPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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.NewListVirtualMachineScaleSetPublicIPAddressesPager 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.internal.Pipeline().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.internal.Endpoint(), 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.NewListVirtualMachineScaleSetVMPublicIPAddressesPager 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.internal.Pipeline().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.internal.Endpoint(), 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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, publicIPAddressName, parameters, options) + if err != nil { + return PublicIPAddressesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicIPAddressesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicIPAddressesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/publicipprefixes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/publicipprefixes_client.go new file mode 100644 index 000000000..4e832283e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/publicipprefixes_client.go @@ -0,0 +1,442 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".PublicIPPrefixesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PublicIPPrefixesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PublicIPPrefixesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PublicIPPrefixesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *PublicIPPrefixesClient) createOrUpdate(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters PublicIPPrefix, options *PublicIPPrefixesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, publicIPPrefixName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified public IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PublicIPPrefixesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PublicIPPrefixesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified public IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *PublicIPPrefixesClient) deleteOperation(ctx context.Context, resourceGroupName string, publicIPPrefixName string, options *PublicIPPrefixesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, publicIPPrefixName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, publicIPPrefixName, options) + if err != nil { + return PublicIPPrefixesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicIPPrefixesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicIPPrefixesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - PublicIPPrefixesClientListOptions contains the optional parameters for the PublicIPPrefixesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - PublicIPPrefixesClientListAllOptions contains the optional parameters for the PublicIPPrefixesClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, publicIPPrefixName, parameters, options) + if err != nil { + return PublicIPPrefixesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicIPPrefixesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicIPPrefixesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/resourcenavigationlinks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/resourcenavigationlinks_client.go new file mode 100644 index 000000000..2c92c2a5d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/resourcenavigationlinks_client.go @@ -0,0 +1,111 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ResourceNavigationLinksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ResourceNavigationLinksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.listCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return ResourceNavigationLinksClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceNavigationLinksClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceNavigationLinksClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/response_types.go new file mode 100644 index 000000000..d59e968e4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/response_types.go @@ -0,0 +1,3734 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import "encoding/json" + +// AdminRuleCollectionsClientCreateOrUpdateResponse contains the response from method AdminRuleCollectionsClient.CreateOrUpdate. +type AdminRuleCollectionsClientCreateOrUpdateResponse struct { + // Defines the admin rule collection. + AdminRuleCollection +} + +// AdminRuleCollectionsClientDeleteResponse contains the response from method AdminRuleCollectionsClient.BeginDelete. +type AdminRuleCollectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// AdminRuleCollectionsClientGetResponse contains the response from method AdminRuleCollectionsClient.Get. +type AdminRuleCollectionsClientGetResponse struct { + // Defines the admin rule collection. + AdminRuleCollection +} + +// AdminRuleCollectionsClientListResponse contains the response from method AdminRuleCollectionsClient.NewListPager. +type AdminRuleCollectionsClientListResponse struct { + // Security admin configuration rule collection list result. + AdminRuleCollectionListResult +} + +// AdminRulesClientCreateOrUpdateResponse contains the response from method AdminRulesClient.CreateOrUpdate. +type AdminRulesClientCreateOrUpdateResponse struct { + // Network base admin rule. + 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.BeginDelete. +type AdminRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// AdminRulesClientGetResponse contains the response from method AdminRulesClient.Get. +type AdminRulesClientGetResponse struct { + // Network base admin rule. + 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.NewListPager. +type AdminRulesClientListResponse struct { + // security configuration admin rule list result. + AdminRuleListResult +} + +// ApplicationGatewayPrivateEndpointConnectionsClientDeleteResponse contains the response from method ApplicationGatewayPrivateEndpointConnectionsClient.BeginDelete. +type ApplicationGatewayPrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ApplicationGatewayPrivateEndpointConnectionsClientGetResponse contains the response from method ApplicationGatewayPrivateEndpointConnectionsClient.Get. +type ApplicationGatewayPrivateEndpointConnectionsClientGetResponse struct { + // Private Endpoint connection on an application gateway. + ApplicationGatewayPrivateEndpointConnection +} + +// ApplicationGatewayPrivateEndpointConnectionsClientListResponse contains the response from method ApplicationGatewayPrivateEndpointConnectionsClient.NewListPager. +type ApplicationGatewayPrivateEndpointConnectionsClientListResponse struct { + // Response for ListApplicationGatewayPrivateEndpointConnection API service call. Gets all private endpoint connections for + // an application gateway. + ApplicationGatewayPrivateEndpointConnectionListResult +} + +// ApplicationGatewayPrivateEndpointConnectionsClientUpdateResponse contains the response from method ApplicationGatewayPrivateEndpointConnectionsClient.BeginUpdate. +type ApplicationGatewayPrivateEndpointConnectionsClientUpdateResponse struct { + // Private Endpoint connection on an application gateway. + ApplicationGatewayPrivateEndpointConnection +} + +// ApplicationGatewayPrivateLinkResourcesClientListResponse contains the response from method ApplicationGatewayPrivateLinkResourcesClient.NewListPager. +type ApplicationGatewayPrivateLinkResourcesClientListResponse struct { + // Response for ListApplicationGatewayPrivateLinkResources API service call. Gets all private link resources for an application + // gateway. + ApplicationGatewayPrivateLinkResourceListResult +} + +// ApplicationGatewayWafDynamicManifestsClientGetResponse contains the response from method ApplicationGatewayWafDynamicManifestsClient.NewGetPager. +type ApplicationGatewayWafDynamicManifestsClientGetResponse struct { + // Response for ApplicationGatewayWafDynamicManifests API service call. + ApplicationGatewayWafDynamicManifestResultList +} + +// ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse contains the response from method ApplicationGatewayWafDynamicManifestsDefaultClient.Get. +type ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse struct { + // Response for ApplicationGatewayWafDynamicManifest API service call. + ApplicationGatewayWafDynamicManifestResult +} + +// ApplicationGatewaysClientBackendHealthOnDemandResponse contains the response from method ApplicationGatewaysClient.BeginBackendHealthOnDemand. +type ApplicationGatewaysClientBackendHealthOnDemandResponse struct { + // Result of on demand test probe. + ApplicationGatewayBackendHealthOnDemand +} + +// ApplicationGatewaysClientBackendHealthResponse contains the response from method ApplicationGatewaysClient.BeginBackendHealth. +type ApplicationGatewaysClientBackendHealthResponse struct { + // Response for ApplicationGatewayBackendHealth API service call. + ApplicationGatewayBackendHealth +} + +// ApplicationGatewaysClientCreateOrUpdateResponse contains the response from method ApplicationGatewaysClient.BeginCreateOrUpdate. +type ApplicationGatewaysClientCreateOrUpdateResponse struct { + // Application gateway resource. + ApplicationGateway +} + +// ApplicationGatewaysClientDeleteResponse contains the response from method ApplicationGatewaysClient.BeginDelete. +type ApplicationGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// ApplicationGatewaysClientGetResponse contains the response from method ApplicationGatewaysClient.Get. +type ApplicationGatewaysClientGetResponse struct { + // Application gateway resource. + ApplicationGateway +} + +// ApplicationGatewaysClientGetSSLPredefinedPolicyResponse contains the response from method ApplicationGatewaysClient.GetSSLPredefinedPolicy. +type ApplicationGatewaysClientGetSSLPredefinedPolicyResponse struct { + // An Ssl predefined policy. + ApplicationGatewaySSLPredefinedPolicy +} + +// ApplicationGatewaysClientListAllResponse contains the response from method ApplicationGatewaysClient.NewListAllPager. +type ApplicationGatewaysClientListAllResponse struct { + // Response for ListApplicationGateways API service call. + 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 { + // Response for ApplicationGatewayAvailableSslOptions API service call. + ApplicationGatewayAvailableSSLOptions +} + +// ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse contains the response from method ApplicationGatewaysClient.NewListAvailableSSLPredefinedPoliciesPager. +type ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse struct { + // Response for ApplicationGatewayAvailableSslOptions API service call. + 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 { + // Response for ApplicationGatewayAvailableWafRuleSets API service call. + ApplicationGatewayAvailableWafRuleSetsResult +} + +// ApplicationGatewaysClientListResponse contains the response from method ApplicationGatewaysClient.NewListPager. +type ApplicationGatewaysClientListResponse struct { + // Response for ListApplicationGateways API service call. + ApplicationGatewayListResult +} + +// ApplicationGatewaysClientStartResponse contains the response from method ApplicationGatewaysClient.BeginStart. +type ApplicationGatewaysClientStartResponse struct { + // placeholder for future response values +} + +// ApplicationGatewaysClientStopResponse contains the response from method ApplicationGatewaysClient.BeginStop. +type ApplicationGatewaysClientStopResponse struct { + // placeholder for future response values +} + +// ApplicationGatewaysClientUpdateTagsResponse contains the response from method ApplicationGatewaysClient.UpdateTags. +type ApplicationGatewaysClientUpdateTagsResponse struct { + // Application gateway resource. + ApplicationGateway +} + +// ApplicationSecurityGroupsClientCreateOrUpdateResponse contains the response from method ApplicationSecurityGroupsClient.BeginCreateOrUpdate. +type ApplicationSecurityGroupsClientCreateOrUpdateResponse struct { + // An application security group in a resource group. + ApplicationSecurityGroup +} + +// ApplicationSecurityGroupsClientDeleteResponse contains the response from method ApplicationSecurityGroupsClient.BeginDelete. +type ApplicationSecurityGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// ApplicationSecurityGroupsClientGetResponse contains the response from method ApplicationSecurityGroupsClient.Get. +type ApplicationSecurityGroupsClientGetResponse struct { + // An application security group in a resource group. + ApplicationSecurityGroup +} + +// ApplicationSecurityGroupsClientListAllResponse contains the response from method ApplicationSecurityGroupsClient.NewListAllPager. +type ApplicationSecurityGroupsClientListAllResponse struct { + // A list of application security groups. + ApplicationSecurityGroupListResult +} + +// ApplicationSecurityGroupsClientListResponse contains the response from method ApplicationSecurityGroupsClient.NewListPager. +type ApplicationSecurityGroupsClientListResponse struct { + // A list of application security groups. + ApplicationSecurityGroupListResult +} + +// ApplicationSecurityGroupsClientUpdateTagsResponse contains the response from method ApplicationSecurityGroupsClient.UpdateTags. +type ApplicationSecurityGroupsClientUpdateTagsResponse struct { + // An application security group in a resource group. + ApplicationSecurityGroup +} + +// AvailableDelegationsClientListResponse contains the response from method AvailableDelegationsClient.NewListPager. +type AvailableDelegationsClientListResponse struct { + // An array of available delegations. + AvailableDelegationsResult +} + +// AvailableEndpointServicesClientListResponse contains the response from method AvailableEndpointServicesClient.NewListPager. +type AvailableEndpointServicesClientListResponse struct { + // Response for the ListAvailableEndpointServices API service call. + EndpointServicesListResult +} + +// AvailablePrivateEndpointTypesClientListByResourceGroupResponse contains the response from method AvailablePrivateEndpointTypesClient.NewListByResourceGroupPager. +type AvailablePrivateEndpointTypesClientListByResourceGroupResponse struct { + // An array of available PrivateEndpoint types. + AvailablePrivateEndpointTypesResult +} + +// AvailablePrivateEndpointTypesClientListResponse contains the response from method AvailablePrivateEndpointTypesClient.NewListPager. +type AvailablePrivateEndpointTypesClientListResponse struct { + // An array of available PrivateEndpoint types. + AvailablePrivateEndpointTypesResult +} + +// AvailableResourceGroupDelegationsClientListResponse contains the response from method AvailableResourceGroupDelegationsClient.NewListPager. +type AvailableResourceGroupDelegationsClientListResponse struct { + // An array of available delegations. + AvailableDelegationsResult +} + +// AvailableServiceAliasesClientListByResourceGroupResponse contains the response from method AvailableServiceAliasesClient.NewListByResourceGroupPager. +type AvailableServiceAliasesClientListByResourceGroupResponse struct { + // An array of available service aliases. + AvailableServiceAliasesResult +} + +// AvailableServiceAliasesClientListResponse contains the response from method AvailableServiceAliasesClient.NewListPager. +type AvailableServiceAliasesClientListResponse struct { + // An array of available service aliases. + AvailableServiceAliasesResult +} + +// AzureFirewallFqdnTagsClientListAllResponse contains the response from method AzureFirewallFqdnTagsClient.NewListAllPager. +type AzureFirewallFqdnTagsClientListAllResponse struct { + // Response for ListAzureFirewallFqdnTags API service call. + AzureFirewallFqdnTagListResult +} + +// AzureFirewallsClientCreateOrUpdateResponse contains the response from method AzureFirewallsClient.BeginCreateOrUpdate. +type AzureFirewallsClientCreateOrUpdateResponse struct { + // Azure Firewall resource. + AzureFirewall +} + +// AzureFirewallsClientDeleteResponse contains the response from method AzureFirewallsClient.BeginDelete. +type AzureFirewallsClientDeleteResponse struct { + // placeholder for future response values +} + +// AzureFirewallsClientGetResponse contains the response from method AzureFirewallsClient.Get. +type AzureFirewallsClientGetResponse struct { + // Azure Firewall resource. + AzureFirewall +} + +// AzureFirewallsClientListAllResponse contains the response from method AzureFirewallsClient.NewListAllPager. +type AzureFirewallsClientListAllResponse struct { + // Response for ListAzureFirewalls API service call. + AzureFirewallListResult +} + +// AzureFirewallsClientListLearnedPrefixesResponse contains the response from method AzureFirewallsClient.BeginListLearnedPrefixes. +type AzureFirewallsClientListLearnedPrefixesResponse struct { + // List of SNAT IP Prefixes learnt by firewall to not SNAT + IPPrefixesList +} + +// AzureFirewallsClientListResponse contains the response from method AzureFirewallsClient.NewListPager. +type AzureFirewallsClientListResponse struct { + // Response for ListAzureFirewalls API service call. + AzureFirewallListResult +} + +// AzureFirewallsClientPacketCaptureResponse contains the response from method AzureFirewallsClient.BeginPacketCapture. +type AzureFirewallsClientPacketCaptureResponse struct { + // placeholder for future response values +} + +// AzureFirewallsClientUpdateTagsResponse contains the response from method AzureFirewallsClient.BeginUpdateTags. +type AzureFirewallsClientUpdateTagsResponse struct { + // Azure Firewall resource. + AzureFirewall +} + +// BastionHostsClientCreateOrUpdateResponse contains the response from method BastionHostsClient.BeginCreateOrUpdate. +type BastionHostsClientCreateOrUpdateResponse struct { + // Bastion Host resource. + BastionHost +} + +// BastionHostsClientDeleteResponse contains the response from method BastionHostsClient.BeginDelete. +type BastionHostsClientDeleteResponse struct { + // placeholder for future response values +} + +// BastionHostsClientGetResponse contains the response from method BastionHostsClient.Get. +type BastionHostsClientGetResponse struct { + // Bastion Host resource. + BastionHost +} + +// BastionHostsClientListByResourceGroupResponse contains the response from method BastionHostsClient.NewListByResourceGroupPager. +type BastionHostsClientListByResourceGroupResponse struct { + // Response for ListBastionHosts API service call. + BastionHostListResult +} + +// BastionHostsClientListResponse contains the response from method BastionHostsClient.NewListPager. +type BastionHostsClientListResponse struct { + // Response for ListBastionHosts API service call. + BastionHostListResult +} + +// BastionHostsClientUpdateTagsResponse contains the response from method BastionHostsClient.BeginUpdateTags. +type BastionHostsClientUpdateTagsResponse struct { + // Bastion Host resource. + BastionHost +} + +// BgpServiceCommunitiesClientListResponse contains the response from method BgpServiceCommunitiesClient.NewListPager. +type BgpServiceCommunitiesClientListResponse struct { + // Response for the ListServiceCommunity API service call. + BgpServiceCommunityListResult +} + +// ConfigurationPolicyGroupsClientCreateOrUpdateResponse contains the response from method ConfigurationPolicyGroupsClient.BeginCreateOrUpdate. +type ConfigurationPolicyGroupsClientCreateOrUpdateResponse struct { + // VpnServerConfigurationPolicyGroup Resource. + VPNServerConfigurationPolicyGroup +} + +// ConfigurationPolicyGroupsClientDeleteResponse contains the response from method ConfigurationPolicyGroupsClient.BeginDelete. +type ConfigurationPolicyGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConfigurationPolicyGroupsClientGetResponse contains the response from method ConfigurationPolicyGroupsClient.Get. +type ConfigurationPolicyGroupsClientGetResponse struct { + // VpnServerConfigurationPolicyGroup Resource. + VPNServerConfigurationPolicyGroup +} + +// ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse contains the response from method ConfigurationPolicyGroupsClient.NewListByVPNServerConfigurationPager. +type ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse struct { + // Result of the request to list VpnServerConfigurationPolicyGroups. It contains a list of VpnServerConfigurationPolicyGroups + // and a URL nextLink to get the next set of results. + ListVPNServerConfigurationPolicyGroupsResult +} + +// ConnectionMonitorsClientCreateOrUpdateResponse contains the response from method ConnectionMonitorsClient.BeginCreateOrUpdate. +type ConnectionMonitorsClientCreateOrUpdateResponse struct { + // Information about the connection monitor. + ConnectionMonitorResult +} + +// ConnectionMonitorsClientDeleteResponse contains the response from method ConnectionMonitorsClient.BeginDelete. +type ConnectionMonitorsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectionMonitorsClientGetResponse contains the response from method ConnectionMonitorsClient.Get. +type ConnectionMonitorsClientGetResponse struct { + // Information about the connection monitor. + ConnectionMonitorResult +} + +// ConnectionMonitorsClientListResponse contains the response from method ConnectionMonitorsClient.NewListPager. +type ConnectionMonitorsClientListResponse struct { + // List of connection monitors. + ConnectionMonitorListResult +} + +// ConnectionMonitorsClientQueryResponse contains the response from method ConnectionMonitorsClient.BeginQuery. +type ConnectionMonitorsClientQueryResponse struct { + // List of connection states snapshots. + ConnectionMonitorQueryResult +} + +// ConnectionMonitorsClientStartResponse contains the response from method ConnectionMonitorsClient.BeginStart. +type ConnectionMonitorsClientStartResponse struct { + // placeholder for future response values +} + +// ConnectionMonitorsClientStopResponse contains the response from method ConnectionMonitorsClient.BeginStop. +type ConnectionMonitorsClientStopResponse struct { + // placeholder for future response values +} + +// ConnectionMonitorsClientUpdateTagsResponse contains the response from method ConnectionMonitorsClient.UpdateTags. +type ConnectionMonitorsClientUpdateTagsResponse struct { + // Information about the connection monitor. + ConnectionMonitorResult +} + +// ConnectivityConfigurationsClientCreateOrUpdateResponse contains the response from method ConnectivityConfigurationsClient.CreateOrUpdate. +type ConnectivityConfigurationsClientCreateOrUpdateResponse struct { + // The network manager connectivity configuration resource + ConnectivityConfiguration +} + +// ConnectivityConfigurationsClientDeleteResponse contains the response from method ConnectivityConfigurationsClient.BeginDelete. +type ConnectivityConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectivityConfigurationsClientGetResponse contains the response from method ConnectivityConfigurationsClient.Get. +type ConnectivityConfigurationsClientGetResponse struct { + // The network manager connectivity configuration resource + ConnectivityConfiguration +} + +// ConnectivityConfigurationsClientListResponse contains the response from method ConnectivityConfigurationsClient.NewListPager. +type ConnectivityConfigurationsClientListResponse struct { + // 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. + ConnectivityConfigurationListResult +} + +// CustomIPPrefixesClientCreateOrUpdateResponse contains the response from method CustomIPPrefixesClient.BeginCreateOrUpdate. +type CustomIPPrefixesClientCreateOrUpdateResponse struct { + // Custom IP prefix resource. + CustomIPPrefix +} + +// CustomIPPrefixesClientDeleteResponse contains the response from method CustomIPPrefixesClient.BeginDelete. +type CustomIPPrefixesClientDeleteResponse struct { + // placeholder for future response values +} + +// CustomIPPrefixesClientGetResponse contains the response from method CustomIPPrefixesClient.Get. +type CustomIPPrefixesClientGetResponse struct { + // Custom IP prefix resource. + CustomIPPrefix +} + +// CustomIPPrefixesClientListAllResponse contains the response from method CustomIPPrefixesClient.NewListAllPager. +type CustomIPPrefixesClientListAllResponse struct { + // Response for ListCustomIpPrefixes API service call. + CustomIPPrefixListResult +} + +// CustomIPPrefixesClientListResponse contains the response from method CustomIPPrefixesClient.NewListPager. +type CustomIPPrefixesClientListResponse struct { + // Response for ListCustomIpPrefixes API service call. + CustomIPPrefixListResult +} + +// CustomIPPrefixesClientUpdateTagsResponse contains the response from method CustomIPPrefixesClient.UpdateTags. +type CustomIPPrefixesClientUpdateTagsResponse struct { + // Custom IP prefix resource. + CustomIPPrefix +} + +// DdosCustomPoliciesClientCreateOrUpdateResponse contains the response from method DdosCustomPoliciesClient.BeginCreateOrUpdate. +type DdosCustomPoliciesClientCreateOrUpdateResponse struct { + // A DDoS custom policy in a resource group. + DdosCustomPolicy +} + +// DdosCustomPoliciesClientDeleteResponse contains the response from method DdosCustomPoliciesClient.BeginDelete. +type DdosCustomPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// DdosCustomPoliciesClientGetResponse contains the response from method DdosCustomPoliciesClient.Get. +type DdosCustomPoliciesClientGetResponse struct { + // A DDoS custom policy in a resource group. + DdosCustomPolicy +} + +// DdosCustomPoliciesClientUpdateTagsResponse contains the response from method DdosCustomPoliciesClient.UpdateTags. +type DdosCustomPoliciesClientUpdateTagsResponse struct { + // A DDoS custom policy in a resource group. + DdosCustomPolicy +} + +// DdosProtectionPlansClientCreateOrUpdateResponse contains the response from method DdosProtectionPlansClient.BeginCreateOrUpdate. +type DdosProtectionPlansClientCreateOrUpdateResponse struct { + // A DDoS protection plan in a resource group. + DdosProtectionPlan +} + +// DdosProtectionPlansClientDeleteResponse contains the response from method DdosProtectionPlansClient.BeginDelete. +type DdosProtectionPlansClientDeleteResponse struct { + // placeholder for future response values +} + +// DdosProtectionPlansClientGetResponse contains the response from method DdosProtectionPlansClient.Get. +type DdosProtectionPlansClientGetResponse struct { + // A DDoS protection plan in a resource group. + DdosProtectionPlan +} + +// DdosProtectionPlansClientListByResourceGroupResponse contains the response from method DdosProtectionPlansClient.NewListByResourceGroupPager. +type DdosProtectionPlansClientListByResourceGroupResponse struct { + // A list of DDoS protection plans. + DdosProtectionPlanListResult +} + +// DdosProtectionPlansClientListResponse contains the response from method DdosProtectionPlansClient.NewListPager. +type DdosProtectionPlansClientListResponse struct { + // A list of DDoS protection plans. + DdosProtectionPlanListResult +} + +// DdosProtectionPlansClientUpdateTagsResponse contains the response from method DdosProtectionPlansClient.UpdateTags. +type DdosProtectionPlansClientUpdateTagsResponse struct { + // A DDoS protection plan in a resource group. + DdosProtectionPlan +} + +// DefaultSecurityRulesClientGetResponse contains the response from method DefaultSecurityRulesClient.Get. +type DefaultSecurityRulesClientGetResponse struct { + // Network security rule. + SecurityRule +} + +// DefaultSecurityRulesClientListResponse contains the response from method DefaultSecurityRulesClient.NewListPager. +type DefaultSecurityRulesClientListResponse struct { + // Response for ListSecurityRule API service call. Retrieves all security rules that belongs to a network security group. + SecurityRuleListResult +} + +// DscpConfigurationClientCreateOrUpdateResponse contains the response from method DscpConfigurationClient.BeginCreateOrUpdate. +type DscpConfigurationClientCreateOrUpdateResponse struct { + // Differentiated Services Code Point configuration for any given network interface + DscpConfiguration +} + +// DscpConfigurationClientDeleteResponse contains the response from method DscpConfigurationClient.BeginDelete. +type DscpConfigurationClientDeleteResponse struct { + // placeholder for future response values +} + +// DscpConfigurationClientGetResponse contains the response from method DscpConfigurationClient.Get. +type DscpConfigurationClientGetResponse struct { + // Differentiated Services Code Point configuration for any given network interface + DscpConfiguration +} + +// DscpConfigurationClientListAllResponse contains the response from method DscpConfigurationClient.NewListAllPager. +type DscpConfigurationClientListAllResponse struct { + // Response for the DscpConfigurationList API service call. + DscpConfigurationListResult +} + +// DscpConfigurationClientListResponse contains the response from method DscpConfigurationClient.NewListPager. +type DscpConfigurationClientListResponse struct { + // Response for the DscpConfigurationList API service call. + DscpConfigurationListResult +} + +// ExpressRouteCircuitAuthorizationsClientCreateOrUpdateResponse contains the response from method ExpressRouteCircuitAuthorizationsClient.BeginCreateOrUpdate. +type ExpressRouteCircuitAuthorizationsClientCreateOrUpdateResponse struct { + // Authorization in an ExpressRouteCircuit resource. + ExpressRouteCircuitAuthorization +} + +// ExpressRouteCircuitAuthorizationsClientDeleteResponse contains the response from method ExpressRouteCircuitAuthorizationsClient.BeginDelete. +type ExpressRouteCircuitAuthorizationsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCircuitAuthorizationsClientGetResponse contains the response from method ExpressRouteCircuitAuthorizationsClient.Get. +type ExpressRouteCircuitAuthorizationsClientGetResponse struct { + // Authorization in an ExpressRouteCircuit resource. + ExpressRouteCircuitAuthorization +} + +// ExpressRouteCircuitAuthorizationsClientListResponse contains the response from method ExpressRouteCircuitAuthorizationsClient.NewListPager. +type ExpressRouteCircuitAuthorizationsClientListResponse struct { + // Response for ListAuthorizations API service call retrieves all authorizations that belongs to an ExpressRouteCircuit. + AuthorizationListResult +} + +// ExpressRouteCircuitConnectionsClientCreateOrUpdateResponse contains the response from method ExpressRouteCircuitConnectionsClient.BeginCreateOrUpdate. +type ExpressRouteCircuitConnectionsClientCreateOrUpdateResponse struct { + // Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. + ExpressRouteCircuitConnection +} + +// ExpressRouteCircuitConnectionsClientDeleteResponse contains the response from method ExpressRouteCircuitConnectionsClient.BeginDelete. +type ExpressRouteCircuitConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCircuitConnectionsClientGetResponse contains the response from method ExpressRouteCircuitConnectionsClient.Get. +type ExpressRouteCircuitConnectionsClientGetResponse struct { + // Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. + ExpressRouteCircuitConnection +} + +// ExpressRouteCircuitConnectionsClientListResponse contains the response from method ExpressRouteCircuitConnectionsClient.NewListPager. +type ExpressRouteCircuitConnectionsClientListResponse struct { + // Response for ListConnections API service call retrieves all global reach connections that belongs to a Private Peering + // for an ExpressRouteCircuit. + ExpressRouteCircuitConnectionListResult +} + +// ExpressRouteCircuitPeeringsClientCreateOrUpdateResponse contains the response from method ExpressRouteCircuitPeeringsClient.BeginCreateOrUpdate. +type ExpressRouteCircuitPeeringsClientCreateOrUpdateResponse struct { + // Peering in an ExpressRouteCircuit resource. + ExpressRouteCircuitPeering +} + +// ExpressRouteCircuitPeeringsClientDeleteResponse contains the response from method ExpressRouteCircuitPeeringsClient.BeginDelete. +type ExpressRouteCircuitPeeringsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCircuitPeeringsClientGetResponse contains the response from method ExpressRouteCircuitPeeringsClient.Get. +type ExpressRouteCircuitPeeringsClientGetResponse struct { + // Peering in an ExpressRouteCircuit resource. + ExpressRouteCircuitPeering +} + +// ExpressRouteCircuitPeeringsClientListResponse contains the response from method ExpressRouteCircuitPeeringsClient.NewListPager. +type ExpressRouteCircuitPeeringsClientListResponse struct { + // Response for ListPeering API service call retrieves all peerings that belong to an ExpressRouteCircuit. + ExpressRouteCircuitPeeringListResult +} + +// ExpressRouteCircuitsClientCreateOrUpdateResponse contains the response from method ExpressRouteCircuitsClient.BeginCreateOrUpdate. +type ExpressRouteCircuitsClientCreateOrUpdateResponse struct { + // ExpressRouteCircuit resource. + ExpressRouteCircuit +} + +// ExpressRouteCircuitsClientDeleteResponse contains the response from method ExpressRouteCircuitsClient.BeginDelete. +type ExpressRouteCircuitsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCircuitsClientGetPeeringStatsResponse contains the response from method ExpressRouteCircuitsClient.GetPeeringStats. +type ExpressRouteCircuitsClientGetPeeringStatsResponse struct { + // Contains stats associated with the peering. + ExpressRouteCircuitStats +} + +// ExpressRouteCircuitsClientGetResponse contains the response from method ExpressRouteCircuitsClient.Get. +type ExpressRouteCircuitsClientGetResponse struct { + // ExpressRouteCircuit resource. + ExpressRouteCircuit +} + +// ExpressRouteCircuitsClientGetStatsResponse contains the response from method ExpressRouteCircuitsClient.GetStats. +type ExpressRouteCircuitsClientGetStatsResponse struct { + // Contains stats associated with the peering. + ExpressRouteCircuitStats +} + +// ExpressRouteCircuitsClientListAllResponse contains the response from method ExpressRouteCircuitsClient.NewListAllPager. +type ExpressRouteCircuitsClientListAllResponse struct { + // Response for ListExpressRouteCircuit API service call. + ExpressRouteCircuitListResult +} + +// ExpressRouteCircuitsClientListArpTableResponse contains the response from method ExpressRouteCircuitsClient.BeginListArpTable. +type ExpressRouteCircuitsClientListArpTableResponse struct { + // Response for ListArpTable associated with the Express Route Circuits API. + ExpressRouteCircuitsArpTableListResult +} + +// ExpressRouteCircuitsClientListResponse contains the response from method ExpressRouteCircuitsClient.NewListPager. +type ExpressRouteCircuitsClientListResponse struct { + // Response for ListExpressRouteCircuit API service call. + ExpressRouteCircuitListResult +} + +// ExpressRouteCircuitsClientListRoutesTableResponse contains the response from method ExpressRouteCircuitsClient.BeginListRoutesTable. +type ExpressRouteCircuitsClientListRoutesTableResponse struct { + // Response for ListRoutesTable associated with the Express Route Circuits API. + ExpressRouteCircuitsRoutesTableListResult +} + +// ExpressRouteCircuitsClientListRoutesTableSummaryResponse contains the response from method ExpressRouteCircuitsClient.BeginListRoutesTableSummary. +type ExpressRouteCircuitsClientListRoutesTableSummaryResponse struct { + // Response for ListRoutesTable associated with the Express Route Circuits API. + ExpressRouteCircuitsRoutesTableSummaryListResult +} + +// ExpressRouteCircuitsClientUpdateTagsResponse contains the response from method ExpressRouteCircuitsClient.UpdateTags. +type ExpressRouteCircuitsClientUpdateTagsResponse struct { + // ExpressRouteCircuit resource. + ExpressRouteCircuit +} + +// ExpressRouteConnectionsClientCreateOrUpdateResponse contains the response from method ExpressRouteConnectionsClient.BeginCreateOrUpdate. +type ExpressRouteConnectionsClientCreateOrUpdateResponse struct { + // ExpressRouteConnection resource. + ExpressRouteConnection +} + +// ExpressRouteConnectionsClientDeleteResponse contains the response from method ExpressRouteConnectionsClient.BeginDelete. +type ExpressRouteConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteConnectionsClientGetResponse contains the response from method ExpressRouteConnectionsClient.Get. +type ExpressRouteConnectionsClientGetResponse struct { + // ExpressRouteConnection resource. + ExpressRouteConnection +} + +// ExpressRouteConnectionsClientListResponse contains the response from method ExpressRouteConnectionsClient.List. +type ExpressRouteConnectionsClientListResponse struct { + // ExpressRouteConnection list. + ExpressRouteConnectionList +} + +// ExpressRouteCrossConnectionPeeringsClientCreateOrUpdateResponse contains the response from method ExpressRouteCrossConnectionPeeringsClient.BeginCreateOrUpdate. +type ExpressRouteCrossConnectionPeeringsClientCreateOrUpdateResponse struct { + // Peering in an ExpressRoute Cross Connection resource. + ExpressRouteCrossConnectionPeering +} + +// ExpressRouteCrossConnectionPeeringsClientDeleteResponse contains the response from method ExpressRouteCrossConnectionPeeringsClient.BeginDelete. +type ExpressRouteCrossConnectionPeeringsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCrossConnectionPeeringsClientGetResponse contains the response from method ExpressRouteCrossConnectionPeeringsClient.Get. +type ExpressRouteCrossConnectionPeeringsClientGetResponse struct { + // Peering in an ExpressRoute Cross Connection resource. + ExpressRouteCrossConnectionPeering +} + +// ExpressRouteCrossConnectionPeeringsClientListResponse contains the response from method ExpressRouteCrossConnectionPeeringsClient.NewListPager. +type ExpressRouteCrossConnectionPeeringsClientListResponse struct { + // Response for ListPeering API service call retrieves all peerings that belong to an ExpressRouteCrossConnection. + ExpressRouteCrossConnectionPeeringList +} + +// ExpressRouteCrossConnectionsClientCreateOrUpdateResponse contains the response from method ExpressRouteCrossConnectionsClient.BeginCreateOrUpdate. +type ExpressRouteCrossConnectionsClientCreateOrUpdateResponse struct { + // ExpressRouteCrossConnection resource. + ExpressRouteCrossConnection +} + +// ExpressRouteCrossConnectionsClientGetResponse contains the response from method ExpressRouteCrossConnectionsClient.Get. +type ExpressRouteCrossConnectionsClientGetResponse struct { + // ExpressRouteCrossConnection resource. + ExpressRouteCrossConnection +} + +// ExpressRouteCrossConnectionsClientListArpTableResponse contains the response from method ExpressRouteCrossConnectionsClient.BeginListArpTable. +type ExpressRouteCrossConnectionsClientListArpTableResponse struct { + // Response for ListArpTable associated with the Express Route Circuits API. + ExpressRouteCircuitsArpTableListResult +} + +// ExpressRouteCrossConnectionsClientListByResourceGroupResponse contains the response from method ExpressRouteCrossConnectionsClient.NewListByResourceGroupPager. +type ExpressRouteCrossConnectionsClientListByResourceGroupResponse struct { + // Response for ListExpressRouteCrossConnection API service call. + ExpressRouteCrossConnectionListResult +} + +// ExpressRouteCrossConnectionsClientListResponse contains the response from method ExpressRouteCrossConnectionsClient.NewListPager. +type ExpressRouteCrossConnectionsClientListResponse struct { + // Response for ListExpressRouteCrossConnection API service call. + ExpressRouteCrossConnectionListResult +} + +// ExpressRouteCrossConnectionsClientListRoutesTableResponse contains the response from method ExpressRouteCrossConnectionsClient.BeginListRoutesTable. +type ExpressRouteCrossConnectionsClientListRoutesTableResponse struct { + // Response for ListRoutesTable associated with the Express Route Circuits API. + ExpressRouteCircuitsRoutesTableListResult +} + +// ExpressRouteCrossConnectionsClientListRoutesTableSummaryResponse contains the response from method ExpressRouteCrossConnectionsClient.BeginListRoutesTableSummary. +type ExpressRouteCrossConnectionsClientListRoutesTableSummaryResponse struct { + // Response for ListRoutesTable associated with the Express Route Cross Connections. + ExpressRouteCrossConnectionsRoutesTableSummaryListResult +} + +// ExpressRouteCrossConnectionsClientUpdateTagsResponse contains the response from method ExpressRouteCrossConnectionsClient.UpdateTags. +type ExpressRouteCrossConnectionsClientUpdateTagsResponse struct { + // ExpressRouteCrossConnection resource. + ExpressRouteCrossConnection +} + +// ExpressRouteGatewaysClientCreateOrUpdateResponse contains the response from method ExpressRouteGatewaysClient.BeginCreateOrUpdate. +type ExpressRouteGatewaysClientCreateOrUpdateResponse struct { + // ExpressRoute gateway resource. + ExpressRouteGateway +} + +// ExpressRouteGatewaysClientDeleteResponse contains the response from method ExpressRouteGatewaysClient.BeginDelete. +type ExpressRouteGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteGatewaysClientGetResponse contains the response from method ExpressRouteGatewaysClient.Get. +type ExpressRouteGatewaysClientGetResponse struct { + // ExpressRoute gateway resource. + ExpressRouteGateway +} + +// ExpressRouteGatewaysClientListByResourceGroupResponse contains the response from method ExpressRouteGatewaysClient.ListByResourceGroup. +type ExpressRouteGatewaysClientListByResourceGroupResponse struct { + // List of ExpressRoute gateways. + ExpressRouteGatewayList +} + +// ExpressRouteGatewaysClientListBySubscriptionResponse contains the response from method ExpressRouteGatewaysClient.ListBySubscription. +type ExpressRouteGatewaysClientListBySubscriptionResponse struct { + // List of ExpressRoute gateways. + ExpressRouteGatewayList +} + +// ExpressRouteGatewaysClientUpdateTagsResponse contains the response from method ExpressRouteGatewaysClient.BeginUpdateTags. +type ExpressRouteGatewaysClientUpdateTagsResponse struct { + // ExpressRoute gateway resource. + ExpressRouteGateway +} + +// ExpressRouteLinksClientGetResponse contains the response from method ExpressRouteLinksClient.Get. +type ExpressRouteLinksClientGetResponse struct { + // ExpressRouteLink child resource definition. + ExpressRouteLink +} + +// ExpressRouteLinksClientListResponse contains the response from method ExpressRouteLinksClient.NewListPager. +type ExpressRouteLinksClientListResponse struct { + // Response for ListExpressRouteLinks API service call. + ExpressRouteLinkListResult +} + +// ExpressRoutePortAuthorizationsClientCreateOrUpdateResponse contains the response from method ExpressRoutePortAuthorizationsClient.BeginCreateOrUpdate. +type ExpressRoutePortAuthorizationsClientCreateOrUpdateResponse struct { + // ExpressRoutePort Authorization resource definition. + ExpressRoutePortAuthorization +} + +// ExpressRoutePortAuthorizationsClientDeleteResponse contains the response from method ExpressRoutePortAuthorizationsClient.BeginDelete. +type ExpressRoutePortAuthorizationsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRoutePortAuthorizationsClientGetResponse contains the response from method ExpressRoutePortAuthorizationsClient.Get. +type ExpressRoutePortAuthorizationsClientGetResponse struct { + // ExpressRoutePort Authorization resource definition. + ExpressRoutePortAuthorization +} + +// ExpressRoutePortAuthorizationsClientListResponse contains the response from method ExpressRoutePortAuthorizationsClient.NewListPager. +type ExpressRoutePortAuthorizationsClientListResponse struct { + // Response for ListExpressRoutePortAuthorizations API service call. + ExpressRoutePortAuthorizationListResult +} + +// ExpressRoutePortsClientCreateOrUpdateResponse contains the response from method ExpressRoutePortsClient.BeginCreateOrUpdate. +type ExpressRoutePortsClientCreateOrUpdateResponse struct { + // ExpressRoutePort resource definition. + ExpressRoutePort +} + +// ExpressRoutePortsClientDeleteResponse contains the response from method ExpressRoutePortsClient.BeginDelete. +type ExpressRoutePortsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRoutePortsClientGenerateLOAResponse contains the response from method ExpressRoutePortsClient.GenerateLOA. +type ExpressRoutePortsClientGenerateLOAResponse struct { + // Response for GenerateExpressRoutePortsLOA API service call. + GenerateExpressRoutePortsLOAResult +} + +// ExpressRoutePortsClientGetResponse contains the response from method ExpressRoutePortsClient.Get. +type ExpressRoutePortsClientGetResponse struct { + // ExpressRoutePort resource definition. + ExpressRoutePort +} + +// ExpressRoutePortsClientListByResourceGroupResponse contains the response from method ExpressRoutePortsClient.NewListByResourceGroupPager. +type ExpressRoutePortsClientListByResourceGroupResponse struct { + // Response for ListExpressRoutePorts API service call. + ExpressRoutePortListResult +} + +// ExpressRoutePortsClientListResponse contains the response from method ExpressRoutePortsClient.NewListPager. +type ExpressRoutePortsClientListResponse struct { + // Response for ListExpressRoutePorts API service call. + ExpressRoutePortListResult +} + +// ExpressRoutePortsClientUpdateTagsResponse contains the response from method ExpressRoutePortsClient.UpdateTags. +type ExpressRoutePortsClientUpdateTagsResponse struct { + // ExpressRoutePort resource definition. + ExpressRoutePort +} + +// ExpressRoutePortsLocationsClientGetResponse contains the response from method ExpressRoutePortsLocationsClient.Get. +type ExpressRoutePortsLocationsClientGetResponse struct { + // Definition of the ExpressRoutePorts peering location resource. + ExpressRoutePortsLocation +} + +// ExpressRoutePortsLocationsClientListResponse contains the response from method ExpressRoutePortsLocationsClient.NewListPager. +type ExpressRoutePortsLocationsClientListResponse struct { + // Response for ListExpressRoutePortsLocations API service call. + ExpressRoutePortsLocationListResult +} + +// ExpressRouteProviderPortsLocationClientListResponse contains the response from method ExpressRouteProviderPortsLocationClient.List. +type ExpressRouteProviderPortsLocationClientListResponse struct { + // Response for ListExpressRouteProviderPort API service call. + ExpressRouteProviderPortListResult +} + +// ExpressRouteServiceProvidersClientListResponse contains the response from method ExpressRouteServiceProvidersClient.NewListPager. +type ExpressRouteServiceProvidersClientListResponse struct { + // Response for the ListExpressRouteServiceProvider API service call. + ExpressRouteServiceProviderListResult +} + +// FirewallPoliciesClientCreateOrUpdateResponse contains the response from method FirewallPoliciesClient.BeginCreateOrUpdate. +type FirewallPoliciesClientCreateOrUpdateResponse struct { + // FirewallPolicy Resource. + FirewallPolicy +} + +// FirewallPoliciesClientDeleteResponse contains the response from method FirewallPoliciesClient.BeginDelete. +type FirewallPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// FirewallPoliciesClientGetResponse contains the response from method FirewallPoliciesClient.Get. +type FirewallPoliciesClientGetResponse struct { + // FirewallPolicy Resource. + FirewallPolicy +} + +// FirewallPoliciesClientListAllResponse contains the response from method FirewallPoliciesClient.NewListAllPager. +type FirewallPoliciesClientListAllResponse struct { + // Response for ListFirewallPolicies API service call. + FirewallPolicyListResult +} + +// FirewallPoliciesClientListResponse contains the response from method FirewallPoliciesClient.NewListPager. +type FirewallPoliciesClientListResponse struct { + // Response for ListFirewallPolicies API service call. + FirewallPolicyListResult +} + +// FirewallPoliciesClientUpdateTagsResponse contains the response from method FirewallPoliciesClient.UpdateTags. +type FirewallPoliciesClientUpdateTagsResponse struct { + // FirewallPolicy Resource. + FirewallPolicy +} + +// FirewallPolicyIdpsSignaturesClientListResponse contains the response from method FirewallPolicyIdpsSignaturesClient.List. +type FirewallPolicyIdpsSignaturesClientListResponse struct { + // Query result + QueryResults +} + +// FirewallPolicyIdpsSignaturesFilterValuesClientListResponse contains the response from method FirewallPolicyIdpsSignaturesFilterValuesClient.List. +type FirewallPolicyIdpsSignaturesFilterValuesClientListResponse struct { + // Describes the list of all possible values for a specific filter value + SignatureOverridesFilterValuesResponse +} + +// FirewallPolicyIdpsSignaturesOverridesClientGetResponse contains the response from method FirewallPolicyIdpsSignaturesOverridesClient.Get. +type FirewallPolicyIdpsSignaturesOverridesClientGetResponse struct { + // Contains all specific policy signatures overrides for the IDPS + SignaturesOverrides +} + +// FirewallPolicyIdpsSignaturesOverridesClientListResponse contains the response from method FirewallPolicyIdpsSignaturesOverridesClient.List. +type FirewallPolicyIdpsSignaturesOverridesClientListResponse struct { + // Describes an object containing an array with a single item + SignaturesOverridesList +} + +// FirewallPolicyIdpsSignaturesOverridesClientPatchResponse contains the response from method FirewallPolicyIdpsSignaturesOverridesClient.Patch. +type FirewallPolicyIdpsSignaturesOverridesClientPatchResponse struct { + // Contains all specific policy signatures overrides for the IDPS + SignaturesOverrides +} + +// FirewallPolicyIdpsSignaturesOverridesClientPutResponse contains the response from method FirewallPolicyIdpsSignaturesOverridesClient.Put. +type FirewallPolicyIdpsSignaturesOverridesClientPutResponse struct { + // Contains all specific policy signatures overrides for the IDPS + SignaturesOverrides +} + +// FirewallPolicyRuleCollectionGroupsClientCreateOrUpdateResponse contains the response from method FirewallPolicyRuleCollectionGroupsClient.BeginCreateOrUpdate. +type FirewallPolicyRuleCollectionGroupsClientCreateOrUpdateResponse struct { + // Rule Collection Group resource. + FirewallPolicyRuleCollectionGroup +} + +// FirewallPolicyRuleCollectionGroupsClientDeleteResponse contains the response from method FirewallPolicyRuleCollectionGroupsClient.BeginDelete. +type FirewallPolicyRuleCollectionGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// FirewallPolicyRuleCollectionGroupsClientGetResponse contains the response from method FirewallPolicyRuleCollectionGroupsClient.Get. +type FirewallPolicyRuleCollectionGroupsClientGetResponse struct { + // Rule Collection Group resource. + FirewallPolicyRuleCollectionGroup +} + +// FirewallPolicyRuleCollectionGroupsClientListResponse contains the response from method FirewallPolicyRuleCollectionGroupsClient.NewListPager. +type FirewallPolicyRuleCollectionGroupsClientListResponse struct { + // Response for ListFirewallPolicyRuleCollectionGroups API service call. + FirewallPolicyRuleCollectionGroupListResult +} + +// FlowLogsClientCreateOrUpdateResponse contains the response from method FlowLogsClient.BeginCreateOrUpdate. +type FlowLogsClientCreateOrUpdateResponse struct { + // A flow log resource. + FlowLog +} + +// FlowLogsClientDeleteResponse contains the response from method FlowLogsClient.BeginDelete. +type FlowLogsClientDeleteResponse struct { + // placeholder for future response values +} + +// FlowLogsClientGetResponse contains the response from method FlowLogsClient.Get. +type FlowLogsClientGetResponse struct { + // A flow log resource. + FlowLog +} + +// FlowLogsClientListResponse contains the response from method FlowLogsClient.NewListPager. +type FlowLogsClientListResponse struct { + // List of flow logs. + FlowLogListResult +} + +// FlowLogsClientUpdateTagsResponse contains the response from method FlowLogsClient.UpdateTags. +type FlowLogsClientUpdateTagsResponse struct { + // A flow log resource. + FlowLog +} + +// GroupsClientCreateOrUpdateResponse contains the response from method GroupsClient.CreateOrUpdate. +type GroupsClientCreateOrUpdateResponse struct { + // The network group resource + Group + + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// GroupsClientDeleteResponse contains the response from method GroupsClient.BeginDelete. +type GroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// GroupsClientGetResponse contains the response from method GroupsClient.Get. +type GroupsClientGetResponse struct { + // The network group resource + Group +} + +// GroupsClientListResponse contains the response from method GroupsClient.NewListPager. +type GroupsClientListResponse struct { + // Result of the request to list NetworkGroup. It contains a list of groups and a URL link to get the next set of results. + GroupListResult +} + +// HubRouteTablesClientCreateOrUpdateResponse contains the response from method HubRouteTablesClient.BeginCreateOrUpdate. +type HubRouteTablesClientCreateOrUpdateResponse struct { + // RouteTable resource in a virtual hub. + HubRouteTable +} + +// HubRouteTablesClientDeleteResponse contains the response from method HubRouteTablesClient.BeginDelete. +type HubRouteTablesClientDeleteResponse struct { + // placeholder for future response values +} + +// HubRouteTablesClientGetResponse contains the response from method HubRouteTablesClient.Get. +type HubRouteTablesClientGetResponse struct { + // RouteTable resource in a virtual hub. + HubRouteTable +} + +// HubRouteTablesClientListResponse contains the response from method HubRouteTablesClient.NewListPager. +type HubRouteTablesClientListResponse struct { + // List of RouteTables and a URL nextLink to get the next set of results. + ListHubRouteTablesResult +} + +// HubVirtualNetworkConnectionsClientCreateOrUpdateResponse contains the response from method HubVirtualNetworkConnectionsClient.BeginCreateOrUpdate. +type HubVirtualNetworkConnectionsClientCreateOrUpdateResponse struct { + // HubVirtualNetworkConnection Resource. + HubVirtualNetworkConnection +} + +// HubVirtualNetworkConnectionsClientDeleteResponse contains the response from method HubVirtualNetworkConnectionsClient.BeginDelete. +type HubVirtualNetworkConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// HubVirtualNetworkConnectionsClientGetResponse contains the response from method HubVirtualNetworkConnectionsClient.Get. +type HubVirtualNetworkConnectionsClientGetResponse struct { + // HubVirtualNetworkConnection Resource. + HubVirtualNetworkConnection +} + +// HubVirtualNetworkConnectionsClientListResponse contains the response from method HubVirtualNetworkConnectionsClient.NewListPager. +type HubVirtualNetworkConnectionsClientListResponse struct { + // List of HubVirtualNetworkConnections and a URL nextLink to get the next set of results. + ListHubVirtualNetworkConnectionsResult +} + +// IPAllocationsClientCreateOrUpdateResponse contains the response from method IPAllocationsClient.BeginCreateOrUpdate. +type IPAllocationsClientCreateOrUpdateResponse struct { + // IpAllocation resource. + IPAllocation +} + +// IPAllocationsClientDeleteResponse contains the response from method IPAllocationsClient.BeginDelete. +type IPAllocationsClientDeleteResponse struct { + // placeholder for future response values +} + +// IPAllocationsClientGetResponse contains the response from method IPAllocationsClient.Get. +type IPAllocationsClientGetResponse struct { + // IpAllocation resource. + IPAllocation +} + +// IPAllocationsClientListByResourceGroupResponse contains the response from method IPAllocationsClient.NewListByResourceGroupPager. +type IPAllocationsClientListByResourceGroupResponse struct { + // Response for the ListIpAllocations API service call. + IPAllocationListResult +} + +// IPAllocationsClientListResponse contains the response from method IPAllocationsClient.NewListPager. +type IPAllocationsClientListResponse struct { + // Response for the ListIpAllocations API service call. + IPAllocationListResult +} + +// IPAllocationsClientUpdateTagsResponse contains the response from method IPAllocationsClient.UpdateTags. +type IPAllocationsClientUpdateTagsResponse struct { + // IpAllocation resource. + IPAllocation +} + +// IPGroupsClientCreateOrUpdateResponse contains the response from method IPGroupsClient.BeginCreateOrUpdate. +type IPGroupsClientCreateOrUpdateResponse struct { + // The IpGroups resource information. + IPGroup +} + +// IPGroupsClientDeleteResponse contains the response from method IPGroupsClient.BeginDelete. +type IPGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// IPGroupsClientGetResponse contains the response from method IPGroupsClient.Get. +type IPGroupsClientGetResponse struct { + // The IpGroups resource information. + IPGroup +} + +// IPGroupsClientListByResourceGroupResponse contains the response from method IPGroupsClient.NewListByResourceGroupPager. +type IPGroupsClientListByResourceGroupResponse struct { + // Response for the ListIpGroups API service call. + IPGroupListResult +} + +// IPGroupsClientListResponse contains the response from method IPGroupsClient.NewListPager. +type IPGroupsClientListResponse struct { + // Response for the ListIpGroups API service call. + IPGroupListResult +} + +// IPGroupsClientUpdateGroupsResponse contains the response from method IPGroupsClient.UpdateGroups. +type IPGroupsClientUpdateGroupsResponse struct { + // The IpGroups resource information. + IPGroup +} + +// InboundNatRulesClientCreateOrUpdateResponse contains the response from method InboundNatRulesClient.BeginCreateOrUpdate. +type InboundNatRulesClientCreateOrUpdateResponse struct { + // Inbound NAT rule of the load balancer. + InboundNatRule +} + +// InboundNatRulesClientDeleteResponse contains the response from method InboundNatRulesClient.BeginDelete. +type InboundNatRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// InboundNatRulesClientGetResponse contains the response from method InboundNatRulesClient.Get. +type InboundNatRulesClientGetResponse struct { + // Inbound NAT rule of the load balancer. + InboundNatRule +} + +// InboundNatRulesClientListResponse contains the response from method InboundNatRulesClient.NewListPager. +type InboundNatRulesClientListResponse struct { + // Response for ListInboundNatRule API service call. + InboundNatRuleListResult +} + +// InboundSecurityRuleClientCreateOrUpdateResponse contains the response from method InboundSecurityRuleClient.BeginCreateOrUpdate. +type InboundSecurityRuleClientCreateOrUpdateResponse struct { + // NVA Inbound Security Rule resource. + InboundSecurityRule +} + +// InterfaceIPConfigurationsClientGetResponse contains the response from method InterfaceIPConfigurationsClient.Get. +type InterfaceIPConfigurationsClientGetResponse struct { + // IPConfiguration in a network interface. + InterfaceIPConfiguration +} + +// InterfaceIPConfigurationsClientListResponse contains the response from method InterfaceIPConfigurationsClient.NewListPager. +type InterfaceIPConfigurationsClientListResponse struct { + // Response for list ip configurations API service call. + InterfaceIPConfigurationListResult +} + +// InterfaceLoadBalancersClientListResponse contains the response from method InterfaceLoadBalancersClient.NewListPager. +type InterfaceLoadBalancersClientListResponse struct { + // Response for list ip configurations API service call. + InterfaceLoadBalancerListResult +} + +// InterfaceTapConfigurationsClientCreateOrUpdateResponse contains the response from method InterfaceTapConfigurationsClient.BeginCreateOrUpdate. +type InterfaceTapConfigurationsClientCreateOrUpdateResponse struct { + // Tap configuration in a Network Interface. + InterfaceTapConfiguration +} + +// InterfaceTapConfigurationsClientDeleteResponse contains the response from method InterfaceTapConfigurationsClient.BeginDelete. +type InterfaceTapConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// InterfaceTapConfigurationsClientGetResponse contains the response from method InterfaceTapConfigurationsClient.Get. +type InterfaceTapConfigurationsClientGetResponse struct { + // Tap configuration in a Network Interface. + InterfaceTapConfiguration +} + +// InterfaceTapConfigurationsClientListResponse contains the response from method InterfaceTapConfigurationsClient.NewListPager. +type InterfaceTapConfigurationsClientListResponse struct { + // Response for list tap configurations API service call. + InterfaceTapConfigurationListResult +} + +// InterfacesClientCreateOrUpdateResponse contains the response from method InterfacesClient.BeginCreateOrUpdate. +type InterfacesClientCreateOrUpdateResponse struct { + // A network interface in a resource group. + Interface +} + +// InterfacesClientDeleteResponse contains the response from method InterfacesClient.BeginDelete. +type InterfacesClientDeleteResponse struct { + // placeholder for future response values +} + +// InterfacesClientGetCloudServiceNetworkInterfaceResponse contains the response from method InterfacesClient.GetCloudServiceNetworkInterface. +type InterfacesClientGetCloudServiceNetworkInterfaceResponse struct { + // A network interface in a resource group. + Interface +} + +// InterfacesClientGetEffectiveRouteTableResponse contains the response from method InterfacesClient.BeginGetEffectiveRouteTable. +type InterfacesClientGetEffectiveRouteTableResponse struct { + // Response for list effective route API service call. + EffectiveRouteListResult +} + +// InterfacesClientGetResponse contains the response from method InterfacesClient.Get. +type InterfacesClientGetResponse struct { + // A network interface in a resource group. + Interface +} + +// InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse contains the response from method InterfacesClient.GetVirtualMachineScaleSetIPConfiguration. +type InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse struct { + // IPConfiguration in a network interface. + InterfaceIPConfiguration +} + +// InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse contains the response from method InterfacesClient.GetVirtualMachineScaleSetNetworkInterface. +type InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse struct { + // A network interface in a resource group. + Interface +} + +// InterfacesClientListAllResponse contains the response from method InterfacesClient.NewListAllPager. +type InterfacesClientListAllResponse struct { + // Response for the ListNetworkInterface API service call. + InterfaceListResult +} + +// InterfacesClientListCloudServiceNetworkInterfacesResponse contains the response from method InterfacesClient.NewListCloudServiceNetworkInterfacesPager. +type InterfacesClientListCloudServiceNetworkInterfacesResponse struct { + // Response for the ListNetworkInterface API service call. + InterfaceListResult +} + +// InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse contains the response from method InterfacesClient.NewListCloudServiceRoleInstanceNetworkInterfacesPager. +type InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse struct { + // Response for the ListNetworkInterface API service call. + InterfaceListResult +} + +// InterfacesClientListEffectiveNetworkSecurityGroupsResponse contains the response from method InterfacesClient.BeginListEffectiveNetworkSecurityGroups. +type InterfacesClientListEffectiveNetworkSecurityGroupsResponse struct { + // Response for list effective network security groups API service call. + EffectiveNetworkSecurityGroupListResult +} + +// InterfacesClientListResponse contains the response from method InterfacesClient.NewListPager. +type InterfacesClientListResponse struct { + // Response for the ListNetworkInterface API service call. + InterfaceListResult +} + +// InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse contains the response from method InterfacesClient.NewListVirtualMachineScaleSetIPConfigurationsPager. +type InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse struct { + // Response for list ip configurations API service call. + InterfaceIPConfigurationListResult +} + +// InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse contains the response from method InterfacesClient.NewListVirtualMachineScaleSetNetworkInterfacesPager. +type InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse struct { + // Response for the ListNetworkInterface API service call. + InterfaceListResult +} + +// InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse contains the response from method InterfacesClient.NewListVirtualMachineScaleSetVMNetworkInterfacesPager. +type InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse struct { + // Response for the ListNetworkInterface API service call. + InterfaceListResult +} + +// InterfacesClientUpdateTagsResponse contains the response from method InterfacesClient.UpdateTags. +type InterfacesClientUpdateTagsResponse struct { + // A network interface in a resource group. + Interface +} + +// LoadBalancerBackendAddressPoolsClientCreateOrUpdateResponse contains the response from method LoadBalancerBackendAddressPoolsClient.BeginCreateOrUpdate. +type LoadBalancerBackendAddressPoolsClientCreateOrUpdateResponse struct { + // Pool of backend IP addresses. + BackendAddressPool +} + +// LoadBalancerBackendAddressPoolsClientDeleteResponse contains the response from method LoadBalancerBackendAddressPoolsClient.BeginDelete. +type LoadBalancerBackendAddressPoolsClientDeleteResponse struct { + // placeholder for future response values +} + +// LoadBalancerBackendAddressPoolsClientGetResponse contains the response from method LoadBalancerBackendAddressPoolsClient.Get. +type LoadBalancerBackendAddressPoolsClientGetResponse struct { + // Pool of backend IP addresses. + BackendAddressPool +} + +// LoadBalancerBackendAddressPoolsClientListResponse contains the response from method LoadBalancerBackendAddressPoolsClient.NewListPager. +type LoadBalancerBackendAddressPoolsClientListResponse struct { + // Response for ListBackendAddressPool API service call. + LoadBalancerBackendAddressPoolListResult +} + +// LoadBalancerFrontendIPConfigurationsClientGetResponse contains the response from method LoadBalancerFrontendIPConfigurationsClient.Get. +type LoadBalancerFrontendIPConfigurationsClientGetResponse struct { + // Frontend IP address of the load balancer. + FrontendIPConfiguration +} + +// LoadBalancerFrontendIPConfigurationsClientListResponse contains the response from method LoadBalancerFrontendIPConfigurationsClient.NewListPager. +type LoadBalancerFrontendIPConfigurationsClientListResponse struct { + // Response for ListFrontendIPConfiguration API service call. + LoadBalancerFrontendIPConfigurationListResult +} + +// LoadBalancerLoadBalancingRulesClientGetResponse contains the response from method LoadBalancerLoadBalancingRulesClient.Get. +type LoadBalancerLoadBalancingRulesClientGetResponse struct { + // A load balancing rule for a load balancer. + LoadBalancingRule +} + +// LoadBalancerLoadBalancingRulesClientListResponse contains the response from method LoadBalancerLoadBalancingRulesClient.NewListPager. +type LoadBalancerLoadBalancingRulesClientListResponse struct { + // Response for ListLoadBalancingRule API service call. + LoadBalancerLoadBalancingRuleListResult +} + +// LoadBalancerNetworkInterfacesClientListResponse contains the response from method LoadBalancerNetworkInterfacesClient.NewListPager. +type LoadBalancerNetworkInterfacesClientListResponse struct { + // Response for the ListNetworkInterface API service call. + InterfaceListResult +} + +// LoadBalancerOutboundRulesClientGetResponse contains the response from method LoadBalancerOutboundRulesClient.Get. +type LoadBalancerOutboundRulesClientGetResponse struct { + // Outbound rule of the load balancer. + OutboundRule +} + +// LoadBalancerOutboundRulesClientListResponse contains the response from method LoadBalancerOutboundRulesClient.NewListPager. +type LoadBalancerOutboundRulesClientListResponse struct { + // Response for ListOutboundRule API service call. + LoadBalancerOutboundRuleListResult +} + +// LoadBalancerProbesClientGetResponse contains the response from method LoadBalancerProbesClient.Get. +type LoadBalancerProbesClientGetResponse struct { + // A load balancer probe. + Probe +} + +// LoadBalancerProbesClientListResponse contains the response from method LoadBalancerProbesClient.NewListPager. +type LoadBalancerProbesClientListResponse struct { + // Response for ListProbe API service call. + LoadBalancerProbeListResult +} + +// LoadBalancersClientCreateOrUpdateResponse contains the response from method LoadBalancersClient.BeginCreateOrUpdate. +type LoadBalancersClientCreateOrUpdateResponse struct { + // LoadBalancer resource. + LoadBalancer +} + +// LoadBalancersClientDeleteResponse contains the response from method LoadBalancersClient.BeginDelete. +type LoadBalancersClientDeleteResponse struct { + // placeholder for future response values +} + +// LoadBalancersClientGetResponse contains the response from method LoadBalancersClient.Get. +type LoadBalancersClientGetResponse struct { + // LoadBalancer resource. + LoadBalancer +} + +// LoadBalancersClientListAllResponse contains the response from method LoadBalancersClient.NewListAllPager. +type LoadBalancersClientListAllResponse struct { + // Response for ListLoadBalancers API service call. + LoadBalancerListResult +} + +// LoadBalancersClientListInboundNatRulePortMappingsResponse contains the response from method LoadBalancersClient.BeginListInboundNatRulePortMappings. +type LoadBalancersClientListInboundNatRulePortMappingsResponse struct { + // The response for a QueryInboundNatRulePortMapping API. + BackendAddressInboundNatRulePortMappings +} + +// LoadBalancersClientListResponse contains the response from method LoadBalancersClient.NewListPager. +type LoadBalancersClientListResponse struct { + // Response for ListLoadBalancers API service call. + LoadBalancerListResult +} + +// LoadBalancersClientMigrateToIPBasedResponse contains the response from method LoadBalancersClient.MigrateToIPBased. +type LoadBalancersClientMigrateToIPBasedResponse struct { + // The response for a migrateToIpBased API. + MigratedPools +} + +// LoadBalancersClientSwapPublicIPAddressesResponse contains the response from method LoadBalancersClient.BeginSwapPublicIPAddresses. +type LoadBalancersClientSwapPublicIPAddressesResponse struct { + // placeholder for future response values +} + +// LoadBalancersClientUpdateTagsResponse contains the response from method LoadBalancersClient.UpdateTags. +type LoadBalancersClientUpdateTagsResponse struct { + // LoadBalancer resource. + LoadBalancer +} + +// LocalNetworkGatewaysClientCreateOrUpdateResponse contains the response from method LocalNetworkGatewaysClient.BeginCreateOrUpdate. +type LocalNetworkGatewaysClientCreateOrUpdateResponse struct { + // A common class for general resource information. + LocalNetworkGateway +} + +// LocalNetworkGatewaysClientDeleteResponse contains the response from method LocalNetworkGatewaysClient.BeginDelete. +type LocalNetworkGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// LocalNetworkGatewaysClientGetResponse contains the response from method LocalNetworkGatewaysClient.Get. +type LocalNetworkGatewaysClientGetResponse struct { + // A common class for general resource information. + LocalNetworkGateway +} + +// LocalNetworkGatewaysClientListResponse contains the response from method LocalNetworkGatewaysClient.NewListPager. +type LocalNetworkGatewaysClientListResponse struct { + // Response for ListLocalNetworkGateways API service call. + LocalNetworkGatewayListResult +} + +// LocalNetworkGatewaysClientUpdateTagsResponse contains the response from method LocalNetworkGatewaysClient.UpdateTags. +type LocalNetworkGatewaysClientUpdateTagsResponse struct { + // A common class for general resource information. + LocalNetworkGateway +} + +// ManagementClientCheckDNSNameAvailabilityResponse contains the response from method ManagementClient.CheckDNSNameAvailability. +type ManagementClientCheckDNSNameAvailabilityResponse struct { + // Response for the CheckDnsNameAvailability API service call. + DNSNameAvailabilityResult +} + +// ManagementClientDeleteBastionShareableLinkResponse contains the response from method ManagementClient.BeginDeleteBastionShareableLink. +type ManagementClientDeleteBastionShareableLinkResponse struct { + // placeholder for future response values +} + +// ManagementClientDisconnectActiveSessionsResponse contains the response from method ManagementClient.NewDisconnectActiveSessionsPager. +type ManagementClientDisconnectActiveSessionsResponse struct { + // Response for DisconnectActiveSessions. + BastionSessionDeleteResult +} + +// ManagementClientExpressRouteProviderPortResponse contains the response from method ManagementClient.ExpressRouteProviderPort. +type ManagementClientExpressRouteProviderPortResponse struct { + // ExpressRouteProviderPort resource. + ExpressRouteProviderPort +} + +// ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse contains the response from method ManagementClient.BeginGeneratevirtualwanvpnserverconfigurationvpnprofile. +type ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse struct { + // Vpn Profile Response for package generation. + VPNProfileResponse +} + +// ManagementClientGetActiveSessionsResponse contains the response from method ManagementClient.BeginGetActiveSessions. +type ManagementClientGetActiveSessionsResponse struct { + // Response for GetActiveSessions. + BastionActiveSessionListResult +} + +// ManagementClientGetBastionShareableLinkResponse contains the response from method ManagementClient.NewGetBastionShareableLinkPager. +type ManagementClientGetBastionShareableLinkResponse struct { + // Response for all the Bastion Shareable Link endpoints. + BastionShareableLinkListResult +} + +// ManagementClientListActiveConnectivityConfigurationsResponse contains the response from method ManagementClient.ListActiveConnectivityConfigurations. +type ManagementClientListActiveConnectivityConfigurationsResponse struct { + // 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. + ActiveConnectivityConfigurationsListResult +} + +// ManagementClientListActiveSecurityAdminRulesResponse contains the response from method ManagementClient.ListActiveSecurityAdminRules. +type ManagementClientListActiveSecurityAdminRulesResponse struct { + // 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. + ActiveSecurityAdminRulesListResult +} + +// ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse contains the response from method ManagementClient.ListNetworkManagerEffectiveConnectivityConfigurations. +type ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse struct { + // Result of the request to list networkManagerEffectiveConnectivityConfiguration. It contains a list of groups and a skiptoken + // to get the next set of results. + ManagerEffectiveConnectivityConfigurationListResult +} + +// ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse contains the response from method ManagementClient.ListNetworkManagerEffectiveSecurityAdminRules. +type ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse struct { + // Result of the request to list networkManagerEffectiveSecurityAdminRules. It contains a list of groups and a skiptoken to + // get the next set of results. + ManagerEffectiveSecurityAdminRulesListResult +} + +// ManagementClientPutBastionShareableLinkResponse contains the response from method ManagementClient.BeginPutBastionShareableLink. +type ManagementClientPutBastionShareableLinkResponse struct { + // Response for all the Bastion Shareable Link endpoints. + BastionShareableLinkListResult +} + +// ManagementClientSupportedSecurityProvidersResponse contains the response from method ManagementClient.SupportedSecurityProviders. +type ManagementClientSupportedSecurityProvidersResponse struct { + // Collection of SecurityProviders. + VirtualWanSecurityProviders +} + +// ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse contains the response from method ManagementGroupNetworkManagerConnectionsClient.CreateOrUpdate. +type ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse struct { + // The Network Manager Connection resource + 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 { + // The Network Manager Connection resource + ManagerConnection +} + +// ManagementGroupNetworkManagerConnectionsClientListResponse contains the response from method ManagementGroupNetworkManagerConnectionsClient.NewListPager. +type ManagementGroupNetworkManagerConnectionsClientListResponse struct { + // List of network manager connections. + ManagerConnectionListResult +} + +// ManagerCommitsClientPostResponse contains the response from method ManagerCommitsClient.BeginPost. +type ManagerCommitsClientPostResponse struct { + // Network Manager Commit. + ManagerCommit +} + +// ManagerDeploymentStatusClientListResponse contains the response from method ManagerDeploymentStatusClient.List. +type ManagerDeploymentStatusClientListResponse struct { + // A list of Network Manager Deployment Status + ManagerDeploymentStatusListResult +} + +// ManagersClientCreateOrUpdateResponse contains the response from method ManagersClient.CreateOrUpdate. +type ManagersClientCreateOrUpdateResponse struct { + // The Managed Network resource + Manager +} + +// ManagersClientDeleteResponse contains the response from method ManagersClient.BeginDelete. +type ManagersClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagersClientGetResponse contains the response from method ManagersClient.Get. +type ManagersClientGetResponse struct { + // The Managed Network resource + Manager +} + +// ManagersClientListBySubscriptionResponse contains the response from method ManagersClient.NewListBySubscriptionPager. +type ManagersClientListBySubscriptionResponse struct { + // 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. + ManagerListResult +} + +// ManagersClientListResponse contains the response from method ManagersClient.NewListPager. +type ManagersClientListResponse struct { + // 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. + ManagerListResult +} + +// ManagersClientPatchResponse contains the response from method ManagersClient.Patch. +type ManagersClientPatchResponse struct { + // The Managed Network resource + Manager +} + +// NatGatewaysClientCreateOrUpdateResponse contains the response from method NatGatewaysClient.BeginCreateOrUpdate. +type NatGatewaysClientCreateOrUpdateResponse struct { + // Nat Gateway resource. + NatGateway +} + +// NatGatewaysClientDeleteResponse contains the response from method NatGatewaysClient.BeginDelete. +type NatGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// NatGatewaysClientGetResponse contains the response from method NatGatewaysClient.Get. +type NatGatewaysClientGetResponse struct { + // Nat Gateway resource. + NatGateway +} + +// NatGatewaysClientListAllResponse contains the response from method NatGatewaysClient.NewListAllPager. +type NatGatewaysClientListAllResponse struct { + // Response for ListNatGateways API service call. + NatGatewayListResult +} + +// NatGatewaysClientListResponse contains the response from method NatGatewaysClient.NewListPager. +type NatGatewaysClientListResponse struct { + // Response for ListNatGateways API service call. + NatGatewayListResult +} + +// NatGatewaysClientUpdateTagsResponse contains the response from method NatGatewaysClient.UpdateTags. +type NatGatewaysClientUpdateTagsResponse struct { + // Nat Gateway resource. + NatGateway +} + +// NatRulesClientCreateOrUpdateResponse contains the response from method NatRulesClient.BeginCreateOrUpdate. +type NatRulesClientCreateOrUpdateResponse struct { + // VpnGatewayNatRule Resource. + VPNGatewayNatRule +} + +// NatRulesClientDeleteResponse contains the response from method NatRulesClient.BeginDelete. +type NatRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// NatRulesClientGetResponse contains the response from method NatRulesClient.Get. +type NatRulesClientGetResponse struct { + // VpnGatewayNatRule Resource. + VPNGatewayNatRule +} + +// NatRulesClientListByVPNGatewayResponse contains the response from method NatRulesClient.NewListByVPNGatewayPager. +type NatRulesClientListByVPNGatewayResponse struct { + // 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. + ListVPNGatewayNatRulesResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // 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. + OperationListResult +} + +// P2SVPNGatewaysClientCreateOrUpdateResponse contains the response from method P2SVPNGatewaysClient.BeginCreateOrUpdate. +type P2SVPNGatewaysClientCreateOrUpdateResponse struct { + // P2SVpnGateway Resource. + P2SVPNGateway +} + +// P2SVPNGatewaysClientDeleteResponse contains the response from method P2SVPNGatewaysClient.BeginDelete. +type P2SVPNGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse contains the response from method P2SVPNGatewaysClient.BeginDisconnectP2SVPNConnections. +type P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse struct { + // placeholder for future response values +} + +// P2SVPNGatewaysClientGenerateVPNProfileResponse contains the response from method P2SVPNGatewaysClient.BeginGenerateVPNProfile. +type P2SVPNGatewaysClientGenerateVPNProfileResponse struct { + // Vpn Profile Response for package generation. + VPNProfileResponse +} + +// P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse contains the response from method P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealthDetailed. +type P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse struct { + // P2S Vpn connection detailed health written to sas url. + P2SVPNConnectionHealth +} + +// P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse contains the response from method P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealth. +type P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse struct { + // P2SVpnGateway Resource. + P2SVPNGateway +} + +// P2SVPNGatewaysClientGetResponse contains the response from method P2SVPNGatewaysClient.Get. +type P2SVPNGatewaysClientGetResponse struct { + // P2SVpnGateway Resource. + P2SVPNGateway +} + +// P2SVPNGatewaysClientListByResourceGroupResponse contains the response from method P2SVPNGatewaysClient.NewListByResourceGroupPager. +type P2SVPNGatewaysClientListByResourceGroupResponse struct { + // Result of the request to list P2SVpnGateways. It contains a list of P2SVpnGateways and a URL nextLink to get the next set + // of results. + ListP2SVPNGatewaysResult +} + +// P2SVPNGatewaysClientListResponse contains the response from method P2SVPNGatewaysClient.NewListPager. +type P2SVPNGatewaysClientListResponse struct { + // Result of the request to list P2SVpnGateways. It contains a list of P2SVpnGateways and a URL nextLink to get the next set + // of results. + ListP2SVPNGatewaysResult +} + +// P2SVPNGatewaysClientResetResponse contains the response from method P2SVPNGatewaysClient.BeginReset. +type P2SVPNGatewaysClientResetResponse struct { + // P2SVpnGateway Resource. + P2SVPNGateway +} + +// P2SVPNGatewaysClientUpdateTagsResponse contains the response from method P2SVPNGatewaysClient.BeginUpdateTags. +type P2SVPNGatewaysClientUpdateTagsResponse struct { + // P2SVpnGateway Resource. + P2SVPNGateway +} + +// PacketCapturesClientCreateResponse contains the response from method PacketCapturesClient.BeginCreate. +type PacketCapturesClientCreateResponse struct { + // Information about packet capture session. + PacketCaptureResult +} + +// PacketCapturesClientDeleteResponse contains the response from method PacketCapturesClient.BeginDelete. +type PacketCapturesClientDeleteResponse struct { + // placeholder for future response values +} + +// PacketCapturesClientGetResponse contains the response from method PacketCapturesClient.Get. +type PacketCapturesClientGetResponse struct { + // Information about packet capture session. + PacketCaptureResult +} + +// PacketCapturesClientGetStatusResponse contains the response from method PacketCapturesClient.BeginGetStatus. +type PacketCapturesClientGetStatusResponse struct { + // Status of packet capture session. + PacketCaptureQueryStatusResult +} + +// PacketCapturesClientListResponse contains the response from method PacketCapturesClient.NewListPager. +type PacketCapturesClientListResponse struct { + // List of packet capture sessions. + PacketCaptureListResult +} + +// PacketCapturesClientStopResponse contains the response from method PacketCapturesClient.BeginStop. +type PacketCapturesClientStopResponse struct { + // placeholder for future response values +} + +// PeerExpressRouteCircuitConnectionsClientGetResponse contains the response from method PeerExpressRouteCircuitConnectionsClient.Get. +type PeerExpressRouteCircuitConnectionsClientGetResponse struct { + // Peer Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. + PeerExpressRouteCircuitConnection +} + +// PeerExpressRouteCircuitConnectionsClientListResponse contains the response from method PeerExpressRouteCircuitConnectionsClient.NewListPager. +type PeerExpressRouteCircuitConnectionsClientListResponse struct { + // Response for ListPeeredConnections API service call retrieves all global reach peer circuit connections that belongs to + // a Private Peering for an ExpressRouteCircuit. + PeerExpressRouteCircuitConnectionListResult +} + +// PrivateDNSZoneGroupsClientCreateOrUpdateResponse contains the response from method PrivateDNSZoneGroupsClient.BeginCreateOrUpdate. +type PrivateDNSZoneGroupsClientCreateOrUpdateResponse struct { + // Private dns zone group resource. + PrivateDNSZoneGroup +} + +// PrivateDNSZoneGroupsClientDeleteResponse contains the response from method PrivateDNSZoneGroupsClient.BeginDelete. +type PrivateDNSZoneGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateDNSZoneGroupsClientGetResponse contains the response from method PrivateDNSZoneGroupsClient.Get. +type PrivateDNSZoneGroupsClientGetResponse struct { + // Private dns zone group resource. + PrivateDNSZoneGroup +} + +// PrivateDNSZoneGroupsClientListResponse contains the response from method PrivateDNSZoneGroupsClient.NewListPager. +type PrivateDNSZoneGroupsClientListResponse struct { + // Response for the ListPrivateDnsZoneGroups API service call. + PrivateDNSZoneGroupListResult +} + +// PrivateEndpointsClientCreateOrUpdateResponse contains the response from method PrivateEndpointsClient.BeginCreateOrUpdate. +type PrivateEndpointsClientCreateOrUpdateResponse struct { + // Private endpoint resource. + PrivateEndpoint +} + +// PrivateEndpointsClientDeleteResponse contains the response from method PrivateEndpointsClient.BeginDelete. +type PrivateEndpointsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointsClientGetResponse contains the response from method PrivateEndpointsClient.Get. +type PrivateEndpointsClientGetResponse struct { + // Private endpoint resource. + PrivateEndpoint +} + +// PrivateEndpointsClientListBySubscriptionResponse contains the response from method PrivateEndpointsClient.NewListBySubscriptionPager. +type PrivateEndpointsClientListBySubscriptionResponse struct { + // Response for the ListPrivateEndpoints API service call. + PrivateEndpointListResult +} + +// PrivateEndpointsClientListResponse contains the response from method PrivateEndpointsClient.NewListPager. +type PrivateEndpointsClientListResponse struct { + // Response for the ListPrivateEndpoints API service call. + PrivateEndpointListResult +} + +// PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityByResourceGroupResponse contains the response from method PrivateLinkServicesClient.BeginCheckPrivateLinkServiceVisibilityByResourceGroup. +type PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityByResourceGroupResponse struct { + // Response for the CheckPrivateLinkServiceVisibility API service call. + PrivateLinkServiceVisibility +} + +// PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityResponse contains the response from method PrivateLinkServicesClient.BeginCheckPrivateLinkServiceVisibility. +type PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityResponse struct { + // Response for the CheckPrivateLinkServiceVisibility API service call. + PrivateLinkServiceVisibility +} + +// PrivateLinkServicesClientCreateOrUpdateResponse contains the response from method PrivateLinkServicesClient.BeginCreateOrUpdate. +type PrivateLinkServicesClientCreateOrUpdateResponse struct { + // Private link service resource. + PrivateLinkService +} + +// PrivateLinkServicesClientDeletePrivateEndpointConnectionResponse contains the response from method PrivateLinkServicesClient.BeginDeletePrivateEndpointConnection. +type PrivateLinkServicesClientDeletePrivateEndpointConnectionResponse struct { + // placeholder for future response values +} + +// PrivateLinkServicesClientDeleteResponse contains the response from method PrivateLinkServicesClient.BeginDelete. +type PrivateLinkServicesClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateLinkServicesClientGetPrivateEndpointConnectionResponse contains the response from method PrivateLinkServicesClient.GetPrivateEndpointConnection. +type PrivateLinkServicesClientGetPrivateEndpointConnectionResponse struct { + // PrivateEndpointConnection resource. + PrivateEndpointConnection +} + +// PrivateLinkServicesClientGetResponse contains the response from method PrivateLinkServicesClient.Get. +type PrivateLinkServicesClientGetResponse struct { + // Private link service resource. + PrivateLinkService +} + +// PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse contains the response from method PrivateLinkServicesClient.NewListAutoApprovedPrivateLinkServicesByResourceGroupPager. +type PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse struct { + // An array of private link service id that can be linked to a private end point with auto approved. + AutoApprovedPrivateLinkServicesResult +} + +// PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse contains the response from method PrivateLinkServicesClient.NewListAutoApprovedPrivateLinkServicesPager. +type PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse struct { + // An array of private link service id that can be linked to a private end point with auto approved. + AutoApprovedPrivateLinkServicesResult +} + +// PrivateLinkServicesClientListBySubscriptionResponse contains the response from method PrivateLinkServicesClient.NewListBySubscriptionPager. +type PrivateLinkServicesClientListBySubscriptionResponse struct { + // Response for the ListPrivateLinkService API service call. + PrivateLinkServiceListResult +} + +// PrivateLinkServicesClientListPrivateEndpointConnectionsResponse contains the response from method PrivateLinkServicesClient.NewListPrivateEndpointConnectionsPager. +type PrivateLinkServicesClientListPrivateEndpointConnectionsResponse struct { + // Response for the ListPrivateEndpointConnection API service call. + PrivateEndpointConnectionListResult +} + +// PrivateLinkServicesClientListResponse contains the response from method PrivateLinkServicesClient.NewListPager. +type PrivateLinkServicesClientListResponse struct { + // Response for the ListPrivateLinkService API service call. + PrivateLinkServiceListResult +} + +// PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse contains the response from method PrivateLinkServicesClient.UpdatePrivateEndpointConnection. +type PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse struct { + // PrivateEndpointConnection resource. + PrivateEndpointConnection +} + +// ProfilesClientCreateOrUpdateResponse contains the response from method ProfilesClient.CreateOrUpdate. +type ProfilesClientCreateOrUpdateResponse struct { + // Network profile resource. + Profile +} + +// ProfilesClientDeleteResponse contains the response from method ProfilesClient.BeginDelete. +type ProfilesClientDeleteResponse struct { + // placeholder for future response values +} + +// ProfilesClientGetResponse contains the response from method ProfilesClient.Get. +type ProfilesClientGetResponse struct { + // Network profile resource. + Profile +} + +// ProfilesClientListAllResponse contains the response from method ProfilesClient.NewListAllPager. +type ProfilesClientListAllResponse struct { + // Response for ListNetworkProfiles API service call. + ProfileListResult +} + +// ProfilesClientListResponse contains the response from method ProfilesClient.NewListPager. +type ProfilesClientListResponse struct { + // Response for ListNetworkProfiles API service call. + ProfileListResult +} + +// ProfilesClientUpdateTagsResponse contains the response from method ProfilesClient.UpdateTags. +type ProfilesClientUpdateTagsResponse struct { + // Network profile resource. + Profile +} + +// PublicIPAddressesClientCreateOrUpdateResponse contains the response from method PublicIPAddressesClient.BeginCreateOrUpdate. +type PublicIPAddressesClientCreateOrUpdateResponse struct { + // Public IP address resource. + PublicIPAddress +} + +// PublicIPAddressesClientDdosProtectionStatusResponse contains the response from method PublicIPAddressesClient.BeginDdosProtectionStatus. +type PublicIPAddressesClientDdosProtectionStatusResponse struct { + // Response for GetPublicIpAddressDdosProtectionStatusOperation API service call. + PublicIPDdosProtectionStatusResult +} + +// PublicIPAddressesClientDeleteResponse contains the response from method PublicIPAddressesClient.BeginDelete. +type PublicIPAddressesClientDeleteResponse struct { + // placeholder for future response values +} + +// PublicIPAddressesClientGetCloudServicePublicIPAddressResponse contains the response from method PublicIPAddressesClient.GetCloudServicePublicIPAddress. +type PublicIPAddressesClientGetCloudServicePublicIPAddressResponse struct { + // Public IP address resource. + PublicIPAddress +} + +// PublicIPAddressesClientGetResponse contains the response from method PublicIPAddressesClient.Get. +type PublicIPAddressesClientGetResponse struct { + // Public IP address resource. + PublicIPAddress +} + +// PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse contains the response from method PublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress. +type PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse struct { + // Public IP address resource. + PublicIPAddress +} + +// PublicIPAddressesClientListAllResponse contains the response from method PublicIPAddressesClient.NewListAllPager. +type PublicIPAddressesClientListAllResponse struct { + // Response for ListPublicIpAddresses API service call. + PublicIPAddressListResult +} + +// PublicIPAddressesClientListCloudServicePublicIPAddressesResponse contains the response from method PublicIPAddressesClient.NewListCloudServicePublicIPAddressesPager. +type PublicIPAddressesClientListCloudServicePublicIPAddressesResponse struct { + // Response for ListPublicIpAddresses API service call. + PublicIPAddressListResult +} + +// PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse contains the response from method PublicIPAddressesClient.NewListCloudServiceRoleInstancePublicIPAddressesPager. +type PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse struct { + // Response for ListPublicIpAddresses API service call. + PublicIPAddressListResult +} + +// PublicIPAddressesClientListResponse contains the response from method PublicIPAddressesClient.NewListPager. +type PublicIPAddressesClientListResponse struct { + // Response for ListPublicIpAddresses API service call. + PublicIPAddressListResult +} + +// PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse contains the response from method PublicIPAddressesClient.NewListVirtualMachineScaleSetPublicIPAddressesPager. +type PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse struct { + // Response for ListPublicIpAddresses API service call. + PublicIPAddressListResult +} + +// PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse contains the response from method PublicIPAddressesClient.NewListVirtualMachineScaleSetVMPublicIPAddressesPager. +type PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse struct { + // Response for ListPublicIpAddresses API service call. + PublicIPAddressListResult +} + +// PublicIPAddressesClientUpdateTagsResponse contains the response from method PublicIPAddressesClient.UpdateTags. +type PublicIPAddressesClientUpdateTagsResponse struct { + // Public IP address resource. + PublicIPAddress +} + +// PublicIPPrefixesClientCreateOrUpdateResponse contains the response from method PublicIPPrefixesClient.BeginCreateOrUpdate. +type PublicIPPrefixesClientCreateOrUpdateResponse struct { + // Public IP prefix resource. + PublicIPPrefix +} + +// PublicIPPrefixesClientDeleteResponse contains the response from method PublicIPPrefixesClient.BeginDelete. +type PublicIPPrefixesClientDeleteResponse struct { + // placeholder for future response values +} + +// PublicIPPrefixesClientGetResponse contains the response from method PublicIPPrefixesClient.Get. +type PublicIPPrefixesClientGetResponse struct { + // Public IP prefix resource. + PublicIPPrefix +} + +// PublicIPPrefixesClientListAllResponse contains the response from method PublicIPPrefixesClient.NewListAllPager. +type PublicIPPrefixesClientListAllResponse struct { + // Response for ListPublicIpPrefixes API service call. + PublicIPPrefixListResult +} + +// PublicIPPrefixesClientListResponse contains the response from method PublicIPPrefixesClient.NewListPager. +type PublicIPPrefixesClientListResponse struct { + // Response for ListPublicIpPrefixes API service call. + PublicIPPrefixListResult +} + +// PublicIPPrefixesClientUpdateTagsResponse contains the response from method PublicIPPrefixesClient.UpdateTags. +type PublicIPPrefixesClientUpdateTagsResponse struct { + // Public IP prefix resource. + PublicIPPrefix +} + +// ResourceNavigationLinksClientListResponse contains the response from method ResourceNavigationLinksClient.List. +type ResourceNavigationLinksClientListResponse struct { + // Response for ResourceNavigationLinks_List operation. + ResourceNavigationLinksListResult +} + +// RouteFilterRulesClientCreateOrUpdateResponse contains the response from method RouteFilterRulesClient.BeginCreateOrUpdate. +type RouteFilterRulesClientCreateOrUpdateResponse struct { + // Route Filter Rule Resource. + RouteFilterRule +} + +// RouteFilterRulesClientDeleteResponse contains the response from method RouteFilterRulesClient.BeginDelete. +type RouteFilterRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// RouteFilterRulesClientGetResponse contains the response from method RouteFilterRulesClient.Get. +type RouteFilterRulesClientGetResponse struct { + // Route Filter Rule Resource. + RouteFilterRule +} + +// RouteFilterRulesClientListByRouteFilterResponse contains the response from method RouteFilterRulesClient.NewListByRouteFilterPager. +type RouteFilterRulesClientListByRouteFilterResponse struct { + // Response for the ListRouteFilterRules API service call. + RouteFilterRuleListResult +} + +// RouteFiltersClientCreateOrUpdateResponse contains the response from method RouteFiltersClient.BeginCreateOrUpdate. +type RouteFiltersClientCreateOrUpdateResponse struct { + // Route Filter Resource. + RouteFilter +} + +// RouteFiltersClientDeleteResponse contains the response from method RouteFiltersClient.BeginDelete. +type RouteFiltersClientDeleteResponse struct { + // placeholder for future response values +} + +// RouteFiltersClientGetResponse contains the response from method RouteFiltersClient.Get. +type RouteFiltersClientGetResponse struct { + // Route Filter Resource. + RouteFilter +} + +// RouteFiltersClientListByResourceGroupResponse contains the response from method RouteFiltersClient.NewListByResourceGroupPager. +type RouteFiltersClientListByResourceGroupResponse struct { + // Response for the ListRouteFilters API service call. + RouteFilterListResult +} + +// RouteFiltersClientListResponse contains the response from method RouteFiltersClient.NewListPager. +type RouteFiltersClientListResponse struct { + // Response for the ListRouteFilters API service call. + RouteFilterListResult +} + +// RouteFiltersClientUpdateTagsResponse contains the response from method RouteFiltersClient.UpdateTags. +type RouteFiltersClientUpdateTagsResponse struct { + // Route Filter Resource. + RouteFilter +} + +// RouteMapsClientCreateOrUpdateResponse contains the response from method RouteMapsClient.BeginCreateOrUpdate. +type RouteMapsClientCreateOrUpdateResponse struct { + // The RouteMap child resource of a Virtual hub. + RouteMap +} + +// RouteMapsClientDeleteResponse contains the response from method RouteMapsClient.BeginDelete. +type RouteMapsClientDeleteResponse struct { + // placeholder for future response values +} + +// RouteMapsClientGetResponse contains the response from method RouteMapsClient.Get. +type RouteMapsClientGetResponse struct { + // The RouteMap child resource of a Virtual hub. + RouteMap +} + +// RouteMapsClientListResponse contains the response from method RouteMapsClient.NewListPager. +type RouteMapsClientListResponse struct { + // List of RouteMaps and a URL nextLink to get the next set of results. + ListRouteMapsResult +} + +// RouteTablesClientCreateOrUpdateResponse contains the response from method RouteTablesClient.BeginCreateOrUpdate. +type RouteTablesClientCreateOrUpdateResponse struct { + // Route table resource. + RouteTable +} + +// RouteTablesClientDeleteResponse contains the response from method RouteTablesClient.BeginDelete. +type RouteTablesClientDeleteResponse struct { + // placeholder for future response values +} + +// RouteTablesClientGetResponse contains the response from method RouteTablesClient.Get. +type RouteTablesClientGetResponse struct { + // Route table resource. + RouteTable +} + +// RouteTablesClientListAllResponse contains the response from method RouteTablesClient.NewListAllPager. +type RouteTablesClientListAllResponse struct { + // Response for the ListRouteTable API service call. + RouteTableListResult +} + +// RouteTablesClientListResponse contains the response from method RouteTablesClient.NewListPager. +type RouteTablesClientListResponse struct { + // Response for the ListRouteTable API service call. + RouteTableListResult +} + +// RouteTablesClientUpdateTagsResponse contains the response from method RouteTablesClient.UpdateTags. +type RouteTablesClientUpdateTagsResponse struct { + // Route table resource. + RouteTable +} + +// RoutesClientCreateOrUpdateResponse contains the response from method RoutesClient.BeginCreateOrUpdate. +type RoutesClientCreateOrUpdateResponse struct { + // Route resource. + Route +} + +// RoutesClientDeleteResponse contains the response from method RoutesClient.BeginDelete. +type RoutesClientDeleteResponse struct { + // placeholder for future response values +} + +// RoutesClientGetResponse contains the response from method RoutesClient.Get. +type RoutesClientGetResponse struct { + // Route resource. + Route +} + +// RoutesClientListResponse contains the response from method RoutesClient.NewListPager. +type RoutesClientListResponse struct { + // Response for the ListRoute API service call. + RouteListResult +} + +// RoutingIntentClientCreateOrUpdateResponse contains the response from method RoutingIntentClient.BeginCreateOrUpdate. +type RoutingIntentClientCreateOrUpdateResponse struct { + // The routing intent child resource of a Virtual hub. + RoutingIntent +} + +// RoutingIntentClientDeleteResponse contains the response from method RoutingIntentClient.BeginDelete. +type RoutingIntentClientDeleteResponse struct { + // placeholder for future response values +} + +// RoutingIntentClientGetResponse contains the response from method RoutingIntentClient.Get. +type RoutingIntentClientGetResponse struct { + // The routing intent child resource of a Virtual hub. + RoutingIntent +} + +// RoutingIntentClientListResponse contains the response from method RoutingIntentClient.NewListPager. +type RoutingIntentClientListResponse struct { + // List of the routing intent result and a URL nextLink to get the next set of results. + ListRoutingIntentResult +} + +// ScopeConnectionsClientCreateOrUpdateResponse contains the response from method ScopeConnectionsClient.CreateOrUpdate. +type ScopeConnectionsClientCreateOrUpdateResponse struct { + // The Scope Connections resource + 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 { + // The Scope Connections resource + ScopeConnection +} + +// ScopeConnectionsClientListResponse contains the response from method ScopeConnectionsClient.NewListPager. +type ScopeConnectionsClientListResponse struct { + // List of scope connections. + ScopeConnectionListResult +} + +// SecurityAdminConfigurationsClientCreateOrUpdateResponse contains the response from method SecurityAdminConfigurationsClient.CreateOrUpdate. +type SecurityAdminConfigurationsClientCreateOrUpdateResponse struct { + // Defines the security admin configuration + SecurityAdminConfiguration +} + +// SecurityAdminConfigurationsClientDeleteResponse contains the response from method SecurityAdminConfigurationsClient.BeginDelete. +type SecurityAdminConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityAdminConfigurationsClientGetResponse contains the response from method SecurityAdminConfigurationsClient.Get. +type SecurityAdminConfigurationsClientGetResponse struct { + // Defines the security admin configuration + SecurityAdminConfiguration +} + +// SecurityAdminConfigurationsClientListResponse contains the response from method SecurityAdminConfigurationsClient.NewListPager. +type SecurityAdminConfigurationsClientListResponse struct { + // A list of network manager security admin configurations + SecurityAdminConfigurationListResult +} + +// SecurityGroupsClientCreateOrUpdateResponse contains the response from method SecurityGroupsClient.BeginCreateOrUpdate. +type SecurityGroupsClientCreateOrUpdateResponse struct { + // NetworkSecurityGroup resource. + SecurityGroup +} + +// SecurityGroupsClientDeleteResponse contains the response from method SecurityGroupsClient.BeginDelete. +type SecurityGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityGroupsClientGetResponse contains the response from method SecurityGroupsClient.Get. +type SecurityGroupsClientGetResponse struct { + // NetworkSecurityGroup resource. + SecurityGroup +} + +// SecurityGroupsClientListAllResponse contains the response from method SecurityGroupsClient.NewListAllPager. +type SecurityGroupsClientListAllResponse struct { + // Response for ListNetworkSecurityGroups API service call. + SecurityGroupListResult +} + +// SecurityGroupsClientListResponse contains the response from method SecurityGroupsClient.NewListPager. +type SecurityGroupsClientListResponse struct { + // Response for ListNetworkSecurityGroups API service call. + SecurityGroupListResult +} + +// SecurityGroupsClientUpdateTagsResponse contains the response from method SecurityGroupsClient.UpdateTags. +type SecurityGroupsClientUpdateTagsResponse struct { + // NetworkSecurityGroup resource. + SecurityGroup +} + +// SecurityPartnerProvidersClientCreateOrUpdateResponse contains the response from method SecurityPartnerProvidersClient.BeginCreateOrUpdate. +type SecurityPartnerProvidersClientCreateOrUpdateResponse struct { + // Security Partner Provider resource. + SecurityPartnerProvider +} + +// SecurityPartnerProvidersClientDeleteResponse contains the response from method SecurityPartnerProvidersClient.BeginDelete. +type SecurityPartnerProvidersClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityPartnerProvidersClientGetResponse contains the response from method SecurityPartnerProvidersClient.Get. +type SecurityPartnerProvidersClientGetResponse struct { + // Security Partner Provider resource. + SecurityPartnerProvider +} + +// SecurityPartnerProvidersClientListByResourceGroupResponse contains the response from method SecurityPartnerProvidersClient.NewListByResourceGroupPager. +type SecurityPartnerProvidersClientListByResourceGroupResponse struct { + // Response for ListSecurityPartnerProviders API service call. + SecurityPartnerProviderListResult +} + +// SecurityPartnerProvidersClientListResponse contains the response from method SecurityPartnerProvidersClient.NewListPager. +type SecurityPartnerProvidersClientListResponse struct { + // Response for ListSecurityPartnerProviders API service call. + SecurityPartnerProviderListResult +} + +// SecurityPartnerProvidersClientUpdateTagsResponse contains the response from method SecurityPartnerProvidersClient.UpdateTags. +type SecurityPartnerProvidersClientUpdateTagsResponse struct { + // Security Partner Provider resource. + SecurityPartnerProvider +} + +// SecurityRulesClientCreateOrUpdateResponse contains the response from method SecurityRulesClient.BeginCreateOrUpdate. +type SecurityRulesClientCreateOrUpdateResponse struct { + // Network security rule. + SecurityRule +} + +// SecurityRulesClientDeleteResponse contains the response from method SecurityRulesClient.BeginDelete. +type SecurityRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityRulesClientGetResponse contains the response from method SecurityRulesClient.Get. +type SecurityRulesClientGetResponse struct { + // Network security rule. + SecurityRule +} + +// SecurityRulesClientListResponse contains the response from method SecurityRulesClient.NewListPager. +type SecurityRulesClientListResponse struct { + // Response for ListSecurityRule API service call. Retrieves all security rules that belongs to a network security group. + SecurityRuleListResult +} + +// ServiceAssociationLinksClientListResponse contains the response from method ServiceAssociationLinksClient.List. +type ServiceAssociationLinksClientListResponse struct { + // Response for ServiceAssociationLinks_List operation. + ServiceAssociationLinksListResult +} + +// ServiceEndpointPoliciesClientCreateOrUpdateResponse contains the response from method ServiceEndpointPoliciesClient.BeginCreateOrUpdate. +type ServiceEndpointPoliciesClientCreateOrUpdateResponse struct { + // Service End point policy resource. + ServiceEndpointPolicy +} + +// ServiceEndpointPoliciesClientDeleteResponse contains the response from method ServiceEndpointPoliciesClient.BeginDelete. +type ServiceEndpointPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// ServiceEndpointPoliciesClientGetResponse contains the response from method ServiceEndpointPoliciesClient.Get. +type ServiceEndpointPoliciesClientGetResponse struct { + // Service End point policy resource. + ServiceEndpointPolicy +} + +// ServiceEndpointPoliciesClientListByResourceGroupResponse contains the response from method ServiceEndpointPoliciesClient.NewListByResourceGroupPager. +type ServiceEndpointPoliciesClientListByResourceGroupResponse struct { + // Response for ListServiceEndpointPolicies API service call. + ServiceEndpointPolicyListResult +} + +// ServiceEndpointPoliciesClientListResponse contains the response from method ServiceEndpointPoliciesClient.NewListPager. +type ServiceEndpointPoliciesClientListResponse struct { + // Response for ListServiceEndpointPolicies API service call. + ServiceEndpointPolicyListResult +} + +// ServiceEndpointPoliciesClientUpdateTagsResponse contains the response from method ServiceEndpointPoliciesClient.UpdateTags. +type ServiceEndpointPoliciesClientUpdateTagsResponse struct { + // Service End point policy resource. + ServiceEndpointPolicy +} + +// ServiceEndpointPolicyDefinitionsClientCreateOrUpdateResponse contains the response from method ServiceEndpointPolicyDefinitionsClient.BeginCreateOrUpdate. +type ServiceEndpointPolicyDefinitionsClientCreateOrUpdateResponse struct { + // Service Endpoint policy definitions. + ServiceEndpointPolicyDefinition +} + +// ServiceEndpointPolicyDefinitionsClientDeleteResponse contains the response from method ServiceEndpointPolicyDefinitionsClient.BeginDelete. +type ServiceEndpointPolicyDefinitionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ServiceEndpointPolicyDefinitionsClientGetResponse contains the response from method ServiceEndpointPolicyDefinitionsClient.Get. +type ServiceEndpointPolicyDefinitionsClientGetResponse struct { + // Service Endpoint policy definitions. + ServiceEndpointPolicyDefinition +} + +// ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse contains the response from method ServiceEndpointPolicyDefinitionsClient.NewListByResourceGroupPager. +type ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse struct { + // Response for ListServiceEndpointPolicyDefinition API service call. Retrieves all service endpoint policy definition that + // belongs to a service endpoint policy. + ServiceEndpointPolicyDefinitionListResult +} + +// ServiceTagInformationClientListResponse contains the response from method ServiceTagInformationClient.NewListPager. +type ServiceTagInformationClientListResponse struct { + // Response for Get ServiceTagInformation API service call. Retrieves the list of service tag information resources. + ServiceTagInformationListResult +} + +// ServiceTagsClientListResponse contains the response from method ServiceTagsClient.List. +type ServiceTagsClientListResponse struct { + // Response for the ListServiceTags API service call. + ServiceTagsListResult +} + +// StaticMembersClientCreateOrUpdateResponse contains the response from method StaticMembersClient.CreateOrUpdate. +type StaticMembersClientCreateOrUpdateResponse struct { + // StaticMember Item. + 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 Item. + StaticMember +} + +// StaticMembersClientListResponse contains the response from method StaticMembersClient.NewListPager. +type StaticMembersClientListResponse struct { + // Result of the request to list StaticMember. It contains a list of groups and a URL link to get the next set of results. + StaticMemberListResult +} + +// SubnetsClientCreateOrUpdateResponse contains the response from method SubnetsClient.BeginCreateOrUpdate. +type SubnetsClientCreateOrUpdateResponse struct { + // Subnet in a virtual network resource. + Subnet +} + +// SubnetsClientDeleteResponse contains the response from method SubnetsClient.BeginDelete. +type SubnetsClientDeleteResponse struct { + // placeholder for future response values +} + +// SubnetsClientGetResponse contains the response from method SubnetsClient.Get. +type SubnetsClientGetResponse struct { + // Subnet in a virtual network resource. + Subnet +} + +// SubnetsClientListResponse contains the response from method SubnetsClient.NewListPager. +type SubnetsClientListResponse struct { + // Response for ListSubnets API service callRetrieves all subnet that belongs to a virtual network. + SubnetListResult +} + +// SubnetsClientPrepareNetworkPoliciesResponse contains the response from method SubnetsClient.BeginPrepareNetworkPolicies. +type SubnetsClientPrepareNetworkPoliciesResponse struct { + // placeholder for future response values +} + +// SubnetsClientUnprepareNetworkPoliciesResponse contains the response from method SubnetsClient.BeginUnprepareNetworkPolicies. +type SubnetsClientUnprepareNetworkPoliciesResponse struct { + // placeholder for future response values +} + +// SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse contains the response from method SubscriptionNetworkManagerConnectionsClient.CreateOrUpdate. +type SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse struct { + // The Network Manager Connection resource + 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 { + // The Network Manager Connection resource + ManagerConnection +} + +// SubscriptionNetworkManagerConnectionsClientListResponse contains the response from method SubscriptionNetworkManagerConnectionsClient.NewListPager. +type SubscriptionNetworkManagerConnectionsClientListResponse struct { + // List of network manager connections. + ManagerConnectionListResult +} + +// UsagesClientListResponse contains the response from method UsagesClient.NewListPager. +type UsagesClientListResponse struct { + // The list usages operation response. + UsagesListResult +} + +// VPNConnectionsClientCreateOrUpdateResponse contains the response from method VPNConnectionsClient.BeginCreateOrUpdate. +type VPNConnectionsClientCreateOrUpdateResponse struct { + // VpnConnection Resource. + VPNConnection +} + +// VPNConnectionsClientDeleteResponse contains the response from method VPNConnectionsClient.BeginDelete. +type VPNConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VPNConnectionsClientGetResponse contains the response from method VPNConnectionsClient.Get. +type VPNConnectionsClientGetResponse struct { + // VpnConnection Resource. + VPNConnection +} + +// VPNConnectionsClientListByVPNGatewayResponse contains the response from method VPNConnectionsClient.NewListByVPNGatewayPager. +type VPNConnectionsClientListByVPNGatewayResponse struct { + // 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. + ListVPNConnectionsResult +} + +// VPNConnectionsClientStartPacketCaptureResponse contains the response from method VPNConnectionsClient.BeginStartPacketCapture. +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.BeginStopPacketCapture. +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.BeginCreateOrUpdate. +type VPNGatewaysClientCreateOrUpdateResponse struct { + // VpnGateway Resource. + VPNGateway +} + +// VPNGatewaysClientDeleteResponse contains the response from method VPNGatewaysClient.BeginDelete. +type VPNGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// VPNGatewaysClientGetResponse contains the response from method VPNGatewaysClient.Get. +type VPNGatewaysClientGetResponse struct { + // VpnGateway Resource. + VPNGateway +} + +// VPNGatewaysClientListByResourceGroupResponse contains the response from method VPNGatewaysClient.NewListByResourceGroupPager. +type VPNGatewaysClientListByResourceGroupResponse struct { + // Result of the request to list VpnGateways. It contains a list of VpnGateways and a URL nextLink to get the next set of + // results. + ListVPNGatewaysResult +} + +// VPNGatewaysClientListResponse contains the response from method VPNGatewaysClient.NewListPager. +type VPNGatewaysClientListResponse struct { + // Result of the request to list VpnGateways. It contains a list of VpnGateways and a URL nextLink to get the next set of + // results. + ListVPNGatewaysResult +} + +// VPNGatewaysClientResetResponse contains the response from method VPNGatewaysClient.BeginReset. +type VPNGatewaysClientResetResponse struct { + // VpnGateway Resource. + VPNGateway +} + +// VPNGatewaysClientStartPacketCaptureResponse contains the response from method VPNGatewaysClient.BeginStartPacketCapture. +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.BeginStopPacketCapture. +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.BeginUpdateTags. +type VPNGatewaysClientUpdateTagsResponse struct { + // VpnGateway Resource. + VPNGateway +} + +// VPNLinkConnectionsClientGetIkeSasResponse contains the response from method VPNLinkConnectionsClient.BeginGetIkeSas. +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.NewListByVPNConnectionPager. +type VPNLinkConnectionsClientListByVPNConnectionResponse struct { + // 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. + ListVPNSiteLinkConnectionsResult +} + +// VPNLinkConnectionsClientResetConnectionResponse contains the response from method VPNLinkConnectionsClient.BeginResetConnection. +type VPNLinkConnectionsClientResetConnectionResponse struct { + // placeholder for future response values +} + +// VPNServerConfigurationsAssociatedWithVirtualWanClientListResponse contains the response from method VPNServerConfigurationsAssociatedWithVirtualWanClient.BeginList. +type VPNServerConfigurationsAssociatedWithVirtualWanClientListResponse struct { + // VpnServerConfigurations list associated with VirtualWan Response. + VPNServerConfigurationsResponse +} + +// VPNServerConfigurationsClientCreateOrUpdateResponse contains the response from method VPNServerConfigurationsClient.BeginCreateOrUpdate. +type VPNServerConfigurationsClientCreateOrUpdateResponse struct { + // VpnServerConfiguration Resource. + VPNServerConfiguration +} + +// VPNServerConfigurationsClientDeleteResponse contains the response from method VPNServerConfigurationsClient.BeginDelete. +type VPNServerConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// VPNServerConfigurationsClientGetResponse contains the response from method VPNServerConfigurationsClient.Get. +type VPNServerConfigurationsClientGetResponse struct { + // VpnServerConfiguration Resource. + VPNServerConfiguration +} + +// VPNServerConfigurationsClientListByResourceGroupResponse contains the response from method VPNServerConfigurationsClient.NewListByResourceGroupPager. +type VPNServerConfigurationsClientListByResourceGroupResponse struct { + // 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. + ListVPNServerConfigurationsResult +} + +// VPNServerConfigurationsClientListResponse contains the response from method VPNServerConfigurationsClient.NewListPager. +type VPNServerConfigurationsClientListResponse struct { + // 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. + ListVPNServerConfigurationsResult +} + +// VPNServerConfigurationsClientUpdateTagsResponse contains the response from method VPNServerConfigurationsClient.UpdateTags. +type VPNServerConfigurationsClientUpdateTagsResponse struct { + // VpnServerConfiguration Resource. + VPNServerConfiguration +} + +// VPNSiteLinkConnectionsClientGetResponse contains the response from method VPNSiteLinkConnectionsClient.Get. +type VPNSiteLinkConnectionsClientGetResponse struct { + // VpnSiteLinkConnection Resource. + VPNSiteLinkConnection +} + +// VPNSiteLinksClientGetResponse contains the response from method VPNSiteLinksClient.Get. +type VPNSiteLinksClientGetResponse struct { + // VpnSiteLink Resource. + VPNSiteLink +} + +// VPNSiteLinksClientListByVPNSiteResponse contains the response from method VPNSiteLinksClient.NewListByVPNSitePager. +type VPNSiteLinksClientListByVPNSiteResponse struct { + // Result of the request to list VpnSiteLinks. It contains a list of VpnSiteLinks and a URL nextLink to get the next set of + // results. + ListVPNSiteLinksResult +} + +// VPNSitesClientCreateOrUpdateResponse contains the response from method VPNSitesClient.BeginCreateOrUpdate. +type VPNSitesClientCreateOrUpdateResponse struct { + // VpnSite Resource. + VPNSite +} + +// VPNSitesClientDeleteResponse contains the response from method VPNSitesClient.BeginDelete. +type VPNSitesClientDeleteResponse struct { + // placeholder for future response values +} + +// VPNSitesClientGetResponse contains the response from method VPNSitesClient.Get. +type VPNSitesClientGetResponse struct { + // VpnSite Resource. + VPNSite +} + +// VPNSitesClientListByResourceGroupResponse contains the response from method VPNSitesClient.NewListByResourceGroupPager. +type VPNSitesClientListByResourceGroupResponse struct { + // Result of the request to list VpnSites. It contains a list of VpnSites and a URL nextLink to get the next set of results. + ListVPNSitesResult +} + +// VPNSitesClientListResponse contains the response from method VPNSitesClient.NewListPager. +type VPNSitesClientListResponse struct { + // Result of the request to list VpnSites. It contains a list of VpnSites and a URL nextLink to get the next set of results. + ListVPNSitesResult +} + +// VPNSitesClientUpdateTagsResponse contains the response from method VPNSitesClient.UpdateTags. +type VPNSitesClientUpdateTagsResponse struct { + // VpnSite Resource. + VPNSite +} + +// VPNSitesConfigurationClientDownloadResponse contains the response from method VPNSitesConfigurationClient.BeginDownload. +type VPNSitesConfigurationClientDownloadResponse struct { + // placeholder for future response values +} + +// VipSwapClientCreateResponse contains the response from method VipSwapClient.BeginCreate. +type VipSwapClientCreateResponse struct { + // placeholder for future response values +} + +// VipSwapClientGetResponse contains the response from method VipSwapClient.Get. +type VipSwapClientGetResponse struct { + // SwapResource to represent slot type on the specified cloud service. + SwapResource +} + +// VipSwapClientListResponse contains the response from method VipSwapClient.List. +type VipSwapClientListResponse struct { + // SwapResource List with single entry to represent slot type on the specified cloud service. + SwapResourceListResult +} + +// VirtualApplianceConnectionsClientCreateOrUpdateResponse contains the response from method VirtualApplianceConnectionsClient.BeginCreateOrUpdate. +type VirtualApplianceConnectionsClientCreateOrUpdateResponse struct { + // NetworkVirtualApplianceConnection resource. + VirtualApplianceConnection +} + +// VirtualApplianceConnectionsClientDeleteResponse contains the response from method VirtualApplianceConnectionsClient.BeginDelete. +type VirtualApplianceConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualApplianceConnectionsClientGetResponse contains the response from method VirtualApplianceConnectionsClient.Get. +type VirtualApplianceConnectionsClientGetResponse struct { + // NetworkVirtualApplianceConnection resource. + VirtualApplianceConnection +} + +// VirtualApplianceConnectionsClientListResponse contains the response from method VirtualApplianceConnectionsClient.NewListPager. +type VirtualApplianceConnectionsClientListResponse struct { + // NetworkVirtualApplianceConnection list. + VirtualApplianceConnectionList +} + +// VirtualApplianceSKUsClientGetResponse contains the response from method VirtualApplianceSKUsClient.Get. +type VirtualApplianceSKUsClientGetResponse struct { + // Definition of the NetworkVirtualApplianceSkus resource. + VirtualApplianceSKU +} + +// VirtualApplianceSKUsClientListResponse contains the response from method VirtualApplianceSKUsClient.NewListPager. +type VirtualApplianceSKUsClientListResponse struct { + // Response for ListNetworkVirtualApplianceSkus API service call. + VirtualApplianceSKUListResult +} + +// VirtualApplianceSitesClientCreateOrUpdateResponse contains the response from method VirtualApplianceSitesClient.BeginCreateOrUpdate. +type VirtualApplianceSitesClientCreateOrUpdateResponse struct { + // Virtual Appliance Site resource. + VirtualApplianceSite +} + +// VirtualApplianceSitesClientDeleteResponse contains the response from method VirtualApplianceSitesClient.BeginDelete. +type VirtualApplianceSitesClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualApplianceSitesClientGetResponse contains the response from method VirtualApplianceSitesClient.Get. +type VirtualApplianceSitesClientGetResponse struct { + // Virtual Appliance Site resource. + VirtualApplianceSite +} + +// VirtualApplianceSitesClientListResponse contains the response from method VirtualApplianceSitesClient.NewListPager. +type VirtualApplianceSitesClientListResponse struct { + // Response for ListNetworkVirtualApplianceSites API service call. + VirtualApplianceSiteListResult +} + +// VirtualAppliancesClientCreateOrUpdateResponse contains the response from method VirtualAppliancesClient.BeginCreateOrUpdate. +type VirtualAppliancesClientCreateOrUpdateResponse struct { + // NetworkVirtualAppliance Resource. + VirtualAppliance +} + +// VirtualAppliancesClientDeleteResponse contains the response from method VirtualAppliancesClient.BeginDelete. +type VirtualAppliancesClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualAppliancesClientGetResponse contains the response from method VirtualAppliancesClient.Get. +type VirtualAppliancesClientGetResponse struct { + // NetworkVirtualAppliance Resource. + VirtualAppliance +} + +// VirtualAppliancesClientListByResourceGroupResponse contains the response from method VirtualAppliancesClient.NewListByResourceGroupPager. +type VirtualAppliancesClientListByResourceGroupResponse struct { + // Response for ListNetworkVirtualAppliances API service call. + VirtualApplianceListResult +} + +// VirtualAppliancesClientListResponse contains the response from method VirtualAppliancesClient.NewListPager. +type VirtualAppliancesClientListResponse struct { + // Response for ListNetworkVirtualAppliances API service call. + VirtualApplianceListResult +} + +// VirtualAppliancesClientUpdateTagsResponse contains the response from method VirtualAppliancesClient.UpdateTags. +type VirtualAppliancesClientUpdateTagsResponse struct { + // NetworkVirtualAppliance Resource. + VirtualAppliance +} + +// VirtualHubBgpConnectionClientCreateOrUpdateResponse contains the response from method VirtualHubBgpConnectionClient.BeginCreateOrUpdate. +type VirtualHubBgpConnectionClientCreateOrUpdateResponse struct { + // Virtual Appliance Site resource. + BgpConnection +} + +// VirtualHubBgpConnectionClientDeleteResponse contains the response from method VirtualHubBgpConnectionClient.BeginDelete. +type VirtualHubBgpConnectionClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualHubBgpConnectionClientGetResponse contains the response from method VirtualHubBgpConnectionClient.Get. +type VirtualHubBgpConnectionClientGetResponse struct { + // Virtual Appliance Site resource. + BgpConnection +} + +// VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse contains the response from method VirtualHubBgpConnectionsClient.BeginListAdvertisedRoutes. +type VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse struct { + // Map from virtual router instance to list of peer routes. + Value map[string][]*PeerRoute +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse. +func (v *VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualHubBgpConnectionsClientListLearnedRoutesResponse contains the response from method VirtualHubBgpConnectionsClient.BeginListLearnedRoutes. +type VirtualHubBgpConnectionsClientListLearnedRoutesResponse struct { + // Map from virtual router instance to list of peer routes. + Value map[string][]*PeerRoute +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubBgpConnectionsClientListLearnedRoutesResponse. +func (v *VirtualHubBgpConnectionsClientListLearnedRoutesResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualHubBgpConnectionsClientListResponse contains the response from method VirtualHubBgpConnectionsClient.NewListPager. +type VirtualHubBgpConnectionsClientListResponse struct { + // VirtualHubBgpConnections list. + ListVirtualHubBgpConnectionResults +} + +// VirtualHubIPConfigurationClientCreateOrUpdateResponse contains the response from method VirtualHubIPConfigurationClient.BeginCreateOrUpdate. +type VirtualHubIPConfigurationClientCreateOrUpdateResponse struct { + // IpConfigurations. + HubIPConfiguration +} + +// VirtualHubIPConfigurationClientDeleteResponse contains the response from method VirtualHubIPConfigurationClient.BeginDelete. +type VirtualHubIPConfigurationClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualHubIPConfigurationClientGetResponse contains the response from method VirtualHubIPConfigurationClient.Get. +type VirtualHubIPConfigurationClientGetResponse struct { + // IpConfigurations. + HubIPConfiguration +} + +// VirtualHubIPConfigurationClientListResponse contains the response from method VirtualHubIPConfigurationClient.NewListPager. +type VirtualHubIPConfigurationClientListResponse struct { + // VirtualHubIpConfigurations list. + ListVirtualHubIPConfigurationResults +} + +// VirtualHubRouteTableV2SClientCreateOrUpdateResponse contains the response from method VirtualHubRouteTableV2SClient.BeginCreateOrUpdate. +type VirtualHubRouteTableV2SClientCreateOrUpdateResponse struct { + // VirtualHubRouteTableV2 Resource. + VirtualHubRouteTableV2 +} + +// VirtualHubRouteTableV2SClientDeleteResponse contains the response from method VirtualHubRouteTableV2SClient.BeginDelete. +type VirtualHubRouteTableV2SClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualHubRouteTableV2SClientGetResponse contains the response from method VirtualHubRouteTableV2SClient.Get. +type VirtualHubRouteTableV2SClientGetResponse struct { + // VirtualHubRouteTableV2 Resource. + VirtualHubRouteTableV2 +} + +// VirtualHubRouteTableV2SClientListResponse contains the response from method VirtualHubRouteTableV2SClient.NewListPager. +type VirtualHubRouteTableV2SClientListResponse struct { + // List of VirtualHubRouteTableV2s and a URL nextLink to get the next set of results. + ListVirtualHubRouteTableV2SResult +} + +// VirtualHubsClientCreateOrUpdateResponse contains the response from method VirtualHubsClient.BeginCreateOrUpdate. +type VirtualHubsClientCreateOrUpdateResponse struct { + // VirtualHub Resource. + VirtualHub +} + +// VirtualHubsClientDeleteResponse contains the response from method VirtualHubsClient.BeginDelete. +type VirtualHubsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualHubsClientGetEffectiveVirtualHubRoutesResponse contains the response from method VirtualHubsClient.BeginGetEffectiveVirtualHubRoutes. +type VirtualHubsClientGetEffectiveVirtualHubRoutesResponse struct { + // EffectiveRoutes List. + VirtualHubEffectiveRouteList +} + +// VirtualHubsClientGetInboundRoutesResponse contains the response from method VirtualHubsClient.BeginGetInboundRoutes. +type VirtualHubsClientGetInboundRoutesResponse struct { + // EffectiveRouteMapRoute List. + EffectiveRouteMapRouteList +} + +// VirtualHubsClientGetOutboundRoutesResponse contains the response from method VirtualHubsClient.BeginGetOutboundRoutes. +type VirtualHubsClientGetOutboundRoutesResponse struct { + // EffectiveRouteMapRoute List. + EffectiveRouteMapRouteList +} + +// VirtualHubsClientGetResponse contains the response from method VirtualHubsClient.Get. +type VirtualHubsClientGetResponse struct { + // VirtualHub Resource. + VirtualHub +} + +// VirtualHubsClientListByResourceGroupResponse contains the response from method VirtualHubsClient.NewListByResourceGroupPager. +type VirtualHubsClientListByResourceGroupResponse struct { + // Result of the request to list VirtualHubs. It contains a list of VirtualHubs and a URL nextLink to get the next set of + // results. + ListVirtualHubsResult +} + +// VirtualHubsClientListResponse contains the response from method VirtualHubsClient.NewListPager. +type VirtualHubsClientListResponse struct { + // Result of the request to list VirtualHubs. It contains a list of VirtualHubs and a URL nextLink to get the next set of + // results. + ListVirtualHubsResult +} + +// VirtualHubsClientUpdateTagsResponse contains the response from method VirtualHubsClient.UpdateTags. +type VirtualHubsClientUpdateTagsResponse struct { + // VirtualHub Resource. + VirtualHub +} + +// VirtualNetworkGatewayConnectionsClientCreateOrUpdateResponse contains the response from method VirtualNetworkGatewayConnectionsClient.BeginCreateOrUpdate. +type VirtualNetworkGatewayConnectionsClientCreateOrUpdateResponse struct { + // A common class for general resource information. + VirtualNetworkGatewayConnection +} + +// VirtualNetworkGatewayConnectionsClientDeleteResponse contains the response from method VirtualNetworkGatewayConnectionsClient.BeginDelete. +type VirtualNetworkGatewayConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewayConnectionsClientGetIkeSasResponse contains the response from method VirtualNetworkGatewayConnectionsClient.BeginGetIkeSas. +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 { + // A common class for general resource information. + VirtualNetworkGatewayConnection +} + +// VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse contains the response from method VirtualNetworkGatewayConnectionsClient.GetSharedKey. +type VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse struct { + // Response for GetConnectionSharedKey API service call. + ConnectionSharedKey +} + +// VirtualNetworkGatewayConnectionsClientListResponse contains the response from method VirtualNetworkGatewayConnectionsClient.NewListPager. +type VirtualNetworkGatewayConnectionsClientListResponse struct { + // Response for the ListVirtualNetworkGatewayConnections API service call. + VirtualNetworkGatewayConnectionListResult +} + +// VirtualNetworkGatewayConnectionsClientResetConnectionResponse contains the response from method VirtualNetworkGatewayConnectionsClient.BeginResetConnection. +type VirtualNetworkGatewayConnectionsClientResetConnectionResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewayConnectionsClientResetSharedKeyResponse contains the response from method VirtualNetworkGatewayConnectionsClient.BeginResetSharedKey. +type VirtualNetworkGatewayConnectionsClientResetSharedKeyResponse struct { + // The virtual network connection reset shared key. + ConnectionResetSharedKey +} + +// VirtualNetworkGatewayConnectionsClientSetSharedKeyResponse contains the response from method VirtualNetworkGatewayConnectionsClient.BeginSetSharedKey. +type VirtualNetworkGatewayConnectionsClientSetSharedKeyResponse struct { + // Response for GetConnectionSharedKey API service call. + ConnectionSharedKey +} + +// VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse contains the response from method VirtualNetworkGatewayConnectionsClient.BeginStartPacketCapture. +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.BeginStopPacketCapture. +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.BeginUpdateTags. +type VirtualNetworkGatewayConnectionsClientUpdateTagsResponse struct { + // A common class for general resource information. + VirtualNetworkGatewayConnection +} + +// VirtualNetworkGatewayNatRulesClientCreateOrUpdateResponse contains the response from method VirtualNetworkGatewayNatRulesClient.BeginCreateOrUpdate. +type VirtualNetworkGatewayNatRulesClientCreateOrUpdateResponse struct { + // VirtualNetworkGatewayNatRule Resource. + VirtualNetworkGatewayNatRule +} + +// VirtualNetworkGatewayNatRulesClientDeleteResponse contains the response from method VirtualNetworkGatewayNatRulesClient.BeginDelete. +type VirtualNetworkGatewayNatRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewayNatRulesClientGetResponse contains the response from method VirtualNetworkGatewayNatRulesClient.Get. +type VirtualNetworkGatewayNatRulesClientGetResponse struct { + // VirtualNetworkGatewayNatRule Resource. + VirtualNetworkGatewayNatRule +} + +// VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse contains the response from method VirtualNetworkGatewayNatRulesClient.NewListByVirtualNetworkGatewayPager. +type VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse struct { + // 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. + ListVirtualNetworkGatewayNatRulesResult +} + +// VirtualNetworkGatewaysClientCreateOrUpdateResponse contains the response from method VirtualNetworkGatewaysClient.BeginCreateOrUpdate. +type VirtualNetworkGatewaysClientCreateOrUpdateResponse struct { + // A common class for general resource information. + VirtualNetworkGateway +} + +// VirtualNetworkGatewaysClientDeleteResponse contains the response from method VirtualNetworkGatewaysClient.BeginDelete. +type VirtualNetworkGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse contains the response from method VirtualNetworkGatewaysClient.BeginDisconnectVirtualNetworkGatewayVPNConnections. +type VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewaysClientGenerateVPNProfileResponse contains the response from method VirtualNetworkGatewaysClient.BeginGenerateVPNProfile. +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.BeginGeneratevpnclientpackage. +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.BeginGetAdvertisedRoutes. +type VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse struct { + // List of virtual network gateway routes. + GatewayRouteListResult +} + +// VirtualNetworkGatewaysClientGetBgpPeerStatusResponse contains the response from method VirtualNetworkGatewaysClient.BeginGetBgpPeerStatus. +type VirtualNetworkGatewaysClientGetBgpPeerStatusResponse struct { + // Response for list BGP peer status API service call. + BgpPeerStatusListResult +} + +// VirtualNetworkGatewaysClientGetLearnedRoutesResponse contains the response from method VirtualNetworkGatewaysClient.BeginGetLearnedRoutes. +type VirtualNetworkGatewaysClientGetLearnedRoutesResponse struct { + // List of virtual network gateway routes. + GatewayRouteListResult +} + +// VirtualNetworkGatewaysClientGetResponse contains the response from method VirtualNetworkGatewaysClient.Get. +type VirtualNetworkGatewaysClientGetResponse struct { + // A common class for general resource information. + VirtualNetworkGateway +} + +// VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse contains the response from method VirtualNetworkGatewaysClient.BeginGetVPNProfilePackageURL. +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.BeginGetVpnclientConnectionHealth. +type VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse struct { + // List of virtual network gateway vpn client connection health. + VPNClientConnectionHealthDetailListResult +} + +// VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse contains the response from method VirtualNetworkGatewaysClient.BeginGetVpnclientIPSecParameters. +type VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse struct { + // An IPSec parameters for a virtual network gateway P2S connection. + VPNClientIPsecParameters +} + +// VirtualNetworkGatewaysClientListConnectionsResponse contains the response from method VirtualNetworkGatewaysClient.NewListConnectionsPager. +type VirtualNetworkGatewaysClientListConnectionsResponse struct { + // Response for the VirtualNetworkGatewayListConnections API service call. + VirtualNetworkGatewayListConnectionsResult +} + +// VirtualNetworkGatewaysClientListResponse contains the response from method VirtualNetworkGatewaysClient.NewListPager. +type VirtualNetworkGatewaysClientListResponse struct { + // Response for the ListVirtualNetworkGateways API service call. + VirtualNetworkGatewayListResult +} + +// VirtualNetworkGatewaysClientResetResponse contains the response from method VirtualNetworkGatewaysClient.BeginReset. +type VirtualNetworkGatewaysClientResetResponse struct { + // A common class for general resource information. + VirtualNetworkGateway +} + +// VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse contains the response from method VirtualNetworkGatewaysClient.BeginResetVPNClientSharedKey. +type VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse contains the response from method VirtualNetworkGatewaysClient.BeginSetVpnclientIPSecParameters. +type VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse struct { + // An IPSec parameters for a virtual network gateway P2S connection. + VPNClientIPsecParameters +} + +// VirtualNetworkGatewaysClientStartPacketCaptureResponse contains the response from method VirtualNetworkGatewaysClient.BeginStartPacketCapture. +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.BeginStopPacketCapture. +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.BeginUpdateTags. +type VirtualNetworkGatewaysClientUpdateTagsResponse struct { + // A common class for general resource information. + VirtualNetworkGateway +} + +// VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse contains the response from method VirtualNetworkGatewaysClient.VPNDeviceConfigurationScript. +type VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse struct { + Value *string +} + +// VirtualNetworkPeeringsClientCreateOrUpdateResponse contains the response from method VirtualNetworkPeeringsClient.BeginCreateOrUpdate. +type VirtualNetworkPeeringsClientCreateOrUpdateResponse struct { + // Peerings in a virtual network resource. + VirtualNetworkPeering +} + +// VirtualNetworkPeeringsClientDeleteResponse contains the response from method VirtualNetworkPeeringsClient.BeginDelete. +type VirtualNetworkPeeringsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkPeeringsClientGetResponse contains the response from method VirtualNetworkPeeringsClient.Get. +type VirtualNetworkPeeringsClientGetResponse struct { + // Peerings in a virtual network resource. + VirtualNetworkPeering +} + +// VirtualNetworkPeeringsClientListResponse contains the response from method VirtualNetworkPeeringsClient.NewListPager. +type VirtualNetworkPeeringsClientListResponse struct { + // Response for ListSubnets API service call. Retrieves all subnets that belong to a virtual network. + VirtualNetworkPeeringListResult +} + +// VirtualNetworkTapsClientCreateOrUpdateResponse contains the response from method VirtualNetworkTapsClient.BeginCreateOrUpdate. +type VirtualNetworkTapsClientCreateOrUpdateResponse struct { + // Virtual Network Tap resource. + VirtualNetworkTap +} + +// VirtualNetworkTapsClientDeleteResponse contains the response from method VirtualNetworkTapsClient.BeginDelete. +type VirtualNetworkTapsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkTapsClientGetResponse contains the response from method VirtualNetworkTapsClient.Get. +type VirtualNetworkTapsClientGetResponse struct { + // Virtual Network Tap resource. + VirtualNetworkTap +} + +// VirtualNetworkTapsClientListAllResponse contains the response from method VirtualNetworkTapsClient.NewListAllPager. +type VirtualNetworkTapsClientListAllResponse struct { + // Response for ListVirtualNetworkTap API service call. + VirtualNetworkTapListResult +} + +// VirtualNetworkTapsClientListByResourceGroupResponse contains the response from method VirtualNetworkTapsClient.NewListByResourceGroupPager. +type VirtualNetworkTapsClientListByResourceGroupResponse struct { + // Response for ListVirtualNetworkTap API service call. + VirtualNetworkTapListResult +} + +// VirtualNetworkTapsClientUpdateTagsResponse contains the response from method VirtualNetworkTapsClient.UpdateTags. +type VirtualNetworkTapsClientUpdateTagsResponse struct { + // Virtual Network Tap resource. + VirtualNetworkTap +} + +// VirtualNetworksClientCheckIPAddressAvailabilityResponse contains the response from method VirtualNetworksClient.CheckIPAddressAvailability. +type VirtualNetworksClientCheckIPAddressAvailabilityResponse struct { + // Response for CheckIPAddressAvailability API service call. + IPAddressAvailabilityResult +} + +// VirtualNetworksClientCreateOrUpdateResponse contains the response from method VirtualNetworksClient.BeginCreateOrUpdate. +type VirtualNetworksClientCreateOrUpdateResponse struct { + // Virtual Network resource. + VirtualNetwork +} + +// VirtualNetworksClientDeleteResponse contains the response from method VirtualNetworksClient.BeginDelete. +type VirtualNetworksClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworksClientGetResponse contains the response from method VirtualNetworksClient.Get. +type VirtualNetworksClientGetResponse struct { + // Virtual Network resource. + VirtualNetwork +} + +// VirtualNetworksClientListAllResponse contains the response from method VirtualNetworksClient.NewListAllPager. +type VirtualNetworksClientListAllResponse struct { + // Response for the ListVirtualNetworks API service call. + VirtualNetworkListResult +} + +// VirtualNetworksClientListDdosProtectionStatusResponse contains the response from method VirtualNetworksClient.BeginListDdosProtectionStatus. +type VirtualNetworksClientListDdosProtectionStatusResponse struct { + // Response for GetVirtualNetworkDdosProtectionStatusOperation. + VirtualNetworkDdosProtectionStatusResult +} + +// VirtualNetworksClientListResponse contains the response from method VirtualNetworksClient.NewListPager. +type VirtualNetworksClientListResponse struct { + // Response for the ListVirtualNetworks API service call. + VirtualNetworkListResult +} + +// VirtualNetworksClientListUsageResponse contains the response from method VirtualNetworksClient.NewListUsagePager. +type VirtualNetworksClientListUsageResponse struct { + // Response for the virtual networks GetUsage API service call. + VirtualNetworkListUsageResult +} + +// VirtualNetworksClientUpdateTagsResponse contains the response from method VirtualNetworksClient.UpdateTags. +type VirtualNetworksClientUpdateTagsResponse struct { + // Virtual Network resource. + VirtualNetwork +} + +// VirtualRouterPeeringsClientCreateOrUpdateResponse contains the response from method VirtualRouterPeeringsClient.BeginCreateOrUpdate. +type VirtualRouterPeeringsClientCreateOrUpdateResponse struct { + // Virtual Router Peering resource. + VirtualRouterPeering +} + +// VirtualRouterPeeringsClientDeleteResponse contains the response from method VirtualRouterPeeringsClient.BeginDelete. +type VirtualRouterPeeringsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualRouterPeeringsClientGetResponse contains the response from method VirtualRouterPeeringsClient.Get. +type VirtualRouterPeeringsClientGetResponse struct { + // Virtual Router Peering resource. + VirtualRouterPeering +} + +// VirtualRouterPeeringsClientListResponse contains the response from method VirtualRouterPeeringsClient.NewListPager. +type VirtualRouterPeeringsClientListResponse struct { + // Response for ListVirtualRouterPeerings API service call. + VirtualRouterPeeringListResult +} + +// VirtualRoutersClientCreateOrUpdateResponse contains the response from method VirtualRoutersClient.BeginCreateOrUpdate. +type VirtualRoutersClientCreateOrUpdateResponse struct { + // VirtualRouter Resource. + VirtualRouter +} + +// VirtualRoutersClientDeleteResponse contains the response from method VirtualRoutersClient.BeginDelete. +type VirtualRoutersClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualRoutersClientGetResponse contains the response from method VirtualRoutersClient.Get. +type VirtualRoutersClientGetResponse struct { + // VirtualRouter Resource. + VirtualRouter +} + +// VirtualRoutersClientListByResourceGroupResponse contains the response from method VirtualRoutersClient.NewListByResourceGroupPager. +type VirtualRoutersClientListByResourceGroupResponse struct { + // Response for ListVirtualRouters API service call. + VirtualRouterListResult +} + +// VirtualRoutersClientListResponse contains the response from method VirtualRoutersClient.NewListPager. +type VirtualRoutersClientListResponse struct { + // Response for ListVirtualRouters API service call. + VirtualRouterListResult +} + +// VirtualWansClientCreateOrUpdateResponse contains the response from method VirtualWansClient.BeginCreateOrUpdate. +type VirtualWansClientCreateOrUpdateResponse struct { + // VirtualWAN Resource. + VirtualWAN +} + +// VirtualWansClientDeleteResponse contains the response from method VirtualWansClient.BeginDelete. +type VirtualWansClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualWansClientGetResponse contains the response from method VirtualWansClient.Get. +type VirtualWansClientGetResponse struct { + // VirtualWAN Resource. + VirtualWAN +} + +// VirtualWansClientListByResourceGroupResponse contains the response from method VirtualWansClient.NewListByResourceGroupPager. +type VirtualWansClientListByResourceGroupResponse struct { + // Result of the request to list VirtualWANs. It contains a list of VirtualWANs and a URL nextLink to get the next set of + // results. + ListVirtualWANsResult +} + +// VirtualWansClientListResponse contains the response from method VirtualWansClient.NewListPager. +type VirtualWansClientListResponse struct { + // Result of the request to list VirtualWANs. It contains a list of VirtualWANs and a URL nextLink to get the next set of + // results. + ListVirtualWANsResult +} + +// VirtualWansClientUpdateTagsResponse contains the response from method VirtualWansClient.UpdateTags. +type VirtualWansClientUpdateTagsResponse struct { + // VirtualWAN Resource. + VirtualWAN +} + +// WatchersClientCheckConnectivityResponse contains the response from method WatchersClient.BeginCheckConnectivity. +type WatchersClientCheckConnectivityResponse struct { + // Information on the connectivity status. + ConnectivityInformation +} + +// WatchersClientCreateOrUpdateResponse contains the response from method WatchersClient.CreateOrUpdate. +type WatchersClientCreateOrUpdateResponse struct { + // Network watcher in a resource group. + Watcher +} + +// WatchersClientDeleteResponse contains the response from method WatchersClient.BeginDelete. +type WatchersClientDeleteResponse struct { + // placeholder for future response values +} + +// WatchersClientGetAzureReachabilityReportResponse contains the response from method WatchersClient.BeginGetAzureReachabilityReport. +type WatchersClientGetAzureReachabilityReportResponse struct { + // Azure reachability report details. + AzureReachabilityReport +} + +// WatchersClientGetFlowLogStatusResponse contains the response from method WatchersClient.BeginGetFlowLogStatus. +type WatchersClientGetFlowLogStatusResponse struct { + // Information on the configuration of flow log and traffic analytics (optional) . + FlowLogInformation +} + +// WatchersClientGetNetworkConfigurationDiagnosticResponse contains the response from method WatchersClient.BeginGetNetworkConfigurationDiagnostic. +type WatchersClientGetNetworkConfigurationDiagnosticResponse struct { + // Results of network configuration diagnostic on the target resource. + ConfigurationDiagnosticResponse +} + +// WatchersClientGetNextHopResponse contains the response from method WatchersClient.BeginGetNextHop. +type WatchersClientGetNextHopResponse struct { + // The information about next hop from the specified VM. + NextHopResult +} + +// WatchersClientGetResponse contains the response from method WatchersClient.Get. +type WatchersClientGetResponse struct { + // Network watcher in a resource group. + Watcher +} + +// WatchersClientGetTopologyResponse contains the response from method WatchersClient.GetTopology. +type WatchersClientGetTopologyResponse struct { + // Topology of the specified resource group. + Topology +} + +// WatchersClientGetTroubleshootingResponse contains the response from method WatchersClient.BeginGetTroubleshooting. +type WatchersClientGetTroubleshootingResponse struct { + // Troubleshooting information gained from specified resource. + TroubleshootingResult +} + +// WatchersClientGetTroubleshootingResultResponse contains the response from method WatchersClient.BeginGetTroubleshootingResult. +type WatchersClientGetTroubleshootingResultResponse struct { + // Troubleshooting information gained from specified resource. + TroubleshootingResult +} + +// WatchersClientGetVMSecurityRulesResponse contains the response from method WatchersClient.BeginGetVMSecurityRules. +type WatchersClientGetVMSecurityRulesResponse struct { + // The information about security rules applied to the specified VM. + SecurityGroupViewResult +} + +// WatchersClientListAllResponse contains the response from method WatchersClient.NewListAllPager. +type WatchersClientListAllResponse struct { + // Response for ListNetworkWatchers API service call. + WatcherListResult +} + +// WatchersClientListAvailableProvidersResponse contains the response from method WatchersClient.BeginListAvailableProviders. +type WatchersClientListAvailableProvidersResponse struct { + // List of available countries with details. + AvailableProvidersList +} + +// WatchersClientListResponse contains the response from method WatchersClient.NewListPager. +type WatchersClientListResponse struct { + // Response for ListNetworkWatchers API service call. + WatcherListResult +} + +// WatchersClientSetFlowLogConfigurationResponse contains the response from method WatchersClient.BeginSetFlowLogConfiguration. +type WatchersClientSetFlowLogConfigurationResponse struct { + // Information on the configuration of flow log and traffic analytics (optional) . + FlowLogInformation +} + +// WatchersClientUpdateTagsResponse contains the response from method WatchersClient.UpdateTags. +type WatchersClientUpdateTagsResponse struct { + // Network watcher in a resource group. + Watcher +} + +// WatchersClientVerifyIPFlowResponse contains the response from method WatchersClient.BeginVerifyIPFlow. +type WatchersClientVerifyIPFlowResponse struct { + // Results of IP flow verification on the target resource. + VerificationIPFlowResult +} + +// WebApplicationFirewallPoliciesClientCreateOrUpdateResponse contains the response from method WebApplicationFirewallPoliciesClient.CreateOrUpdate. +type WebApplicationFirewallPoliciesClientCreateOrUpdateResponse struct { + // Defines web application firewall policy. + WebApplicationFirewallPolicy +} + +// WebApplicationFirewallPoliciesClientDeleteResponse contains the response from method WebApplicationFirewallPoliciesClient.BeginDelete. +type WebApplicationFirewallPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// WebApplicationFirewallPoliciesClientGetResponse contains the response from method WebApplicationFirewallPoliciesClient.Get. +type WebApplicationFirewallPoliciesClientGetResponse struct { + // Defines web application firewall policy. + WebApplicationFirewallPolicy +} + +// WebApplicationFirewallPoliciesClientListAllResponse contains the response from method WebApplicationFirewallPoliciesClient.NewListAllPager. +type WebApplicationFirewallPoliciesClientListAllResponse struct { + // 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. + WebApplicationFirewallPolicyListResult +} + +// WebApplicationFirewallPoliciesClientListResponse contains the response from method WebApplicationFirewallPoliciesClient.NewListPager. +type WebApplicationFirewallPoliciesClientListResponse struct { + // 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. + WebApplicationFirewallPolicyListResult +} + +// WebCategoriesClientGetResponse contains the response from method WebCategoriesClient.Get. +type WebCategoriesClientGetResponse struct { + // Azure Web Category Resource. + AzureWebCategory +} + +// WebCategoriesClientListBySubscriptionResponse contains the response from method WebCategoriesClient.NewListBySubscriptionPager. +type WebCategoriesClientListBySubscriptionResponse struct { + // Response for ListAzureWebCategories API service call. + AzureWebCategoryListResult +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routefilterrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routefilterrules_client.go new file mode 100644 index 000000000..5badce1f1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routefilterrules_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".RouteFilterRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RouteFilterRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RouteFilterRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RouteFilterRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *RouteFilterRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, options *RouteFilterRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, routeFilterRuleParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified rule from a route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RouteFilterRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RouteFilterRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified rule from a route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *RouteFilterRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, options *RouteFilterRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, routeFilterName, ruleName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, routeFilterName, ruleName, options) + if err != nil { + return RouteFilterRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RouteFilterRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RouteFilterRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListByRouteFilterPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/routefilters_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routefilters_client.go new file mode 100644 index 000000000..edccbbfdf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routefilters_client.go @@ -0,0 +1,440 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".RouteFiltersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RouteFiltersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RouteFiltersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RouteFiltersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *RouteFiltersClient) createOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, options *RouteFiltersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, routeFilterName, routeFilterParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, routeFilterParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RouteFiltersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RouteFiltersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *RouteFiltersClient) deleteOperation(ctx context.Context, resourceGroupName string, routeFilterName string, options *RouteFiltersClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, routeFilterName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, routeFilterName, options) + if err != nil { + return RouteFiltersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RouteFiltersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RouteFiltersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - RouteFiltersClientListOptions contains the optional parameters for the RouteFiltersClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - RouteFiltersClientListByResourceGroupOptions contains the optional parameters for the RouteFiltersClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, routeFilterName, parameters, options) + if err != nil { + return RouteFiltersClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RouteFiltersClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RouteFiltersClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/routemaps_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routemaps_client.go new file mode 100644 index 000000000..66d3f968e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routemaps_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".RouteMapsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RouteMapsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RouteMapsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RouteMapsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *RouteMapsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, routeMapParameters RouteMap, options *RouteMapsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, routeMapName, routeMapParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, routeMapParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a RouteMap. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RouteMapsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RouteMapsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a RouteMap. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *RouteMapsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, options *RouteMapsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, routeMapName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, routeMapName, options) + if err != nil { + return RouteMapsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RouteMapsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RouteMapsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/routes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routes_client.go new file mode 100644 index 000000000..8342ff62d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routes_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".RoutesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoutesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RoutesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RoutesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *RoutesClient) createOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route, options *RoutesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, routeTableName, routeName, routeParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, routeParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified route from a route table. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RoutesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RoutesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified route from a route table. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *RoutesClient) deleteOperation(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, options *RoutesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, routeTableName, routeName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, routeTableName, routeName, options) + if err != nil { + return RoutesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoutesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoutesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/routetables_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routetables_client.go new file mode 100644 index 000000000..8559d9359 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routetables_client.go @@ -0,0 +1,438 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".RouteTablesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RouteTablesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RouteTablesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RouteTablesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *RouteTablesClient) createOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable, options *RouteTablesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, routeTableName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified route table. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RouteTablesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RouteTablesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified route table. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *RouteTablesClient) deleteOperation(ctx context.Context, resourceGroupName string, routeTableName string, options *RouteTablesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, routeTableName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, routeTableName, options) + if err != nil { + return RouteTablesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RouteTablesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RouteTablesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - RouteTablesClientListOptions contains the optional parameters for the RouteTablesClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - RouteTablesClientListAllOptions contains the optional parameters for the RouteTablesClient.NewListAllPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, routeTableName, parameters, options) + if err != nil { + return RouteTablesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RouteTablesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RouteTablesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/routingintent_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routingintent_client.go new file mode 100644 index 000000000..103d8fc9b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/routingintent_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".RoutingIntentClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoutingIntentClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RoutingIntentClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RoutingIntentClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *RoutingIntentClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters RoutingIntent, options *RoutingIntentClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, routingIntentName, routingIntentParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, routingIntentParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a RoutingIntent. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RoutingIntentClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RoutingIntentClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a RoutingIntent. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *RoutingIntentClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, routingIntentName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, routingIntentName, options) + if err != nil { + return RoutingIntentClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoutingIntentClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoutingIntentClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/scopeconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/scopeconnections_client.go new file mode 100644 index 000000000..24f9a5a2f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/scopeconnections_client.go @@ -0,0 +1,312 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ScopeConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, scopeConnectionName, parameters, options) + if err != nil { + return ScopeConnectionsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeConnectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ScopeConnectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, scopeConnectionName, options) + if err != nil { + return ScopeConnectionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeConnectionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ScopeConnectionsClientDeleteResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, scopeConnectionName, options) + if err != nil { + return ScopeConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScopeConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/securityadminconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/securityadminconfigurations_client.go new file mode 100644 index 000000000..a16ab5c06 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/securityadminconfigurations_client.go @@ -0,0 +1,336 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".SecurityAdminConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecurityAdminConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, securityAdminConfiguration, options) + if err != nil { + return SecurityAdminConfigurationsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityAdminConfigurationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SecurityAdminConfigurationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, securityAdminConfiguration); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecurityAdminConfigurationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SecurityAdminConfigurationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a network manager security admin configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *SecurityAdminConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *SecurityAdminConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return SecurityAdminConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityAdminConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecurityAdminConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/securitygroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/securitygroups_client.go new file mode 100644 index 000000000..11f1848cb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/securitygroups_client.go @@ -0,0 +1,441 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".SecurityGroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecurityGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecurityGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SecurityGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *SecurityGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, options *SecurityGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified network security group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecurityGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SecurityGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified network security group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *SecurityGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, options *SecurityGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, options) + if err != nil { + return SecurityGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecurityGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - SecurityGroupsClientListOptions contains the optional parameters for the SecurityGroupsClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - SecurityGroupsClientListAllOptions contains the optional parameters for the SecurityGroupsClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, parameters, options) + if err != nil { + return SecurityGroupsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityGroupsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecurityGroupsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/securitypartnerproviders_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/securitypartnerproviders_client.go new file mode 100644 index 000000000..ea42ace56 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/securitypartnerproviders_client.go @@ -0,0 +1,440 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".SecurityPartnerProvidersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecurityPartnerProvidersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecurityPartnerProvidersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SecurityPartnerProvidersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Security Partner Provider. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *SecurityPartnerProvidersClient) createOrUpdate(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters SecurityPartnerProvider, options *SecurityPartnerProvidersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, securityPartnerProviderName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified Security Partner Provider. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecurityPartnerProvidersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SecurityPartnerProvidersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified Security Partner Provider. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *SecurityPartnerProvidersClient) deleteOperation(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, options *SecurityPartnerProvidersClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, securityPartnerProviderName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, securityPartnerProviderName, options) + if err != nil { + return SecurityPartnerProvidersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityPartnerProvidersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecurityPartnerProvidersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - SecurityPartnerProvidersClientListOptions contains the optional parameters for the SecurityPartnerProvidersClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - SecurityPartnerProvidersClientListByResourceGroupOptions contains the optional parameters for the SecurityPartnerProvidersClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, securityPartnerProviderName, parameters, options) + if err != nil { + return SecurityPartnerProvidersClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityPartnerProvidersClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecurityPartnerProvidersClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/securityrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/securityrules_client.go new file mode 100644 index 000000000..77f8bb4f4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/securityrules_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".SecurityRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecurityRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecurityRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SecurityRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *SecurityRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, options *SecurityRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, securityRuleParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified network security rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecurityRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SecurityRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified network security rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *SecurityRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, options *SecurityRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, options) + if err != nil { + return SecurityRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecurityRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/serviceassociationlinks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/serviceassociationlinks_client.go new file mode 100644 index 000000000..8e21c4fec --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/serviceassociationlinks_client.go @@ -0,0 +1,111 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ServiceAssociationLinksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServiceAssociationLinksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.listCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return ServiceAssociationLinksClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServiceAssociationLinksClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceAssociationLinksClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/serviceendpointpolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/serviceendpointpolicies_client.go new file mode 100644 index 000000000..d0ea81755 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/serviceendpointpolicies_client.go @@ -0,0 +1,443 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ServiceEndpointPoliciesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServiceEndpointPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServiceEndpointPoliciesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ServiceEndpointPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a service Endpoint Policies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ServiceEndpointPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters ServiceEndpointPolicy, options *ServiceEndpointPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified service endpoint policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServiceEndpointPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ServiceEndpointPoliciesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified service endpoint policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ServiceEndpointPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, options *ServiceEndpointPoliciesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, options) + if err != nil { + return ServiceEndpointPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServiceEndpointPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceEndpointPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - ServiceEndpointPoliciesClientListOptions contains the optional parameters for the ServiceEndpointPoliciesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - ServiceEndpointPoliciesClientListByResourceGroupOptions contains the optional parameters for the ServiceEndpointPoliciesClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, parameters, options) + if err != nil { + return ServiceEndpointPoliciesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServiceEndpointPoliciesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceEndpointPoliciesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/serviceendpointpolicydefinitions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/serviceendpointpolicydefinitions_client.go new file mode 100644 index 000000000..62f6a730b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/serviceendpointpolicydefinitions_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ServiceEndpointPolicyDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServiceEndpointPolicyDefinitionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServiceEndpointPolicyDefinitionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ServiceEndpointPolicyDefinitionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *ServiceEndpointPolicyDefinitionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, serviceEndpointPolicyDefinitions ServiceEndpointPolicyDefinition, options *ServiceEndpointPolicyDefinitionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, serviceEndpointPolicyDefinitions, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, serviceEndpointPolicyDefinitions); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified ServiceEndpoint policy definitions. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServiceEndpointPolicyDefinitionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ServiceEndpointPolicyDefinitionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified ServiceEndpoint policy definitions. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *ServiceEndpointPolicyDefinitionsClient) deleteOperation(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, options *ServiceEndpointPolicyDefinitionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, options) + if err != nil { + return ServiceEndpointPolicyDefinitionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServiceEndpointPolicyDefinitionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceEndpointPolicyDefinitionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/servicetaginformation_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/servicetaginformation_client.go new file mode 100644 index 000000000..3379a4eb9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/servicetaginformation_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ServiceTagInformationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServiceTagInformationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets a list of service tag information resources with pagination. +// +// Generated from API version 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/servicetags_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/servicetags_client.go new file mode 100644 index 000000000..fa1369cd4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/servicetags_client.go @@ -0,0 +1,102 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".ServiceTagsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServiceTagsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.listCreateRequest(ctx, location, options) + if err != nil { + return ServiceTagsClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServiceTagsClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceTagsClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/staticmembers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/staticmembers_client.go new file mode 100644 index 000000000..79f39d40b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/staticmembers_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".StaticMembersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &StaticMembersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a static member. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, staticMemberName, parameters, options) + if err != nil { + return StaticMembersClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StaticMembersClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return StaticMembersClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, staticMemberName, options) + if err != nil { + return StaticMembersClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StaticMembersClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return StaticMembersClientDeleteResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, staticMemberName, options) + if err != nil { + return StaticMembersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StaticMembersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return StaticMembersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/subnets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/subnets_client.go new file mode 100644 index 000000000..31977cadc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/subnets_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".SubnetsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SubnetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SubnetsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SubnetsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *SubnetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, options *SubnetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, subnetParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified subnet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SubnetsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SubnetsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified subnet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *SubnetsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return SubnetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SubnetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SubnetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SubnetsClientPrepareNetworkPoliciesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SubnetsClientPrepareNetworkPoliciesResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// PrepareNetworkPolicies - Prepares a subnet by applying network intent policies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *SubnetsClient) prepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, prepareNetworkPoliciesRequestParameters PrepareNetworkPoliciesRequest, options *SubnetsClientBeginPrepareNetworkPoliciesOptions) (*http.Response, error) { + var err error + req, err := client.prepareNetworkPoliciesCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, prepareNetworkPoliciesRequestParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, prepareNetworkPoliciesRequestParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginUnprepareNetworkPolicies - Unprepares a subnet by removing network intent policies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SubnetsClientUnprepareNetworkPoliciesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[SubnetsClientUnprepareNetworkPoliciesResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UnprepareNetworkPolicies - Unprepares a subnet by removing network intent policies. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *SubnetsClient) unprepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, unprepareNetworkPoliciesRequestParameters UnprepareNetworkPoliciesRequest, options *SubnetsClientBeginUnprepareNetworkPoliciesOptions) (*http.Response, error) { + var err error + req, err := client.unprepareNetworkPoliciesCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, unprepareNetworkPoliciesRequestParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, unprepareNetworkPoliciesRequestParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/subscriptionnetworkmanagerconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/subscriptionnetworkmanagerconnections_client.go new file mode 100644 index 000000000..f756bd114 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/subscriptionnetworkmanagerconnections_client.go @@ -0,0 +1,274 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".SubscriptionNetworkManagerConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SubscriptionNetworkManagerConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, networkManagerConnectionName, parameters, options) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.deleteCreateRequest(ctx, networkManagerConnectionName, options) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SubscriptionNetworkManagerConnectionsClientDeleteResponse{}, err + } + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, networkManagerConnectionName, options) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SubscriptionNetworkManagerConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - SubscriptionNetworkManagerConnectionsClientListOptions contains the optional parameters for the SubscriptionNetworkManagerConnectionsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/time_rfc3339.go new file mode 100644 index 000000000..851a2002c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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]any, 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/v4/usages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/usages_client.go new file mode 100644 index 000000000..0368efe46 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/usages_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".UsagesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UsagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List network usages for a subscription. +// +// Generated from API version 2023-05-01 +// - location - The location where resource usage is queried. +// - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/vipswap_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vipswap_client.go new file mode 100644 index 000000000..d317d341d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vipswap_client.go @@ -0,0 +1,240 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VipSwapClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VipSwapClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller[VipSwapClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VipSwapClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Performs vip swap operation on swappable cloud services. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VipSwapClient) create(ctx context.Context, groupName string, resourceName string, parameters SwapResource, options *VipSwapClientBeginCreateOptions) (*http.Response, error) { + var err error + req, err := client.createCreateRequest(ctx, groupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, groupName, resourceName, options) + if err != nil { + return VipSwapClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VipSwapClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VipSwapClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.listCreateRequest(ctx, groupName, resourceName, options) + if err != nil { + return VipSwapClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VipSwapClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VipSwapClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualapplianceconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualapplianceconnections_client.go new file mode 100644 index 000000000..96661b620 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualapplianceconnections_client.go @@ -0,0 +1,336 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualApplianceConnectionsClient contains the methods for the NetworkVirtualApplianceConnections group. +// Don't use this type directly, use NewVirtualApplianceConnectionsClient() instead. +type VirtualApplianceConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVirtualApplianceConnectionsClient creates a new instance of VirtualApplianceConnectionsClient 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 NewVirtualApplianceConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualApplianceConnectionsClient, error) { + cl, err := arm.NewClient(moduleName+".VirtualApplianceConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualApplianceConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a connection to Network Virtual Appliance, if it doesn't exist else updates the existing +// NVA connection' +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - networkVirtualApplianceName - The name of the Network Virtual Appliance. +// - connectionName - The name of the NVA connection. +// - networkVirtualApplianceConnectionParameters - Parameters supplied in an NetworkVirtualApplianceConnection PUT operation. +// - options - VirtualApplianceConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualApplianceConnectionsClient.BeginCreateOrUpdate +// method. +func (client *VirtualApplianceConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, connectionName string, networkVirtualApplianceConnectionParameters VirtualApplianceConnection, options *VirtualApplianceConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualApplianceConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkVirtualApplianceName, connectionName, networkVirtualApplianceConnectionParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualApplianceConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualApplianceConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates a connection to Network Virtual Appliance, if it doesn't exist else updates the existing NVA connection' +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualApplianceConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, connectionName string, networkVirtualApplianceConnectionParameters VirtualApplianceConnection, options *VirtualApplianceConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, connectionName, networkVirtualApplianceConnectionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualApplianceConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, connectionName string, networkVirtualApplianceConnectionParameters VirtualApplianceConnection, options *VirtualApplianceConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{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 networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, networkVirtualApplianceConnectionParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a NVA connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - networkVirtualApplianceName - The name of the Network Virtual Appliance. +// - connectionName - The name of the NVA connection. +// - options - VirtualApplianceConnectionsClientBeginDeleteOptions contains the optional parameters for the VirtualApplianceConnectionsClient.BeginDelete +// method. +func (client *VirtualApplianceConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, connectionName string, options *VirtualApplianceConnectionsClientBeginDeleteOptions) (*runtime.Poller[VirtualApplianceConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkVirtualApplianceName, connectionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualApplianceConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualApplianceConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a NVA connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualApplianceConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, connectionName string, options *VirtualApplianceConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, connectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualApplianceConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, connectionName string, options *VirtualApplianceConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{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 networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of specified NVA connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - networkVirtualApplianceName - The name of the Network Virtual Appliance. +// - connectionName - The name of the NVA connection. +// - options - VirtualApplianceConnectionsClientGetOptions contains the optional parameters for the VirtualApplianceConnectionsClient.Get +// method. +func (client *VirtualApplianceConnectionsClient) Get(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, connectionName string, options *VirtualApplianceConnectionsClientGetOptions) (VirtualApplianceConnectionsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, connectionName, options) + if err != nil { + return VirtualApplianceConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualApplianceConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualApplianceConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VirtualApplianceConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, connectionName string, options *VirtualApplianceConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{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 networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 *VirtualApplianceConnectionsClient) getHandleResponse(resp *http.Response) (VirtualApplianceConnectionsClientGetResponse, error) { + result := VirtualApplianceConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualApplianceConnection); err != nil { + return VirtualApplianceConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists NetworkVirtualApplianceConnections under the NVA. +// +// Generated from API version 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - networkVirtualApplianceName - The name of the Network Virtual Appliance. +// - options - VirtualApplianceConnectionsClientListOptions contains the optional parameters for the VirtualApplianceConnectionsClient.NewListPager +// method. +func (client *VirtualApplianceConnectionsClient) NewListPager(resourceGroupName string, networkVirtualApplianceName string, options *VirtualApplianceConnectionsClientListOptions) *runtime.Pager[VirtualApplianceConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualApplianceConnectionsClientListResponse]{ + More: func(page VirtualApplianceConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualApplianceConnectionsClientListResponse) (VirtualApplianceConnectionsClientListResponse, 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 VirtualApplianceConnectionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualApplianceConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualApplianceConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualApplianceConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, options *VirtualApplianceConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections" + 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 *VirtualApplianceConnectionsClient) listHandleResponse(resp *http.Response) (VirtualApplianceConnectionsClientListResponse, error) { + result := VirtualApplianceConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualApplianceConnectionList); err != nil { + return VirtualApplianceConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualappliances_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualappliances_client.go new file mode 100644 index 000000000..7d2ed1b5f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualappliances_client.go @@ -0,0 +1,442 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualAppliancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualAppliancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualAppliancesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualAppliancesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Network Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualAppliancesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters VirtualAppliance, options *VirtualAppliancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified Network Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualAppliancesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualAppliancesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified Network Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualAppliancesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, options *VirtualAppliancesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, options) + if err != nil { + return VirtualAppliancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualAppliancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualAppliancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - VirtualAppliancesClientListOptions contains the optional parameters for the VirtualAppliancesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - VirtualAppliancesClientListByResourceGroupOptions contains the optional parameters for the VirtualAppliancesClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, parameters, options) + if err != nil { + return VirtualAppliancesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualAppliancesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualAppliancesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/virtualappliancesites_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualappliancesites_client.go new file mode 100644 index 000000000..e75bd2ce8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualappliancesites_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualApplianceSitesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualApplianceSitesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualApplianceSitesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualApplianceSitesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualApplianceSitesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, parameters VirtualApplianceSite, options *VirtualApplianceSitesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, siteName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified site from a Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualApplianceSitesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualApplianceSitesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified site from a Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualApplianceSitesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, options *VirtualApplianceSitesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, siteName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, siteName, options) + if err != nil { + return VirtualApplianceSitesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualApplianceSitesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualApplianceSitesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualapplianceskus_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualapplianceskus_client.go new file mode 100644 index 000000000..49f709be5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualapplianceskus_client.go @@ -0,0 +1,161 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualApplianceSKUsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualApplianceSKUsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, skuName, options) + if err != nil { + return VirtualApplianceSKUsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualApplianceSKUsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualApplianceSKUsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - VirtualApplianceSKUsClientListOptions contains the optional parameters for the VirtualApplianceSKUsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualhubbgpconnection_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubbgpconnection_client.go new file mode 100644 index 000000000..b4952595a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubbgpconnection_client.go @@ -0,0 +1,265 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualHubBgpConnectionClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualHubBgpConnectionClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubBgpConnectionClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubBgpConnectionClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualHubBgpConnectionClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, parameters BgpConnection, options *VirtualHubBgpConnectionClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a VirtualHubBgpConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubBgpConnectionClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubBgpConnectionClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a VirtualHubBgpConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualHubBgpConnectionClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *VirtualHubBgpConnectionClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return VirtualHubBgpConnectionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualHubBgpConnectionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualHubBgpConnectionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualhubbgpconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubbgpconnections_client.go new file mode 100644 index 000000000..fda2975fe --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubbgpconnections_client.go @@ -0,0 +1,265 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualHubBgpConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualHubBgpConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Retrieves the details of all VirtualHubBgpConnections. +// +// Generated from API version 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualHubBgpConnectionsClient) listAdvertisedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string, options *VirtualHubBgpConnectionsClientBeginListAdvertisedRoutesOptions) (*http.Response, error) { + var err error + req, err := client.listAdvertisedRoutesCreateRequest(ctx, resourceGroupName, hubName, connectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubBgpConnectionsClientListLearnedRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubBgpConnectionsClientListLearnedRoutesResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualHubBgpConnectionsClient) listLearnedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string, options *VirtualHubBgpConnectionsClientBeginListLearnedRoutesOptions) (*http.Response, error) { + var err error + req, err := client.listLearnedRoutesCreateRequest(ctx, resourceGroupName, hubName, connectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualhubipconfiguration_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubipconfiguration_client.go new file mode 100644 index 000000000..0b5195a65 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubipconfiguration_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualHubIPConfigurationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualHubIPConfigurationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubIPConfigurationClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubIPConfigurationClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualHubIPConfigurationClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, parameters HubIPConfiguration, options *VirtualHubIPConfigurationClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, ipConfigName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a VirtualHubIpConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubIPConfigurationClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubIPConfigurationClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a VirtualHubIpConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualHubIPConfigurationClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, options *VirtualHubIPConfigurationClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, ipConfigName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, ipConfigName, options) + if err != nil { + return VirtualHubIPConfigurationClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualHubIPConfigurationClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualHubIPConfigurationClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualhubroutetablev2s_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubroutetablev2s_client.go new file mode 100644 index 000000000..a3affc392 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubroutetablev2s_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualHubRouteTableV2SClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualHubRouteTableV2SClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubRouteTableV2SClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubRouteTableV2SClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualHubRouteTableV2SClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, virtualHubRouteTableV2Parameters VirtualHubRouteTableV2, options *VirtualHubRouteTableV2SClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, virtualHubRouteTableV2Parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualHubRouteTableV2Parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a VirtualHubRouteTableV2. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubRouteTableV2SClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubRouteTableV2SClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a VirtualHubRouteTableV2. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualHubRouteTableV2SClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *VirtualHubRouteTableV2SClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return VirtualHubRouteTableV2SClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualHubRouteTableV2SClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualHubRouteTableV2SClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualhubs_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubs_client.go new file mode 100644 index 000000000..c473beaef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualhubs_client.go @@ -0,0 +1,662 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualHubsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualHubsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualHubsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters VirtualHub, options *VirtualHubsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, virtualHubParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualHubParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a VirtualHub. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a VirtualHub. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualHubsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, options) + if err != nil { + return VirtualHubsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualHubsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualHubsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubsClientGetEffectiveVirtualHubRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientGetEffectiveVirtualHubRoutesResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualHubsClient) getEffectiveVirtualHubRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions) (*http.Response, error) { + var err error + req, err := client.getEffectiveVirtualHubRoutesCreateRequest(ctx, resourceGroupName, virtualHubName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.EffectiveRoutesParameters != nil { + if err := runtime.MarshalAsJSON(req, *options.EffectiveRoutesParameters); err != nil { + return nil, err + } + return req, nil + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubsClientGetInboundRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientGetInboundRoutesResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualHubsClient) getInboundRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, getInboundRoutesParameters GetInboundRoutesParameters, options *VirtualHubsClientBeginGetInboundRoutesOptions) (*http.Response, error) { + var err error + req, err := client.getInboundRoutesCreateRequest(ctx, resourceGroupName, virtualHubName, getInboundRoutesParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, getInboundRoutesParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualHubsClientGetOutboundRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientGetOutboundRoutesResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualHubsClient) getOutboundRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, getOutboundRoutesParameters GetOutboundRoutesParameters, options *VirtualHubsClientBeginGetOutboundRoutesOptions) (*http.Response, error) { + var err error + req, err := client.getOutboundRoutesCreateRequest(ctx, resourceGroupName, virtualHubName, getOutboundRoutesParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, getOutboundRoutesParameters); err != nil { + return nil, err + } + return req, nil +} + +// NewListPager - Lists all the VirtualHubs in a subscription. +// +// Generated from API version 2023-05-01 +// - options - VirtualHubsClientListOptions contains the optional parameters for the VirtualHubsClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The resource group name of the VirtualHub. +// - options - VirtualHubsClientListByResourceGroupOptions contains the optional parameters for the VirtualHubsClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualHubName, virtualHubParameters, options) + if err != nil { + return VirtualHubsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualHubsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualHubsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualHubParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/virtualnetworkgatewayconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworkgatewayconnections_client.go new file mode 100644 index 000000000..29e424903 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworkgatewayconnections_client.go @@ -0,0 +1,900 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualNetworkGatewayConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkGatewayConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, options *VirtualNetworkGatewayConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified virtual network Gateway connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified virtual network Gateway connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return VirtualNetworkGatewayConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkGatewayConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkGatewayConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientGetIkeSasResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientGetIkeSasResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) getIkeSas(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginGetIkeSasOptions) (*http.Response, error) { + var err error + req, err := client.getIkeSasCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getSharedKeyCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse{}, err + } + resp, err := client.getSharedKeyHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - VirtualNetworkGatewayConnectionsClientListOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientResetConnectionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientResetConnectionResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// ResetConnection - Resets the virtual network gateway connection specified. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) resetConnection(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginResetConnectionOptions) (*http.Response, error) { + var err error + req, err := client.resetConnectionCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientResetSharedKeyResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientResetSharedKeyResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) resetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, options *VirtualNetworkGatewayConnectionsClientBeginResetSharedKeyOptions) (*http.Response, error) { + var err error + req, err := client.resetSharedKeyCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientSetSharedKeyResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientSetSharedKeyResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) setSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, options *VirtualNetworkGatewayConnectionsClientBeginSetSharedKeyOptions) (*http.Response, error) { + var err error + req, err := client.setSharedKeyCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) startPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginStartPacketCaptureOptions) (*http.Response, error) { + var err error + req, err := client.startPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientStopPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientStopPacketCaptureResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) stopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewayConnectionsClientBeginStopPacketCaptureOptions) (*http.Response, error) { + var err error + req, err := client.stopPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdateTags - Updates a virtual network gateway connection tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateTags - Updates a virtual network gateway connection tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) updateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject, options *VirtualNetworkGatewayConnectionsClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworkgatewaynatrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworkgatewaynatrules_client.go new file mode 100644 index 000000000..f3754932e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworkgatewaynatrules_client.go @@ -0,0 +1,337 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualNetworkGatewayNatRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkGatewayNatRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayNatRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayNatRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewayNatRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, natRuleParameters VirtualNetworkGatewayNatRule, options *VirtualNetworkGatewayNatRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName, natRuleParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, natRuleParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a nat rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewayNatRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayNatRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a nat rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworkGatewayNatRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, options *VirtualNetworkGatewayNatRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName, options) + if err != nil { + return VirtualNetworkGatewayNatRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkGatewayNatRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkGatewayNatRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListByVirtualNetworkGatewayPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualnetworkgateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworkgateways_client.go new file mode 100644 index 000000000..2ff9abf98 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworkgateways_client.go @@ -0,0 +1,1622 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualNetworkGatewaysClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkGatewaysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, options *VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified virtual network gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified virtual network gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworkGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) disconnectVirtualNetworkGatewayVPNConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVPNConnectionRequest, options *VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions) (*http.Response, error) { + var err error + req, err := client.disconnectVirtualNetworkGatewayVPNConnectionsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, request, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, request); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGenerateVPNProfileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGenerateVPNProfileResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) generateVPNProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions) (*http.Response, error) { + var err error + req, err := client.generateVPNProfileCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions) (*http.Response, error) { + var err error + req, err := client.generatevpnclientpackageCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// Get - Gets the specified virtual network gateway by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return VirtualNetworkGatewaysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkGatewaysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) getAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string, options *VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions) (*http.Response, error) { + var err error + req, err := client.getAdvertisedRoutesCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, peer, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("peer", peer) + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetBgpPeerStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetBgpPeerStatusResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) getBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions) (*http.Response, error) { + var err error + req, err := client.getBgpPeerStatusCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetLearnedRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetLearnedRoutesResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) getLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions) (*http.Response, error) { + var err error + req, err := client.getLearnedRoutesCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) getVPNProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions) (*http.Response, error) { + var err error + req, err := client.getVPNProfilePackageURLCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) getVpnclientConnectionHealth(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions) (*http.Response, error) { + var err error + req, err := client.getVpnclientConnectionHealthCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) getVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions) (*http.Response, error) { + var err error + req, err := client.getVpnclientIPSecParametersCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - VirtualNetworkGatewaysClientListOptions contains the optional parameters for the VirtualNetworkGatewaysClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListConnectionsPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientResetResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientResetResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetOptions) (*http.Response, error) { + var err error + req, err := client.resetCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) resetVPNClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions) (*http.Response, error) { + var err error + req, err := client.resetVPNClientSharedKeyCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) setVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIPSecParams VPNClientIPsecParameters, options *VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions) (*http.Response, error) { + var err error + req, err := client.setVpnclientIPSecParametersCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIPSecParams, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnclientIPSecParams); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientStartPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientStartPacketCaptureResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) startPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions) (*http.Response, error) { + var err error + req, err := client.startPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientStopPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientStopPacketCaptureResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkGatewaysClient) stopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions) (*http.Response, error) { + var err error + req, err := client.stopPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// SupportedVPNDevices - Gets a xml format representation for supported vpn devices. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.supportedVPNDevicesCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err + } + resp, err := client.supportedVPNDevicesHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateTags - Updates a virtual network gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworkGatewaysClient) updateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject, options *VirtualNetworkGatewaysClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.vpnDeviceConfigurationScriptCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err + } + resp, err := client.vpnDeviceConfigurationScriptHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/virtualnetworkpeerings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworkpeerings_client.go new file mode 100644 index 000000000..923ddf890 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworkpeerings_client.go @@ -0,0 +1,338 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualNetworkPeeringsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkPeeringsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkPeeringsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkPeeringsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworkPeeringsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, options *VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualNetworkPeeringParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified virtual network peering. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkPeeringsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkPeeringsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified virtual network peering. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworkPeeringsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, options *VirtualNetworkPeeringsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options) + if err != nil { + return VirtualNetworkPeeringsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkPeeringsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkPeeringsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualnetworks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworks_client.go new file mode 100644 index 000000000..bfd38e8fb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworks_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualNetworksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.checkIPAddressAvailabilityCreateRequest(ctx, resourceGroupName, virtualNetworkName, ipAddress, options) + if err != nil { + return VirtualNetworksClientCheckIPAddressAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworksClientCheckIPAddressAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworksClientCheckIPAddressAvailabilityResponse{}, err + } + resp, err := client.checkIPAddressAvailabilityHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("ipAddress", ipAddress) + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworksClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworksClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return VirtualNetworksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - VirtualNetworksClientListAllOptions contains the optional parameters for the VirtualNetworksClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.internal.Pipeline().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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[*runtime.Pager[VirtualNetworksClientListDdosProtectionStatusResponse]]{ + FinalStateVia: runtime.FinalStateViaLocation, + Response: &pager, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &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 2023-05-01 +func (client *VirtualNetworksClient) listDdosProtectionStatus(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginListDdosProtectionStatusOptions) (*http.Response, error) { + var err error + req, err := client.listDdosProtectionStatusCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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", "2023-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 2023-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.NewListUsagePager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) + if err != nil { + return VirtualNetworksClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworksClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworksClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/virtualnetworktaps_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworktaps_client.go new file mode 100644 index 000000000..3963dc911 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualnetworktaps_client.go @@ -0,0 +1,439 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualNetworkTapsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkTapsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkTapsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkTapsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates a Virtual Network Tap. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworkTapsClient) createOrUpdate(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap, options *VirtualNetworkTapsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, tapName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified virtual network tap. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkTapsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkTapsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified virtual network tap. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualNetworkTapsClient) deleteOperation(ctx context.Context, resourceGroupName string, tapName string, options *VirtualNetworkTapsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, tapName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, tapName, options) + if err != nil { + return VirtualNetworkTapsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkTapsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkTapsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - VirtualNetworkTapsClientListAllOptions contains the optional parameters for the VirtualNetworkTapsClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - VirtualNetworkTapsClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworkTapsClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, tapName, tapParameters, options) + if err != nil { + return VirtualNetworkTapsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkTapsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkTapsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, tapParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/virtualrouterpeerings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualrouterpeerings_client.go new file mode 100644 index 000000000..e43884136 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualrouterpeerings_client.go @@ -0,0 +1,335 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualRouterPeeringsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualRouterPeeringsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualRouterPeeringsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualRouterPeeringsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Virtual Router Peering. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualRouterPeeringsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, parameters VirtualRouterPeering, options *VirtualRouterPeeringsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualRouterName, peeringName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified peering from a Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualRouterPeeringsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualRouterPeeringsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified peering from a Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualRouterPeeringsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, options *VirtualRouterPeeringsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualRouterName, peeringName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualRouterName, peeringName, options) + if err != nil { + return VirtualRouterPeeringsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualRouterPeeringsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualRouterPeeringsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualrouters_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualrouters_client.go new file mode 100644 index 000000000..0dcb79ad9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualrouters_client.go @@ -0,0 +1,376 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualRoutersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualRoutersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualRoutersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualRoutersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualRoutersClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, parameters VirtualRouter, options *VirtualRoutersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualRouterName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualRoutersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualRoutersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualRoutersClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualRouterName string, options *VirtualRoutersClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualRouterName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualRouterName, options) + if err != nil { + return VirtualRoutersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualRoutersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualRoutersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - VirtualRoutersClientListOptions contains the optional parameters for the VirtualRoutersClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - VirtualRoutersClientListByResourceGroupOptions contains the optional parameters for the VirtualRoutersClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/virtualwans_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualwans_client.go new file mode 100644 index 000000000..f3e6988b9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/virtualwans_client.go @@ -0,0 +1,436 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VirtualWansClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualWansClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualWansClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualWansClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VirtualWansClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualWANName string, wanParameters VirtualWAN, options *VirtualWansClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualWANName, wanParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, wanParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a VirtualWAN. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualWansClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualWansClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a VirtualWAN. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VirtualWansClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualWANName string, options *VirtualWansClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return VirtualWansClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualWansClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualWansClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - VirtualWansClientListOptions contains the optional parameters for the VirtualWansClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The resource group name of the VirtualWan. +// - options - VirtualWansClientListByResourceGroupOptions contains the optional parameters for the VirtualWansClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualWANName, wanParameters, options) + if err != nil { + return VirtualWansClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualWansClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualWansClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, wanParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/vpnconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnconnections_client.go new file mode 100644 index 000000000..a82b7f75e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnconnections_client.go @@ -0,0 +1,497 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VPNConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VPNConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, vpnConnectionParameters VPNConnection, options *VPNConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnConnectionParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a vpn connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a vpn connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VPNConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, options *VPNConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, options) + if err != nil { + return VPNConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VPNConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VPNConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListByVPNGatewayPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNConnectionsClientStartPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNConnectionsClientStartPacketCaptureResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNConnectionsClient) startPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, options *VPNConnectionsClientBeginStartPacketCaptureOptions) (*http.Response, error) { + var err error + req, err := client.startPacketCaptureCreateRequest(ctx, resourceGroupName, gatewayName, vpnConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNConnectionsClientStopPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNConnectionsClientStopPacketCaptureResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNConnectionsClient) stopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, options *VPNConnectionsClientBeginStopPacketCaptureOptions) (*http.Response, error) { + var err error + req, err := client.stopPacketCaptureCreateRequest(ctx, resourceGroupName, gatewayName, vpnConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpngateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpngateways_client.go new file mode 100644 index 000000000..a44104994 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpngateways_client.go @@ -0,0 +1,670 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VPNGatewaysClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VPNGatewaysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters VPNGateway, options *VPNGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, gatewayName, vpnGatewayParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnGatewayParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a virtual wan vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a virtual wan vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VPNGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return VPNGatewaysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VPNGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VPNGatewaysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - VPNGatewaysClientListOptions contains the optional parameters for the VPNGatewaysClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The resource group name of the VpnGateway. +// - options - VPNGatewaysClientListByResourceGroupOptions contains the optional parameters for the VPNGatewaysClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNGatewaysClientResetResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientResetResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNGatewaysClient) reset(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginResetOptions) (*http.Response, error) { + var err error + req, err := client.resetCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.IPConfigurationID != nil { + reqQP.Set("ipConfigurationId", *options.IPConfigurationID) + } + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNGatewaysClientStartPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientStartPacketCaptureResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNGatewaysClient) startPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginStartPacketCaptureOptions) (*http.Response, error) { + var err error + req, err := client.startPacketCaptureCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNGatewaysClientStopPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientStopPacketCaptureResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNGatewaysClient) stopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginStopPacketCaptureOptions) (*http.Response, error) { + var err error + req, err := client.stopPacketCaptureCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// BeginUpdateTags - Updates virtual wan vpn gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNGatewaysClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateTags - Updates virtual wan vpn gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VPNGatewaysClient) updateTags(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters TagsObject, options *VPNGatewaysClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, gatewayName, vpnGatewayParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnGatewayParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnlinkconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnlinkconnections_client.go new file mode 100644 index 000000000..86bd6c0bd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnlinkconnections_client.go @@ -0,0 +1,280 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VPNLinkConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VPNLinkConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNLinkConnectionsClientGetIkeSasResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNLinkConnectionsClientGetIkeSasResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNLinkConnectionsClient) getIkeSas(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNLinkConnectionsClientBeginGetIkeSasOptions) (*http.Response, error) { + var err error + req, err := client.getIkeSasCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListByVPNConnectionPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNLinkConnectionsClientResetConnectionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNLinkConnectionsClientResetConnectionResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// ResetConnection - Resets the VpnLink connection specified. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VPNLinkConnectionsClient) resetConnection(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNLinkConnectionsClientBeginResetConnectionOptions) (*http.Response, error) { + var err error + req, err := client.resetConnectionCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/vpnserverconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnserverconfigurations_client.go new file mode 100644 index 000000000..feed90e56 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnserverconfigurations_client.go @@ -0,0 +1,440 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VPNServerConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VPNServerConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNServerConfigurationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNServerConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNServerConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters VPNServerConfiguration, options *VPNServerConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnServerConfigurationParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a VpnServerConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNServerConfigurationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNServerConfigurationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a VpnServerConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VPNServerConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, options) + if err != nil { + return VPNServerConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VPNServerConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VPNServerConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - VPNServerConfigurationsClientListOptions contains the optional parameters for the VPNServerConfigurationsClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The resource group name of the VpnServerConfiguration. +// - options - VPNServerConfigurationsClientListByResourceGroupOptions contains the optional parameters for the VPNServerConfigurationsClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters, options) + if err != nil { + return VPNServerConfigurationsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VPNServerConfigurationsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VPNServerConfigurationsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnServerConfigurationParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/vpnserverconfigurationsassociatedwithvirtualwan_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnserverconfigurationsassociatedwithvirtualwan_client.go new file mode 100644 index 000000000..b8feb7ff1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnserverconfigurationsassociatedwithvirtualwan_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VPNServerConfigurationsAssociatedWithVirtualWanClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VPNServerConfigurationsAssociatedWithVirtualWanClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNServerConfigurationsAssociatedWithVirtualWanClientListResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNServerConfigurationsAssociatedWithVirtualWanClientListResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNServerConfigurationsAssociatedWithVirtualWanClient) listOperation(ctx context.Context, resourceGroupName string, virtualWANName string, options *VPNServerConfigurationsAssociatedWithVirtualWanClientBeginListOptions) (*http.Response, error) { + var err error + req, err := client.listCreateRequest(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/vpnsitelinkconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnsitelinkconnections_client.go new file mode 100644 index 000000000..4c0c45d18 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnsitelinkconnections_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VPNSiteLinkConnectionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VPNSiteLinkConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName, options) + if err != nil { + return VPNSiteLinkConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VPNSiteLinkConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VPNSiteLinkConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/vpnsitelinks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnsitelinks_client.go new file mode 100644 index 000000000..124ae6ecb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnsitelinks_client.go @@ -0,0 +1,180 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VPNSiteLinksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VPNSiteLinksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, vpnSiteName, vpnSiteLinkName, options) + if err != nil { + return VPNSiteLinksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VPNSiteLinksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VPNSiteLinksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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.NewListByVPNSitePager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/vpnsites_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnsites_client.go new file mode 100644 index 000000000..bbdbcef64 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnsites_client.go @@ -0,0 +1,436 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VPNSitesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VPNSitesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNSitesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNSitesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNSitesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters VPNSite, options *VPNSitesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vpnSiteName, vpnSiteParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnSiteParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a VpnSite. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNSitesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNSitesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a VpnSite. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *VPNSitesClient) deleteOperation(ctx context.Context, resourceGroupName string, vpnSiteName string, options *VPNSitesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vpnSiteName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, vpnSiteName, options) + if err != nil { + return VPNSitesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VPNSitesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VPNSitesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - VPNSitesClientListOptions contains the optional parameters for the VPNSitesClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The resource group name of the VpnSite. +// - options - VPNSitesClientListByResourceGroupOptions contains the optional parameters for the VPNSitesClient.NewListByResourceGroupPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, vpnSiteName, vpnSiteParameters, options) + if err != nil { + return VPNSitesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VPNSitesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VPNSitesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, vpnSiteParameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/v4/vpnsitesconfiguration_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnsitesconfiguration_client.go new file mode 100644 index 000000000..92f858074 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/vpnsitesconfiguration_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".VPNSitesConfigurationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VPNSitesConfigurationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNSitesConfigurationClientDownloadResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VPNSitesConfigurationClientDownloadResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *VPNSitesConfigurationClient) download(ctx context.Context, resourceGroupName string, virtualWANName string, request GetVPNSitesConfigurationRequest, options *VPNSitesConfigurationClientBeginDownloadOptions) (*http.Response, error) { + var err error + req, err := client.downloadCreateRequest(ctx, resourceGroupName, virtualWANName, request, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, request); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/watchers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/watchers_client.go new file mode 100644 index 000000000..0dfd46432 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/watchers_client.go @@ -0,0 +1,1305 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".WatchersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WatchersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientCheckConnectivityResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientCheckConnectivityResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *WatchersClient) checkConnectivity(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters, options *WatchersClientBeginCheckConnectivityOptions) (*http.Response, error) { + var err error + req, err := client.checkConnectivityCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return WatchersClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WatchersClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return WatchersClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified network watcher resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *WatchersClient) deleteOperation(ctx context.Context, resourceGroupName string, networkWatcherName string, options *WatchersClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkWatcherName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, networkWatcherName, options) + if err != nil { + return WatchersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WatchersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WatchersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientGetAzureReachabilityReportResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetAzureReachabilityReportResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *WatchersClient) getAzureReachabilityReport(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters, options *WatchersClientBeginGetAzureReachabilityReportOptions) (*http.Response, error) { + var err error + req, err := client.getAzureReachabilityReportCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientGetFlowLogStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetFlowLogStatusResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *WatchersClient) getFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, options *WatchersClientBeginGetFlowLogStatusOptions) (*http.Response, error) { + var err error + req, err := client.getFlowLogStatusCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientGetNetworkConfigurationDiagnosticResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetNetworkConfigurationDiagnosticResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *WatchersClient) getNetworkConfigurationDiagnostic(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters, options *WatchersClientBeginGetNetworkConfigurationDiagnosticOptions) (*http.Response, error) { + var err error + req, err := client.getNetworkConfigurationDiagnosticCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginGetNextHop - Gets the next hop from the specified VM. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientGetNextHopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetNextHopResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GetNextHop - Gets the next hop from the specified VM. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *WatchersClient) getNextHop(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters, options *WatchersClientBeginGetNextHopOptions) (*http.Response, error) { + var err error + req, err := client.getNextHopCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// GetTopology - Gets the current network topology by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.getTopologyCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return WatchersClientGetTopologyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WatchersClientGetTopologyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WatchersClientGetTopologyResponse{}, err + } + resp, err := client.getTopologyHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientGetTroubleshootingResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetTroubleshootingResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GetTroubleshooting - Initiate troubleshooting on a specified resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *WatchersClient) getTroubleshooting(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, options *WatchersClientBeginGetTroubleshootingOptions) (*http.Response, error) { + var err error + req, err := client.getTroubleshootingCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientGetTroubleshootingResultResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetTroubleshootingResultResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *WatchersClient) getTroubleshootingResult(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, options *WatchersClientBeginGetTroubleshootingResultOptions) (*http.Response, error) { + var err error + req, err := client.getTroubleshootingResultCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientGetVMSecurityRulesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetVMSecurityRulesResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *WatchersClient) getVMSecurityRules(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, options *WatchersClientBeginGetVMSecurityRulesOptions) (*http.Response, error) { + var err error + req, err := client.getVMSecurityRulesCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// NewListPager - Gets all network watchers by resource group. +// +// Generated from API version 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - WatchersClientListOptions contains the optional parameters for the WatchersClient.NewListPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - WatchersClientListAllOptions contains the optional parameters for the WatchersClient.NewListAllPager 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientListAvailableProvidersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientListAvailableProvidersResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *WatchersClient) listAvailableProviders(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters, options *WatchersClientBeginListAvailableProvidersOptions) (*http.Response, error) { + var err error + req, err := client.listAvailableProvidersCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientSetFlowLogConfigurationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientSetFlowLogConfigurationResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *WatchersClient) setFlowLogConfiguration(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, options *WatchersClientBeginSetFlowLogConfigurationOptions) (*http.Response, error) { + var err error + req, err := client.setFlowLogConfigurationCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// UpdateTags - Updates a network watcher tags. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return WatchersClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WatchersClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WatchersClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientVerifyIPFlowResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WatchersClientVerifyIPFlowResponse](options.ResumeToken, client.internal.Pipeline(), 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 2023-05-01 +func (client *WatchersClient) verifyIPFlow(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, options *WatchersClientBeginVerifyIPFlowOptions) (*http.Response, error) { + var err error + req, err := client.verifyIPFlowCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/webapplicationfirewallpolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/webapplicationfirewallpolicies_client.go new file mode 100644 index 000000000..afd9d1a13 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/webapplicationfirewallpolicies_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".WebApplicationFirewallPoliciesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebApplicationFirewallPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 2023-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) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, policyName, parameters, options) + if err != nil { + return WebApplicationFirewallPoliciesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebApplicationFirewallPoliciesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return WebApplicationFirewallPoliciesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 2023-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WebApplicationFirewallPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[WebApplicationFirewallPoliciesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01 +func (client *WebApplicationFirewallPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, policyName string, options *WebApplicationFirewallPoliciesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, policyName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, policyName, options) + if err != nil { + return WebApplicationFirewallPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebApplicationFirewallPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebApplicationFirewallPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - resourceGroupName - The name of the resource group. +// - options - WebApplicationFirewallPoliciesClientListOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.NewListPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - WebApplicationFirewallPoliciesClientListAllOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.NewListAllPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/v4/webcategories_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/webcategories_client.go new file mode 100644 index 000000000..a59062096 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4/webcategories_client.go @@ -0,0 +1,163 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetwork + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName+".WebCategoriesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WebCategoriesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the specified Azure Web Category. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-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) { + var err error + req, err := client.getCreateRequest(ctx, name, options) + if err != nil { + return WebCategoriesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WebCategoriesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebCategoriesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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 2023-05-01 +// - options - WebCategoriesClientListBySubscriptionOptions contains the optional parameters for the WebCategoriesClient.NewListBySubscriptionPager +// 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-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/privatedns/armprivatedns/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md new file mode 100644 index 000000000..10b920c12 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md @@ -0,0 +1,20 @@ +# Release History + +## 1.2.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + +## 1.1.0 (2023-03-27) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + +## 1.0.0 (2022-05-18) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns` 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/privatedns/armprivatedns/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/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/privatedns/armprivatedns/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/README.md new file mode 100644 index 000000000..3a731b96c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/README.md @@ -0,0 +1,98 @@ +# Azure Private DNS Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns) + +The `armprivatedns` module provides operations for working with Azure Private DNS. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/privatedns/armprivatedns) + +# 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 Private DNS module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Private DNS. 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). + +## Client Factory + +Azure Private DNS module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armprivatedns.NewClientFactory(, 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, + }, +} +clientFactory, err := armprivatedns.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewPrivateZonesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## More sample code + +- [Private Zone](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/privatedns/privatezone) +- [Record Sets](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/privatedns/record_sets) +- [Virtual Network Link](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/privatedns/virtualnetworklink) + +## 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 `Private DNS` 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/privatedns/armprivatedns/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/assets.json new file mode 100644 index 000000000..df1ba6bf8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "go", + "TagPrefix": "go/resourcemanager/privatedns/armprivatedns", + "Tag": "go/resourcemanager/privatedns/armprivatedns_329737d335" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/autorest.md new file mode 100644 index 000000000..135ffeb7b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/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/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/privatedns/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/privatedns/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.2.0 +``` \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/build.go new file mode 100644 index 000000000..17d7a41bb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/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/privatedns/armprivatedns + +package armprivatedns diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/ci.yml new file mode 100644 index 000000000..73b1d24af --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/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/privatedns/armprivatedns/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/privatedns/armprivatedns/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/privatedns/armprivatedns' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/client_factory.go new file mode 100644 index 000000000..114f103e1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/client_factory.go @@ -0,0 +1,57 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - Gets 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +// NewPrivateZonesClient creates a new instance of PrivateZonesClient. +func (c *ClientFactory) NewPrivateZonesClient() *PrivateZonesClient { + subClient, _ := NewPrivateZonesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewRecordSetsClient creates a new instance of RecordSetsClient. +func (c *ClientFactory) NewRecordSetsClient() *RecordSetsClient { + subClient, _ := NewRecordSetsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewVirtualNetworkLinksClient creates a new instance of VirtualNetworkLinksClient. +func (c *ClientFactory) NewVirtualNetworkLinksClient() *VirtualNetworkLinksClient { + subClient, _ := NewVirtualNetworkLinksClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/constants.go new file mode 100644 index 000000000..e46120d3a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/constants.go @@ -0,0 +1,83 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns" + moduleVersion = "v1.2.0" +) + +// ProvisioningState - The provisioning state of the resource. This is a read-only property and any attempt to set this value +// will be ignored. +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + 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{ + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +type RecordType string + +const ( + RecordTypeA RecordType = "A" + RecordTypeAAAA RecordType = "AAAA" + RecordTypeCNAME RecordType = "CNAME" + RecordTypeMX RecordType = "MX" + RecordTypePTR RecordType = "PTR" + RecordTypeSOA RecordType = "SOA" + RecordTypeSRV RecordType = "SRV" + RecordTypeTXT RecordType = "TXT" +) + +// PossibleRecordTypeValues returns the possible values for the RecordType const type. +func PossibleRecordTypeValues() []RecordType { + return []RecordType{ + RecordTypeA, + RecordTypeAAAA, + RecordTypeCNAME, + RecordTypeMX, + RecordTypePTR, + RecordTypeSOA, + RecordTypeSRV, + RecordTypeTXT, + } +} + +// VirtualNetworkLinkState - The status of the virtual network link to the Private DNS zone. Possible values are 'InProgress' +// and 'Done'. This is a read-only property and any attempt to set this value will be ignored. +type VirtualNetworkLinkState string + +const ( + VirtualNetworkLinkStateCompleted VirtualNetworkLinkState = "Completed" + VirtualNetworkLinkStateInProgress VirtualNetworkLinkState = "InProgress" +) + +// PossibleVirtualNetworkLinkStateValues returns the possible values for the VirtualNetworkLinkState const type. +func PossibleVirtualNetworkLinkStateValues() []VirtualNetworkLinkState { + return []VirtualNetworkLinkState{ + VirtualNetworkLinkStateCompleted, + VirtualNetworkLinkStateInProgress, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/models.go new file mode 100644 index 000000000..08b228ef3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/models.go @@ -0,0 +1,318 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +// ARecord - An A record. +type ARecord struct { + // The IPv4 address of this A record. + IPv4Address *string +} + +// AaaaRecord - An AAAA record. +type AaaaRecord struct { + // The IPv6 address of this AAAA record. + IPv6Address *string +} + +// CnameRecord - A CNAME record. +type CnameRecord struct { + // The canonical name for this CNAME record. + Cname *string +} + +// MxRecord - An MX record. +type MxRecord struct { + // The domain name of the mail host for this MX record. + Exchange *string + + // The preference value for this MX record. + Preference *int32 +} + +// PrivateZone - Describes a Private DNS zone. +type PrivateZone struct { + // The ETag of the zone. + Etag *string + + // The Azure Region where the resource lives + Location *string + + // Properties of the Private DNS zone. + Properties *PrivateZoneProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + Type *string +} + +// PrivateZoneListResult - The response to a Private DNS zone list operation. +type PrivateZoneListResult struct { + // Information about the Private DNS zones. + Value []*PrivateZone + + // READ-ONLY; The continuation token for the next page of results. + NextLink *string +} + +// PrivateZoneProperties - Represents the properties of the Private DNS zone. +type PrivateZoneProperties struct { + // READ-ONLY; Private zone internal Id + InternalID *string + + // READ-ONLY; The maximum number of record sets that can be created in this Private DNS zone. This is a read-only property + // and any attempt to set this value will be ignored. + MaxNumberOfRecordSets *int64 + + // READ-ONLY; The maximum number of virtual networks that can be linked to this Private DNS zone. This is a read-only property + // and any attempt to set this value will be ignored. + MaxNumberOfVirtualNetworkLinks *int64 + + // READ-ONLY; The maximum number of virtual networks that can be linked to this Private DNS zone with registration enabled. + // This is a read-only property and any attempt to set this value will be ignored. + MaxNumberOfVirtualNetworkLinksWithRegistration *int64 + + // READ-ONLY; The current number of record sets in this Private DNS zone. This is a read-only property and any attempt to + // set this value will be ignored. + NumberOfRecordSets *int64 + + // READ-ONLY; The current number of virtual networks that are linked to this Private DNS zone. This is a read-only property + // and any attempt to set this value will be ignored. + NumberOfVirtualNetworkLinks *int64 + + // READ-ONLY; The current number of virtual networks that are linked to this Private DNS zone with registration enabled. This + // is a read-only property and any attempt to set this value will be ignored. + NumberOfVirtualNetworkLinksWithRegistration *int64 + + // READ-ONLY; The provisioning state of the resource. This is a read-only property and any attempt to set this value will + // be ignored. + ProvisioningState *ProvisioningState +} + +// ProxyResource - The resource model definition for an ARM proxy resource. +type ProxyResource struct { + // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + Type *string +} + +// PtrRecord - A PTR record. +type PtrRecord struct { + // The PTR target domain name for this PTR record. + Ptrdname *string +} + +// RecordSet - Describes a DNS record set (a collection of DNS records with the same name and type) in a Private DNS zone. +type RecordSet struct { + // The ETag of the record set. + Etag *string + + // The properties of the record set. + Properties *RecordSetProperties + + // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + Type *string +} + +// RecordSetListResult - The response to a record set list operation. +type RecordSetListResult struct { + // Information about the record sets in the response. + Value []*RecordSet + + // READ-ONLY; The continuation token for the next page of results. + NextLink *string +} + +// RecordSetProperties - Represents the properties of the records in the record set. +type RecordSetProperties struct { + // The list of A records in the record set. + ARecords []*ARecord + + // The list of AAAA records in the record set. + AaaaRecords []*AaaaRecord + + // The CNAME record in the record set. + CnameRecord *CnameRecord + + // The metadata attached to the record set. + Metadata map[string]*string + + // The list of MX records in the record set. + MxRecords []*MxRecord + + // The list of PTR records in the record set. + PtrRecords []*PtrRecord + + // The SOA record in the record set. + SoaRecord *SoaRecord + + // The list of SRV records in the record set. + SrvRecords []*SrvRecord + + // The TTL (time-to-live) of the records in the record set. + TTL *int64 + + // The list of TXT records in the record set. + TxtRecords []*TxtRecord + + // READ-ONLY; Fully qualified domain name of the record set. + Fqdn *string + + // READ-ONLY; Is the record set auto-registered in the Private DNS zone through a virtual network link? + IsAutoRegistered *bool +} + +// Resource - The core properties of ARM resources +type Resource struct { + // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + Type *string +} + +// SoaRecord - An SOA record. +type SoaRecord struct { + // The email contact for this SOA record. + Email *string + + // The expire time for this SOA record. + ExpireTime *int64 + + // The domain name of the authoritative name server for this SOA record. + Host *string + + // The minimum value for this SOA record. By convention this is used to determine the negative caching duration. + MinimumTTL *int64 + + // The refresh value for this SOA record. + RefreshTime *int64 + + // The retry time for this SOA record. + RetryTime *int64 + + // The serial number for this SOA record. + SerialNumber *int64 +} + +// SrvRecord - An SRV record. +type SrvRecord struct { + // The port value for this SRV record. + Port *int32 + + // The priority value for this SRV record. + Priority *int32 + + // The target domain name for this SRV record. + Target *string + + // The weight value for this SRV record. + Weight *int32 +} + +// SubResource - Reference to another subresource. +type SubResource struct { + // Resource ID. + ID *string +} + +// TrackedResource - The resource model definition for a ARM tracked top level resource +type TrackedResource struct { + // The Azure Region where the resource lives + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + Type *string +} + +// TxtRecord - A TXT record. +type TxtRecord struct { + // The text value of this TXT record. + Value []*string +} + +// VirtualNetworkLink - Describes a link to virtual network for a Private DNS zone. +type VirtualNetworkLink struct { + // The ETag of the virtual network link. + Etag *string + + // The Azure Region where the resource lives + Location *string + + // Properties of the virtual network link to the Private DNS zone. + Properties *VirtualNetworkLinkProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + Type *string +} + +// VirtualNetworkLinkListResult - The response to a list virtual network link to Private DNS zone operation. +type VirtualNetworkLinkListResult struct { + // Information about the virtual network links to the Private DNS zones. + Value []*VirtualNetworkLink + + // READ-ONLY; The continuation token for the next page of results. + NextLink *string +} + +// VirtualNetworkLinkProperties - Represents the properties of the Private DNS zone. +type VirtualNetworkLinkProperties struct { + // Is auto-registration of virtual machine records in the virtual network in the Private DNS zone enabled? + RegistrationEnabled *bool + + // The reference of the virtual network. + VirtualNetwork *SubResource + + // READ-ONLY; The provisioning state of the resource. This is a read-only property and any attempt to set this value will + // be ignored. + ProvisioningState *ProvisioningState + + // READ-ONLY; The status of the virtual network link to the Private DNS zone. Possible values are 'InProgress' and 'Done'. + // This is a read-only property and any attempt to set this value will be ignored. + VirtualNetworkLinkState *VirtualNetworkLinkState +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/models_serde.go new file mode 100644 index 000000000..5131706a0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/models_serde.go @@ -0,0 +1,835 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ARecord. +func (a ARecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipv4Address", a.IPv4Address) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ARecord. +func (a *ARecord) UnmarshalJSON(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 "ipv4Address": + err = unpopulate(val, "IPv4Address", &a.IPv4Address) + 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 AaaaRecord. +func (a AaaaRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipv6Address", a.IPv6Address) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AaaaRecord. +func (a *AaaaRecord) UnmarshalJSON(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 "ipv6Address": + err = unpopulate(val, "IPv6Address", &a.IPv6Address) + 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 CnameRecord. +func (c CnameRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cname", c.Cname) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CnameRecord. +func (c *CnameRecord) UnmarshalJSON(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 "cname": + err = unpopulate(val, "Cname", &c.Cname) + 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 MxRecord. +func (m MxRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exchange", m.Exchange) + populate(objectMap, "preference", m.Preference) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MxRecord. +func (m *MxRecord) UnmarshalJSON(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 "exchange": + err = unpopulate(val, "Exchange", &m.Exchange) + delete(rawMsg, key) + case "preference": + err = unpopulate(val, "Preference", &m.Preference) + 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 PrivateZone. +func (p PrivateZone) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 PrivateZone. +func (p *PrivateZone) UnmarshalJSON(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 PrivateZoneListResult. +func (p PrivateZoneListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateZoneListResult. +func (p *PrivateZoneListResult) UnmarshalJSON(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 PrivateZoneProperties. +func (p PrivateZoneProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "internalId", p.InternalID) + populate(objectMap, "maxNumberOfRecordSets", p.MaxNumberOfRecordSets) + populate(objectMap, "maxNumberOfVirtualNetworkLinks", p.MaxNumberOfVirtualNetworkLinks) + populate(objectMap, "maxNumberOfVirtualNetworkLinksWithRegistration", p.MaxNumberOfVirtualNetworkLinksWithRegistration) + populate(objectMap, "numberOfRecordSets", p.NumberOfRecordSets) + populate(objectMap, "numberOfVirtualNetworkLinks", p.NumberOfVirtualNetworkLinks) + populate(objectMap, "numberOfVirtualNetworkLinksWithRegistration", p.NumberOfVirtualNetworkLinksWithRegistration) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateZoneProperties. +func (p *PrivateZoneProperties) UnmarshalJSON(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 "internalId": + err = unpopulate(val, "InternalID", &p.InternalID) + delete(rawMsg, key) + case "maxNumberOfRecordSets": + err = unpopulate(val, "MaxNumberOfRecordSets", &p.MaxNumberOfRecordSets) + delete(rawMsg, key) + case "maxNumberOfVirtualNetworkLinks": + err = unpopulate(val, "MaxNumberOfVirtualNetworkLinks", &p.MaxNumberOfVirtualNetworkLinks) + delete(rawMsg, key) + case "maxNumberOfVirtualNetworkLinksWithRegistration": + err = unpopulate(val, "MaxNumberOfVirtualNetworkLinksWithRegistration", &p.MaxNumberOfVirtualNetworkLinksWithRegistration) + delete(rawMsg, key) + case "numberOfRecordSets": + err = unpopulate(val, "NumberOfRecordSets", &p.NumberOfRecordSets) + delete(rawMsg, key) + case "numberOfVirtualNetworkLinks": + err = unpopulate(val, "NumberOfVirtualNetworkLinks", &p.NumberOfVirtualNetworkLinks) + delete(rawMsg, key) + case "numberOfVirtualNetworkLinksWithRegistration": + err = unpopulate(val, "NumberOfVirtualNetworkLinksWithRegistration", &p.NumberOfVirtualNetworkLinksWithRegistration) + 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 ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 PtrRecord. +func (p PtrRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ptrdname", p.Ptrdname) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PtrRecord. +func (p *PtrRecord) UnmarshalJSON(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 "ptrdname": + err = unpopulate(val, "Ptrdname", &p.Ptrdname) + 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 RecordSet. +func (r RecordSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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 "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 RecordSetListResult. +func (r RecordSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecordSetListResult. +func (r *RecordSetListResult) UnmarshalJSON(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 RecordSetProperties. +func (r RecordSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aRecords", r.ARecords) + populate(objectMap, "aaaaRecords", r.AaaaRecords) + populate(objectMap, "cnameRecord", r.CnameRecord) + populate(objectMap, "fqdn", r.Fqdn) + populate(objectMap, "isAutoRegistered", r.IsAutoRegistered) + populate(objectMap, "metadata", r.Metadata) + populate(objectMap, "mxRecords", r.MxRecords) + populate(objectMap, "ptrRecords", r.PtrRecords) + populate(objectMap, "soaRecord", r.SoaRecord) + populate(objectMap, "srvRecords", r.SrvRecords) + populate(objectMap, "ttl", r.TTL) + populate(objectMap, "txtRecords", r.TxtRecords) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecordSetProperties. +func (r *RecordSetProperties) UnmarshalJSON(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 "aRecords": + err = unpopulate(val, "ARecords", &r.ARecords) + delete(rawMsg, key) + case "aaaaRecords": + err = unpopulate(val, "AaaaRecords", &r.AaaaRecords) + delete(rawMsg, key) + case "cnameRecord": + err = unpopulate(val, "CnameRecord", &r.CnameRecord) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &r.Fqdn) + delete(rawMsg, key) + case "isAutoRegistered": + err = unpopulate(val, "IsAutoRegistered", &r.IsAutoRegistered) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &r.Metadata) + delete(rawMsg, key) + case "mxRecords": + err = unpopulate(val, "MxRecords", &r.MxRecords) + delete(rawMsg, key) + case "ptrRecords": + err = unpopulate(val, "PtrRecords", &r.PtrRecords) + delete(rawMsg, key) + case "soaRecord": + err = unpopulate(val, "SoaRecord", &r.SoaRecord) + delete(rawMsg, key) + case "srvRecords": + err = unpopulate(val, "SrvRecords", &r.SrvRecords) + delete(rawMsg, key) + case "ttl": + err = unpopulate(val, "TTL", &r.TTL) + delete(rawMsg, key) + case "txtRecords": + err = unpopulate(val, "TxtRecords", &r.TxtRecords) + 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]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + 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 "name": + err = unpopulate(val, "Name", &r.Name) + 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 SoaRecord. +func (s SoaRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "email", s.Email) + populate(objectMap, "expireTime", s.ExpireTime) + populate(objectMap, "host", s.Host) + populate(objectMap, "minimumTtl", s.MinimumTTL) + populate(objectMap, "refreshTime", s.RefreshTime) + populate(objectMap, "retryTime", s.RetryTime) + populate(objectMap, "serialNumber", s.SerialNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoaRecord. +func (s *SoaRecord) UnmarshalJSON(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 "email": + err = unpopulate(val, "Email", &s.Email) + delete(rawMsg, key) + case "expireTime": + err = unpopulate(val, "ExpireTime", &s.ExpireTime) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &s.Host) + delete(rawMsg, key) + case "minimumTtl": + err = unpopulate(val, "MinimumTTL", &s.MinimumTTL) + delete(rawMsg, key) + case "refreshTime": + err = unpopulate(val, "RefreshTime", &s.RefreshTime) + delete(rawMsg, key) + case "retryTime": + err = unpopulate(val, "RetryTime", &s.RetryTime) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &s.SerialNumber) + 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 SrvRecord. +func (s SrvRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "port", s.Port) + populate(objectMap, "priority", s.Priority) + populate(objectMap, "target", s.Target) + populate(objectMap, "weight", s.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SrvRecord. +func (s *SrvRecord) UnmarshalJSON(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 "port": + err = unpopulate(val, "Port", &s.Port) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &s.Priority) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &s.Target) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &s.Weight) + 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]any) + 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 TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(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 "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) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TxtRecord. +func (t TxtRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TxtRecord. +func (t *TxtRecord) UnmarshalJSON(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 "value": + err = unpopulate(val, "Value", &t.Value) + 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 VirtualNetworkLink. +func (v VirtualNetworkLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 VirtualNetworkLink. +func (v *VirtualNetworkLink) UnmarshalJSON(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 VirtualNetworkLinkListResult. +func (v VirtualNetworkLinkListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkLinkListResult. +func (v *VirtualNetworkLinkListResult) UnmarshalJSON(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 VirtualNetworkLinkProperties. +func (v VirtualNetworkLinkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "registrationEnabled", v.RegistrationEnabled) + populate(objectMap, "virtualNetwork", v.VirtualNetwork) + populate(objectMap, "virtualNetworkLinkState", v.VirtualNetworkLinkState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkLinkProperties. +func (v *VirtualNetworkLinkProperties) UnmarshalJSON(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 "registrationEnabled": + err = unpopulate(val, "RegistrationEnabled", &v.RegistrationEnabled) + delete(rawMsg, key) + case "virtualNetwork": + err = unpopulate(val, "VirtualNetwork", &v.VirtualNetwork) + delete(rawMsg, key) + case "virtualNetworkLinkState": + err = unpopulate(val, "VirtualNetworkLinkState", &v.VirtualNetworkLinkState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + 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 any) 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/privatedns/armprivatedns/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/options.go new file mode 100644 index 000000000..5a0f148ca --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/options.go @@ -0,0 +1,163 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +// PrivateZonesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateZonesClient.BeginCreateOrUpdate +// method. +type PrivateZonesClientBeginCreateOrUpdateOptions struct { + // The ETag of the Private DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen ETag value + // to prevent accidentally overwriting any concurrent changes. + IfMatch *string + + // Set to '*' to allow a new Private DNS zone to be created, but to prevent updating an existing zone. Other values will be + // ignored. + IfNoneMatch *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateZonesClientBeginDeleteOptions contains the optional parameters for the PrivateZonesClient.BeginDelete method. +type PrivateZonesClientBeginDeleteOptions struct { + // The ETag of the Private DNS zone. Omit this value to always delete the current zone. Specify the last-seen ETag value to + // prevent accidentally deleting any concurrent changes. + IfMatch *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateZonesClientBeginUpdateOptions contains the optional parameters for the PrivateZonesClient.BeginUpdate method. +type PrivateZonesClientBeginUpdateOptions struct { + // The ETag of the Private DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen ETag value + // to prevent accidentally overwriting any concurrent changes. + IfMatch *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateZonesClientGetOptions contains the optional parameters for the PrivateZonesClient.Get method. +type PrivateZonesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateZonesClientListByResourceGroupOptions contains the optional parameters for the PrivateZonesClient.NewListByResourceGroupPager +// method. +type PrivateZonesClientListByResourceGroupOptions struct { + // The maximum number of record sets to return. If not specified, returns up to 100 record sets. + Top *int32 +} + +// PrivateZonesClientListOptions contains the optional parameters for the PrivateZonesClient.NewListPager method. +type PrivateZonesClientListOptions struct { + // The maximum number of Private DNS zones to return. If not specified, returns up to 100 zones. + Top *int32 +} + +// RecordSetsClientCreateOrUpdateOptions contains the optional parameters for the RecordSetsClient.CreateOrUpdate method. +type RecordSetsClientCreateOrUpdateOptions struct { + // The ETag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen ETag value + // to prevent accidentally overwriting any concurrent changes. + IfMatch *string + + // Set to '*' to allow a new record set to be created, but to prevent updating an existing record set. Other values will be + // ignored. + IfNoneMatch *string +} + +// RecordSetsClientDeleteOptions contains the optional parameters for the RecordSetsClient.Delete method. +type RecordSetsClientDeleteOptions struct { + // The ETag of the record set. Omit this value to always delete the current record set. Specify the last-seen ETag value to + // prevent accidentally deleting any concurrent changes. + IfMatch *string +} + +// RecordSetsClientGetOptions contains the optional parameters for the RecordSetsClient.Get method. +type RecordSetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.NewListByTypePager method. +type RecordSetsClientListByTypeOptions struct { + // The suffix label of the record set name to be used to filter the record set enumeration. If this parameter is specified, + // the returned enumeration will only contain records that end with ".". + Recordsetnamesuffix *string + + // The maximum number of record sets to return. If not specified, returns up to 100 record sets. + Top *int32 +} + +// RecordSetsClientListOptions contains the optional parameters for the RecordSetsClient.NewListPager method. +type RecordSetsClientListOptions struct { + // The suffix label of the record set name to be used to filter the record set enumeration. If this parameter is specified, + // the returned enumeration will only contain records that end with ".". + Recordsetnamesuffix *string + + // The maximum number of record sets to return. If not specified, returns up to 100 record sets. + Top *int32 +} + +// RecordSetsClientUpdateOptions contains the optional parameters for the RecordSetsClient.Update method. +type RecordSetsClientUpdateOptions struct { + // The ETag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen ETag value + // to prevent accidentally overwriting concurrent changes. + IfMatch *string +} + +// VirtualNetworkLinksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkLinksClient.BeginCreateOrUpdate +// method. +type VirtualNetworkLinksClientBeginCreateOrUpdateOptions struct { + // The ETag of the virtual network link to the Private DNS zone. Omit this value to always overwrite the current virtual network + // link. Specify the last-seen ETag value to prevent accidentally overwriting + // any concurrent changes. + IfMatch *string + + // Set to '*' to allow a new virtual network link to the Private DNS zone to be created, but to prevent updating an existing + // link. Other values will be ignored. + IfNoneMatch *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkLinksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkLinksClient.BeginDelete +// method. +type VirtualNetworkLinksClientBeginDeleteOptions struct { + // The ETag of the virtual network link to the Private DNS zone. Omit this value to always delete the current zone. Specify + // the last-seen ETag value to prevent accidentally deleting any concurrent + // changes. + IfMatch *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkLinksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworkLinksClient.BeginUpdate +// method. +type VirtualNetworkLinksClientBeginUpdateOptions struct { + // The ETag of the virtual network link to the Private DNS zone. Omit this value to always overwrite the current virtual network + // link. Specify the last-seen ETag value to prevent accidentally overwriting + // any concurrent changes. + IfMatch *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkLinksClientGetOptions contains the optional parameters for the VirtualNetworkLinksClient.Get method. +type VirtualNetworkLinksClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkLinksClientListOptions contains the optional parameters for the VirtualNetworkLinksClient.NewListPager method. +type VirtualNetworkLinksClientListOptions struct { + // The maximum number of virtual network links to return. If not specified, returns up to 100 virtual network links. + Top *int32 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client.go new file mode 100644 index 000000000..ed4026308 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client.go @@ -0,0 +1,485 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// PrivateZonesClient contains the methods for the PrivateZones group. +// Don't use this type directly, use NewPrivateZonesClient() instead. +type PrivateZonesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateZonesClient creates a new instance of PrivateZonesClient with the specified values. +// - subscriptionID - Gets 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 NewPrivateZonesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateZonesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateZonesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a Private DNS zone. Does not modify Links to virtual networks or DNS records within +// the zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - parameters - Parameters supplied to the CreateOrUpdate operation. +// - options - PrivateZonesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateZonesClient.BeginCreateOrUpdate +// method. +func (client *PrivateZonesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, privateZoneName string, parameters PrivateZone, options *PrivateZonesClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateZonesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, privateZoneName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateZonesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateZonesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a Private DNS zone. Does not modify Links to virtual networks or DNS records within +// the zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +func (client *PrivateZonesClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateZoneName string, parameters PrivateZone, options *PrivateZonesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PrivateZonesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateZoneName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateZonesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, parameters PrivateZone, options *PrivateZonesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a Private DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot +// be undone. Private DNS zone cannot be deleted unless all virtual network links to it are +// removed. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - options - PrivateZonesClientBeginDeleteOptions contains the optional parameters for the PrivateZonesClient.BeginDelete +// method. +func (client *PrivateZonesClient) BeginDelete(ctx context.Context, resourceGroupName string, privateZoneName string, options *PrivateZonesClientBeginDeleteOptions) (*runtime.Poller[PrivateZonesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, privateZoneName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateZonesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateZonesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a Private DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be +// undone. Private DNS zone cannot be deleted unless all virtual network links to it are +// removed. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +func (client *PrivateZonesClient) deleteOperation(ctx context.Context, resourceGroupName string, privateZoneName string, options *PrivateZonesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateZonesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateZoneName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateZonesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, options *PrivateZonesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-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, nil +} + +// Get - Gets a Private DNS zone. Retrieves the zone properties, but not the virtual networks links or the record sets within +// the zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - options - PrivateZonesClientGetOptions contains the optional parameters for the PrivateZonesClient.Get method. +func (client *PrivateZonesClient) Get(ctx context.Context, resourceGroupName string, privateZoneName string, options *PrivateZonesClientGetOptions) (PrivateZonesClientGetResponse, error) { + var err error + const operationName = "PrivateZonesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, privateZoneName, options) + if err != nil { + return PrivateZonesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateZonesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateZonesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateZonesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, options *PrivateZonesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateZonesClient) getHandleResponse(resp *http.Response) (PrivateZonesClientGetResponse, error) { + result := PrivateZonesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateZone); err != nil { + return PrivateZonesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the Private DNS zones in all resource groups in a subscription. +// +// Generated from API version 2020-06-01 +// - options - PrivateZonesClientListOptions contains the optional parameters for the PrivateZonesClient.NewListPager method. +func (client *PrivateZonesClient) NewListPager(options *PrivateZonesClientListOptions) *runtime.Pager[PrivateZonesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateZonesClientListResponse]{ + More: func(page PrivateZonesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateZonesClientListResponse) (PrivateZonesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateZonesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return PrivateZonesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateZonesClient) listCreateRequest(ctx context.Context, options *PrivateZonesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), 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", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateZonesClient) listHandleResponse(resp *http.Response) (PrivateZonesClientListResponse, error) { + result := PrivateZonesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateZoneListResult); err != nil { + return PrivateZonesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists the Private DNS zones within a resource group. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - options - PrivateZonesClientListByResourceGroupOptions contains the optional parameters for the PrivateZonesClient.NewListByResourceGroupPager +// method. +func (client *PrivateZonesClient) NewListByResourceGroupPager(resourceGroupName string, options *PrivateZonesClientListByResourceGroupOptions) *runtime.Pager[PrivateZonesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateZonesClientListByResourceGroupResponse]{ + More: func(page PrivateZonesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateZonesClientListByResourceGroupResponse) (PrivateZonesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateZonesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return PrivateZonesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PrivateZonesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateZonesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones" + 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.internal.Endpoint(), 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", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PrivateZonesClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateZonesClientListByResourceGroupResponse, error) { + result := PrivateZonesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateZoneListResult); err != nil { + return PrivateZonesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a Private DNS zone. Does not modify virtual network links or DNS records within the zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - parameters - Parameters supplied to the Update operation. +// - options - PrivateZonesClientBeginUpdateOptions contains the optional parameters for the PrivateZonesClient.BeginUpdate +// method. +func (client *PrivateZonesClient) BeginUpdate(ctx context.Context, resourceGroupName string, privateZoneName string, parameters PrivateZone, options *PrivateZonesClientBeginUpdateOptions) (*runtime.Poller[PrivateZonesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, privateZoneName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateZonesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateZonesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a Private DNS zone. Does not modify virtual network links or DNS records within the zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +func (client *PrivateZonesClient) update(ctx context.Context, resourceGroupName string, privateZoneName string, parameters PrivateZone, options *PrivateZonesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PrivateZonesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, privateZoneName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PrivateZonesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, parameters PrivateZone, options *PrivateZonesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client.go new file mode 100644 index 000000000..b2253f547 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client.go @@ -0,0 +1,489 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// RecordSetsClient contains the methods for the RecordSets group. +// Don't use this type directly, use NewRecordSetsClient() instead. +type RecordSetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRecordSetsClient creates a new instance of RecordSetsClient with the specified values. +// - subscriptionID - Gets 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 NewRecordSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecordSetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RecordSetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a record set within a Private DNS zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - recordType - The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are +// created when the Private DNS zone is created). +// - relativeRecordSetName - The name of the record set, relative to the name of the zone. +// - parameters - Parameters supplied to the CreateOrUpdate operation. +// - options - RecordSetsClientCreateOrUpdateOptions contains the optional parameters for the RecordSetsClient.CreateOrUpdate +// method. +func (client *RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, parameters RecordSet, options *RecordSetsClientCreateOrUpdateOptions) (RecordSetsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "RecordSetsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateZoneName, recordType, relativeRecordSetName, parameters, options) + if err != nil { + return RecordSetsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RecordSetsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RecordSetsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RecordSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, parameters RecordSet, options *RecordSetsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if recordType == "" { + return nil, errors.New("parameter recordType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) + urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *RecordSetsClient) createOrUpdateHandleResponse(resp *http.Response) (RecordSetsClientCreateOrUpdateResponse, error) { + result := RecordSetsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecordSet); err != nil { + return RecordSetsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a record set from a Private DNS zone. This operation cannot be undone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - recordType - The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when +// the Private DNS zone is deleted). +// - relativeRecordSetName - The name of the record set, relative to the name of the zone. +// - options - RecordSetsClientDeleteOptions contains the optional parameters for the RecordSetsClient.Delete method. +func (client *RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, options *RecordSetsClientDeleteOptions) (RecordSetsClientDeleteResponse, error) { + var err error + const operationName = "RecordSetsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateZoneName, recordType, relativeRecordSetName, options) + if err != nil { + return RecordSetsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RecordSetsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return RecordSetsClientDeleteResponse{}, err + } + return RecordSetsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RecordSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, options *RecordSetsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if recordType == "" { + return nil, errors.New("parameter recordType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) + urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-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, nil +} + +// Get - Gets a record set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - recordType - The type of DNS record in this record set. +// - relativeRecordSetName - The name of the record set, relative to the name of the zone. +// - options - RecordSetsClientGetOptions contains the optional parameters for the RecordSetsClient.Get method. +func (client *RecordSetsClient) Get(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, options *RecordSetsClientGetOptions) (RecordSetsClientGetResponse, error) { + var err error + const operationName = "RecordSetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, privateZoneName, recordType, relativeRecordSetName, options) + if err != nil { + return RecordSetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RecordSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecordSetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RecordSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, options *RecordSetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if recordType == "" { + return nil, errors.New("parameter recordType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) + urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RecordSetsClient) getHandleResponse(resp *http.Response) (RecordSetsClientGetResponse, error) { + result := RecordSetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecordSet); err != nil { + return RecordSetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all record sets in a Private DNS zone. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - options - RecordSetsClientListOptions contains the optional parameters for the RecordSetsClient.NewListPager method. +func (client *RecordSetsClient) NewListPager(resourceGroupName string, privateZoneName string, options *RecordSetsClientListOptions) *runtime.Pager[RecordSetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RecordSetsClientListResponse]{ + More: func(page RecordSetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RecordSetsClientListResponse) (RecordSetsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecordSetsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, privateZoneName, options) + }, nil) + if err != nil { + return RecordSetsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *RecordSetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, options *RecordSetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/ALL" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), 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.Recordsetnamesuffix != nil { + reqQP.Set("$recordsetnamesuffix", *options.Recordsetnamesuffix) + } + reqQP.Set("api-version", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RecordSetsClient) listHandleResponse(resp *http.Response) (RecordSetsClientListResponse, error) { + result := RecordSetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecordSetListResult); err != nil { + return RecordSetsClientListResponse{}, err + } + return result, nil +} + +// NewListByTypePager - Lists the record sets of a specified type in a Private DNS zone. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - recordType - The type of record sets to enumerate. +// - options - RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.NewListByTypePager +// method. +func (client *RecordSetsClient) NewListByTypePager(resourceGroupName string, privateZoneName string, recordType RecordType, options *RecordSetsClientListByTypeOptions) *runtime.Pager[RecordSetsClientListByTypeResponse] { + return runtime.NewPager(runtime.PagingHandler[RecordSetsClientListByTypeResponse]{ + More: func(page RecordSetsClientListByTypeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RecordSetsClientListByTypeResponse) (RecordSetsClientListByTypeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecordSetsClient.NewListByTypePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByTypeCreateRequest(ctx, resourceGroupName, privateZoneName, recordType, options) + }, nil) + if err != nil { + return RecordSetsClientListByTypeResponse{}, err + } + return client.listByTypeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByTypeCreateRequest creates the ListByType request. +func (client *RecordSetsClient) listByTypeCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, options *RecordSetsClientListByTypeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if recordType == "" { + return nil, errors.New("parameter recordType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), 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.Recordsetnamesuffix != nil { + reqQP.Set("$recordsetnamesuffix", *options.Recordsetnamesuffix) + } + reqQP.Set("api-version", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTypeHandleResponse handles the ListByType response. +func (client *RecordSetsClient) listByTypeHandleResponse(resp *http.Response) (RecordSetsClientListByTypeResponse, error) { + result := RecordSetsClientListByTypeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecordSetListResult); err != nil { + return RecordSetsClientListByTypeResponse{}, err + } + return result, nil +} + +// Update - Updates a record set within a Private DNS zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - recordType - The type of DNS record in this record set. +// - relativeRecordSetName - The name of the record set, relative to the name of the zone. +// - parameters - Parameters supplied to the Update operation. +// - options - RecordSetsClientUpdateOptions contains the optional parameters for the RecordSetsClient.Update method. +func (client *RecordSetsClient) Update(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, parameters RecordSet, options *RecordSetsClientUpdateOptions) (RecordSetsClientUpdateResponse, error) { + var err error + const operationName = "RecordSetsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, privateZoneName, recordType, relativeRecordSetName, parameters, options) + if err != nil { + return RecordSetsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RecordSetsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecordSetsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *RecordSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, parameters RecordSet, options *RecordSetsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if recordType == "" { + return nil, errors.New("parameter recordType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) + urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *RecordSetsClient) updateHandleResponse(resp *http.Response) (RecordSetsClientUpdateResponse, error) { + result := RecordSetsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecordSet); err != nil { + return RecordSetsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/response_types.go new file mode 100644 index 000000000..8b5cff426 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/response_types.go @@ -0,0 +1,108 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +// PrivateZonesClientCreateOrUpdateResponse contains the response from method PrivateZonesClient.BeginCreateOrUpdate. +type PrivateZonesClientCreateOrUpdateResponse struct { + // Describes a Private DNS zone. + PrivateZone +} + +// PrivateZonesClientDeleteResponse contains the response from method PrivateZonesClient.BeginDelete. +type PrivateZonesClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateZonesClientGetResponse contains the response from method PrivateZonesClient.Get. +type PrivateZonesClientGetResponse struct { + // Describes a Private DNS zone. + PrivateZone +} + +// PrivateZonesClientListByResourceGroupResponse contains the response from method PrivateZonesClient.NewListByResourceGroupPager. +type PrivateZonesClientListByResourceGroupResponse struct { + // The response to a Private DNS zone list operation. + PrivateZoneListResult +} + +// PrivateZonesClientListResponse contains the response from method PrivateZonesClient.NewListPager. +type PrivateZonesClientListResponse struct { + // The response to a Private DNS zone list operation. + PrivateZoneListResult +} + +// PrivateZonesClientUpdateResponse contains the response from method PrivateZonesClient.BeginUpdate. +type PrivateZonesClientUpdateResponse struct { + // Describes a Private DNS zone. + PrivateZone +} + +// RecordSetsClientCreateOrUpdateResponse contains the response from method RecordSetsClient.CreateOrUpdate. +type RecordSetsClientCreateOrUpdateResponse struct { + // Describes a DNS record set (a collection of DNS records with the same name and type) in a Private DNS zone. + RecordSet +} + +// RecordSetsClientDeleteResponse contains the response from method RecordSetsClient.Delete. +type RecordSetsClientDeleteResponse struct { + // placeholder for future response values +} + +// RecordSetsClientGetResponse contains the response from method RecordSetsClient.Get. +type RecordSetsClientGetResponse struct { + // Describes a DNS record set (a collection of DNS records with the same name and type) in a Private DNS zone. + RecordSet +} + +// RecordSetsClientListByTypeResponse contains the response from method RecordSetsClient.NewListByTypePager. +type RecordSetsClientListByTypeResponse struct { + // The response to a record set list operation. + RecordSetListResult +} + +// RecordSetsClientListResponse contains the response from method RecordSetsClient.NewListPager. +type RecordSetsClientListResponse struct { + // The response to a record set list operation. + RecordSetListResult +} + +// RecordSetsClientUpdateResponse contains the response from method RecordSetsClient.Update. +type RecordSetsClientUpdateResponse struct { + // Describes a DNS record set (a collection of DNS records with the same name and type) in a Private DNS zone. + RecordSet +} + +// VirtualNetworkLinksClientCreateOrUpdateResponse contains the response from method VirtualNetworkLinksClient.BeginCreateOrUpdate. +type VirtualNetworkLinksClientCreateOrUpdateResponse struct { + // Describes a link to virtual network for a Private DNS zone. + VirtualNetworkLink +} + +// VirtualNetworkLinksClientDeleteResponse contains the response from method VirtualNetworkLinksClient.BeginDelete. +type VirtualNetworkLinksClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkLinksClientGetResponse contains the response from method VirtualNetworkLinksClient.Get. +type VirtualNetworkLinksClientGetResponse struct { + // Describes a link to virtual network for a Private DNS zone. + VirtualNetworkLink +} + +// VirtualNetworkLinksClientListResponse contains the response from method VirtualNetworkLinksClient.NewListPager. +type VirtualNetworkLinksClientListResponse struct { + // The response to a list virtual network link to Private DNS zone operation. + VirtualNetworkLinkListResult +} + +// VirtualNetworkLinksClientUpdateResponse contains the response from method VirtualNetworkLinksClient.BeginUpdate. +type VirtualNetworkLinksClientUpdateResponse struct { + // Describes a link to virtual network for a Private DNS zone. + VirtualNetworkLink +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client.go new file mode 100644 index 000000000..a3a8dc06f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client.go @@ -0,0 +1,450 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// VirtualNetworkLinksClient contains the methods for the VirtualNetworkLinks group. +// Don't use this type directly, use NewVirtualNetworkLinksClient() instead. +type VirtualNetworkLinksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVirtualNetworkLinksClient creates a new instance of VirtualNetworkLinksClient with the specified values. +// - subscriptionID - Gets 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 NewVirtualNetworkLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkLinksClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkLinksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a virtual network link to the specified Private DNS zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - virtualNetworkLinkName - The name of the virtual network link. +// - parameters - Parameters supplied to the CreateOrUpdate operation. +// - options - VirtualNetworkLinksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkLinksClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworkLinksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, parameters VirtualNetworkLink, options *VirtualNetworkLinksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworkLinksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, privateZoneName, virtualNetworkLinkName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkLinksClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkLinksClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a virtual network link to the specified Private DNS zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +func (client *VirtualNetworkLinksClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, parameters VirtualNetworkLink, options *VirtualNetworkLinksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworkLinksClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateZoneName, virtualNetworkLinkName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualNetworkLinksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, parameters VirtualNetworkLink, options *VirtualNetworkLinksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if virtualNetworkLinkName == "" { + return nil, errors.New("parameter virtualNetworkLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkLinkName}", url.PathEscape(virtualNetworkLinkName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a virtual network link to the specified Private DNS zone. WARNING: In case of a registration virtual +// network, all auto-registered DNS records in the zone for the virtual network will also be +// deleted. This operation cannot be undone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - virtualNetworkLinkName - The name of the virtual network link. +// - options - VirtualNetworkLinksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkLinksClient.BeginDelete +// method. +func (client *VirtualNetworkLinksClient) BeginDelete(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, options *VirtualNetworkLinksClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworkLinksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, privateZoneName, virtualNetworkLinkName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkLinksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkLinksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a virtual network link to the specified Private DNS zone. WARNING: In case of a registration virtual network, +// all auto-registered DNS records in the zone for the virtual network will also be +// deleted. This operation cannot be undone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +func (client *VirtualNetworkLinksClient) deleteOperation(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, options *VirtualNetworkLinksClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworkLinksClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateZoneName, virtualNetworkLinkName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualNetworkLinksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, options *VirtualNetworkLinksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if virtualNetworkLinkName == "" { + return nil, errors.New("parameter virtualNetworkLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkLinkName}", url.PathEscape(virtualNetworkLinkName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-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, nil +} + +// Get - Gets a virtual network link to the specified Private DNS zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - virtualNetworkLinkName - The name of the virtual network link. +// - options - VirtualNetworkLinksClientGetOptions contains the optional parameters for the VirtualNetworkLinksClient.Get method. +func (client *VirtualNetworkLinksClient) Get(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, options *VirtualNetworkLinksClientGetOptions) (VirtualNetworkLinksClientGetResponse, error) { + var err error + const operationName = "VirtualNetworkLinksClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, privateZoneName, virtualNetworkLinkName, options) + if err != nil { + return VirtualNetworkLinksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworkLinksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkLinksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VirtualNetworkLinksClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, options *VirtualNetworkLinksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if virtualNetworkLinkName == "" { + return nil, errors.New("parameter virtualNetworkLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkLinkName}", url.PathEscape(virtualNetworkLinkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualNetworkLinksClient) getHandleResponse(resp *http.Response) (VirtualNetworkLinksClientGetResponse, error) { + result := VirtualNetworkLinksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkLink); err != nil { + return VirtualNetworkLinksClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the virtual network links to the specified Private DNS zone. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - options - VirtualNetworkLinksClientListOptions contains the optional parameters for the VirtualNetworkLinksClient.NewListPager +// method. +func (client *VirtualNetworkLinksClient) NewListPager(resourceGroupName string, privateZoneName string, options *VirtualNetworkLinksClientListOptions) *runtime.Pager[VirtualNetworkLinksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkLinksClientListResponse]{ + More: func(page VirtualNetworkLinksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworkLinksClientListResponse) (VirtualNetworkLinksClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworkLinksClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, privateZoneName, options) + }, nil) + if err != nil { + return VirtualNetworkLinksClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualNetworkLinksClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, options *VirtualNetworkLinksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), 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", "2020-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualNetworkLinksClient) listHandleResponse(resp *http.Response) (VirtualNetworkLinksClientListResponse, error) { + result := VirtualNetworkLinksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkLinkListResult); err != nil { + return VirtualNetworkLinksClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a virtual network link to the specified Private DNS zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +// - resourceGroupName - The name of the resource group. +// - privateZoneName - The name of the Private DNS zone (without a terminating dot). +// - virtualNetworkLinkName - The name of the virtual network link. +// - parameters - Parameters supplied to the Update operation. +// - options - VirtualNetworkLinksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworkLinksClient.BeginUpdate +// method. +func (client *VirtualNetworkLinksClient) BeginUpdate(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, parameters VirtualNetworkLink, options *VirtualNetworkLinksClientBeginUpdateOptions) (*runtime.Poller[VirtualNetworkLinksClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, privateZoneName, virtualNetworkLinkName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkLinksClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkLinksClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a virtual network link to the specified Private DNS zone. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-06-01 +func (client *VirtualNetworkLinksClient) update(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, parameters VirtualNetworkLink, options *VirtualNetworkLinksClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworkLinksClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, privateZoneName, virtualNetworkLinkName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualNetworkLinksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, parameters VirtualNetworkLink, options *VirtualNetworkLinksClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateZoneName == "" { + return nil, errors.New("parameter privateZoneName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if virtualNetworkLinkName == "" { + return nil, errors.New("parameter virtualNetworkLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkLinkName}", url.PathEscape(virtualNetworkLinkName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-06-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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, 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..7186a65f1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/CHANGELOG.md @@ -0,0 +1,45 @@ +# Release History + +## 1.2.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + +## 1.2.0-beta.3 (2023-10-09) + +### Other Changes + +- Updated to latest `azcore` beta. + +## 1.2.0-beta.2 (2023-07-19) + +### Bug Fixes + +- Fixed a potential panic in faked paged and long-running operations. + +## 1.2.0-beta.1 (2023-06-12) + +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + +## 1.1.1 (2023-04-14) +### Bug Fixes + +- Fix serialization bug of empty value of `any` type. + + +## 1.1.0 (2023-03-27) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + +## 1.0.0 (2022-05-16) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources` 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/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..fbe11f6c6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/README.md @@ -0,0 +1,100 @@ +# 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 (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 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). + +## Client Factory + +Azure Resources module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armresources.NewClientFactory(, 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, + }, +} +clientFactory, err := armresources.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## More sample code + +- [Creating a Fake](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/resources/armresources/fake_example_test.go) +- [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/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/assets.json new file mode 100644 index 000000000..cd6e59432 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "go", + "TagPrefix": "go/resourcemanager/resources/armresources", + "Tag": "go/resourcemanager/resources/armresources_ab8e63cc21" +} 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..58dea419a --- /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.2.0 +package-resources: true +``` 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..546b96f36 --- /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 ../../../../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/client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client.go new file mode 100644 index 000000000..46fde2c78 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client.go @@ -0,0 +1,1042 @@ +//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. DO NOT EDIT. +// 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" + "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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &Client{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "Client.CheckExistence" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) + if err != nil { + return ClientCheckExistenceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientCheckExistenceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ClientCheckExistenceResponse{}, err + } + return ClientCheckExistenceResponse{Success: httpResp.StatusCode >= 200 && httpResp.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.internal.Endpoint(), 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) { + var err error + const operationName = "Client.CheckExistenceByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkExistenceByIDCreateRequest(ctx, resourceID, apiVersion, options) + if err != nil { + return ClientCheckExistenceByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientCheckExistenceByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ClientCheckExistenceByIDResponse{}, err + } + return ClientCheckExistenceByIDResponse{Success: httpResp.StatusCode >= 200 && httpResp.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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "Client.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateByIDResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientCreateOrUpdateByIDResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "Client.BeginCreateOrUpdateByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateByIDCreateRequest(ctx, resourceID, apiVersion, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "Client.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteByIDResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientDeleteByIDResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "Client.BeginDeleteByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteByIDCreateRequest(ctx, resourceID, apiVersion, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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) { + var err error + const operationName = "Client.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) + if err != nil { + return ClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "Client.GetByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getByIDCreateRequest(ctx, resourceID, apiVersion, options) + if err != nil { + return ClientGetByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetByIDResponse{}, err + } + resp, err := client.getByIDHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - options - ClientListOptions contains the optional parameters for the Client.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "Client.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return ClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// 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.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "Client.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return ClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientMoveResourcesResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientMoveResourcesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "Client.BeginMoveResources" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.moveResourcesCreateRequest(ctx, sourceResourceGroupName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "Client.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateByIDResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientUpdateByIDResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "Client.BeginUpdateByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateByIDCreateRequest(ctx, resourceID, apiVersion, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientValidateMoveResourcesResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientValidateMoveResourcesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "Client.BeginValidateMoveResources" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateMoveResourcesCreateRequest(ctx, sourceResourceGroupName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client_factory.go new file mode 100644 index 000000000..bcd6487d6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client_factory.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +// NewClient creates a new instance of Client. +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDeploymentOperationsClient creates a new instance of DeploymentOperationsClient. +func (c *ClientFactory) NewDeploymentOperationsClient() *DeploymentOperationsClient { + subClient, _ := NewDeploymentOperationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDeploymentsClient creates a new instance of DeploymentsClient. +func (c *ClientFactory) NewDeploymentsClient() *DeploymentsClient { + subClient, _ := NewDeploymentsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +// NewProviderResourceTypesClient creates a new instance of ProviderResourceTypesClient. +func (c *ClientFactory) NewProviderResourceTypesClient() *ProviderResourceTypesClient { + subClient, _ := NewProviderResourceTypesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewProvidersClient creates a new instance of ProvidersClient. +func (c *ClientFactory) NewProvidersClient() *ProvidersClient { + subClient, _ := NewProvidersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewResourceGroupsClient creates a new instance of ResourceGroupsClient. +func (c *ClientFactory) NewResourceGroupsClient() *ResourceGroupsClient { + subClient, _ := NewResourceGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTagsClient creates a new instance of TagsClient. +func (c *ClientFactory) NewTagsClient() *TagsClient { + subClient, _ := NewTagsClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/constants.go new file mode 100644 index 000000000..6cf0f0dc3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + moduleVersion = "v1.2.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 ( + // AliasPatternTypeExtract - Extract is the only allowed value. + AliasPatternTypeExtract AliasPatternType = "Extract" + // AliasPatternTypeNotSpecified - NotSpecified is not allowed. + AliasPatternTypeNotSpecified AliasPatternType = "NotSpecified" +) + +// PossibleAliasPatternTypeValues returns the possible values for the AliasPatternType const type. +func PossibleAliasPatternTypeValues() []AliasPatternType { + return []AliasPatternType{ + AliasPatternTypeExtract, + AliasPatternTypeNotSpecified, + } +} + +// AliasType - The type of the alias. +type AliasType string + +const ( + // AliasTypeMask - Alias value is secret. + AliasTypeMask AliasType = "Mask" + // AliasTypeNotSpecified - Alias type is unknown (same as not providing alias type). + AliasTypeNotSpecified AliasType = "NotSpecified" + // AliasTypePlainText - Alias value is not secret. + AliasTypePlainText AliasType = "PlainText" +) + +// PossibleAliasTypeValues returns the possible values for the AliasType const type. +func PossibleAliasTypeValues() []AliasType { + return []AliasType{ + AliasTypeMask, + AliasTypeNotSpecified, + AliasTypePlainText, + } +} + +// 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" + // 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" + // 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" + // 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" + // 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" + // 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, + ChangeTypeDeploy, + ChangeTypeIgnore, + ChangeTypeModify, + ChangeTypeNoChange, + 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 ( + DeploymentModeComplete DeploymentMode = "Complete" + DeploymentModeIncremental DeploymentMode = "Incremental" +) + +// PossibleDeploymentModeValues returns the possible values for the DeploymentMode const type. +func PossibleDeploymentModeValues() []DeploymentMode { + return []DeploymentMode{ + DeploymentModeComplete, + DeploymentModeIncremental, + } +} + +// 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 ( + // PropertyChangeTypeArray - The property is an array and contains nested changes. + PropertyChangeTypeArray PropertyChangeType = "Array" + // 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" + // 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{ + PropertyChangeTypeArray, + PropertyChangeTypeCreate, + PropertyChangeTypeDelete, + PropertyChangeTypeModify, + 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 ( + // ProvisioningOperationAction - The provisioning operation is action. + ProvisioningOperationAction ProvisioningOperation = "Action" + // ProvisioningOperationAzureAsyncOperationWaiting - The provisioning operation is waiting Azure async operation. + ProvisioningOperationAzureAsyncOperationWaiting ProvisioningOperation = "AzureAsyncOperationWaiting" + // ProvisioningOperationCreate - The provisioning operation is create. + ProvisioningOperationCreate ProvisioningOperation = "Create" + // ProvisioningOperationDelete - The provisioning operation is delete. + ProvisioningOperationDelete ProvisioningOperation = "Delete" + // ProvisioningOperationDeploymentCleanup - The provisioning operation is cleanup. This operation is part of the 'complete' + // mode deployment. + ProvisioningOperationDeploymentCleanup ProvisioningOperation = "DeploymentCleanup" + // ProvisioningOperationEvaluateDeploymentOutput - The provisioning operation is evaluate output. + ProvisioningOperationEvaluateDeploymentOutput ProvisioningOperation = "EvaluateDeploymentOutput" + // ProvisioningOperationNotSpecified - The provisioning operation is not specified. + ProvisioningOperationNotSpecified ProvisioningOperation = "NotSpecified" + // ProvisioningOperationRead - The provisioning operation is read. + ProvisioningOperationRead ProvisioningOperation = "Read" + // ProvisioningOperationResourceCacheWaiting - The provisioning operation is waiting for resource cache. + ProvisioningOperationResourceCacheWaiting ProvisioningOperation = "ResourceCacheWaiting" + // ProvisioningOperationWaiting - The provisioning operation is waiting. + ProvisioningOperationWaiting ProvisioningOperation = "Waiting" +) + +// PossibleProvisioningOperationValues returns the possible values for the ProvisioningOperation const type. +func PossibleProvisioningOperationValues() []ProvisioningOperation { + return []ProvisioningOperation{ + ProvisioningOperationAction, + ProvisioningOperationAzureAsyncOperationWaiting, + ProvisioningOperationCreate, + ProvisioningOperationDelete, + ProvisioningOperationDeploymentCleanup, + ProvisioningOperationEvaluateDeploymentOutput, + ProvisioningOperationNotSpecified, + ProvisioningOperationRead, + ProvisioningOperationResourceCacheWaiting, + ProvisioningOperationWaiting, + } +} + +// 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 ( + ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeNone, + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeSystemAssignedUserAssigned, + ResourceIdentityTypeUserAssigned, + } +} + +// 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 ( + WhatIfResultFormatFullResourcePayloads WhatIfResultFormat = "FullResourcePayloads" + WhatIfResultFormatResourceIDOnly WhatIfResultFormat = "ResourceIdOnly" +) + +// PossibleWhatIfResultFormatValues returns the possible values for the WhatIfResultFormat const type. +func PossibleWhatIfResultFormatValues() []WhatIfResultFormat { + return []WhatIfResultFormat{ + WhatIfResultFormatFullResourcePayloads, + WhatIfResultFormatResourceIDOnly, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deploymentoperations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deploymentoperations_client.go new file mode 100644 index 000000000..ec1e1ab80 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deploymentoperations_client.go @@ -0,0 +1,685 @@ +//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. DO NOT EDIT. +// 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" + "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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeploymentOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "DeploymentOperationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentOperationsClient.GetAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, err + } + resp, err := client.getAtManagementGroupScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentOperationsClient.GetAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtScopeCreateRequest(ctx, scope, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetAtScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentOperationsClientGetAtScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetAtScopeResponse{}, err + } + resp, err := client.getAtScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentOperationsClient.GetAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtSubscriptionScopeCreateRequest(ctx, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, err + } + resp, err := client.getAtSubscriptionScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentOperationsClient.GetAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtTenantScopeCreateRequest(ctx, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetAtTenantScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentOperationsClientGetAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetAtTenantScopeResponse{}, err + } + resp, err := client.getAtTenantScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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. +// +// 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.NewListPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, deploymentName, options) + }, nil) + if err != nil { + return DeploymentOperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// 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.NewListAtManagementGroupScopePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.NewListAtManagementGroupScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + }, nil) + if err != nil { + return DeploymentOperationsClientListAtManagementGroupScopeResponse{}, err + } + return client.listAtManagementGroupScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// 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.NewListAtScopePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.NewListAtScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtScopeCreateRequest(ctx, scope, deploymentName, options) + }, nil) + if err != nil { + return DeploymentOperationsClientListAtScopeResponse{}, err + } + return client.listAtScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - deploymentName - The name of the deployment. +// - options - DeploymentOperationsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtSubscriptionScopePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.NewListAtSubscriptionScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + }, nil) + if err != nil { + return DeploymentOperationsClientListAtSubscriptionScopeResponse{}, err + } + return client.listAtSubscriptionScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - deploymentName - The name of the deployment. +// - options - DeploymentOperationsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtTenantScopePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.NewListAtTenantScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtTenantScopeCreateRequest(ctx, deploymentName, options) + }, nil) + if err != nil { + return DeploymentOperationsClientListAtTenantScopeResponse{}, err + } + return client.listAtTenantScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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/deployments_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deployments_client.go new file mode 100644 index 000000000..2e9eff6b7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deployments_client.go @@ -0,0 +1,2995 @@ +//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. DO NOT EDIT. +// 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" + "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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeploymentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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 any, options *DeploymentsClientCalculateTemplateHashOptions) (DeploymentsClientCalculateTemplateHashResponse, error) { + var err error + const operationName = "DeploymentsClient.CalculateTemplateHash" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.calculateTemplateHashCreateRequest(ctx, templateParam, options) + if err != nil { + return DeploymentsClientCalculateTemplateHashResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCalculateTemplateHashResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCalculateTemplateHashResponse{}, err + } + resp, err := client.calculateTemplateHashHandleResponse(httpResp) + return resp, err +} + +// calculateTemplateHashCreateRequest creates the CalculateTemplateHash request. +func (client *DeploymentsClient) calculateTemplateHashCreateRequest(ctx context.Context, templateParam any, options *DeploymentsClientCalculateTemplateHashOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/calculateTemplateHash" + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, templateParam); err != nil { + return nil, err + } + return req, nil +} + +// 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) { + var err error + const operationName = "DeploymentsClient.Cancel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return DeploymentsClientCancelResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCancelResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelResponse{}, err + } + 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.CancelAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err + } + 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.CancelAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return DeploymentsClientCancelAtScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCancelAtScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelAtScopeResponse{}, err + } + 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.CancelAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err + } + 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.CancelAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientCancelAtTenantScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCancelAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelAtTenantScopeResponse{}, err + } + 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.CheckExistence" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCheckExistenceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceResponse{}, err + } + return DeploymentsClientCheckExistenceResponse{Success: httpResp.StatusCode >= 200 && httpResp.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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.CheckExistenceAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkExistenceAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err + } + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{Success: httpResp.StatusCode >= 200 && httpResp.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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.CheckExistenceAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkExistenceAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceAtScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCheckExistenceAtScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceAtScopeResponse{}, err + } + return DeploymentsClientCheckExistenceAtScopeResponse{Success: httpResp.StatusCode >= 200 && httpResp.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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.CheckExistenceAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkExistenceAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err + } + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{Success: httpResp.StatusCode >= 200 && httpResp.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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.CheckExistenceAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkExistenceAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err + } + return DeploymentsClientCheckExistenceAtTenantScopeResponse{Success: httpResp.StatusCode >= 200 && httpResp.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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginCreateOrUpdateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateAtScopeCreateRequest(ctx, scope, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginCreateOrUpdateAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginDeleteAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginDeleteAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginDeleteAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginDeleteAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.ExportTemplate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportTemplateCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientExportTemplateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateResponse{}, err + } + resp, err := client.exportTemplateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.ExportTemplateAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportTemplateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err + } + resp, err := client.exportTemplateAtManagementGroupScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.ExportTemplateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportTemplateAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateAtScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientExportTemplateAtScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateAtScopeResponse{}, err + } + resp, err := client.exportTemplateAtScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.ExportTemplateAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportTemplateAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err + } + resp, err := client.exportTemplateAtSubscriptionScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.ExportTemplateAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportTemplateAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err + } + resp, err := client.exportTemplateAtTenantScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return DeploymentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.GetAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return DeploymentsClientGetAtManagementGroupScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientGetAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetAtManagementGroupScopeResponse{}, err + } + resp, err := client.getAtManagementGroupScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.GetAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return DeploymentsClientGetAtScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientGetAtScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetAtScopeResponse{}, err + } + resp, err := client.getAtScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.GetAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientGetAtSubscriptionScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientGetAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetAtSubscriptionScopeResponse{}, err + } + resp, err := client.getAtSubscriptionScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "DeploymentsClient.GetAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientGetAtTenantScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientGetAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetAtTenantScopeResponse{}, err + } + resp, err := client.getAtTenantScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - groupID - The management group ID. +// - options - DeploymentsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtManagementGroupScopePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListAtManagementGroupScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtManagementGroupScopeCreateRequest(ctx, groupID, options) + }, nil) + if err != nil { + return DeploymentsClientListAtManagementGroupScopeResponse{}, err + } + return client.listAtManagementGroupScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - scope - The resource scope. +// - options - DeploymentsClientListAtScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtScopePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListAtScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return DeploymentsClientListAtScopeResponse{}, err + } + return client.listAtScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - options - DeploymentsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtSubscriptionScopePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListAtSubscriptionScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtSubscriptionScopeCreateRequest(ctx, options) + }, nil) + if err != nil { + return DeploymentsClientListAtSubscriptionScopeResponse{}, err + } + return client.listAtSubscriptionScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - options - DeploymentsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtTenantScopePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListAtTenantScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtTenantScopeCreateRequest(ctx, options) + }, nil) + if err != nil { + return DeploymentsClientListAtTenantScopeResponse{}, err + } + return client.listAtTenantScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// 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.NewListByResourceGroupPager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return DeploymentsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginValidate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginValidateAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginValidateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateAtScopeCreateRequest(ctx, scope, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginValidateAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginValidateAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientWhatIfResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginWhatIf" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.whatIfCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtManagementGroupScopeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientWhatIfAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginWhatIfAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.whatIfAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtSubscriptionScopeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientWhatIfAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginWhatIfAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.whatIfAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtTenantScopeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientWhatIfAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "DeploymentsClient.BeginWhatIfAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.whatIfAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models.go new file mode 100644 index 000000000..ce98f859a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models.go @@ -0,0 +1,1173 @@ +//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. DO NOT EDIT. +// 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 + + // READ-ONLY; The profile version. + ProfileVersion *string +} + +// Alias - The alias type. +type Alias struct { + // The default path for an alias. + DefaultPath *string + + // The default pattern for an alias. + DefaultPattern *AliasPattern + + // The alias name. + Name *string + + // The paths for an alias. + Paths []*AliasPath + + // The type of the alias. + Type *AliasType + + // READ-ONLY; The default alias path metadata. Applies to the default path and to any alias path that doesn't have metadata + DefaultMetadata *AliasPathMetadata +} + +// AliasPath - The type of the paths for alias. +type AliasPath struct { + // The API versions. + APIVersions []*string + + // The path of an alias. + Path *string + + // The pattern for an alias path. + Pattern *AliasPattern + + // READ-ONLY; The metadata of the alias path. If missing, fall back to the default metadata of the alias. + Metadata *AliasPathMetadata +} + +type AliasPathMetadata struct { + // READ-ONLY; The attributes of the token that the alias path is referring to. + Attributes *AliasPathAttributes + + // READ-ONLY; The type of the token that the alias path is referring to. + Type *AliasPathTokenType +} + +// AliasPattern - The type of the pattern for an alias path. +type AliasPattern struct { + // The alias pattern phrase. + Phrase *string + + // The type of alias pattern + Type *AliasPatternType + + // The alias pattern variable. + Variable *string +} + +// BasicDependency - Deployment dependency information. +type BasicDependency struct { + // The ID of the dependency. + ID *string + + // The dependency resource name. + ResourceName *string + + // The dependency resource type. + ResourceType *string +} + +// 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 +} + +// Dependency - Deployment dependency information. +type Dependency struct { + // The list of dependencies. + DependsOn []*BasicDependency + + // The ID of the dependency. + ID *string + + // The dependency resource name. + ResourceName *string + + // The dependency resource type. + ResourceType *string +} + +// Deployment operation parameters. +type Deployment struct { + // REQUIRED; The deployment properties. + Properties *DeploymentProperties + + // The location to store the deployment data. + Location *string + + // Deployment tags + Tags map[string]*string +} + +// DeploymentExportResult - The deployment export result. +type DeploymentExportResult struct { + // The template content. + Template any +} + +// DeploymentExtended - Deployment information. +type DeploymentExtended struct { + // the location of the deployment. + Location *string + + // Deployment properties. + Properties *DeploymentPropertiesExtended + + // Deployment tags + Tags map[string]*string + + // READ-ONLY; The ID of the deployment. + ID *string + + // READ-ONLY; The name of the deployment. + Name *string + + // READ-ONLY; The type of the deployment. + Type *string +} + +// DeploymentExtendedFilter - Deployment filter. +type DeploymentExtendedFilter struct { + // The provisioning state. + ProvisioningState *string +} + +// DeploymentListResult - List of deployments. +type DeploymentListResult struct { + // An array of deployments. + Value []*DeploymentExtended + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string +} + +// DeploymentOperation - Deployment operation information. +type DeploymentOperation struct { + // Deployment properties. + Properties *DeploymentOperationProperties + + // READ-ONLY; Full deployment operation ID. + ID *string + + // READ-ONLY; Deployment operation ID. + OperationID *string +} + +// DeploymentOperationProperties - Deployment operation properties. +type DeploymentOperationProperties struct { + // READ-ONLY; The duration of the operation. + Duration *string + + // READ-ONLY; The name of the current provisioning operation. + ProvisioningOperation *ProvisioningOperation + + // READ-ONLY; The state of the provisioning. + ProvisioningState *string + + // READ-ONLY; The HTTP request message. + Request *HTTPMessage + + // READ-ONLY; The HTTP response message. + Response *HTTPMessage + + // READ-ONLY; Deployment operation service request id. + ServiceRequestID *string + + // 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 + + // 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 + + // READ-ONLY; The target resource. + TargetResource *TargetResource + + // READ-ONLY; The date and time of the operation. + Timestamp *time.Time +} + +// DeploymentOperationsListResult - List of deployment operations. +type DeploymentOperationsListResult struct { + // An array of deployment operations. + Value []*DeploymentOperation + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string +} + +// 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 + + // The debug setting of the deployment. + DebugSetting *DebugSetting + + // 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 + + // The deployment on error behavior. + OnErrorDeployment *OnErrorDeployment + + // 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 any + + // 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 + + // 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 any + + // The URI of the template. Use either the templateLink property or the template property, but not both. + TemplateLink *TemplateLink +} + +// DeploymentPropertiesExtended - Deployment properties with additional details. +type DeploymentPropertiesExtended struct { + // READ-ONLY; The correlation ID of the deployment. + CorrelationID *string + + // READ-ONLY; The debug setting of the deployment. + DebugSetting *DebugSetting + + // READ-ONLY; The list of deployment dependencies. + Dependencies []*Dependency + + // READ-ONLY; The duration of the template deployment. + Duration *string + + // READ-ONLY; The deployment error. + Error *ErrorResponse + + // READ-ONLY; The deployment mode. Possible values are Incremental and Complete. + Mode *DeploymentMode + + // READ-ONLY; The deployment on error behavior. + OnErrorDeployment *OnErrorDeploymentExtended + + // READ-ONLY; Array of provisioned resources. + OutputResources []*ResourceReference + + // READ-ONLY; Key/value pairs that represent deployment output. + Outputs any + + // READ-ONLY; Deployment parameters. + Parameters any + + // READ-ONLY; The URI referencing the parameters. + ParametersLink *ParametersLink + + // READ-ONLY; The list of resource providers needed for the deployment. + Providers []*Provider + + // READ-ONLY; Denotes the state of provisioning. + ProvisioningState *ProvisioningState + + // READ-ONLY; The hash produced for the template. + TemplateHash *string + + // READ-ONLY; The URI referencing the template. + TemplateLink *TemplateLink + + // READ-ONLY; The timestamp of the template deployment. + Timestamp *time.Time + + // READ-ONLY; Array of validated resources. + ValidatedResources []*ResourceReference +} + +// DeploymentValidateResult - Information from validate template deployment response. +type DeploymentValidateResult struct { + // The template deployment properties. + Properties *DeploymentPropertiesExtended + + // READ-ONLY; The deployment validation error. + Error *ErrorResponse +} + +// DeploymentWhatIf - Deployment What-if operation parameters. +type DeploymentWhatIf struct { + // REQUIRED; The deployment properties. + Properties *DeploymentWhatIfProperties + + // The location to store the deployment data. + Location *string +} + +// 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 + + // The debug setting of the deployment. + DebugSetting *DebugSetting + + // 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 + + // The deployment on error behavior. + OnErrorDeployment *OnErrorDeployment + + // 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 any + + // 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 + + // 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 any + + // The URI of the template. Use either the templateLink property or the template property, but not both. + TemplateLink *TemplateLink + + // Optional What-If operation settings. + WhatIfSettings *DeploymentWhatIfSettings +} + +// DeploymentWhatIfSettings - Deployment What-If operation settings. +type DeploymentWhatIfSettings struct { + // The format of the What-If results + ResultFormat *WhatIfResultFormat +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// 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 + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorResponse + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// 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 + + // The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. + Resources []*string +} + +// 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 +} + +// ExtendedLocation - Resource extended location. +type ExtendedLocation struct { + // The extended location name. + Name *string + + // The extended location type. + Type *ExtendedLocationType +} + +// GenericResource - Resource information. +type GenericResource struct { + // Resource extended location. + ExtendedLocation *ExtendedLocation + + // The identity of the resource. + Identity *Identity + + // The kind of the resource. + Kind *string + + // Resource location + Location *string + + // ID of the resource that manages this resource. + ManagedBy *string + + // The plan of the resource. + Plan *Plan + + // The resource properties. + Properties any + + // The SKU of the resource. + SKU *SKU + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource ID + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// GenericResourceExpanded - Resource information. +type GenericResourceExpanded struct { + // Resource extended location. + ExtendedLocation *ExtendedLocation + + // The identity of the resource. + Identity *Identity + + // The kind of the resource. + Kind *string + + // Resource location + Location *string + + // ID of the resource that manages this resource. + ManagedBy *string + + // The plan of the resource. + Plan *Plan + + // The resource properties. + Properties any + + // The SKU of the resource. + SKU *SKU + + // Resource tags + Tags map[string]*string + + // READ-ONLY; The changed time of the resource. This is only present if requested via the $expand query parameter. + ChangedTime *time.Time + + // READ-ONLY; The created time of the resource. This is only present if requested via the $expand query parameter. + CreatedTime *time.Time + + // READ-ONLY; Resource ID + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; The provisioning state of the resource. This is only present if requested via the $expand query parameter. + ProvisioningState *string + + // READ-ONLY; Resource type + Type *string +} + +// GenericResourceFilter - Resource filter. +type GenericResourceFilter struct { + // The resource type. + ResourceType *string + + // The tag name. + Tagname *string + + // The tag value. + Tagvalue *string +} + +// HTTPMessage - HTTP message. +type HTTPMessage struct { + // HTTP message content. + Content any +} + +// Identity for the resource. +type Identity struct { + // The identity type. + Type *ResourceIdentityType + + // 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 + + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of resource. + TenantID *string +} + +type IdentityUserAssignedIdentitiesValue struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string +} + +// MoveInfo - Parameters of move resources. +type MoveInfo struct { + // The IDs of the resources. + Resources []*string + + // The target resource group. + TargetResourceGroup *string +} + +// OnErrorDeployment - Deployment on error behavior. +type OnErrorDeployment struct { + // The deployment to be used on error case. + DeploymentName *string + + // The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + Type *OnErrorDeploymentType +} + +// OnErrorDeploymentExtended - Deployment on error behavior with additional details. +type OnErrorDeploymentExtended struct { + // The deployment to be used on error case. + DeploymentName *string + + // The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + Type *OnErrorDeploymentType + + // READ-ONLY; The state of the provisioning for the on error deployment. + ProvisioningState *string +} + +// Operation - Microsoft.Resources operation +type Operation struct { + // The object that represents the operation. + Display *OperationDisplay + + // Operation name: {provider}/{resource}/{operation} + Name *string +} + +// OperationDisplay - The object that represents the operation. +type OperationDisplay struct { + // Description of the operation. + Description *string + + // Operation type: Read, write, delete, etc. + Operation *string + + // Service provider: Microsoft.Resources + Provider *string + + // Resource on which the operation is performed: Profile, endpoint, etc. + Resource *string +} + +// 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 + + // List of Microsoft.Resources operations. + Value []*Operation +} + +// ParametersLink - Entity representing the reference to the deployment parameters. +type ParametersLink struct { + // REQUIRED; The URI of the parameters file. + URI *string + + // If included, must match the ContentVersion in the template. + ContentVersion *string +} + +// Permission - Role definition permissions. +type Permission struct { + // Allowed actions. + Actions []*string + + // Allowed Data actions. + DataActions []*string + + // Denied actions. + NotActions []*string + + // Denied Data actions. + NotDataActions []*string +} + +// Plan for the resource. +type Plan struct { + // The plan ID. + Name *string + + // The offer ID. + Product *string + + // The promotion code. + PromotionCode *string + + // The publisher ID. + Publisher *string + + // The plan's version. + Version *string +} + +// Provider - Resource provider information. +type Provider struct { + // The namespace of the resource provider. + Namespace *string + + // The provider authorization consent state. + ProviderAuthorizationConsentState *ProviderAuthorizationConsentState + + // READ-ONLY; The provider ID. + ID *string + + // READ-ONLY; The registration policy of the resource provider. + RegistrationPolicy *string + + // READ-ONLY; The registration state of the resource provider. + RegistrationState *string + + // READ-ONLY; The collection of provider resource types. + ResourceTypes []*ProviderResourceType +} + +// ProviderConsentDefinition - The provider consent. +type ProviderConsentDefinition struct { + // A value indicating whether authorization is consented or not. + ConsentToAuthorization *bool +} + +// ProviderExtendedLocation - The provider extended location. +type ProviderExtendedLocation struct { + // The extended locations for the azure location. + ExtendedLocations []*string + + // The azure location. + Location *string + + // The extended location type. + Type *string +} + +// ProviderListResult - List of resource providers. +type ProviderListResult struct { + // An array of resource providers. + Value []*Provider + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string +} + +// ProviderPermission - The provider permission +type ProviderPermission struct { + // The application id. + ApplicationID *string + + // Role definition properties. + ManagedByRoleDefinition *RoleDefinition + + // The provider authorization consent state. + ProviderAuthorizationConsentState *ProviderAuthorizationConsentState + + // Role definition properties. + RoleDefinition *RoleDefinition +} + +// ProviderPermissionListResult - List of provider permissions. +type ProviderPermissionListResult struct { + // An array of provider permissions. + Value []*ProviderPermission + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string +} + +// ProviderRegistrationRequest - The provider registration definition. +type ProviderRegistrationRequest struct { + // The provider consent. + ThirdPartyProviderConsent *ProviderConsentDefinition +} + +// ProviderResourceType - Resource type managed by the resource provider. +type ProviderResourceType struct { + // The API version. + APIVersions []*string + + // The aliases that are supported by this resource type. + Aliases []*Alias + + // The additional capabilities offered by this resource type. + Capabilities *string + + // The location mappings that are supported by this resource type. + LocationMappings []*ProviderExtendedLocation + + // The collection of locations where this resource type can be created. + Locations []*string + + // The properties. + Properties map[string]*string + + // The resource type. + ResourceType *string + ZoneMappings []*ZoneMapping + + // READ-ONLY; The API profiles for the resource provider. + APIProfiles []*APIProfile + + // READ-ONLY; The default API version. + DefaultAPIVersion *string +} + +// ProviderResourceTypeListResult - List of resource types of a resource provider. +type ProviderResourceTypeListResult struct { + // An array of resource types. + Value []*ProviderResourceType + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string +} + +// Resource - Specified resource. +type Resource struct { + // Resource extended location. + ExtendedLocation *ExtendedLocation + + // Resource location + Location *string + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Resource ID + ID *string + + // READ-ONLY; Resource name + Name *string + + // READ-ONLY; Resource type + Type *string +} + +// 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 + + // The ID of the resource that manages this resource group. + ManagedBy *string + + // The resource group properties. + Properties *ResourceGroupProperties + + // The tags attached to the resource group. + Tags map[string]*string + + // READ-ONLY; The ID of the resource group. + ID *string + + // READ-ONLY; The name of the resource group. + Name *string + + // READ-ONLY; The type of the resource group. + Type *string +} + +// ResourceGroupExportResult - Resource group export result. +type ResourceGroupExportResult struct { + // The template export error. + Error *ErrorResponse + + // The template content. + Template any +} + +// ResourceGroupFilter - Resource group filter. +type ResourceGroupFilter struct { + // The tag name. + TagName *string + + // The tag value. + TagValue *string +} + +// ResourceGroupListResult - List of resource groups. +type ResourceGroupListResult struct { + // An array of resource groups. + Value []*ResourceGroup + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string +} + +// ResourceGroupPatchable - Resource group information. +type ResourceGroupPatchable struct { + // The ID of the resource that manages this resource group. + ManagedBy *string + + // The name of the resource group. + Name *string + + // The resource group properties. + Properties *ResourceGroupProperties + + // The tags attached to the resource group. + Tags map[string]*string +} + +// ResourceGroupProperties - The resource group properties. +type ResourceGroupProperties struct { + // READ-ONLY; The provisioning state. + ProvisioningState *string +} + +// ResourceListResult - List of resource groups. +type ResourceListResult struct { + // An array of resources. + Value []*GenericResourceExpanded + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string +} + +// ResourceProviderOperationDisplayProperties - Resource provider operation's display properties. +type ResourceProviderOperationDisplayProperties struct { + // Operation description. + Description *string + + // Resource provider operation. + Operation *string + + // Operation provider. + Provider *string + + // Operation description. + Publisher *string + + // Operation resource. + Resource *string +} + +// ResourceReference - The resource Id model. +type ResourceReference struct { + // READ-ONLY; The fully qualified resource Id. + ID *string +} + +// RoleDefinition - Role definition properties. +type RoleDefinition struct { + // The role definition ID. + ID *string + + // If this is a service role. + IsServiceRole *bool + + // The role definition name. + Name *string + + // Role definition permissions. + Permissions []*Permission + + // Role definition assignable scopes. + Scopes []*string +} + +// SKU for the resource. +type SKU struct { + // The SKU capacity. + Capacity *int32 + + // The SKU family. + Family *string + + // The SKU model. + Model *string + + // The SKU name. + Name *string + + // The SKU size. + Size *string + + // The SKU tier. + Tier *string +} + +// ScopedDeployment - Deployment operation parameters. +type ScopedDeployment struct { + // REQUIRED; The location to store the deployment data. + Location *string + + // REQUIRED; The deployment properties. + Properties *DeploymentProperties + + // Deployment tags + Tags map[string]*string +} + +// ScopedDeploymentWhatIf - Deployment What-if operation parameters. +type ScopedDeploymentWhatIf struct { + // REQUIRED; The location to store the deployment data. + Location *string + + // REQUIRED; The deployment properties. + Properties *DeploymentWhatIfProperties +} + +// StatusMessage - Operation status message object. +type StatusMessage struct { + // The error reported by the operation. + Error *ErrorResponse + + // Status of the deployment operation. + Status *string +} + +// SubResource - Sub-resource. +type SubResource struct { + // Resource ID + ID *string +} + +// TagCount - Tag count. +type TagCount struct { + // Type of count. + Type *string + + // Value of count. + Value *int32 +} + +// 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 + + // The tag name. + TagName *string + + // The list of tag values. + Values []*TagValue + + // READ-ONLY; The tag name ID. + ID *string +} + +// TagValue - Tag information. +type TagValue struct { + // The tag value count. + Count *TagCount + + // The tag value. + TagValue *string + + // READ-ONLY; The tag value ID. + ID *string +} + +// Tags - A dictionary of name and value pairs. +type Tags struct { + // Dictionary of + Tags map[string]*string +} + +// TagsListResult - List of subscription tags. +type TagsListResult struct { + // An array of tags. + Value []*TagDetails + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string +} + +// TagsPatchResource - Wrapper resource for tags patch API request only. +type TagsPatchResource struct { + // The operation type for the patch API. + Operation *TagsPatchOperation + + // The set of tags. + Properties *Tags +} + +// TagsResource - Wrapper resource for tags API requests and responses. +type TagsResource struct { + // REQUIRED; The set of tags. + Properties *Tags + + // READ-ONLY; The ID of the tags wrapper resource. + ID *string + + // READ-ONLY; The name of the tags wrapper resource. + Name *string + + // READ-ONLY; The type of the tags wrapper resource. + Type *string +} + +// TargetResource - Target resource. +type TargetResource struct { + // The ID of the resource. + ID *string + + // The name of the resource. + ResourceName *string + + // The type of the resource. + ResourceType *string +} + +// 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 + + // The template hash. + TemplateHash *string +} + +// TemplateLink - Entity representing the reference to the template. +type TemplateLink struct { + // If included, must match the ContentVersion in the template. + ContentVersion *string + + // The resource id of a Template Spec. Use either the id or uri property, but not both. + ID *string + + // The query string (for example, a SAS token) to be used with the templateLink URI. + QueryString *string + + // 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 + + // The URI of the template to deploy. Use either the uri or id property, but not both. + URI *string +} + +// 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 + + // REQUIRED; Resource ID + ResourceID *string + + // The predicted snapshot of the resource after the deployment is executed. + After any + + // The snapshot of the resource before the deployment is executed. + Before any + + // The predicted changes to resource properties. + Delta []*WhatIfPropertyChange + + // The explanation about why the resource is unsupported by What-If. + UnsupportedReason *string +} + +// WhatIfOperationProperties - Deployment operation properties. +type WhatIfOperationProperties struct { + // List of resource changes predicted by What-If operation. + Changes []*WhatIfChange +} + +// 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 + + // What-If operation properties. + Properties *WhatIfOperationProperties + + // Status of the What-If operation. + Status *string +} + +// WhatIfPropertyChange - The predicted change to the resource property. +type WhatIfPropertyChange struct { + // REQUIRED; The path of the property. + Path *string + + // REQUIRED; The type of property change. + PropertyChangeType *PropertyChangeType + + // The value of the property after the deployment is executed. + After any + + // The value of the property before the deployment is executed. + Before any + + // Nested property changes. + Children []*WhatIfPropertyChange +} + +type ZoneMapping struct { + // The location of the zone mapping. + Location *string + Zones []*string +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models_serde.go new file mode 100644 index 000000000..5c6e3ac77 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models_serde.go @@ -0,0 +1,3108 @@ +//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. DO NOT EDIT. +// 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 APIProfile. +func (a APIProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiVersion", a.APIVersion) + populate(objectMap, "profileVersion", a.ProfileVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIProfile. +func (a *APIProfile) UnmarshalJSON(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 "apiVersion": + err = unpopulate(val, "APIVersion", &a.APIVersion) + delete(rawMsg, key) + case "profileVersion": + err = unpopulate(val, "ProfileVersion", &a.ProfileVersion) + 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 Alias. +func (a Alias) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultMetadata", a.DefaultMetadata) + populate(objectMap, "defaultPath", a.DefaultPath) + populate(objectMap, "defaultPattern", a.DefaultPattern) + populate(objectMap, "name", a.Name) + populate(objectMap, "paths", a.Paths) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Alias. +func (a *Alias) UnmarshalJSON(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 "defaultMetadata": + err = unpopulate(val, "DefaultMetadata", &a.DefaultMetadata) + delete(rawMsg, key) + case "defaultPath": + err = unpopulate(val, "DefaultPath", &a.DefaultPath) + delete(rawMsg, key) + case "defaultPattern": + err = unpopulate(val, "DefaultPattern", &a.DefaultPattern) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "paths": + err = unpopulate(val, "Paths", &a.Paths) + 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 AliasPath. +func (a AliasPath) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiVersions", a.APIVersions) + populate(objectMap, "metadata", a.Metadata) + populate(objectMap, "path", a.Path) + populate(objectMap, "pattern", a.Pattern) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AliasPath. +func (a *AliasPath) UnmarshalJSON(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 "apiVersions": + err = unpopulate(val, "APIVersions", &a.APIVersions) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &a.Path) + delete(rawMsg, key) + case "pattern": + err = unpopulate(val, "Pattern", &a.Pattern) + 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 AliasPathMetadata. +func (a AliasPathMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attributes", a.Attributes) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AliasPathMetadata. +func (a *AliasPathMetadata) UnmarshalJSON(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 "attributes": + err = unpopulate(val, "Attributes", &a.Attributes) + 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 AliasPattern. +func (a AliasPattern) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "phrase", a.Phrase) + populate(objectMap, "type", a.Type) + populate(objectMap, "variable", a.Variable) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AliasPattern. +func (a *AliasPattern) UnmarshalJSON(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 "phrase": + err = unpopulate(val, "Phrase", &a.Phrase) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 BasicDependency. +func (b BasicDependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "resourceName", b.ResourceName) + populate(objectMap, "resourceType", b.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BasicDependency. +func (b *BasicDependency) UnmarshalJSON(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 "resourceName": + err = unpopulate(val, "ResourceName", &b.ResourceName) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &b.ResourceType) + 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 DebugSetting. +func (d DebugSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "detailLevel", d.DetailLevel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DebugSetting. +func (d *DebugSetting) UnmarshalJSON(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 "detailLevel": + err = unpopulate(val, "DetailLevel", &d.DetailLevel) + 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 Dependency. +func (d Dependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dependsOn", d.DependsOn) + populate(objectMap, "id", d.ID) + populate(objectMap, "resourceName", d.ResourceName) + populate(objectMap, "resourceType", d.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dependency. +func (d *Dependency) UnmarshalJSON(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 "dependsOn": + err = unpopulate(val, "DependsOn", &d.DependsOn) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &d.ResourceName) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &d.ResourceType) + 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 Deployment. +func (d Deployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 Deployment. +func (d *Deployment) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &d.Location) + 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 DeploymentExportResult. +func (d DeploymentExportResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "template", d.Template) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentExportResult. +func (d *DeploymentExportResult) UnmarshalJSON(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 "template": + err = unpopulate(val, "Template", &d.Template) + 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 DeploymentExtended. +func (d DeploymentExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 DeploymentExtended. +func (d *DeploymentExtended) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentExtendedFilter. +func (d DeploymentExtendedFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", d.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentExtendedFilter. +func (d *DeploymentExtendedFilter) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentListResult. +func (d DeploymentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentListResult. +func (d *DeploymentListResult) UnmarshalJSON(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 DeploymentOperation. +func (d DeploymentOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "operationId", d.OperationID) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentOperation. +func (d *DeploymentOperation) UnmarshalJSON(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 "operationId": + err = unpopulate(val, "OperationID", &d.OperationID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + 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 DeploymentOperationProperties. +func (d DeploymentOperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "duration", d.Duration) + populate(objectMap, "provisioningOperation", d.ProvisioningOperation) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "request", d.Request) + populate(objectMap, "response", d.Response) + populate(objectMap, "serviceRequestId", d.ServiceRequestID) + populate(objectMap, "statusCode", d.StatusCode) + populate(objectMap, "statusMessage", d.StatusMessage) + populate(objectMap, "targetResource", d.TargetResource) + populateDateTimeRFC3339(objectMap, "timestamp", d.Timestamp) + 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 = unpopulateDateTimeRFC3339(val, "Timestamp", &d.Timestamp) + 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 DeploymentOperationsListResult. +func (d DeploymentOperationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentOperationsListResult. +func (d *DeploymentOperationsListResult) UnmarshalJSON(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 DeploymentProperties. +func (d DeploymentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "debugSetting", d.DebugSetting) + populate(objectMap, "expressionEvaluationOptions", d.ExpressionEvaluationOptions) + populate(objectMap, "mode", d.Mode) + populate(objectMap, "onErrorDeployment", d.OnErrorDeployment) + populateAny(objectMap, "parameters", d.Parameters) + populate(objectMap, "parametersLink", d.ParametersLink) + populateAny(objectMap, "template", d.Template) + populate(objectMap, "templateLink", d.TemplateLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentProperties. +func (d *DeploymentProperties) UnmarshalJSON(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 "debugSetting": + err = unpopulate(val, "DebugSetting", &d.DebugSetting) + delete(rawMsg, key) + case "expressionEvaluationOptions": + err = unpopulate(val, "ExpressionEvaluationOptions", &d.ExpressionEvaluationOptions) + 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 "parameters": + err = unpopulate(val, "Parameters", &d.Parameters) + delete(rawMsg, key) + case "parametersLink": + err = unpopulate(val, "ParametersLink", &d.ParametersLink) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &d.Template) + delete(rawMsg, key) + case "templateLink": + err = unpopulate(val, "TemplateLink", &d.TemplateLink) + 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 DeploymentPropertiesExtended. +func (d DeploymentPropertiesExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationId", d.CorrelationID) + populate(objectMap, "debugSetting", d.DebugSetting) + populate(objectMap, "dependencies", d.Dependencies) + populate(objectMap, "duration", d.Duration) + populate(objectMap, "error", d.Error) + populate(objectMap, "mode", d.Mode) + populate(objectMap, "onErrorDeployment", d.OnErrorDeployment) + populate(objectMap, "outputResources", d.OutputResources) + populateAny(objectMap, "outputs", d.Outputs) + populateAny(objectMap, "parameters", d.Parameters) + populate(objectMap, "parametersLink", d.ParametersLink) + populate(objectMap, "providers", d.Providers) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "templateHash", d.TemplateHash) + populate(objectMap, "templateLink", d.TemplateLink) + populateDateTimeRFC3339(objectMap, "timestamp", d.Timestamp) + populate(objectMap, "validatedResources", d.ValidatedResources) + return json.Marshal(objectMap) +} + +// 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 = unpopulateDateTimeRFC3339(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 DeploymentValidateResult. +func (d DeploymentValidateResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", d.Error) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentValidateResult. +func (d *DeploymentValidateResult) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &d.Error) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + 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 DeploymentWhatIf. +func (d DeploymentWhatIf) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", d.Location) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentWhatIf. +func (d *DeploymentWhatIf) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + 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 DeploymentWhatIfProperties. +func (d DeploymentWhatIfProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "debugSetting", d.DebugSetting) + populate(objectMap, "expressionEvaluationOptions", d.ExpressionEvaluationOptions) + populate(objectMap, "mode", d.Mode) + populate(objectMap, "onErrorDeployment", d.OnErrorDeployment) + populateAny(objectMap, "parameters", d.Parameters) + populate(objectMap, "parametersLink", d.ParametersLink) + populateAny(objectMap, "template", d.Template) + populate(objectMap, "templateLink", d.TemplateLink) + populate(objectMap, "whatIfSettings", d.WhatIfSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentWhatIfProperties. +func (d *DeploymentWhatIfProperties) UnmarshalJSON(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 "debugSetting": + err = unpopulate(val, "DebugSetting", &d.DebugSetting) + delete(rawMsg, key) + case "expressionEvaluationOptions": + err = unpopulate(val, "ExpressionEvaluationOptions", &d.ExpressionEvaluationOptions) + 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 "parameters": + err = unpopulate(val, "Parameters", &d.Parameters) + delete(rawMsg, key) + case "parametersLink": + err = unpopulate(val, "ParametersLink", &d.ParametersLink) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &d.Template) + delete(rawMsg, key) + case "templateLink": + err = unpopulate(val, "TemplateLink", &d.TemplateLink) + delete(rawMsg, key) + case "whatIfSettings": + err = unpopulate(val, "WhatIfSettings", &d.WhatIfSettings) + 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 DeploymentWhatIfSettings. +func (d DeploymentWhatIfSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resultFormat", d.ResultFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentWhatIfSettings. +func (d *DeploymentWhatIfSettings) UnmarshalJSON(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 "resultFormat": + err = unpopulate(val, "ResultFormat", &d.ResultFormat) + 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 ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(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 "info": + err = unpopulate(val, "Info", &e.Info) + 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 ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + 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 "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + 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 ExportTemplateRequest. +func (e ExportTemplateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "options", e.Options) + populate(objectMap, "resources", e.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportTemplateRequest. +func (e *ExportTemplateRequest) UnmarshalJSON(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 "options": + err = unpopulate(val, "Options", &e.Options) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &e.Resources) + 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 ExpressionEvaluationOptions. +func (e ExpressionEvaluationOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scope", e.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressionEvaluationOptions. +func (e *ExpressionEvaluationOptions) UnmarshalJSON(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 "scope": + err = unpopulate(val, "Scope", &e.Scope) + 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]any) + 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 GenericResource. +func (g GenericResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) + populateAny(objectMap, "properties", g.Properties) + 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 GenericResource. +func (g *GenericResource) UnmarshalJSON(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 "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 "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 GenericResourceExpanded. +func (g GenericResourceExpanded) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "changedTime", g.ChangedTime) + populateDateTimeRFC3339(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) + populateAny(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 = unpopulateDateTimeRFC3339(val, "ChangedTime", &g.ChangedTime) + delete(rawMsg, key) + case "createdTime": + err = unpopulateDateTimeRFC3339(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 GenericResourceFilter. +func (g GenericResourceFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceType", g.ResourceType) + populate(objectMap, "tagname", g.Tagname) + populate(objectMap, "tagvalue", g.Tagvalue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenericResourceFilter. +func (g *GenericResourceFilter) UnmarshalJSON(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 "resourceType": + err = unpopulate(val, "ResourceType", &g.ResourceType) + delete(rawMsg, key) + case "tagname": + err = unpopulate(val, "Tagname", &g.Tagname) + delete(rawMsg, key) + case "tagvalue": + err = unpopulate(val, "Tagvalue", &g.Tagvalue) + 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 HTTPMessage. +func (h HTTPMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "content", h.Content) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPMessage. +func (h *HTTPMessage) UnmarshalJSON(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 "content": + err = unpopulate(val, "Content", &h.Content) + 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 Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(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 "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + 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 IdentityUserAssignedIdentitiesValue. +func (i IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", i.ClientID) + populate(objectMap, "principalId", i.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityUserAssignedIdentitiesValue. +func (i *IdentityUserAssignedIdentitiesValue) UnmarshalJSON(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 "clientId": + err = unpopulate(val, "ClientID", &i.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + 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 MoveInfo. +func (m MoveInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resources", m.Resources) + populate(objectMap, "targetResourceGroup", m.TargetResourceGroup) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MoveInfo. +func (m *MoveInfo) UnmarshalJSON(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 "resources": + err = unpopulate(val, "Resources", &m.Resources) + delete(rawMsg, key) + case "targetResourceGroup": + err = unpopulate(val, "TargetResourceGroup", &m.TargetResourceGroup) + 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 OnErrorDeployment. +func (o OnErrorDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deploymentName", o.DeploymentName) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OnErrorDeployment. +func (o *OnErrorDeployment) UnmarshalJSON(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 "deploymentName": + err = unpopulate(val, "DeploymentName", &o.DeploymentName) + 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 OnErrorDeploymentExtended. +func (o OnErrorDeploymentExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deploymentName", o.DeploymentName) + populate(objectMap, "provisioningState", o.ProvisioningState) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OnErrorDeploymentExtended. +func (o *OnErrorDeploymentExtended) UnmarshalJSON(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 "deploymentName": + err = unpopulate(val, "DeploymentName", &o.DeploymentName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + 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 Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + 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) + } + 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]any) + 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]any) + 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 ParametersLink. +func (p ParametersLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contentVersion", p.ContentVersion) + populate(objectMap, "uri", p.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ParametersLink. +func (p *ParametersLink) UnmarshalJSON(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 "contentVersion": + err = unpopulate(val, "ContentVersion", &p.ContentVersion) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &p.URI) + 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 Permission. +func (p Permission) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", p.Actions) + populate(objectMap, "dataActions", p.DataActions) + populate(objectMap, "notActions", p.NotActions) + populate(objectMap, "notDataActions", p.NotDataActions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Permission. +func (p *Permission) UnmarshalJSON(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 "actions": + err = unpopulate(val, "Actions", &p.Actions) + delete(rawMsg, key) + case "dataActions": + err = unpopulate(val, "DataActions", &p.DataActions) + delete(rawMsg, key) + case "notActions": + err = unpopulate(val, "NotActions", &p.NotActions) + delete(rawMsg, key) + case "notDataActions": + err = unpopulate(val, "NotDataActions", &p.NotDataActions) + 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]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "product", p.Product) + populate(objectMap, "promotionCode", p.PromotionCode) + populate(objectMap, "publisher", p.Publisher) + populate(objectMap, "version", p.Version) + 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) + 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 Provider. +func (p Provider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "namespace", p.Namespace) + populate(objectMap, "providerAuthorizationConsentState", p.ProviderAuthorizationConsentState) + populate(objectMap, "registrationPolicy", p.RegistrationPolicy) + populate(objectMap, "registrationState", p.RegistrationState) + populate(objectMap, "resourceTypes", p.ResourceTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Provider. +func (p *Provider) UnmarshalJSON(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 "namespace": + err = unpopulate(val, "Namespace", &p.Namespace) + delete(rawMsg, key) + case "providerAuthorizationConsentState": + err = unpopulate(val, "ProviderAuthorizationConsentState", &p.ProviderAuthorizationConsentState) + delete(rawMsg, key) + case "registrationPolicy": + err = unpopulate(val, "RegistrationPolicy", &p.RegistrationPolicy) + delete(rawMsg, key) + case "registrationState": + err = unpopulate(val, "RegistrationState", &p.RegistrationState) + delete(rawMsg, key) + case "resourceTypes": + err = unpopulate(val, "ResourceTypes", &p.ResourceTypes) + 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 ProviderConsentDefinition. +func (p ProviderConsentDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "consentToAuthorization", p.ConsentToAuthorization) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderConsentDefinition. +func (p *ProviderConsentDefinition) UnmarshalJSON(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 "consentToAuthorization": + err = unpopulate(val, "ConsentToAuthorization", &p.ConsentToAuthorization) + 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 ProviderExtendedLocation. +func (p ProviderExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocations", p.ExtendedLocations) + populate(objectMap, "location", p.Location) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderExtendedLocation. +func (p *ProviderExtendedLocation) UnmarshalJSON(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 "extendedLocations": + err = unpopulate(val, "ExtendedLocations", &p.ExtendedLocations) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + 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 ProviderListResult. +func (p ProviderListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderListResult. +func (p *ProviderListResult) UnmarshalJSON(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 ProviderPermission. +func (p ProviderPermission) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationId", p.ApplicationID) + populate(objectMap, "managedByRoleDefinition", p.ManagedByRoleDefinition) + populate(objectMap, "providerAuthorizationConsentState", p.ProviderAuthorizationConsentState) + populate(objectMap, "roleDefinition", p.RoleDefinition) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderPermission. +func (p *ProviderPermission) UnmarshalJSON(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 "applicationId": + err = unpopulate(val, "ApplicationID", &p.ApplicationID) + delete(rawMsg, key) + case "managedByRoleDefinition": + err = unpopulate(val, "ManagedByRoleDefinition", &p.ManagedByRoleDefinition) + delete(rawMsg, key) + case "providerAuthorizationConsentState": + err = unpopulate(val, "ProviderAuthorizationConsentState", &p.ProviderAuthorizationConsentState) + delete(rawMsg, key) + case "roleDefinition": + err = unpopulate(val, "RoleDefinition", &p.RoleDefinition) + 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 ProviderPermissionListResult. +func (p ProviderPermissionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderPermissionListResult. +func (p *ProviderPermissionListResult) UnmarshalJSON(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 ProviderRegistrationRequest. +func (p ProviderRegistrationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "thirdPartyProviderConsent", p.ThirdPartyProviderConsent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderRegistrationRequest. +func (p *ProviderRegistrationRequest) UnmarshalJSON(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 "thirdPartyProviderConsent": + err = unpopulate(val, "ThirdPartyProviderConsent", &p.ThirdPartyProviderConsent) + 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 ProviderResourceType. +func (p ProviderResourceType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiProfiles", p.APIProfiles) + populate(objectMap, "apiVersions", p.APIVersions) + populate(objectMap, "aliases", p.Aliases) + populate(objectMap, "capabilities", p.Capabilities) + populate(objectMap, "defaultApiVersion", p.DefaultAPIVersion) + populate(objectMap, "locationMappings", p.LocationMappings) + populate(objectMap, "locations", p.Locations) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "resourceType", p.ResourceType) + populate(objectMap, "zoneMappings", p.ZoneMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderResourceType. +func (p *ProviderResourceType) UnmarshalJSON(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 "apiProfiles": + err = unpopulate(val, "APIProfiles", &p.APIProfiles) + delete(rawMsg, key) + case "apiVersions": + err = unpopulate(val, "APIVersions", &p.APIVersions) + delete(rawMsg, key) + case "aliases": + err = unpopulate(val, "Aliases", &p.Aliases) + delete(rawMsg, key) + case "capabilities": + err = unpopulate(val, "Capabilities", &p.Capabilities) + delete(rawMsg, key) + case "defaultApiVersion": + err = unpopulate(val, "DefaultAPIVersion", &p.DefaultAPIVersion) + delete(rawMsg, key) + case "locationMappings": + err = unpopulate(val, "LocationMappings", &p.LocationMappings) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &p.Locations) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &p.ResourceType) + delete(rawMsg, key) + case "zoneMappings": + err = unpopulate(val, "ZoneMappings", &p.ZoneMappings) + 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 ProviderResourceTypeListResult. +func (p ProviderResourceTypeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderResourceTypeListResult. +func (p *ProviderResourceTypeListResult) UnmarshalJSON(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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) +} + +// 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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &r.ExtendedLocation) + 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 "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 ResourceGroup. +func (r ResourceGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroup. +func (r *ResourceGroup) UnmarshalJSON(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 "managedBy": + err = unpopulate(val, "ManagedBy", &r.ManagedBy) + 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 ResourceGroupExportResult. +func (r ResourceGroupExportResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", r.Error) + populateAny(objectMap, "template", r.Template) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupExportResult. +func (r *ResourceGroupExportResult) UnmarshalJSON(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 "template": + err = unpopulate(val, "Template", &r.Template) + 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 ResourceGroupFilter. +func (r ResourceGroupFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tagName", r.TagName) + populate(objectMap, "tagValue", r.TagValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupFilter. +func (r *ResourceGroupFilter) UnmarshalJSON(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 "tagName": + err = unpopulate(val, "TagName", &r.TagName) + delete(rawMsg, key) + case "tagValue": + err = unpopulate(val, "TagValue", &r.TagValue) + 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 ResourceGroupListResult. +func (r ResourceGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupListResult. +func (r *ResourceGroupListResult) UnmarshalJSON(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 ResourceGroupPatchable. +func (r ResourceGroupPatchable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "managedBy", r.ManagedBy) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupPatchable. +func (r *ResourceGroupPatchable) UnmarshalJSON(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 "managedBy": + err = unpopulate(val, "ManagedBy", &r.ManagedBy) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceGroupProperties. +func (r ResourceGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", r.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupProperties. +func (r *ResourceGroupProperties) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceListResult. +func (r ResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceListResult. +func (r *ResourceListResult) UnmarshalJSON(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 ResourceProviderOperationDisplayProperties. +func (r ResourceProviderOperationDisplayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", r.Description) + populate(objectMap, "operation", r.Operation) + populate(objectMap, "provider", r.Provider) + populate(objectMap, "publisher", r.Publisher) + populate(objectMap, "resource", r.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperationDisplayProperties. +func (r *ResourceProviderOperationDisplayProperties) UnmarshalJSON(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 "operation": + err = unpopulate(val, "Operation", &r.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &r.Provider) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &r.Publisher) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &r.Resource) + 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 ResourceReference. +func (r ResourceReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReference. +func (r *ResourceReference) UnmarshalJSON(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 RoleDefinition. +func (r RoleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "isServiceRole", r.IsServiceRole) + populate(objectMap, "name", r.Name) + populate(objectMap, "permissions", r.Permissions) + populate(objectMap, "scopes", r.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinition. +func (r *RoleDefinition) UnmarshalJSON(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 "isServiceRole": + err = unpopulate(val, "IsServiceRole", &r.IsServiceRole) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &r.Permissions) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &r.Scopes) + 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]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "family", s.Family) + populate(objectMap, "model", s.Model) + populate(objectMap, "name", s.Name) + populate(objectMap, "size", s.Size) + 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 "family": + err = unpopulate(val, "Family", &s.Family) + delete(rawMsg, key) + case "model": + err = unpopulate(val, "Model", &s.Model) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &s.Size) + 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 ScopedDeployment. +func (s ScopedDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", s.Location) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedDeployment. +func (s *ScopedDeployment) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &s.Location) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScopedDeploymentWhatIf. +func (s ScopedDeploymentWhatIf) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", s.Location) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedDeploymentWhatIf. +func (s *ScopedDeploymentWhatIf) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &s.Location) + 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 StatusMessage. +func (s StatusMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", s.Error) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StatusMessage. +func (s *StatusMessage) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &s.Error) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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]any) + 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 TagCount. +func (t TagCount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", t.Type) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagCount. +func (t *TagCount) UnmarshalJSON(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 "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TagDetails. +func (t TagDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", t.Count) + populate(objectMap, "id", t.ID) + populate(objectMap, "tagName", t.TagName) + populate(objectMap, "values", t.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagDetails. +func (t *TagDetails) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &t.Count) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "tagName": + err = unpopulate(val, "TagName", &t.TagName) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &t.Values) + 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 TagValue. +func (t TagValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", t.Count) + populate(objectMap, "id", t.ID) + populate(objectMap, "tagValue", t.TagValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagValue. +func (t *TagValue) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &t.Count) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "tagValue": + err = unpopulate(val, "TagValue", &t.TagValue) + 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 Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Tags. +func (t *Tags) UnmarshalJSON(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 TagsListResult. +func (t TagsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsListResult. +func (t *TagsListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TagsPatchResource. +func (t TagsPatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operation", t.Operation) + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsPatchResource. +func (t *TagsPatchResource) UnmarshalJSON(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 "operation": + err = unpopulate(val, "Operation", &t.Operation) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + 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 TagsResource. +func (t TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. +func (t *TagsResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TargetResource. +func (t TargetResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "resourceName", t.ResourceName) + populate(objectMap, "resourceType", t.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetResource. +func (t *TargetResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &t.ResourceName) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &t.ResourceType) + 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 TemplateHashResult. +func (t TemplateHashResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "minifiedTemplate", t.MinifiedTemplate) + populate(objectMap, "templateHash", t.TemplateHash) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TemplateHashResult. +func (t *TemplateHashResult) UnmarshalJSON(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 "minifiedTemplate": + err = unpopulate(val, "MinifiedTemplate", &t.MinifiedTemplate) + delete(rawMsg, key) + case "templateHash": + err = unpopulate(val, "TemplateHash", &t.TemplateHash) + 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 TemplateLink. +func (t TemplateLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contentVersion", t.ContentVersion) + populate(objectMap, "id", t.ID) + populate(objectMap, "queryString", t.QueryString) + populate(objectMap, "relativePath", t.RelativePath) + populate(objectMap, "uri", t.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TemplateLink. +func (t *TemplateLink) UnmarshalJSON(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 "contentVersion": + err = unpopulate(val, "ContentVersion", &t.ContentVersion) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "queryString": + err = unpopulate(val, "QueryString", &t.QueryString) + delete(rawMsg, key) + case "relativePath": + err = unpopulate(val, "RelativePath", &t.RelativePath) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &t.URI) + 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 WhatIfChange. +func (w WhatIfChange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "after", w.After) + populateAny(objectMap, "before", w.Before) + populate(objectMap, "changeType", w.ChangeType) + populate(objectMap, "delta", w.Delta) + populate(objectMap, "resourceId", w.ResourceID) + populate(objectMap, "unsupportedReason", w.UnsupportedReason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WhatIfChange. +func (w *WhatIfChange) UnmarshalJSON(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 "after": + err = unpopulate(val, "After", &w.After) + delete(rawMsg, key) + case "before": + err = unpopulate(val, "Before", &w.Before) + delete(rawMsg, key) + case "changeType": + err = unpopulate(val, "ChangeType", &w.ChangeType) + delete(rawMsg, key) + case "delta": + err = unpopulate(val, "Delta", &w.Delta) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &w.ResourceID) + delete(rawMsg, key) + case "unsupportedReason": + err = unpopulate(val, "UnsupportedReason", &w.UnsupportedReason) + 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 WhatIfOperationProperties. +func (w WhatIfOperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "changes", w.Changes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WhatIfOperationProperties. +func (w *WhatIfOperationProperties) UnmarshalJSON(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 "changes": + err = unpopulate(val, "Changes", &w.Changes) + 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 WhatIfOperationResult. +func (w WhatIfOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", w.Error) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WhatIfOperationResult. +func (w *WhatIfOperationResult) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &w.Error) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + 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 WhatIfPropertyChange. +func (w WhatIfPropertyChange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "after", w.After) + populateAny(objectMap, "before", w.Before) + populate(objectMap, "children", w.Children) + populate(objectMap, "path", w.Path) + populate(objectMap, "propertyChangeType", w.PropertyChangeType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WhatIfPropertyChange. +func (w *WhatIfPropertyChange) UnmarshalJSON(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 "after": + err = unpopulate(val, "After", &w.After) + delete(rawMsg, key) + case "before": + err = unpopulate(val, "Before", &w.Before) + delete(rawMsg, key) + case "children": + err = unpopulate(val, "Children", &w.Children) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &w.Path) + delete(rawMsg, key) + case "propertyChangeType": + err = unpopulate(val, "PropertyChangeType", &w.PropertyChangeType) + 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 ZoneMapping. +func (z ZoneMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", z.Location) + populate(objectMap, "zones", z.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ZoneMapping. +func (z *ZoneMapping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &z.Location) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &z.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) 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/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/operations_client.go new file mode 100644 index 000000000..e0fc6b961 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/operations_client.go @@ -0,0 +1,88 @@ +//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. DO NOT EDIT. +// 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" + "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 { + internal *arm.Client +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all of the available Microsoft.Resources REST API operations. +// +// Generated from API version 2021-04-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/options.go new file mode 100644 index 000000000..dfdb23b0c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/options.go @@ -0,0 +1,654 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +// 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.NewListByResourceGroupPager 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.NewListPager 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 +} + +// 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.NewListAtManagementGroupScopePager +// method. +type DeploymentOperationsClientListAtManagementGroupScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtScopePager +// method. +type DeploymentOperationsClientListAtScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtSubscriptionScopePager +// method. +type DeploymentOperationsClientListAtSubscriptionScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtTenantScopePager +// method. +type DeploymentOperationsClientListAtTenantScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListOptions contains the optional parameters for the DeploymentOperationsClient.NewListPager +// method. +type DeploymentOperationsClientListOptions struct { + // The number of results to return. + Top *int32 +} + +// 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.NewListAtManagementGroupScopePager +// 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.NewListAtScopePager 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.NewListAtSubscriptionScopePager +// 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.NewListAtTenantScopePager +// 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.NewListByResourceGroupPager +// 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 +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListAtTenantScopePager +// 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.NewListPager 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 +} + +// 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.NewListPager 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 +} + +// 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.NewListPager 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 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providerresourcetypes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providerresourcetypes_client.go new file mode 100644 index 000000000..a64c08f02 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providerresourcetypes_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. DO NOT EDIT. +// 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" + "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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProviderResourceTypesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "ProviderResourceTypesClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProviderResourceTypesClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProviderResourceTypesClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProviderResourceTypesClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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/providers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providers_client.go new file mode 100644 index 000000000..e1612d160 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providers_client.go @@ -0,0 +1,511 @@ +//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. DO NOT EDIT. +// 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" + "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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProvidersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "ProvidersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvidersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "ProvidersClient.GetAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtTenantScopeCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientGetAtTenantScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvidersClientGetAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientGetAtTenantScopeResponse{}, err + } + resp, err := client.getAtTenantScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - options - ProvidersClientListOptions contains the optional parameters for the ProvidersClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProvidersClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return ProvidersClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - options - ProvidersClientListAtTenantScopeOptions contains the optional parameters for the ProvidersClient.NewListAtTenantScopePager +// 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProvidersClient.NewListAtTenantScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtTenantScopeCreateRequest(ctx, options) + }, nil) + if err != nil { + return ProvidersClientListAtTenantScopeResponse{}, err + } + return client.listAtTenantScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "ProvidersClient.ProviderPermissions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.providerPermissionsCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientProviderPermissionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvidersClientProviderPermissionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientProviderPermissionsResponse{}, err + } + resp, err := client.providerPermissionsHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "ProvidersClient.Register" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.registerCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientRegisterResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvidersClientRegisterResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientRegisterResponse{}, err + } + resp, err := client.registerHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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 { + if err := runtime.MarshalAsJSON(req, *options.Properties); err != nil { + return nil, err + } + return req, nil + } + 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) { + var err error + const operationName = "ProvidersClient.RegisterAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.registerAtManagementGroupScopeCreateRequest(ctx, resourceProviderNamespace, groupID, options) + if err != nil { + return ProvidersClientRegisterAtManagementGroupScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvidersClientRegisterAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientRegisterAtManagementGroupScopeResponse{}, err + } + 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.internal.Endpoint(), 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) { + var err error + const operationName = "ProvidersClient.Unregister" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.unregisterCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientUnregisterResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvidersClientUnregisterResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientUnregisterResponse{}, err + } + resp, err := client.unregisterHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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/resourcegroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/resourcegroups_client.go new file mode 100644 index 000000000..b228d9f64 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/resourcegroups_client.go @@ -0,0 +1,495 @@ +//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. DO NOT EDIT. +// 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" + "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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ResourceGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "ResourceGroupsClient.CheckExistence" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ResourceGroupsClientCheckExistenceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceGroupsClientCheckExistenceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ResourceGroupsClientCheckExistenceResponse{}, err + } + return ResourceGroupsClientCheckExistenceResponse{Success: httpResp.StatusCode >= 200 && httpResp.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.internal.Endpoint(), 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) { + var err error + const operationName = "ResourceGroupsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, parameters, options) + if err != nil { + return ResourceGroupsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceGroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ResourceGroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourceGroupsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ResourceGroupsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "ResourceGroupsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourceGroupsClientExportTemplateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ResourceGroupsClientExportTemplateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// 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) { + var err error + const operationName = "ResourceGroupsClient.BeginExportTemplate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.exportTemplateCreateRequest(ctx, resourceGroupName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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) { + var err error + const operationName = "ResourceGroupsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ResourceGroupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGroupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - options - ResourceGroupsClientListOptions contains the optional parameters for the ResourceGroupsClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceGroupsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return ResourceGroupsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "ResourceGroupsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, parameters, options) + if err != nil { + return ResourceGroupsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGroupsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/response_types.go new file mode 100644 index 000000000..fb04138cd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/response_types.go @@ -0,0 +1,561 @@ +//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. DO NOT EDIT. +// 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.BeginCreateOrUpdateByID. +type ClientCreateOrUpdateByIDResponse struct { + // Resource information. + GenericResource +} + +// ClientCreateOrUpdateResponse contains the response from method Client.BeginCreateOrUpdate. +type ClientCreateOrUpdateResponse struct { + // Resource information. + GenericResource +} + +// ClientDeleteByIDResponse contains the response from method Client.BeginDeleteByID. +type ClientDeleteByIDResponse struct { + // placeholder for future response values +} + +// ClientDeleteResponse contains the response from method Client.BeginDelete. +type ClientDeleteResponse struct { + // placeholder for future response values +} + +// ClientGetByIDResponse contains the response from method Client.GetByID. +type ClientGetByIDResponse struct { + // Resource information. + GenericResource +} + +// ClientGetResponse contains the response from method Client.Get. +type ClientGetResponse struct { + // Resource information. + GenericResource +} + +// ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager. +type ClientListByResourceGroupResponse struct { + // List of resource groups. + ResourceListResult +} + +// ClientListResponse contains the response from method Client.NewListPager. +type ClientListResponse struct { + // List of resource groups. + ResourceListResult +} + +// ClientMoveResourcesResponse contains the response from method Client.BeginMoveResources. +type ClientMoveResourcesResponse struct { + // placeholder for future response values +} + +// ClientUpdateByIDResponse contains the response from method Client.BeginUpdateByID. +type ClientUpdateByIDResponse struct { + // Resource information. + GenericResource +} + +// ClientUpdateResponse contains the response from method Client.BeginUpdate. +type ClientUpdateResponse struct { + // Resource information. + GenericResource +} + +// ClientValidateMoveResourcesResponse contains the response from method Client.BeginValidateMoveResources. +type ClientValidateMoveResourcesResponse struct { + // placeholder for future response values +} + +// DeploymentOperationsClientGetAtManagementGroupScopeResponse contains the response from method DeploymentOperationsClient.GetAtManagementGroupScope. +type DeploymentOperationsClientGetAtManagementGroupScopeResponse struct { + // Deployment operation information. + DeploymentOperation +} + +// DeploymentOperationsClientGetAtScopeResponse contains the response from method DeploymentOperationsClient.GetAtScope. +type DeploymentOperationsClientGetAtScopeResponse struct { + // Deployment operation information. + DeploymentOperation +} + +// DeploymentOperationsClientGetAtSubscriptionScopeResponse contains the response from method DeploymentOperationsClient.GetAtSubscriptionScope. +type DeploymentOperationsClientGetAtSubscriptionScopeResponse struct { + // Deployment operation information. + DeploymentOperation +} + +// DeploymentOperationsClientGetAtTenantScopeResponse contains the response from method DeploymentOperationsClient.GetAtTenantScope. +type DeploymentOperationsClientGetAtTenantScopeResponse struct { + // Deployment operation information. + DeploymentOperation +} + +// DeploymentOperationsClientGetResponse contains the response from method DeploymentOperationsClient.Get. +type DeploymentOperationsClientGetResponse struct { + // Deployment operation information. + DeploymentOperation +} + +// DeploymentOperationsClientListAtManagementGroupScopeResponse contains the response from method DeploymentOperationsClient.NewListAtManagementGroupScopePager. +type DeploymentOperationsClientListAtManagementGroupScopeResponse struct { + // List of deployment operations. + DeploymentOperationsListResult +} + +// DeploymentOperationsClientListAtScopeResponse contains the response from method DeploymentOperationsClient.NewListAtScopePager. +type DeploymentOperationsClientListAtScopeResponse struct { + // List of deployment operations. + DeploymentOperationsListResult +} + +// DeploymentOperationsClientListAtSubscriptionScopeResponse contains the response from method DeploymentOperationsClient.NewListAtSubscriptionScopePager. +type DeploymentOperationsClientListAtSubscriptionScopeResponse struct { + // List of deployment operations. + DeploymentOperationsListResult +} + +// DeploymentOperationsClientListAtTenantScopeResponse contains the response from method DeploymentOperationsClient.NewListAtTenantScopePager. +type DeploymentOperationsClientListAtTenantScopeResponse struct { + // List of deployment operations. + DeploymentOperationsListResult +} + +// DeploymentOperationsClientListResponse contains the response from method DeploymentOperationsClient.NewListPager. +type DeploymentOperationsClientListResponse struct { + // List of deployment operations. + DeploymentOperationsListResult +} + +// DeploymentsClientCalculateTemplateHashResponse contains the response from method DeploymentsClient.CalculateTemplateHash. +type DeploymentsClientCalculateTemplateHashResponse struct { + // Result of the request to calculate template hash. It contains a string of minified template and its hash. + 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.BeginCreateOrUpdateAtManagementGroupScope. +type DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientCreateOrUpdateAtScopeResponse contains the response from method DeploymentsClient.BeginCreateOrUpdateAtScope. +type DeploymentsClientCreateOrUpdateAtScopeResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse contains the response from method DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope. +type DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientCreateOrUpdateAtTenantScopeResponse contains the response from method DeploymentsClient.BeginCreateOrUpdateAtTenantScope. +type DeploymentsClientCreateOrUpdateAtTenantScopeResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientCreateOrUpdateResponse contains the response from method DeploymentsClient.BeginCreateOrUpdate. +type DeploymentsClientCreateOrUpdateResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientDeleteAtManagementGroupScopeResponse contains the response from method DeploymentsClient.BeginDeleteAtManagementGroupScope. +type DeploymentsClientDeleteAtManagementGroupScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientDeleteAtScopeResponse contains the response from method DeploymentsClient.BeginDeleteAtScope. +type DeploymentsClientDeleteAtScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientDeleteAtSubscriptionScopeResponse contains the response from method DeploymentsClient.BeginDeleteAtSubscriptionScope. +type DeploymentsClientDeleteAtSubscriptionScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientDeleteAtTenantScopeResponse contains the response from method DeploymentsClient.BeginDeleteAtTenantScope. +type DeploymentsClientDeleteAtTenantScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientDeleteResponse contains the response from method DeploymentsClient.BeginDelete. +type DeploymentsClientDeleteResponse struct { + // placeholder for future response values +} + +// DeploymentsClientExportTemplateAtManagementGroupScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtManagementGroupScope. +type DeploymentsClientExportTemplateAtManagementGroupScopeResponse struct { + // The deployment export result. + DeploymentExportResult +} + +// DeploymentsClientExportTemplateAtScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtScope. +type DeploymentsClientExportTemplateAtScopeResponse struct { + // The deployment export result. + DeploymentExportResult +} + +// DeploymentsClientExportTemplateAtSubscriptionScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtSubscriptionScope. +type DeploymentsClientExportTemplateAtSubscriptionScopeResponse struct { + // The deployment export result. + DeploymentExportResult +} + +// DeploymentsClientExportTemplateAtTenantScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtTenantScope. +type DeploymentsClientExportTemplateAtTenantScopeResponse struct { + // The deployment export result. + DeploymentExportResult +} + +// DeploymentsClientExportTemplateResponse contains the response from method DeploymentsClient.ExportTemplate. +type DeploymentsClientExportTemplateResponse struct { + // The deployment export result. + DeploymentExportResult +} + +// DeploymentsClientGetAtManagementGroupScopeResponse contains the response from method DeploymentsClient.GetAtManagementGroupScope. +type DeploymentsClientGetAtManagementGroupScopeResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientGetAtScopeResponse contains the response from method DeploymentsClient.GetAtScope. +type DeploymentsClientGetAtScopeResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientGetAtSubscriptionScopeResponse contains the response from method DeploymentsClient.GetAtSubscriptionScope. +type DeploymentsClientGetAtSubscriptionScopeResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientGetAtTenantScopeResponse contains the response from method DeploymentsClient.GetAtTenantScope. +type DeploymentsClientGetAtTenantScopeResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientGetResponse contains the response from method DeploymentsClient.Get. +type DeploymentsClientGetResponse struct { + // Deployment information. + DeploymentExtended +} + +// DeploymentsClientListAtManagementGroupScopeResponse contains the response from method DeploymentsClient.NewListAtManagementGroupScopePager. +type DeploymentsClientListAtManagementGroupScopeResponse struct { + // List of deployments. + DeploymentListResult +} + +// DeploymentsClientListAtScopeResponse contains the response from method DeploymentsClient.NewListAtScopePager. +type DeploymentsClientListAtScopeResponse struct { + // List of deployments. + DeploymentListResult +} + +// DeploymentsClientListAtSubscriptionScopeResponse contains the response from method DeploymentsClient.NewListAtSubscriptionScopePager. +type DeploymentsClientListAtSubscriptionScopeResponse struct { + // List of deployments. + DeploymentListResult +} + +// DeploymentsClientListAtTenantScopeResponse contains the response from method DeploymentsClient.NewListAtTenantScopePager. +type DeploymentsClientListAtTenantScopeResponse struct { + // List of deployments. + DeploymentListResult +} + +// DeploymentsClientListByResourceGroupResponse contains the response from method DeploymentsClient.NewListByResourceGroupPager. +type DeploymentsClientListByResourceGroupResponse struct { + // List of deployments. + DeploymentListResult +} + +// DeploymentsClientValidateAtManagementGroupScopeResponse contains the response from method DeploymentsClient.BeginValidateAtManagementGroupScope. +type DeploymentsClientValidateAtManagementGroupScopeResponse struct { + // Information from validate template deployment response. + DeploymentValidateResult +} + +// DeploymentsClientValidateAtScopeResponse contains the response from method DeploymentsClient.BeginValidateAtScope. +type DeploymentsClientValidateAtScopeResponse struct { + // Information from validate template deployment response. + DeploymentValidateResult +} + +// DeploymentsClientValidateAtSubscriptionScopeResponse contains the response from method DeploymentsClient.BeginValidateAtSubscriptionScope. +type DeploymentsClientValidateAtSubscriptionScopeResponse struct { + // Information from validate template deployment response. + DeploymentValidateResult +} + +// DeploymentsClientValidateAtTenantScopeResponse contains the response from method DeploymentsClient.BeginValidateAtTenantScope. +type DeploymentsClientValidateAtTenantScopeResponse struct { + // Information from validate template deployment response. + DeploymentValidateResult +} + +// DeploymentsClientValidateResponse contains the response from method DeploymentsClient.BeginValidate. +type DeploymentsClientValidateResponse struct { + // Information from validate template deployment response. + DeploymentValidateResult +} + +// DeploymentsClientWhatIfAtManagementGroupScopeResponse contains the response from method DeploymentsClient.BeginWhatIfAtManagementGroupScope. +type DeploymentsClientWhatIfAtManagementGroupScopeResponse struct { + // Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + WhatIfOperationResult +} + +// DeploymentsClientWhatIfAtSubscriptionScopeResponse contains the response from method DeploymentsClient.BeginWhatIfAtSubscriptionScope. +type DeploymentsClientWhatIfAtSubscriptionScopeResponse struct { + // Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + WhatIfOperationResult +} + +// DeploymentsClientWhatIfAtTenantScopeResponse contains the response from method DeploymentsClient.BeginWhatIfAtTenantScope. +type DeploymentsClientWhatIfAtTenantScopeResponse struct { + // Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + WhatIfOperationResult +} + +// DeploymentsClientWhatIfResponse contains the response from method DeploymentsClient.BeginWhatIf. +type DeploymentsClientWhatIfResponse struct { + // Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + WhatIfOperationResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // 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. + OperationListResult +} + +// ProviderResourceTypesClientListResponse contains the response from method ProviderResourceTypesClient.List. +type ProviderResourceTypesClientListResponse struct { + // List of resource types of a resource provider. + ProviderResourceTypeListResult +} + +// ProvidersClientGetAtTenantScopeResponse contains the response from method ProvidersClient.GetAtTenantScope. +type ProvidersClientGetAtTenantScopeResponse struct { + // Resource provider information. + Provider +} + +// ProvidersClientGetResponse contains the response from method ProvidersClient.Get. +type ProvidersClientGetResponse struct { + // Resource provider information. + Provider +} + +// ProvidersClientListAtTenantScopeResponse contains the response from method ProvidersClient.NewListAtTenantScopePager. +type ProvidersClientListAtTenantScopeResponse struct { + // List of resource providers. + ProviderListResult +} + +// ProvidersClientListResponse contains the response from method ProvidersClient.NewListPager. +type ProvidersClientListResponse struct { + // List of resource providers. + ProviderListResult +} + +// ProvidersClientProviderPermissionsResponse contains the response from method ProvidersClient.ProviderPermissions. +type ProvidersClientProviderPermissionsResponse struct { + // List of provider permissions. + 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 { + // Resource provider information. + Provider +} + +// ProvidersClientUnregisterResponse contains the response from method ProvidersClient.Unregister. +type ProvidersClientUnregisterResponse struct { + // Resource provider information. + 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 { + // Resource group information. + ResourceGroup +} + +// ResourceGroupsClientDeleteResponse contains the response from method ResourceGroupsClient.BeginDelete. +type ResourceGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// ResourceGroupsClientExportTemplateResponse contains the response from method ResourceGroupsClient.BeginExportTemplate. +type ResourceGroupsClientExportTemplateResponse struct { + // Resource group export result. + ResourceGroupExportResult +} + +// ResourceGroupsClientGetResponse contains the response from method ResourceGroupsClient.Get. +type ResourceGroupsClientGetResponse struct { + // Resource group information. + ResourceGroup +} + +// ResourceGroupsClientListResponse contains the response from method ResourceGroupsClient.NewListPager. +type ResourceGroupsClientListResponse struct { + // List of resource groups. + ResourceGroupListResult +} + +// ResourceGroupsClientUpdateResponse contains the response from method ResourceGroupsClient.Update. +type ResourceGroupsClientUpdateResponse struct { + // Resource group information. + ResourceGroup +} + +// TagsClientCreateOrUpdateAtScopeResponse contains the response from method TagsClient.CreateOrUpdateAtScope. +type TagsClientCreateOrUpdateAtScopeResponse struct { + // Wrapper resource for tags API requests and responses. + TagsResource +} + +// TagsClientCreateOrUpdateResponse contains the response from method TagsClient.CreateOrUpdate. +type TagsClientCreateOrUpdateResponse struct { + // Tag details. + TagDetails +} + +// TagsClientCreateOrUpdateValueResponse contains the response from method TagsClient.CreateOrUpdateValue. +type TagsClientCreateOrUpdateValueResponse struct { + // Tag information. + 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 { + // Wrapper resource for tags API requests and responses. + TagsResource +} + +// TagsClientListResponse contains the response from method TagsClient.NewListPager. +type TagsClientListResponse struct { + // List of subscription tags. + TagsListResult +} + +// TagsClientUpdateAtScopeResponse contains the response from method TagsClient.UpdateAtScope. +type TagsClientUpdateAtScopeResponse struct { + // Wrapper resource for tags API requests and responses. + TagsResource +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/tags_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/tags_client.go new file mode 100644 index 000000000..b6d0fc249 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/tags_client.go @@ -0,0 +1,544 @@ +//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. DO NOT EDIT. +// 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" + "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 { + internal *arm.Client + subscriptionID string +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TagsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + 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) { + var err error + const operationName = "TagsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, tagName, options) + if err != nil { + return TagsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return TagsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "TagsClient.CreateOrUpdateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateAtScopeCreateRequest(ctx, scope, parameters, options) + if err != nil { + return TagsClientCreateOrUpdateAtScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagsClientCreateOrUpdateAtScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TagsClientCreateOrUpdateAtScopeResponse{}, err + } + resp, err := client.createOrUpdateAtScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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) { + var err error + const operationName = "TagsClient.CreateOrUpdateValue" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateValueCreateRequest(ctx, tagName, tagValue, options) + if err != nil { + return TagsClientCreateOrUpdateValueResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagsClientCreateOrUpdateValueResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return TagsClientCreateOrUpdateValueResponse{}, err + } + resp, err := client.createOrUpdateValueHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "TagsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, tagName, options) + if err != nil { + return TagsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TagsClientDeleteResponse{}, err + } + 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.internal.Endpoint(), 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) { + var err error + const operationName = "TagsClient.DeleteAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteAtScopeCreateRequest(ctx, scope, options) + if err != nil { + return TagsClientDeleteAtScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagsClientDeleteAtScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TagsClientDeleteAtScopeResponse{}, err + } + 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.internal.Endpoint(), 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) { + var err error + const operationName = "TagsClient.DeleteValue" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteValueCreateRequest(ctx, tagName, tagValue, options) + if err != nil { + return TagsClientDeleteValueResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagsClientDeleteValueResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TagsClientDeleteValueResponse{}, err + } + 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.internal.Endpoint(), 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) { + var err error + const operationName = "TagsClient.GetAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAtScopeCreateRequest(ctx, scope, options) + if err != nil { + return TagsClientGetAtScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagsClientGetAtScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TagsClientGetAtScopeResponse{}, err + } + resp, err := client.getAtScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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. +// +// Generated from API version 2021-04-01 +// - options - TagsClientListOptions contains the optional parameters for the TagsClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TagsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return TagsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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.internal.Endpoint(), 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) { + var err error + const operationName = "TagsClient.UpdateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateAtScopeCreateRequest(ctx, scope, parameters, options) + if err != nil { + return TagsClientUpdateAtScopeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TagsClientUpdateAtScopeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TagsClientUpdateAtScopeResponse{}, err + } + resp, err := client.updateAtScopeHandleResponse(httpResp) + return resp, err +} + +// 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.internal.Endpoint(), 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 err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// 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/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/time_rfc3339.go new file mode 100644 index 000000000..5026e349b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/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. DO NOT EDIT. +// 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" +) + +// 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+)*"*$`) + +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func populateDateTimeRFC3339(m map[string]any, 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] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateTimeRFC3339 + 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/storage/armstorage/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/CHANGELOG.md new file mode 100644 index 000000000..c9aefb399 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/CHANGELOG.md @@ -0,0 +1,68 @@ +# Release History + +## 1.5.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + +## 1.5.0-beta.1 (2023-10-09) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + +## 1.4.0 (2023-08-25) +### Features Added + +- New value `CorsRuleAllowedMethodsItemCONNECT`, `CorsRuleAllowedMethodsItemTRACE` added to enum type `CorsRuleAllowedMethodsItem` +- New enum type `MigrationName` with values `MigrationNameDefault` +- New enum type `MigrationStatus` with values `MigrationStatusComplete`, `MigrationStatusFailed`, `MigrationStatusInProgress`, `MigrationStatusInvalid`, `MigrationStatusSubmittedForConversion` +- New enum type `PostFailoverRedundancy` with values `PostFailoverRedundancyStandardLRS`, `PostFailoverRedundancyStandardZRS` +- New enum type `PostPlannedFailoverRedundancy` with values `PostPlannedFailoverRedundancyStandardGRS`, `PostPlannedFailoverRedundancyStandardGZRS`, `PostPlannedFailoverRedundancyStandardRAGRS`, `PostPlannedFailoverRedundancyStandardRAGZRS` +- New function `*AccountsClient.BeginCustomerInitiatedMigration(context.Context, string, string, AccountMigration, *AccountsClientBeginCustomerInitiatedMigrationOptions) (*runtime.Poller[AccountsClientCustomerInitiatedMigrationResponse], error)` +- New function `*AccountsClient.GetCustomerInitiatedMigration(context.Context, string, string, MigrationName, *AccountsClientGetCustomerInitiatedMigrationOptions) (AccountsClientGetCustomerInitiatedMigrationResponse, error)` +- New struct `AccountMigration` +- New struct `AccountMigrationProperties` +- New struct `BlobInventoryCreationTime` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponseAutoGenerated` +- New field `AccountMigrationInProgress`, `IsSKUConversionBlocked` in struct `AccountProperties` +- New field `CreationTime` in struct `BlobInventoryPolicyFilter` +- New field `CanPlannedFailover`, `PostFailoverRedundancy`, `PostPlannedFailoverRedundancy` in struct `GeoReplicationStats` + + +## 1.3.0 (2023-03-27) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + +## 1.2.0 (2022-12-23) +### Features Added + +- New type alias `ListEncryptionScopesInclude` +- New field `FailoverType` in struct `AccountsClientBeginFailoverOptions` +- New field `TierToCold` in struct `ManagementPolicyBaseBlob` +- New field `TierToHot` in struct `ManagementPolicyBaseBlob` +- New field `Filter` in struct `EncryptionScopesClientListOptions` +- New field `Include` in struct `EncryptionScopesClientListOptions` +- New field `Maxpagesize` in struct `EncryptionScopesClientListOptions` +- New field `TierToHot` in struct `ManagementPolicyVersion` +- New field `TierToCold` in struct `ManagementPolicyVersion` +- New field `TierToCold` in struct `ManagementPolicySnapShot` +- New field `TierToHot` in struct `ManagementPolicySnapShot` + + +## 1.1.0 (2022-08-10) +### Features Added + +- New const `DirectoryServiceOptionsAADKERB` + + +## 1.0.0 (2022-05-16) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage` 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/storage/armstorage/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/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/storage/armstorage/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/README.md new file mode 100644 index 000000000..9f7fe2b72 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/README.md @@ -0,0 +1,102 @@ +# Azure Storage Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage) + +The `armstorage` module provides operations for working with Azure Storage. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/storage/armstorage) + +# 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 Storage module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Storage. 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). + +## Client Factory + +Azure Storage module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armstorage.NewClientFactory(, 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, + }, +} +clientFactory, err := armstorage.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewAccountsClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## More sample code + +- [Blob](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/blob) +- [Creating a Fake](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/storage/armstorage/fake_example_test.go) +- [File](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/file) +- [Management Policy](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/managementpolicy) +- [Queue](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/queue) +- [Storage Account](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/storageaccount) +- [Table](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/table) + +## 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 `Storage` 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/storage/armstorage/accounts_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/accounts_client.go new file mode 100644 index 000000000..81c6bc011 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/accounts_client.go @@ -0,0 +1,1330 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccountsClient contains the methods for the StorageAccounts group. +// Don't use this type directly, use NewAccountsClient() instead. +type AccountsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccountsClient creates a new instance of AccountsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccountsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginAbortHierarchicalNamespaceMigration - Abort live Migration of storage account to enable Hns +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions contains the optional parameters for the AccountsClient.BeginAbortHierarchicalNamespaceMigration +// method. +func (client *AccountsClient) BeginAbortHierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions) (*runtime.Poller[AccountsClientAbortHierarchicalNamespaceMigrationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.abortHierarchicalNamespaceMigration(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientAbortHierarchicalNamespaceMigrationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountsClientAbortHierarchicalNamespaceMigrationResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// AbortHierarchicalNamespaceMigration - Abort live Migration of storage account to enable Hns +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *AccountsClient) abortHierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions) (*http.Response, error) { + var err error + const operationName = "AccountsClient.BeginAbortHierarchicalNamespaceMigration" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.abortHierarchicalNamespaceMigrationCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// abortHierarchicalNamespaceMigrationCreateRequest creates the AbortHierarchicalNamespaceMigration request. +func (client *AccountsClient) abortHierarchicalNamespaceMigrationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CheckNameAvailability - Checks that the storage account name is valid and is not already in use. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - AccountsClientCheckNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckNameAvailability +// method. +func (client *AccountsClient) CheckNameAvailability(ctx context.Context, accountName AccountCheckNameAvailabilityParameters, options *AccountsClientCheckNameAvailabilityOptions) (AccountsClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "AccountsClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, accountName, options) + if err != nil { + return AccountsClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Context, accountName AccountCheckNameAvailabilityParameters, options *AccountsClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability" + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, accountName); err != nil { + return nil, err + } + return req, nil +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *AccountsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (AccountsClientCheckNameAvailabilityResponse, error) { + result := AccountsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { + return AccountsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreate - Asynchronously creates a new storage account with the specified parameters. If an account is already created +// and a subsequent create request is issued with different properties, the account properties +// will be updated. If an account is already created and a subsequent create or update request is issued with the exact same +// set of properties, the request will succeed. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The parameters to provide for the created account. +// - options - AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. +func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters, options *AccountsClientBeginCreateOptions) (*runtime.Poller[AccountsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Asynchronously creates a new storage account with the specified parameters. If an account is already created and +// a subsequent create request is issued with different properties, the account properties +// will be updated. If an account is already created and a subsequent create or update request is issued with the exact same +// set of properties, the request will succeed. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *AccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters, options *AccountsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "AccountsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters, options *AccountsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginCustomerInitiatedMigration - Account Migration request can be triggered for a storage account to change its redundancy +// level. The migration updates the non-zonal redundant storage account to a zonal redundant account or +// vice-versa in order to have better reliability and availability. Zone-redundant storage (ZRS) replicates your storage account +// synchronously across three Azure availability zones in the primary region. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The request parameters required to perform storage account migration. +// - options - AccountsClientBeginCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.BeginCustomerInitiatedMigration +// method. +func (client *AccountsClient) BeginCustomerInitiatedMigration(ctx context.Context, resourceGroupName string, accountName string, parameters AccountMigration, options *AccountsClientBeginCustomerInitiatedMigrationOptions) (*runtime.Poller[AccountsClientCustomerInitiatedMigrationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.customerInitiatedMigration(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientCustomerInitiatedMigrationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountsClientCustomerInitiatedMigrationResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CustomerInitiatedMigration - Account Migration request can be triggered for a storage account to change its redundancy +// level. The migration updates the non-zonal redundant storage account to a zonal redundant account or +// vice-versa in order to have better reliability and availability. Zone-redundant storage (ZRS) replicates your storage account +// synchronously across three Azure availability zones in the primary region. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *AccountsClient) customerInitiatedMigration(ctx context.Context, resourceGroupName string, accountName string, parameters AccountMigration, options *AccountsClientBeginCustomerInitiatedMigrationOptions) (*http.Response, error) { + var err error + const operationName = "AccountsClient.BeginCustomerInitiatedMigration" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.customerInitiatedMigrationCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// customerInitiatedMigrationCreateRequest creates the CustomerInitiatedMigration request. +func (client *AccountsClient) customerInitiatedMigrationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters AccountMigration, options *AccountsClientBeginCustomerInitiatedMigrationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/startAccountMigration" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Deletes a storage account in Microsoft Azure. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - AccountsClientDeleteOptions contains the optional parameters for the AccountsClient.Delete method. +func (client *AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientDeleteOptions) (AccountsClientDeleteResponse, error) { + var err error + const operationName = "AccountsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return AccountsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return AccountsClientDeleteResponse{}, err + } + return AccountsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// BeginFailover - A failover request can be triggered for a storage account in the event a primary endpoint becomes unavailable +// for any reason. The failover occurs from the storage account's primary cluster to the +// secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover and the account is converted +// to LRS. In the case of a Planned Failover, the primary and secondary +// clusters are swapped after failover and the account remains geo-replicated. Failover should continue to be used in the +// event of availability issues as Planned failover is only available while the +// primary and secondary endpoints are available. The primary use case of a Planned Failover is disaster recovery testing +// drills. This type of failover is invoked by setting FailoverType parameter to +// 'Planned'. Learn more about the failover options here- https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - AccountsClientBeginFailoverOptions contains the optional parameters for the AccountsClient.BeginFailover method. +func (client *AccountsClient) BeginFailover(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginFailoverOptions) (*runtime.Poller[AccountsClientFailoverResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.failover(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientFailoverResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountsClientFailoverResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Failover - A failover request can be triggered for a storage account in the event a primary endpoint becomes unavailable +// for any reason. The failover occurs from the storage account's primary cluster to the +// secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover and the account is converted +// to LRS. In the case of a Planned Failover, the primary and secondary +// clusters are swapped after failover and the account remains geo-replicated. Failover should continue to be used in the +// event of availability issues as Planned failover is only available while the +// primary and secondary endpoints are available. The primary use case of a Planned Failover is disaster recovery testing +// drills. This type of failover is invoked by setting FailoverType parameter to +// 'Planned'. Learn more about the failover options here- https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *AccountsClient) failover(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginFailoverOptions) (*http.Response, error) { + var err error + const operationName = "AccountsClient.BeginFailover" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.failoverCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// failoverCreateRequest creates the Failover request. +func (client *AccountsClient) failoverCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginFailoverOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + if options != nil && options.FailoverType != nil { + reqQP.Set("failoverType", "Planned") + } + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// GetCustomerInitiatedMigration - Gets the status of the ongoing migration for the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - migrationName - The name of the Storage Account Migration. It should always be 'default' +// - options - AccountsClientGetCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.GetCustomerInitiatedMigration +// method. +func (client *AccountsClient) GetCustomerInitiatedMigration(ctx context.Context, resourceGroupName string, accountName string, migrationName MigrationName, options *AccountsClientGetCustomerInitiatedMigrationOptions) (AccountsClientGetCustomerInitiatedMigrationResponse, error) { + var err error + const operationName = "AccountsClient.GetCustomerInitiatedMigration" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCustomerInitiatedMigrationCreateRequest(ctx, resourceGroupName, accountName, migrationName, options) + if err != nil { + return AccountsClientGetCustomerInitiatedMigrationResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientGetCustomerInitiatedMigrationResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientGetCustomerInitiatedMigrationResponse{}, err + } + resp, err := client.getCustomerInitiatedMigrationHandleResponse(httpResp) + return resp, err +} + +// getCustomerInitiatedMigrationCreateRequest creates the GetCustomerInitiatedMigration request. +func (client *AccountsClient) getCustomerInitiatedMigrationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, migrationName MigrationName, options *AccountsClientGetCustomerInitiatedMigrationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/accountMigrations/{migrationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if migrationName == "" { + return nil, errors.New("parameter migrationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{migrationName}", url.PathEscape(string(migrationName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCustomerInitiatedMigrationHandleResponse handles the GetCustomerInitiatedMigration response. +func (client *AccountsClient) getCustomerInitiatedMigrationHandleResponse(resp *http.Response) (AccountsClientGetCustomerInitiatedMigrationResponse, error) { + result := AccountsClientGetCustomerInitiatedMigrationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountMigration); err != nil { + return AccountsClientGetCustomerInitiatedMigrationResponse{}, err + } + return result, nil +} + +// GetProperties - Returns the properties for the specified storage account including but not limited to name, SKU name, location, +// and account status. The ListKeys operation should be used to retrieve storage keys. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - AccountsClientGetPropertiesOptions contains the optional parameters for the AccountsClient.GetProperties method. +func (client *AccountsClient) GetProperties(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientGetPropertiesOptions) (AccountsClientGetPropertiesResponse, error) { + var err error + const operationName = "AccountsClient.GetProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getPropertiesCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return AccountsClientGetPropertiesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientGetPropertiesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientGetPropertiesResponse{}, err + } + resp, err := client.getPropertiesHandleResponse(httpResp) + return resp, err +} + +// getPropertiesCreateRequest creates the GetProperties request. +func (client *AccountsClient) getPropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientGetPropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-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 +} + +// getPropertiesHandleResponse handles the GetProperties response. +func (client *AccountsClient) getPropertiesHandleResponse(resp *http.Response) (AccountsClientGetPropertiesResponse, error) { + result := AccountsClientGetPropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Account); err != nil { + return AccountsClientGetPropertiesResponse{}, err + } + return result, nil +} + +// BeginHierarchicalNamespaceMigration - Live Migration of storage account to enable Hns +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - requestType - Required. Hierarchical namespace migration type can either be a hierarchical namespace validation request +// 'HnsOnValidationRequest' or a hydration request 'HnsOnHydrationRequest'. The validation +// request will validate the migration whereas the hydration request will migrate the account. +// - options - AccountsClientBeginHierarchicalNamespaceMigrationOptions contains the optional parameters for the AccountsClient.BeginHierarchicalNamespaceMigration +// method. +func (client *AccountsClient) BeginHierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, requestType string, options *AccountsClientBeginHierarchicalNamespaceMigrationOptions) (*runtime.Poller[AccountsClientHierarchicalNamespaceMigrationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.hierarchicalNamespaceMigration(ctx, resourceGroupName, accountName, requestType, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientHierarchicalNamespaceMigrationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountsClientHierarchicalNamespaceMigrationResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// HierarchicalNamespaceMigration - Live Migration of storage account to enable Hns +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *AccountsClient) hierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, requestType string, options *AccountsClientBeginHierarchicalNamespaceMigrationOptions) (*http.Response, error) { + var err error + const operationName = "AccountsClient.BeginHierarchicalNamespaceMigration" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.hierarchicalNamespaceMigrationCreateRequest(ctx, resourceGroupName, accountName, requestType, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// hierarchicalNamespaceMigrationCreateRequest creates the HierarchicalNamespaceMigration request. +func (client *AccountsClient) hierarchicalNamespaceMigrationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, requestType string, options *AccountsClientBeginHierarchicalNamespaceMigrationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + reqQP.Set("requestType", requestType) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListPager - Lists all the storage accounts available under the subscription. Note that storage keys are not returned; +// use the ListKeys operation for this. +// +// Generated from API version 2023-01-01 +// - options - AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method. +func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) *runtime.Pager[AccountsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccountsClientListResponse]{ + More: func(page AccountsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccountsClientListResponse) (AccountsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AccountsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return AccountsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *AccountsClient) listCreateRequest(ctx context.Context, options *AccountsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsClientListResponse, error) { + result := AccountsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountListResult); err != nil { + return AccountsClientListResponse{}, err + } + return result, nil +} + +// ListAccountSAS - List SAS credentials of a storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The parameters to provide to list SAS credentials for the storage account. +// - options - AccountsClientListAccountSASOptions contains the optional parameters for the AccountsClient.ListAccountSAS method. +func (client *AccountsClient) ListAccountSAS(ctx context.Context, resourceGroupName string, accountName string, parameters AccountSasParameters, options *AccountsClientListAccountSASOptions) (AccountsClientListAccountSASResponse, error) { + var err error + const operationName = "AccountsClient.ListAccountSAS" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listAccountSASCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return AccountsClientListAccountSASResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientListAccountSASResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientListAccountSASResponse{}, err + } + resp, err := client.listAccountSASHandleResponse(httpResp) + return resp, err +} + +// listAccountSASCreateRequest creates the ListAccountSAS request. +func (client *AccountsClient) listAccountSASCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters AccountSasParameters, options *AccountsClientListAccountSASOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// listAccountSASHandleResponse handles the ListAccountSAS response. +func (client *AccountsClient) listAccountSASHandleResponse(resp *http.Response) (AccountsClientListAccountSASResponse, error) { + result := AccountsClientListAccountSASResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListAccountSasResponse); err != nil { + return AccountsClientListAccountSASResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the storage accounts available under the given resource group. Note that storage +// keys are not returned; use the ListKeys operation for this. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager +// method. +func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName string, options *AccountsClientListByResourceGroupOptions) *runtime.Pager[AccountsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AccountsClientListByResourceGroupResponse]{ + More: func(page AccountsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccountsClientListByResourceGroupResponse) (AccountsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AccountsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return AccountsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AccountsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (AccountsClientListByResourceGroupResponse, error) { + result := AccountsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountListResult); err != nil { + return AccountsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// ListKeys - Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method. +func (client *AccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientListKeysOptions) (AccountsClientListKeysResponse, error) { + var err error + const operationName = "AccountsClient.ListKeys" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listKeysCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return AccountsClientListKeysResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientListKeysResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientListKeysResponse{}, err + } + resp, err := client.listKeysHandleResponse(httpResp) + return resp, err +} + +// listKeysCreateRequest creates the ListKeys request. +func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientListKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", "kerb") + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listKeysHandleResponse handles the ListKeys response. +func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (AccountsClientListKeysResponse, error) { + result := AccountsClientListKeysResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountListKeysResult); err != nil { + return AccountsClientListKeysResponse{}, err + } + return result, nil +} + +// ListServiceSAS - List service SAS credentials of a specific resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The parameters to provide to list service SAS credentials. +// - options - AccountsClientListServiceSASOptions contains the optional parameters for the AccountsClient.ListServiceSAS method. +func (client *AccountsClient) ListServiceSAS(ctx context.Context, resourceGroupName string, accountName string, parameters ServiceSasParameters, options *AccountsClientListServiceSASOptions) (AccountsClientListServiceSASResponse, error) { + var err error + const operationName = "AccountsClient.ListServiceSAS" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listServiceSASCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return AccountsClientListServiceSASResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientListServiceSASResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientListServiceSASResponse{}, err + } + resp, err := client.listServiceSASHandleResponse(httpResp) + return resp, err +} + +// listServiceSASCreateRequest creates the ListServiceSAS request. +func (client *AccountsClient) listServiceSASCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters ServiceSasParameters, options *AccountsClientListServiceSASOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// listServiceSASHandleResponse handles the ListServiceSAS response. +func (client *AccountsClient) listServiceSASHandleResponse(resp *http.Response) (AccountsClientListServiceSASResponse, error) { + result := AccountsClientListServiceSASResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListServiceSasResponse); err != nil { + return AccountsClientListServiceSASResponse{}, err + } + return result, nil +} + +// RegenerateKey - Regenerates one of the access keys or Kerberos keys for the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - regenerateKey - Specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. +// - options - AccountsClientRegenerateKeyOptions contains the optional parameters for the AccountsClient.RegenerateKey method. +func (client *AccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters, options *AccountsClientRegenerateKeyOptions) (AccountsClientRegenerateKeyResponse, error) { + var err error + const operationName = "AccountsClient.RegenerateKey" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, accountName, regenerateKey, options) + if err != nil { + return AccountsClientRegenerateKeyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientRegenerateKeyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientRegenerateKeyResponse{}, err + } + resp, err := client.regenerateKeyHandleResponse(httpResp) + return resp, err +} + +// regenerateKeyCreateRequest creates the RegenerateKey request. +func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters, options *AccountsClientRegenerateKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, regenerateKey); err != nil { + return nil, err + } + return req, nil +} + +// regenerateKeyHandleResponse handles the RegenerateKey response. +func (client *AccountsClient) regenerateKeyHandleResponse(resp *http.Response) (AccountsClientRegenerateKeyResponse, error) { + result := AccountsClientRegenerateKeyResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountListKeysResult); err != nil { + return AccountsClientRegenerateKeyResponse{}, err + } + return result, nil +} + +// BeginRestoreBlobRanges - Restore blobs in the specified blob ranges +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The parameters to provide for restore blob ranges. +// - options - AccountsClientBeginRestoreBlobRangesOptions contains the optional parameters for the AccountsClient.BeginRestoreBlobRanges +// method. +func (client *AccountsClient) BeginRestoreBlobRanges(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters, options *AccountsClientBeginRestoreBlobRangesOptions) (*runtime.Poller[AccountsClientRestoreBlobRangesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restoreBlobRanges(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientRestoreBlobRangesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountsClientRestoreBlobRangesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RestoreBlobRanges - Restore blobs in the specified blob ranges +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *AccountsClient) restoreBlobRanges(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters, options *AccountsClientBeginRestoreBlobRangesOptions) (*http.Response, error) { + var err error + const operationName = "AccountsClient.BeginRestoreBlobRanges" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restoreBlobRangesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// restoreBlobRangesCreateRequest creates the RestoreBlobRanges request. +func (client *AccountsClient) restoreBlobRangesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters, options *AccountsClientBeginRestoreBlobRangesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// RevokeUserDelegationKeys - Revoke user delegation keys. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - AccountsClientRevokeUserDelegationKeysOptions contains the optional parameters for the AccountsClient.RevokeUserDelegationKeys +// method. +func (client *AccountsClient) RevokeUserDelegationKeys(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientRevokeUserDelegationKeysOptions) (AccountsClientRevokeUserDelegationKeysResponse, error) { + var err error + const operationName = "AccountsClient.RevokeUserDelegationKeys" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.revokeUserDelegationKeysCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return AccountsClientRevokeUserDelegationKeysResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientRevokeUserDelegationKeysResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientRevokeUserDelegationKeysResponse{}, err + } + return AccountsClientRevokeUserDelegationKeysResponse{}, nil +} + +// revokeUserDelegationKeysCreateRequest creates the RevokeUserDelegationKeys request. +func (client *AccountsClient) revokeUserDelegationKeysCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientRevokeUserDelegationKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Update - The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It +// can also be used to map the account to a custom domain. Only one custom domain is +// supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom +// domain, the old value must be cleared/unregistered before a new value can be +// set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you +// want to change the storage account keys, use the regenerate keys operation. The +// location and name of the storage account cannot be changed after creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The parameters to provide for the updated account. +// - options - AccountsClientUpdateOptions contains the optional parameters for the AccountsClient.Update method. +func (client *AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters, options *AccountsClientUpdateOptions) (AccountsClientUpdateResponse, error) { + var err error + const operationName = "AccountsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return AccountsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters, options *AccountsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *AccountsClient) updateHandleResponse(resp *http.Response) (AccountsClientUpdateResponse, error) { + result := AccountsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Account); err != nil { + return AccountsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/assets.json new file mode 100644 index 000000000..799f7afd7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "go", + "TagPrefix": "go/resourcemanager/storage/armstorage", + "Tag": "go/resourcemanager/storage/armstorage_c9d59e874d" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/autorest.md new file mode 100644 index 000000000..2a581188e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/autorest.md @@ -0,0 +1,15 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.5.0 +modelerfour: + seal-single-value-enum-by-default: true +tag: package-2023-01 +``` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go new file mode 100644 index 000000000..666afdcd8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go @@ -0,0 +1,1151 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BlobContainersClient contains the methods for the BlobContainers group. +// Don't use this type directly, use NewBlobContainersClient() instead. +type BlobContainersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBlobContainersClient creates a new instance of BlobContainersClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBlobContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BlobContainersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BlobContainersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// ClearLegalHold - Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold +// clears out only the specified tags in the request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - legalHold - The LegalHold property that will be clear from a blob container. +// - options - BlobContainersClientClearLegalHoldOptions contains the optional parameters for the BlobContainersClient.ClearLegalHold +// method. +func (client *BlobContainersClient) ClearLegalHold(ctx context.Context, resourceGroupName string, accountName string, containerName string, legalHold LegalHold, options *BlobContainersClientClearLegalHoldOptions) (BlobContainersClientClearLegalHoldResponse, error) { + var err error + const operationName = "BlobContainersClient.ClearLegalHold" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.clearLegalHoldCreateRequest(ctx, resourceGroupName, accountName, containerName, legalHold, options) + if err != nil { + return BlobContainersClientClearLegalHoldResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientClearLegalHoldResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientClearLegalHoldResponse{}, err + } + resp, err := client.clearLegalHoldHandleResponse(httpResp) + return resp, err +} + +// clearLegalHoldCreateRequest creates the ClearLegalHold request. +func (client *BlobContainersClient) clearLegalHoldCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, legalHold LegalHold, options *BlobContainersClientClearLegalHoldOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, legalHold); err != nil { + return nil, err + } + return req, nil +} + +// clearLegalHoldHandleResponse handles the ClearLegalHold response. +func (client *BlobContainersClient) clearLegalHoldHandleResponse(resp *http.Response) (BlobContainersClientClearLegalHoldResponse, error) { + result := BlobContainersClientClearLegalHoldResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LegalHold); err != nil { + return BlobContainersClientClearLegalHoldResponse{}, err + } + return result, nil +} + +// Create - Creates a new container under the specified account as described by request body. The container resource includes +// metadata and properties for that container. It does not include a list of the blobs +// contained by the container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - blobContainer - Properties of the blob container to create. +// - options - BlobContainersClientCreateOptions contains the optional parameters for the BlobContainersClient.Create method. +func (client *BlobContainersClient) Create(ctx context.Context, resourceGroupName string, accountName string, containerName string, blobContainer BlobContainer, options *BlobContainersClientCreateOptions) (BlobContainersClientCreateResponse, error) { + var err error + const operationName = "BlobContainersClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, containerName, blobContainer, options) + if err != nil { + return BlobContainersClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *BlobContainersClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, blobContainer BlobContainer, options *BlobContainersClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, blobContainer); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *BlobContainersClient) createHandleResponse(resp *http.Response) (BlobContainersClientCreateResponse, error) { + result := BlobContainersClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BlobContainer); err != nil { + return BlobContainersClientCreateResponse{}, err + } + return result, nil +} + +// CreateOrUpdateImmutabilityPolicy - Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given +// but not required for this operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - options - BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.CreateOrUpdateImmutabilityPolicy +// method. +func (client *BlobContainersClient) CreateOrUpdateImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions) (BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse, error) { + var err error + const operationName = "BlobContainersClient.CreateOrUpdateImmutabilityPolicy" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, options) + if err != nil { + return BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse{}, err + } + resp, err := client.createOrUpdateImmutabilityPolicyHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateImmutabilityPolicyCreateRequest creates the CreateOrUpdateImmutabilityPolicy request. +func (client *BlobContainersClient) createOrUpdateImmutabilityPolicyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + urlPath = strings.ReplaceAll(urlPath, "{immutabilityPolicyName}", url.PathEscape("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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-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"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// createOrUpdateImmutabilityPolicyHandleResponse handles the CreateOrUpdateImmutabilityPolicy response. +func (client *BlobContainersClient) createOrUpdateImmutabilityPolicyHandleResponse(resp *http.Response) (BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse, error) { + result := BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { + return BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse{}, err + } + return result, nil +} + +// Delete - Deletes specified container under its account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - options - BlobContainersClientDeleteOptions contains the optional parameters for the BlobContainersClient.Delete method. +func (client *BlobContainersClient) Delete(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientDeleteOptions) (BlobContainersClientDeleteResponse, error) { + var err error + const operationName = "BlobContainersClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, containerName, options) + if err != nil { + return BlobContainersClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientDeleteResponse{}, err + } + return BlobContainersClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BlobContainersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// DeleteImmutabilityPolicy - Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays +// set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability +// policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked +// container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - ifMatch - The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the +// operation only if the immutability policy already exists. If omitted, this operation will +// always be applied. +// - options - BlobContainersClientDeleteImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.DeleteImmutabilityPolicy +// method. +func (client *BlobContainersClient) DeleteImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *BlobContainersClientDeleteImmutabilityPolicyOptions) (BlobContainersClientDeleteImmutabilityPolicyResponse, error) { + var err error + const operationName = "BlobContainersClient.DeleteImmutabilityPolicy" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, ifMatch, options) + if err != nil { + return BlobContainersClientDeleteImmutabilityPolicyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientDeleteImmutabilityPolicyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientDeleteImmutabilityPolicyResponse{}, err + } + resp, err := client.deleteImmutabilityPolicyHandleResponse(httpResp) + return resp, err +} + +// deleteImmutabilityPolicyCreateRequest creates the DeleteImmutabilityPolicy request. +func (client *BlobContainersClient) deleteImmutabilityPolicyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *BlobContainersClientDeleteImmutabilityPolicyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + urlPath = strings.ReplaceAll(urlPath, "{immutabilityPolicyName}", url.PathEscape("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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteImmutabilityPolicyHandleResponse handles the DeleteImmutabilityPolicy response. +func (client *BlobContainersClient) deleteImmutabilityPolicyHandleResponse(resp *http.Response) (BlobContainersClientDeleteImmutabilityPolicyResponse, error) { + result := BlobContainersClientDeleteImmutabilityPolicyResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { + return BlobContainersClientDeleteImmutabilityPolicyResponse{}, err + } + return result, nil +} + +// ExtendImmutabilityPolicy - Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action +// allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - ifMatch - The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the +// operation only if the immutability policy already exists. If omitted, this operation will +// always be applied. +// - options - BlobContainersClientExtendImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.ExtendImmutabilityPolicy +// method. +func (client *BlobContainersClient) ExtendImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *BlobContainersClientExtendImmutabilityPolicyOptions) (BlobContainersClientExtendImmutabilityPolicyResponse, error) { + var err error + const operationName = "BlobContainersClient.ExtendImmutabilityPolicy" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.extendImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, ifMatch, options) + if err != nil { + return BlobContainersClientExtendImmutabilityPolicyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientExtendImmutabilityPolicyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientExtendImmutabilityPolicyResponse{}, err + } + resp, err := client.extendImmutabilityPolicyHandleResponse(httpResp) + return resp, err +} + +// extendImmutabilityPolicyCreateRequest creates the ExtendImmutabilityPolicy request. +func (client *BlobContainersClient) extendImmutabilityPolicyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *BlobContainersClientExtendImmutabilityPolicyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// extendImmutabilityPolicyHandleResponse handles the ExtendImmutabilityPolicy response. +func (client *BlobContainersClient) extendImmutabilityPolicyHandleResponse(resp *http.Response) (BlobContainersClientExtendImmutabilityPolicyResponse, error) { + result := BlobContainersClientExtendImmutabilityPolicyResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { + return BlobContainersClientExtendImmutabilityPolicyResponse{}, err + } + return result, nil +} + +// Get - Gets properties of a specified container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - options - BlobContainersClientGetOptions contains the optional parameters for the BlobContainersClient.Get method. +func (client *BlobContainersClient) Get(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientGetOptions) (BlobContainersClientGetResponse, error) { + var err error + const operationName = "BlobContainersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, containerName, options) + if err != nil { + return BlobContainersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BlobContainersClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BlobContainersClient) getHandleResponse(resp *http.Response) (BlobContainersClientGetResponse, error) { + result := BlobContainersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BlobContainer); err != nil { + return BlobContainersClientGetResponse{}, err + } + return result, nil +} + +// GetImmutabilityPolicy - Gets the existing immutability policy along with the corresponding ETag in response headers and +// body. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - options - BlobContainersClientGetImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.GetImmutabilityPolicy +// method. +func (client *BlobContainersClient) GetImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientGetImmutabilityPolicyOptions) (BlobContainersClientGetImmutabilityPolicyResponse, error) { + var err error + const operationName = "BlobContainersClient.GetImmutabilityPolicy" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, options) + if err != nil { + return BlobContainersClientGetImmutabilityPolicyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientGetImmutabilityPolicyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientGetImmutabilityPolicyResponse{}, err + } + resp, err := client.getImmutabilityPolicyHandleResponse(httpResp) + return resp, err +} + +// getImmutabilityPolicyCreateRequest creates the GetImmutabilityPolicy request. +func (client *BlobContainersClient) getImmutabilityPolicyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientGetImmutabilityPolicyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + urlPath = strings.ReplaceAll(urlPath, "{immutabilityPolicyName}", url.PathEscape("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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-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, nil +} + +// getImmutabilityPolicyHandleResponse handles the GetImmutabilityPolicy response. +func (client *BlobContainersClient) getImmutabilityPolicyHandleResponse(resp *http.Response) (BlobContainersClientGetImmutabilityPolicyResponse, error) { + result := BlobContainersClientGetImmutabilityPolicyResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { + return BlobContainersClientGetImmutabilityPolicyResponse{}, err + } + return result, nil +} + +// Lease - The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration +// can be 15 to 60 seconds, or can be infinite. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - options - BlobContainersClientLeaseOptions contains the optional parameters for the BlobContainersClient.Lease method. +func (client *BlobContainersClient) Lease(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientLeaseOptions) (BlobContainersClientLeaseResponse, error) { + var err error + const operationName = "BlobContainersClient.Lease" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.leaseCreateRequest(ctx, resourceGroupName, accountName, containerName, options) + if err != nil { + return BlobContainersClientLeaseResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientLeaseResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientLeaseResponse{}, err + } + resp, err := client.leaseHandleResponse(httpResp) + return resp, err +} + +// leaseCreateRequest creates the Lease request. +func (client *BlobContainersClient) leaseCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientLeaseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// leaseHandleResponse handles the Lease response. +func (client *BlobContainersClient) leaseHandleResponse(resp *http.Response) (BlobContainersClientLeaseResponse, error) { + result := BlobContainersClientLeaseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LeaseContainerResponse); err != nil { + return BlobContainersClientLeaseResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation +// token. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - BlobContainersClientListOptions contains the optional parameters for the BlobContainersClient.NewListPager method. +func (client *BlobContainersClient) NewListPager(resourceGroupName string, accountName string, options *BlobContainersClientListOptions) *runtime.Pager[BlobContainersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BlobContainersClientListResponse]{ + More: func(page BlobContainersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BlobContainersClientListResponse) (BlobContainersClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BlobContainersClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return BlobContainersClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *BlobContainersClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *BlobContainersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + if options != nil && options.Maxpagesize != nil { + reqQP.Set("$maxpagesize", *options.Maxpagesize) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Include != nil { + reqQP.Set("$include", string(*options.Include)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BlobContainersClient) listHandleResponse(resp *http.Response) (BlobContainersClientListResponse, error) { + result := BlobContainersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListContainerItems); err != nil { + return BlobContainersClientListResponse{}, err + } + return result, nil +} + +// LockImmutabilityPolicy - Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy +// action. ETag in If-Match is required for this operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - ifMatch - The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the +// operation only if the immutability policy already exists. If omitted, this operation will +// always be applied. +// - options - BlobContainersClientLockImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.LockImmutabilityPolicy +// method. +func (client *BlobContainersClient) LockImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *BlobContainersClientLockImmutabilityPolicyOptions) (BlobContainersClientLockImmutabilityPolicyResponse, error) { + var err error + const operationName = "BlobContainersClient.LockImmutabilityPolicy" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.lockImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, ifMatch, options) + if err != nil { + return BlobContainersClientLockImmutabilityPolicyResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientLockImmutabilityPolicyResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientLockImmutabilityPolicyResponse{}, err + } + resp, err := client.lockImmutabilityPolicyHandleResponse(httpResp) + return resp, err +} + +// lockImmutabilityPolicyCreateRequest creates the LockImmutabilityPolicy request. +func (client *BlobContainersClient) lockImmutabilityPolicyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *BlobContainersClientLockImmutabilityPolicyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["If-Match"] = []string{ifMatch} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// lockImmutabilityPolicyHandleResponse handles the LockImmutabilityPolicy response. +func (client *BlobContainersClient) lockImmutabilityPolicyHandleResponse(resp *http.Response) (BlobContainersClientLockImmutabilityPolicyResponse, error) { + result := BlobContainersClientLockImmutabilityPolicyResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { + return BlobContainersClientLockImmutabilityPolicyResponse{}, err + } + return result, nil +} + +// BeginObjectLevelWorm - This operation migrates a blob container from container level WORM to object level immutability +// enabled container. Prerequisites require a container level immutability policy either in locked or +// unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - options - BlobContainersClientBeginObjectLevelWormOptions contains the optional parameters for the BlobContainersClient.BeginObjectLevelWorm +// method. +func (client *BlobContainersClient) BeginObjectLevelWorm(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientBeginObjectLevelWormOptions) (*runtime.Poller[BlobContainersClientObjectLevelWormResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.objectLevelWorm(ctx, resourceGroupName, accountName, containerName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BlobContainersClientObjectLevelWormResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BlobContainersClientObjectLevelWormResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ObjectLevelWorm - This operation migrates a blob container from container level WORM to object level immutability enabled +// container. Prerequisites require a container level immutability policy either in locked or +// unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *BlobContainersClient) objectLevelWorm(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientBeginObjectLevelWormOptions) (*http.Response, error) { + var err error + const operationName = "BlobContainersClient.BeginObjectLevelWorm" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.objectLevelWormCreateRequest(ctx, resourceGroupName, accountName, containerName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// objectLevelWormCreateRequest creates the ObjectLevelWorm request. +func (client *BlobContainersClient) objectLevelWormCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientBeginObjectLevelWormOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/migrate" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// SetLegalHold - Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append +// pattern and does not clear out the existing tags that are not specified in the request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - legalHold - The LegalHold property that will be set to a blob container. +// - options - BlobContainersClientSetLegalHoldOptions contains the optional parameters for the BlobContainersClient.SetLegalHold +// method. +func (client *BlobContainersClient) SetLegalHold(ctx context.Context, resourceGroupName string, accountName string, containerName string, legalHold LegalHold, options *BlobContainersClientSetLegalHoldOptions) (BlobContainersClientSetLegalHoldResponse, error) { + var err error + const operationName = "BlobContainersClient.SetLegalHold" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.setLegalHoldCreateRequest(ctx, resourceGroupName, accountName, containerName, legalHold, options) + if err != nil { + return BlobContainersClientSetLegalHoldResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientSetLegalHoldResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientSetLegalHoldResponse{}, err + } + resp, err := client.setLegalHoldHandleResponse(httpResp) + return resp, err +} + +// setLegalHoldCreateRequest creates the SetLegalHold request. +func (client *BlobContainersClient) setLegalHoldCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, legalHold LegalHold, options *BlobContainersClientSetLegalHoldOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, legalHold); err != nil { + return nil, err + } + return req, nil +} + +// setLegalHoldHandleResponse handles the SetLegalHold response. +func (client *BlobContainersClient) setLegalHoldHandleResponse(resp *http.Response) (BlobContainersClientSetLegalHoldResponse, error) { + result := BlobContainersClientSetLegalHoldResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LegalHold); err != nil { + return BlobContainersClientSetLegalHoldResponse{}, err + } + return result, nil +} + +// Update - Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. +// Update fails if the specified container doesn't already exist. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - containerName - The name of the blob container within the specified storage account. Blob container names must be between +// 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - blobContainer - Properties to update for the blob container. +// - options - BlobContainersClientUpdateOptions contains the optional parameters for the BlobContainersClient.Update method. +func (client *BlobContainersClient) Update(ctx context.Context, resourceGroupName string, accountName string, containerName string, blobContainer BlobContainer, options *BlobContainersClientUpdateOptions) (BlobContainersClientUpdateResponse, error) { + var err error + const operationName = "BlobContainersClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, containerName, blobContainer, options) + if err != nil { + return BlobContainersClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobContainersClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobContainersClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *BlobContainersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, containerName string, blobContainer BlobContainer, options *BlobContainersClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, blobContainer); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *BlobContainersClient) updateHandleResponse(resp *http.Response) (BlobContainersClientUpdateResponse, error) { + result := BlobContainersClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BlobContainer); err != nil { + return BlobContainersClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go new file mode 100644 index 000000000..5fd736aae --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go @@ -0,0 +1,318 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BlobInventoryPoliciesClient contains the methods for the BlobInventoryPolicies group. +// Don't use this type directly, use NewBlobInventoryPoliciesClient() instead. +type BlobInventoryPoliciesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBlobInventoryPoliciesClient creates a new instance of BlobInventoryPoliciesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBlobInventoryPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BlobInventoryPoliciesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BlobInventoryPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Sets the blob inventory policy to the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - blobInventoryPolicyName - The name of the storage account blob inventory policy. It should always be 'default' +// - properties - The blob inventory policy set to a storage account. +// - options - BlobInventoryPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BlobInventoryPoliciesClient.CreateOrUpdate +// method. +func (client *BlobInventoryPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, properties BlobInventoryPolicy, options *BlobInventoryPoliciesClientCreateOrUpdateOptions) (BlobInventoryPoliciesClientCreateOrUpdateResponse, error) { + var err error + const operationName = "BlobInventoryPoliciesClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, blobInventoryPolicyName, properties, options) + if err != nil { + return BlobInventoryPoliciesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobInventoryPoliciesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobInventoryPoliciesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BlobInventoryPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, properties BlobInventoryPolicy, options *BlobInventoryPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if blobInventoryPolicyName == "" { + return nil, errors.New("parameter blobInventoryPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{blobInventoryPolicyName}", url.PathEscape(string(blobInventoryPolicyName))) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *BlobInventoryPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (BlobInventoryPoliciesClientCreateOrUpdateResponse, error) { + result := BlobInventoryPoliciesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BlobInventoryPolicy); err != nil { + return BlobInventoryPoliciesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the blob inventory policy associated with the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - blobInventoryPolicyName - The name of the storage account blob inventory policy. It should always be 'default' +// - options - BlobInventoryPoliciesClientDeleteOptions contains the optional parameters for the BlobInventoryPoliciesClient.Delete +// method. +func (client *BlobInventoryPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientDeleteOptions) (BlobInventoryPoliciesClientDeleteResponse, error) { + var err error + const operationName = "BlobInventoryPoliciesClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, blobInventoryPolicyName, options) + if err != nil { + return BlobInventoryPoliciesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobInventoryPoliciesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return BlobInventoryPoliciesClientDeleteResponse{}, err + } + return BlobInventoryPoliciesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BlobInventoryPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if blobInventoryPolicyName == "" { + return nil, errors.New("parameter blobInventoryPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{blobInventoryPolicyName}", url.PathEscape(string(blobInventoryPolicyName))) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the blob inventory policy associated with the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - blobInventoryPolicyName - The name of the storage account blob inventory policy. It should always be 'default' +// - options - BlobInventoryPoliciesClientGetOptions contains the optional parameters for the BlobInventoryPoliciesClient.Get +// method. +func (client *BlobInventoryPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientGetOptions) (BlobInventoryPoliciesClientGetResponse, error) { + var err error + const operationName = "BlobInventoryPoliciesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, blobInventoryPolicyName, options) + if err != nil { + return BlobInventoryPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobInventoryPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobInventoryPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BlobInventoryPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if blobInventoryPolicyName == "" { + return nil, errors.New("parameter blobInventoryPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{blobInventoryPolicyName}", url.PathEscape(string(blobInventoryPolicyName))) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BlobInventoryPoliciesClient) getHandleResponse(resp *http.Response) (BlobInventoryPoliciesClientGetResponse, error) { + result := BlobInventoryPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BlobInventoryPolicy); err != nil { + return BlobInventoryPoliciesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the blob inventory policy associated with the specified storage account. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - BlobInventoryPoliciesClientListOptions contains the optional parameters for the BlobInventoryPoliciesClient.NewListPager +// method. +func (client *BlobInventoryPoliciesClient) NewListPager(resourceGroupName string, accountName string, options *BlobInventoryPoliciesClientListOptions) *runtime.Pager[BlobInventoryPoliciesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BlobInventoryPoliciesClientListResponse]{ + More: func(page BlobInventoryPoliciesClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *BlobInventoryPoliciesClientListResponse) (BlobInventoryPoliciesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BlobInventoryPoliciesClient.NewListPager") + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return BlobInventoryPoliciesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobInventoryPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BlobInventoryPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *BlobInventoryPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *BlobInventoryPoliciesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BlobInventoryPoliciesClient) listHandleResponse(resp *http.Response) (BlobInventoryPoliciesClientListResponse, error) { + result := BlobInventoryPoliciesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListBlobInventoryPolicy); err != nil { + return BlobInventoryPoliciesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobservices_client.go new file mode 100644 index 000000000..18122f925 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/blobservices_client.go @@ -0,0 +1,251 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BlobServicesClient contains the methods for the BlobServices group. +// Don't use this type directly, use NewBlobServicesClient() instead. +type BlobServicesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBlobServicesClient creates a new instance of BlobServicesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBlobServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BlobServicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BlobServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetServiceProperties - Gets the properties of a storage account’s Blob service, including properties for Storage Analytics +// and CORS (Cross-Origin Resource Sharing) rules. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - BlobServicesClientGetServicePropertiesOptions contains the optional parameters for the BlobServicesClient.GetServiceProperties +// method. +func (client *BlobServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *BlobServicesClientGetServicePropertiesOptions) (BlobServicesClientGetServicePropertiesResponse, error) { + var err error + const operationName = "BlobServicesClient.GetServiceProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return BlobServicesClientGetServicePropertiesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobServicesClientGetServicePropertiesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobServicesClientGetServicePropertiesResponse{}, err + } + resp, err := client.getServicePropertiesHandleResponse(httpResp) + return resp, err +} + +// getServicePropertiesCreateRequest creates the GetServiceProperties request. +func (client *BlobServicesClient) getServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *BlobServicesClientGetServicePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{BlobServicesName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getServicePropertiesHandleResponse handles the GetServiceProperties response. +func (client *BlobServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (BlobServicesClientGetServicePropertiesResponse, error) { + result := BlobServicesClientGetServicePropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BlobServiceProperties); err != nil { + return BlobServicesClientGetServicePropertiesResponse{}, err + } + return result, nil +} + +// NewListPager - List blob services of storage account. It returns a collection of one object named default. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - BlobServicesClientListOptions contains the optional parameters for the BlobServicesClient.NewListPager method. +func (client *BlobServicesClient) NewListPager(resourceGroupName string, accountName string, options *BlobServicesClientListOptions) *runtime.Pager[BlobServicesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BlobServicesClientListResponse]{ + More: func(page BlobServicesClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *BlobServicesClientListResponse) (BlobServicesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BlobServicesClient.NewListPager") + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return BlobServicesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobServicesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BlobServicesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *BlobServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *BlobServicesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BlobServicesClient) listHandleResponse(resp *http.Response) (BlobServicesClientListResponse, error) { + result := BlobServicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BlobServiceItems); err != nil { + return BlobServicesClientListResponse{}, err + } + return result, nil +} + +// SetServiceProperties - Sets the properties of a storage account’s Blob service, including properties for Storage Analytics +// and CORS (Cross-Origin Resource Sharing) rules. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin +// Resource Sharing) rules. +// - options - BlobServicesClientSetServicePropertiesOptions contains the optional parameters for the BlobServicesClient.SetServiceProperties +// method. +func (client *BlobServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters BlobServiceProperties, options *BlobServicesClientSetServicePropertiesOptions) (BlobServicesClientSetServicePropertiesResponse, error) { + var err error + const operationName = "BlobServicesClient.SetServiceProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return BlobServicesClientSetServicePropertiesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BlobServicesClientSetServicePropertiesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BlobServicesClientSetServicePropertiesResponse{}, err + } + resp, err := client.setServicePropertiesHandleResponse(httpResp) + return resp, err +} + +// setServicePropertiesCreateRequest creates the SetServiceProperties request. +func (client *BlobServicesClient) setServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters BlobServiceProperties, options *BlobServicesClientSetServicePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{BlobServicesName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// setServicePropertiesHandleResponse handles the SetServiceProperties response. +func (client *BlobServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (BlobServicesClientSetServicePropertiesResponse, error) { + result := BlobServicesClientSetServicePropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BlobServiceProperties); err != nil { + return BlobServicesClientSetServicePropertiesResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/build.go new file mode 100644 index 000000000..9c22bcd53 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/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/storage/armstorage + +package armstorage diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/ci.yml new file mode 100644 index 000000000..56efca76c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/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/storage/armstorage/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/storage/armstorage/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/storage/armstorage' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/client_factory.go new file mode 100644 index 000000000..d0da80d15 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/client_factory.go @@ -0,0 +1,158 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +// NewAccountsClient creates a new instance of AccountsClient. +func (c *ClientFactory) NewAccountsClient() *AccountsClient { + subClient, _ := NewAccountsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewBlobContainersClient creates a new instance of BlobContainersClient. +func (c *ClientFactory) NewBlobContainersClient() *BlobContainersClient { + subClient, _ := NewBlobContainersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewBlobInventoryPoliciesClient creates a new instance of BlobInventoryPoliciesClient. +func (c *ClientFactory) NewBlobInventoryPoliciesClient() *BlobInventoryPoliciesClient { + subClient, _ := NewBlobInventoryPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewBlobServicesClient creates a new instance of BlobServicesClient. +func (c *ClientFactory) NewBlobServicesClient() *BlobServicesClient { + subClient, _ := NewBlobServicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDeletedAccountsClient creates a new instance of DeletedAccountsClient. +func (c *ClientFactory) NewDeletedAccountsClient() *DeletedAccountsClient { + subClient, _ := NewDeletedAccountsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewEncryptionScopesClient creates a new instance of EncryptionScopesClient. +func (c *ClientFactory) NewEncryptionScopesClient() *EncryptionScopesClient { + subClient, _ := NewEncryptionScopesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewFileServicesClient creates a new instance of FileServicesClient. +func (c *ClientFactory) NewFileServicesClient() *FileServicesClient { + subClient, _ := NewFileServicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewFileSharesClient creates a new instance of FileSharesClient. +func (c *ClientFactory) NewFileSharesClient() *FileSharesClient { + subClient, _ := NewFileSharesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewLocalUsersClient creates a new instance of LocalUsersClient. +func (c *ClientFactory) NewLocalUsersClient() *LocalUsersClient { + subClient, _ := NewLocalUsersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewManagementPoliciesClient creates a new instance of ManagementPoliciesClient. +func (c *ClientFactory) NewManagementPoliciesClient() *ManagementPoliciesClient { + subClient, _ := NewManagementPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewObjectReplicationPoliciesClient creates a new instance of ObjectReplicationPoliciesClient. +func (c *ClientFactory) NewObjectReplicationPoliciesClient() *ObjectReplicationPoliciesClient { + subClient, _ := NewObjectReplicationPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewQueueClient creates a new instance of QueueClient. +func (c *ClientFactory) NewQueueClient() *QueueClient { + subClient, _ := NewQueueClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewQueueServicesClient creates a new instance of QueueServicesClient. +func (c *ClientFactory) NewQueueServicesClient() *QueueServicesClient { + subClient, _ := NewQueueServicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSKUsClient creates a new instance of SKUsClient. +func (c *ClientFactory) NewSKUsClient() *SKUsClient { + subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTableClient creates a new instance of TableClient. +func (c *ClientFactory) NewTableClient() *TableClient { + subClient, _ := NewTableClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewTableServicesClient creates a new instance of TableServicesClient. +func (c *ClientFactory) NewTableServicesClient() *TableServicesClient { + subClient, _ := NewTableServicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewUsagesClient creates a new instance of UsagesClient. +func (c *ClientFactory) NewUsagesClient() *UsagesClient { + subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/constants.go new file mode 100644 index 000000000..bfd1b531c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/constants.go @@ -0,0 +1,1274 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + moduleVersion = "v1.5.0" +) + +// AccessTier - Required for storage accounts where kind = BlobStorage. The access tier is used for billing. The 'Premium' +// access tier is the default value for premium block blobs storage account type and it cannot +// be changed for the premium block blobs storage account type. +type AccessTier string + +const ( + AccessTierCool AccessTier = "Cool" + AccessTierHot AccessTier = "Hot" + AccessTierPremium AccessTier = "Premium" +) + +// PossibleAccessTierValues returns the possible values for the AccessTier const type. +func PossibleAccessTierValues() []AccessTier { + return []AccessTier{ + AccessTierCool, + AccessTierHot, + AccessTierPremium, + } +} + +// AccountImmutabilityPolicyState - The ImmutabilityPolicy state defines the mode of the policy. Disabled state disables the +// policy, Unlocked state allows increase and decrease of immutability retention time and also allows toggling +// allowProtectedAppendWrites property, Locked state only allows the increase of the immutability retention time. A policy +// can only be created in a Disabled or Unlocked state and can be toggled between +// the two states. Only a policy in an Unlocked state can transition to a Locked state which cannot be reverted. +type AccountImmutabilityPolicyState string + +const ( + AccountImmutabilityPolicyStateDisabled AccountImmutabilityPolicyState = "Disabled" + AccountImmutabilityPolicyStateLocked AccountImmutabilityPolicyState = "Locked" + AccountImmutabilityPolicyStateUnlocked AccountImmutabilityPolicyState = "Unlocked" +) + +// PossibleAccountImmutabilityPolicyStateValues returns the possible values for the AccountImmutabilityPolicyState const type. +func PossibleAccountImmutabilityPolicyStateValues() []AccountImmutabilityPolicyState { + return []AccountImmutabilityPolicyState{ + AccountImmutabilityPolicyStateDisabled, + AccountImmutabilityPolicyStateLocked, + AccountImmutabilityPolicyStateUnlocked, + } +} + +// AccountStatus - Gets the status indicating whether the primary location of the storage account is available or unavailable. +type AccountStatus string + +const ( + AccountStatusAvailable AccountStatus = "available" + AccountStatusUnavailable AccountStatus = "unavailable" +) + +// PossibleAccountStatusValues returns the possible values for the AccountStatus const type. +func PossibleAccountStatusValues() []AccountStatus { + return []AccountStatus{ + AccountStatusAvailable, + AccountStatusUnavailable, + } +} + +// ActiveDirectoryPropertiesAccountType - Specifies the Active Directory account type for Azure Storage. +type ActiveDirectoryPropertiesAccountType string + +const ( + ActiveDirectoryPropertiesAccountTypeComputer ActiveDirectoryPropertiesAccountType = "Computer" + ActiveDirectoryPropertiesAccountTypeUser ActiveDirectoryPropertiesAccountType = "User" +) + +// PossibleActiveDirectoryPropertiesAccountTypeValues returns the possible values for the ActiveDirectoryPropertiesAccountType const type. +func PossibleActiveDirectoryPropertiesAccountTypeValues() []ActiveDirectoryPropertiesAccountType { + return []ActiveDirectoryPropertiesAccountType{ + ActiveDirectoryPropertiesAccountTypeComputer, + ActiveDirectoryPropertiesAccountTypeUser, + } +} + +// AllowedCopyScope - Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. +type AllowedCopyScope string + +const ( + AllowedCopyScopeAAD AllowedCopyScope = "AAD" + AllowedCopyScopePrivateLink AllowedCopyScope = "PrivateLink" +) + +// PossibleAllowedCopyScopeValues returns the possible values for the AllowedCopyScope const type. +func PossibleAllowedCopyScopeValues() []AllowedCopyScope { + return []AllowedCopyScope{ + AllowedCopyScopeAAD, + AllowedCopyScopePrivateLink, + } +} + +type BlobInventoryPolicyName string + +const ( + BlobInventoryPolicyNameDefault BlobInventoryPolicyName = "default" +) + +// PossibleBlobInventoryPolicyNameValues returns the possible values for the BlobInventoryPolicyName const type. +func PossibleBlobInventoryPolicyNameValues() []BlobInventoryPolicyName { + return []BlobInventoryPolicyName{ + BlobInventoryPolicyNameDefault, + } +} + +// BlobRestoreProgressStatus - The status of blob restore progress. Possible values are: - InProgress: Indicates that blob +// restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: +// Indicates that blob restore is failed. +type BlobRestoreProgressStatus string + +const ( + BlobRestoreProgressStatusComplete BlobRestoreProgressStatus = "Complete" + BlobRestoreProgressStatusFailed BlobRestoreProgressStatus = "Failed" + BlobRestoreProgressStatusInProgress BlobRestoreProgressStatus = "InProgress" +) + +// PossibleBlobRestoreProgressStatusValues returns the possible values for the BlobRestoreProgressStatus const type. +func PossibleBlobRestoreProgressStatusValues() []BlobRestoreProgressStatus { + return []BlobRestoreProgressStatus{ + BlobRestoreProgressStatusComplete, + BlobRestoreProgressStatusFailed, + BlobRestoreProgressStatusInProgress, + } +} + +// Bypass - Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of +// Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none +// of those traffics. +type Bypass string + +const ( + BypassAzureServices Bypass = "AzureServices" + BypassLogging Bypass = "Logging" + BypassMetrics Bypass = "Metrics" + BypassNone Bypass = "None" +) + +// PossibleBypassValues returns the possible values for the Bypass const type. +func PossibleBypassValues() []Bypass { + return []Bypass{ + BypassAzureServices, + BypassLogging, + BypassMetrics, + BypassNone, + } +} + +type CorsRuleAllowedMethodsItem string + +const ( + CorsRuleAllowedMethodsItemCONNECT CorsRuleAllowedMethodsItem = "CONNECT" + CorsRuleAllowedMethodsItemDELETE CorsRuleAllowedMethodsItem = "DELETE" + CorsRuleAllowedMethodsItemGET CorsRuleAllowedMethodsItem = "GET" + CorsRuleAllowedMethodsItemHEAD CorsRuleAllowedMethodsItem = "HEAD" + CorsRuleAllowedMethodsItemMERGE CorsRuleAllowedMethodsItem = "MERGE" + CorsRuleAllowedMethodsItemOPTIONS CorsRuleAllowedMethodsItem = "OPTIONS" + CorsRuleAllowedMethodsItemPATCH CorsRuleAllowedMethodsItem = "PATCH" + CorsRuleAllowedMethodsItemPOST CorsRuleAllowedMethodsItem = "POST" + CorsRuleAllowedMethodsItemPUT CorsRuleAllowedMethodsItem = "PUT" + CorsRuleAllowedMethodsItemTRACE CorsRuleAllowedMethodsItem = "TRACE" +) + +// PossibleCorsRuleAllowedMethodsItemValues returns the possible values for the CorsRuleAllowedMethodsItem const type. +func PossibleCorsRuleAllowedMethodsItemValues() []CorsRuleAllowedMethodsItem { + return []CorsRuleAllowedMethodsItem{ + CorsRuleAllowedMethodsItemCONNECT, + CorsRuleAllowedMethodsItemDELETE, + CorsRuleAllowedMethodsItemGET, + CorsRuleAllowedMethodsItemHEAD, + CorsRuleAllowedMethodsItemMERGE, + CorsRuleAllowedMethodsItemOPTIONS, + CorsRuleAllowedMethodsItemPATCH, + CorsRuleAllowedMethodsItemPOST, + CorsRuleAllowedMethodsItemPUT, + CorsRuleAllowedMethodsItemTRACE, + } +} + +// 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, + } +} + +// DNSEndpointType - Allows you to specify the type of endpoint. Set this to AzureDNSZone to create a large number of accounts +// in a single subscription, which creates accounts in an Azure DNS Zone and the endpoint URL +// will have an alphanumeric DNS Zone identifier. +type DNSEndpointType string + +const ( + DNSEndpointTypeAzureDNSZone DNSEndpointType = "AzureDnsZone" + DNSEndpointTypeStandard DNSEndpointType = "Standard" +) + +// PossibleDNSEndpointTypeValues returns the possible values for the DNSEndpointType const type. +func PossibleDNSEndpointTypeValues() []DNSEndpointType { + return []DNSEndpointType{ + DNSEndpointTypeAzureDNSZone, + DNSEndpointTypeStandard, + } +} + +// DefaultAction - Specifies the default action of allow or deny when no other rules match. +type DefaultAction string + +const ( + DefaultActionAllow DefaultAction = "Allow" + DefaultActionDeny DefaultAction = "Deny" +) + +// PossibleDefaultActionValues returns the possible values for the DefaultAction const type. +func PossibleDefaultActionValues() []DefaultAction { + return []DefaultAction{ + DefaultActionAllow, + DefaultActionDeny, + } +} + +// DefaultSharePermission - Default share permission for users using Kerberos authentication if RBAC role is not assigned. +type DefaultSharePermission string + +const ( + DefaultSharePermissionNone DefaultSharePermission = "None" + DefaultSharePermissionStorageFileDataSmbShareContributor DefaultSharePermission = "StorageFileDataSmbShareContributor" + DefaultSharePermissionStorageFileDataSmbShareElevatedContributor DefaultSharePermission = "StorageFileDataSmbShareElevatedContributor" + DefaultSharePermissionStorageFileDataSmbShareReader DefaultSharePermission = "StorageFileDataSmbShareReader" +) + +// PossibleDefaultSharePermissionValues returns the possible values for the DefaultSharePermission const type. +func PossibleDefaultSharePermissionValues() []DefaultSharePermission { + return []DefaultSharePermission{ + DefaultSharePermissionNone, + DefaultSharePermissionStorageFileDataSmbShareContributor, + DefaultSharePermissionStorageFileDataSmbShareElevatedContributor, + DefaultSharePermissionStorageFileDataSmbShareReader, + } +} + +// DirectoryServiceOptions - Indicates the directory service used. Note that this enum may be extended in the future. +type DirectoryServiceOptions string + +const ( + DirectoryServiceOptionsAADDS DirectoryServiceOptions = "AADDS" + DirectoryServiceOptionsAADKERB DirectoryServiceOptions = "AADKERB" + DirectoryServiceOptionsAD DirectoryServiceOptions = "AD" + DirectoryServiceOptionsNone DirectoryServiceOptions = "None" +) + +// PossibleDirectoryServiceOptionsValues returns the possible values for the DirectoryServiceOptions const type. +func PossibleDirectoryServiceOptionsValues() []DirectoryServiceOptions { + return []DirectoryServiceOptions{ + DirectoryServiceOptionsAADDS, + DirectoryServiceOptionsAADKERB, + DirectoryServiceOptionsAD, + DirectoryServiceOptionsNone, + } +} + +// EnabledProtocols - The authentication protocol that is used for the file share. Can only be specified when creating a share. +type EnabledProtocols string + +const ( + EnabledProtocolsNFS EnabledProtocols = "NFS" + EnabledProtocolsSMB EnabledProtocols = "SMB" +) + +// PossibleEnabledProtocolsValues returns the possible values for the EnabledProtocols const type. +func PossibleEnabledProtocolsValues() []EnabledProtocols { + return []EnabledProtocols{ + EnabledProtocolsNFS, + EnabledProtocolsSMB, + } +} + +// EncryptionScopeSource - The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. +type EncryptionScopeSource string + +const ( + EncryptionScopeSourceMicrosoftKeyVault EncryptionScopeSource = "Microsoft.KeyVault" + EncryptionScopeSourceMicrosoftStorage EncryptionScopeSource = "Microsoft.Storage" +) + +// PossibleEncryptionScopeSourceValues returns the possible values for the EncryptionScopeSource const type. +func PossibleEncryptionScopeSourceValues() []EncryptionScopeSource { + return []EncryptionScopeSource{ + EncryptionScopeSourceMicrosoftKeyVault, + EncryptionScopeSourceMicrosoftStorage, + } +} + +// EncryptionScopeState - The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. +type EncryptionScopeState string + +const ( + EncryptionScopeStateDisabled EncryptionScopeState = "Disabled" + EncryptionScopeStateEnabled EncryptionScopeState = "Enabled" +) + +// PossibleEncryptionScopeStateValues returns the possible values for the EncryptionScopeState const type. +func PossibleEncryptionScopeStateValues() []EncryptionScopeState { + return []EncryptionScopeState{ + EncryptionScopeStateDisabled, + EncryptionScopeStateEnabled, + } +} + +// ExpirationAction - The SAS expiration action. Can only be Log. +type ExpirationAction string + +const ( + ExpirationActionLog ExpirationAction = "Log" +) + +// PossibleExpirationActionValues returns the possible values for the ExpirationAction const type. +func PossibleExpirationActionValues() []ExpirationAction { + return []ExpirationAction{ + ExpirationActionLog, + } +} + +// 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, + } +} + +// Format - This is a required field, it specifies the format for the inventory files. +type Format string + +const ( + FormatCSV Format = "Csv" + FormatParquet Format = "Parquet" +) + +// PossibleFormatValues returns the possible values for the Format const type. +func PossibleFormatValues() []Format { + return []Format{ + FormatCSV, + FormatParquet, + } +} + +// GeoReplicationStatus - The status of the secondary location. Possible values are: - Live: Indicates that the secondary +// location is active and operational. - Bootstrap: Indicates initial synchronization from the primary +// location to the secondary location is in progress.This typically occurs when replication is first enabled. - Unavailable: +// Indicates that the secondary location is temporarily unavailable. +type GeoReplicationStatus string + +const ( + GeoReplicationStatusBootstrap GeoReplicationStatus = "Bootstrap" + GeoReplicationStatusLive GeoReplicationStatus = "Live" + GeoReplicationStatusUnavailable GeoReplicationStatus = "Unavailable" +) + +// PossibleGeoReplicationStatusValues returns the possible values for the GeoReplicationStatus const type. +func PossibleGeoReplicationStatusValues() []GeoReplicationStatus { + return []GeoReplicationStatus{ + GeoReplicationStatusBootstrap, + GeoReplicationStatusLive, + GeoReplicationStatusUnavailable, + } +} + +// HTTPProtocol - The protocol permitted for a request made with the account SAS. +type HTTPProtocol string + +const ( + HTTPProtocolHTTPS HTTPProtocol = "https" + HTTPProtocolHTTPSHTTP HTTPProtocol = "https,http" +) + +// PossibleHTTPProtocolValues returns the possible values for the HTTPProtocol const type. +func PossibleHTTPProtocolValues() []HTTPProtocol { + return []HTTPProtocol{ + HTTPProtocolHTTPS, + HTTPProtocolHTTPSHTTP, + } +} + +// IdentityType - The identity type. +type IdentityType string + +const ( + IdentityTypeNone IdentityType = "None" + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +// PossibleIdentityTypeValues returns the possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{ + IdentityTypeNone, + IdentityTypeSystemAssigned, + IdentityTypeSystemAssignedUserAssigned, + IdentityTypeUserAssigned, + } +} + +// ImmutabilityPolicyState - The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. +type ImmutabilityPolicyState string + +const ( + ImmutabilityPolicyStateLocked ImmutabilityPolicyState = "Locked" + ImmutabilityPolicyStateUnlocked ImmutabilityPolicyState = "Unlocked" +) + +// PossibleImmutabilityPolicyStateValues returns the possible values for the ImmutabilityPolicyState const type. +func PossibleImmutabilityPolicyStateValues() []ImmutabilityPolicyState { + return []ImmutabilityPolicyState{ + ImmutabilityPolicyStateLocked, + ImmutabilityPolicyStateUnlocked, + } +} + +// ImmutabilityPolicyUpdateType - The ImmutabilityPolicy update type of a blob container, possible values include: put, lock +// and extend. +type ImmutabilityPolicyUpdateType string + +const ( + ImmutabilityPolicyUpdateTypeExtend ImmutabilityPolicyUpdateType = "extend" + ImmutabilityPolicyUpdateTypeLock ImmutabilityPolicyUpdateType = "lock" + ImmutabilityPolicyUpdateTypePut ImmutabilityPolicyUpdateType = "put" +) + +// PossibleImmutabilityPolicyUpdateTypeValues returns the possible values for the ImmutabilityPolicyUpdateType const type. +func PossibleImmutabilityPolicyUpdateTypeValues() []ImmutabilityPolicyUpdateType { + return []ImmutabilityPolicyUpdateType{ + ImmutabilityPolicyUpdateTypeExtend, + ImmutabilityPolicyUpdateTypeLock, + ImmutabilityPolicyUpdateTypePut, + } +} + +// InventoryRuleType - The valid value is Inventory +type InventoryRuleType string + +const ( + InventoryRuleTypeInventory InventoryRuleType = "Inventory" +) + +// PossibleInventoryRuleTypeValues returns the possible values for the InventoryRuleType const type. +func PossibleInventoryRuleTypeValues() []InventoryRuleType { + return []InventoryRuleType{ + InventoryRuleTypeInventory, + } +} + +// KeyPermission - Permissions for the key -- read-only or full permissions. +type KeyPermission string + +const ( + KeyPermissionFull KeyPermission = "Full" + KeyPermissionRead KeyPermission = "Read" +) + +// PossibleKeyPermissionValues returns the possible values for the KeyPermission const type. +func PossibleKeyPermissionValues() []KeyPermission { + return []KeyPermission{ + KeyPermissionFull, + KeyPermissionRead, + } +} + +// KeySource - The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault +type KeySource string + +const ( + KeySourceMicrosoftKeyvault KeySource = "Microsoft.Keyvault" + KeySourceMicrosoftStorage KeySource = "Microsoft.Storage" +) + +// PossibleKeySourceValues returns the possible values for the KeySource const type. +func PossibleKeySourceValues() []KeySource { + return []KeySource{ + KeySourceMicrosoftKeyvault, + KeySourceMicrosoftStorage, + } +} + +// KeyType - Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped +// encryption key will be used. 'Service' key type implies that a default service key is used. +type KeyType string + +const ( + KeyTypeAccount KeyType = "Account" + KeyTypeService KeyType = "Service" +) + +// PossibleKeyTypeValues returns the possible values for the KeyType const type. +func PossibleKeyTypeValues() []KeyType { + return []KeyType{ + KeyTypeAccount, + KeyTypeService, + } +} + +// Kind - Indicates the type of storage account. +type Kind string + +const ( + KindBlobStorage Kind = "BlobStorage" + KindBlockBlobStorage Kind = "BlockBlobStorage" + KindFileStorage Kind = "FileStorage" + KindStorage Kind = "Storage" + KindStorageV2 Kind = "StorageV2" +) + +// PossibleKindValues returns the possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{ + KindBlobStorage, + KindBlockBlobStorage, + KindFileStorage, + KindStorage, + KindStorageV2, + } +} + +// LargeFileSharesState - Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. +type LargeFileSharesState string + +const ( + LargeFileSharesStateDisabled LargeFileSharesState = "Disabled" + LargeFileSharesStateEnabled LargeFileSharesState = "Enabled" +) + +// PossibleLargeFileSharesStateValues returns the possible values for the LargeFileSharesState const type. +func PossibleLargeFileSharesStateValues() []LargeFileSharesState { + return []LargeFileSharesState{ + LargeFileSharesStateDisabled, + LargeFileSharesStateEnabled, + } +} + +// LeaseContainerRequestAction - Specifies the lease action. Can be one of the available actions. +type LeaseContainerRequestAction string + +const ( + LeaseContainerRequestActionAcquire LeaseContainerRequestAction = "Acquire" + LeaseContainerRequestActionBreak LeaseContainerRequestAction = "Break" + LeaseContainerRequestActionChange LeaseContainerRequestAction = "Change" + LeaseContainerRequestActionRelease LeaseContainerRequestAction = "Release" + LeaseContainerRequestActionRenew LeaseContainerRequestAction = "Renew" +) + +// PossibleLeaseContainerRequestActionValues returns the possible values for the LeaseContainerRequestAction const type. +func PossibleLeaseContainerRequestActionValues() []LeaseContainerRequestAction { + return []LeaseContainerRequestAction{ + LeaseContainerRequestActionAcquire, + LeaseContainerRequestActionBreak, + LeaseContainerRequestActionChange, + LeaseContainerRequestActionRelease, + LeaseContainerRequestActionRenew, + } +} + +// LeaseDuration - Specifies whether the lease on a container is of infinite or fixed duration, only when the container is +// leased. +type LeaseDuration string + +const ( + LeaseDurationFixed LeaseDuration = "Fixed" + LeaseDurationInfinite LeaseDuration = "Infinite" +) + +// PossibleLeaseDurationValues returns the possible values for the LeaseDuration const type. +func PossibleLeaseDurationValues() []LeaseDuration { + return []LeaseDuration{ + LeaseDurationFixed, + LeaseDurationInfinite, + } +} + +// LeaseShareAction - Specifies the lease action. Can be one of the available actions. +type LeaseShareAction string + +const ( + LeaseShareActionAcquire LeaseShareAction = "Acquire" + LeaseShareActionBreak LeaseShareAction = "Break" + LeaseShareActionChange LeaseShareAction = "Change" + LeaseShareActionRelease LeaseShareAction = "Release" + LeaseShareActionRenew LeaseShareAction = "Renew" +) + +// PossibleLeaseShareActionValues returns the possible values for the LeaseShareAction const type. +func PossibleLeaseShareActionValues() []LeaseShareAction { + return []LeaseShareAction{ + LeaseShareActionAcquire, + LeaseShareActionBreak, + LeaseShareActionChange, + LeaseShareActionRelease, + LeaseShareActionRenew, + } +} + +// LeaseState - Lease state of the container. +type LeaseState string + +const ( + LeaseStateAvailable LeaseState = "Available" + LeaseStateBreaking LeaseState = "Breaking" + LeaseStateBroken LeaseState = "Broken" + LeaseStateExpired LeaseState = "Expired" + LeaseStateLeased LeaseState = "Leased" +) + +// PossibleLeaseStateValues returns the possible values for the LeaseState const type. +func PossibleLeaseStateValues() []LeaseState { + return []LeaseState{ + LeaseStateAvailable, + LeaseStateBreaking, + LeaseStateBroken, + LeaseStateExpired, + LeaseStateLeased, + } +} + +// LeaseStatus - The lease status of the container. +type LeaseStatus string + +const ( + LeaseStatusLocked LeaseStatus = "Locked" + LeaseStatusUnlocked LeaseStatus = "Unlocked" +) + +// PossibleLeaseStatusValues returns the possible values for the LeaseStatus const type. +func PossibleLeaseStatusValues() []LeaseStatus { + return []LeaseStatus{ + LeaseStatusLocked, + LeaseStatusUnlocked, + } +} + +type ListContainersInclude string + +const ( + ListContainersIncludeDeleted ListContainersInclude = "deleted" +) + +// PossibleListContainersIncludeValues returns the possible values for the ListContainersInclude const type. +func PossibleListContainersIncludeValues() []ListContainersInclude { + return []ListContainersInclude{ + ListContainersIncludeDeleted, + } +} + +type ListEncryptionScopesInclude string + +const ( + ListEncryptionScopesIncludeAll ListEncryptionScopesInclude = "All" + ListEncryptionScopesIncludeDisabled ListEncryptionScopesInclude = "Disabled" + ListEncryptionScopesIncludeEnabled ListEncryptionScopesInclude = "Enabled" +) + +// PossibleListEncryptionScopesIncludeValues returns the possible values for the ListEncryptionScopesInclude const type. +func PossibleListEncryptionScopesIncludeValues() []ListEncryptionScopesInclude { + return []ListEncryptionScopesInclude{ + ListEncryptionScopesIncludeAll, + ListEncryptionScopesIncludeDisabled, + ListEncryptionScopesIncludeEnabled, + } +} + +type ManagementPolicyName string + +const ( + ManagementPolicyNameDefault ManagementPolicyName = "default" +) + +// PossibleManagementPolicyNameValues returns the possible values for the ManagementPolicyName const type. +func PossibleManagementPolicyNameValues() []ManagementPolicyName { + return []ManagementPolicyName{ + ManagementPolicyNameDefault, + } +} + +type MigrationName string + +const ( + MigrationNameDefault MigrationName = "default" +) + +// PossibleMigrationNameValues returns the possible values for the MigrationName const type. +func PossibleMigrationNameValues() []MigrationName { + return []MigrationName{ + MigrationNameDefault, + } +} + +// MigrationState - This property denotes the container level immutability to object level immutability migration state. +type MigrationState string + +const ( + MigrationStateCompleted MigrationState = "Completed" + MigrationStateInProgress MigrationState = "InProgress" +) + +// PossibleMigrationStateValues returns the possible values for the MigrationState const type. +func PossibleMigrationStateValues() []MigrationState { + return []MigrationState{ + MigrationStateCompleted, + MigrationStateInProgress, + } +} + +// MigrationStatus - Current status of migration +type MigrationStatus string + +const ( + MigrationStatusComplete MigrationStatus = "Complete" + MigrationStatusFailed MigrationStatus = "Failed" + MigrationStatusInProgress MigrationStatus = "InProgress" + MigrationStatusInvalid MigrationStatus = "Invalid" + MigrationStatusSubmittedForConversion MigrationStatus = "SubmittedForConversion" +) + +// PossibleMigrationStatusValues returns the possible values for the MigrationStatus const type. +func PossibleMigrationStatusValues() []MigrationStatus { + return []MigrationStatus{ + MigrationStatusComplete, + MigrationStatusFailed, + MigrationStatusInProgress, + MigrationStatusInvalid, + MigrationStatusSubmittedForConversion, + } +} + +// MinimumTLSVersion - Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS +// 1.0 for this property. +type MinimumTLSVersion string + +const ( + MinimumTLSVersionTLS10 MinimumTLSVersion = "TLS1_0" + MinimumTLSVersionTLS11 MinimumTLSVersion = "TLS1_1" + MinimumTLSVersionTLS12 MinimumTLSVersion = "TLS1_2" +) + +// PossibleMinimumTLSVersionValues returns the possible values for the MinimumTLSVersion const type. +func PossibleMinimumTLSVersionValues() []MinimumTLSVersion { + return []MinimumTLSVersion{ + MinimumTLSVersionTLS10, + MinimumTLSVersionTLS11, + MinimumTLSVersionTLS12, + } +} + +// Name - Name of the policy. The valid value is AccessTimeTracking. This field is currently read only +type Name string + +const ( + NameAccessTimeTracking Name = "AccessTimeTracking" +) + +// PossibleNameValues returns the possible values for the Name const type. +func PossibleNameValues() []Name { + return []Name{ + NameAccessTimeTracking, + } +} + +// ObjectType - This is a required field. This field specifies the scope of the inventory created either at the blob or container +// level. +type ObjectType string + +const ( + ObjectTypeBlob ObjectType = "Blob" + ObjectTypeContainer ObjectType = "Container" +) + +// PossibleObjectTypeValues returns the possible values for the ObjectType const type. +func PossibleObjectTypeValues() []ObjectType { + return []ObjectType{ + ObjectTypeBlob, + ObjectTypeContainer, + } +} + +// Permissions - The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List +// (l), Add (a), Create (c), Update (u) and Process (p). +type Permissions string + +const ( + PermissionsA Permissions = "a" + PermissionsC Permissions = "c" + PermissionsD Permissions = "d" + PermissionsL Permissions = "l" + PermissionsP Permissions = "p" + PermissionsR Permissions = "r" + PermissionsU Permissions = "u" + PermissionsW Permissions = "w" +) + +// PossiblePermissionsValues returns the possible values for the Permissions const type. +func PossiblePermissionsValues() []Permissions { + return []Permissions{ + PermissionsA, + PermissionsC, + PermissionsD, + PermissionsL, + PermissionsP, + PermissionsR, + PermissionsU, + PermissionsW, + } +} + +// PostFailoverRedundancy - The redundancy type of the account after an account failover is performed. +type PostFailoverRedundancy string + +const ( + PostFailoverRedundancyStandardLRS PostFailoverRedundancy = "Standard_LRS" + PostFailoverRedundancyStandardZRS PostFailoverRedundancy = "Standard_ZRS" +) + +// PossiblePostFailoverRedundancyValues returns the possible values for the PostFailoverRedundancy const type. +func PossiblePostFailoverRedundancyValues() []PostFailoverRedundancy { + return []PostFailoverRedundancy{ + PostFailoverRedundancyStandardLRS, + PostFailoverRedundancyStandardZRS, + } +} + +// PostPlannedFailoverRedundancy - The redundancy type of the account after a planned account failover is performed. +type PostPlannedFailoverRedundancy string + +const ( + PostPlannedFailoverRedundancyStandardGRS PostPlannedFailoverRedundancy = "Standard_GRS" + PostPlannedFailoverRedundancyStandardGZRS PostPlannedFailoverRedundancy = "Standard_GZRS" + PostPlannedFailoverRedundancyStandardRAGRS PostPlannedFailoverRedundancy = "Standard_RAGRS" + PostPlannedFailoverRedundancyStandardRAGZRS PostPlannedFailoverRedundancy = "Standard_RAGZRS" +) + +// PossiblePostPlannedFailoverRedundancyValues returns the possible values for the PostPlannedFailoverRedundancy const type. +func PossiblePostPlannedFailoverRedundancyValues() []PostPlannedFailoverRedundancy { + return []PostPlannedFailoverRedundancy{ + PostPlannedFailoverRedundancyStandardGRS, + PostPlannedFailoverRedundancyStandardGZRS, + PostPlannedFailoverRedundancyStandardRAGRS, + PostPlannedFailoverRedundancyStandardRAGZRS, + } +} + +// 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, + } +} + +// ProvisioningState - Gets the status of the storage account at the time the operation was called. +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateResolvingDNS ProvisioningState = "ResolvingDNS" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCreating, + ProvisioningStateResolvingDNS, + ProvisioningStateSucceeded, + } +} + +// PublicAccess - Specifies whether data in the container may be accessed publicly and the level of access. +type PublicAccess string + +const ( + PublicAccessBlob PublicAccess = "Blob" + PublicAccessContainer PublicAccess = "Container" + PublicAccessNone PublicAccess = "None" +) + +// PossiblePublicAccessValues returns the possible values for the PublicAccess const type. +func PossiblePublicAccessValues() []PublicAccess { + return []PublicAccess{ + PublicAccessBlob, + PublicAccessContainer, + PublicAccessNone, + } +} + +// PublicNetworkAccess - Allow or disallow public network access to Storage Account. Value is optional but if passed in, must +// be 'Enabled' or 'Disabled'. +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + +// Reason - Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable +// is false. +type Reason string + +const ( + ReasonAccountNameInvalid Reason = "AccountNameInvalid" + ReasonAlreadyExists Reason = "AlreadyExists" +) + +// PossibleReasonValues returns the possible values for the Reason const type. +func PossibleReasonValues() []Reason { + return []Reason{ + ReasonAccountNameInvalid, + ReasonAlreadyExists, + } +} + +// ReasonCode - The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id +// is set when the SKU has requiredQuotas parameter as the subscription does not belong to that +// quota. The "NotAvailableForSubscription" is related to capacity at DC. +type ReasonCode string + +const ( + ReasonCodeNotAvailableForSubscription ReasonCode = "NotAvailableForSubscription" + ReasonCodeQuotaID ReasonCode = "QuotaId" +) + +// PossibleReasonCodeValues returns the possible values for the ReasonCode const type. +func PossibleReasonCodeValues() []ReasonCode { + return []ReasonCode{ + ReasonCodeNotAvailableForSubscription, + ReasonCodeQuotaID, + } +} + +// RootSquashType - The property is for NFS share only. The default is NoRootSquash. +type RootSquashType string + +const ( + RootSquashTypeAllSquash RootSquashType = "AllSquash" + RootSquashTypeNoRootSquash RootSquashType = "NoRootSquash" + RootSquashTypeRootSquash RootSquashType = "RootSquash" +) + +// PossibleRootSquashTypeValues returns the possible values for the RootSquashType const type. +func PossibleRootSquashTypeValues() []RootSquashType { + return []RootSquashType{ + RootSquashTypeAllSquash, + RootSquashTypeNoRootSquash, + RootSquashTypeRootSquash, + } +} + +// RoutingChoice - Routing Choice defines the kind of network routing opted by the user. +type RoutingChoice string + +const ( + RoutingChoiceInternetRouting RoutingChoice = "InternetRouting" + RoutingChoiceMicrosoftRouting RoutingChoice = "MicrosoftRouting" +) + +// PossibleRoutingChoiceValues returns the possible values for the RoutingChoice const type. +func PossibleRoutingChoiceValues() []RoutingChoice { + return []RoutingChoice{ + RoutingChoiceInternetRouting, + RoutingChoiceMicrosoftRouting, + } +} + +// RuleType - The valid value is Lifecycle +type RuleType string + +const ( + RuleTypeLifecycle RuleType = "Lifecycle" +) + +// PossibleRuleTypeValues returns the possible values for the RuleType const type. +func PossibleRuleTypeValues() []RuleType { + return []RuleType{ + RuleTypeLifecycle, + } +} + +// SKUConversionStatus - This property indicates the current sku conversion status. +type SKUConversionStatus string + +const ( + SKUConversionStatusFailed SKUConversionStatus = "Failed" + SKUConversionStatusInProgress SKUConversionStatus = "InProgress" + SKUConversionStatusSucceeded SKUConversionStatus = "Succeeded" +) + +// PossibleSKUConversionStatusValues returns the possible values for the SKUConversionStatus const type. +func PossibleSKUConversionStatusValues() []SKUConversionStatus { + return []SKUConversionStatus{ + SKUConversionStatusFailed, + SKUConversionStatusInProgress, + SKUConversionStatusSucceeded, + } +} + +// SKUName - The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called +// accountType. +type SKUName string + +const ( + SKUNamePremiumLRS SKUName = "Premium_LRS" + SKUNamePremiumZRS SKUName = "Premium_ZRS" + SKUNameStandardGRS SKUName = "Standard_GRS" + SKUNameStandardGZRS SKUName = "Standard_GZRS" + SKUNameStandardLRS SKUName = "Standard_LRS" + SKUNameStandardRAGRS SKUName = "Standard_RAGRS" + SKUNameStandardRAGZRS SKUName = "Standard_RAGZRS" + SKUNameStandardZRS SKUName = "Standard_ZRS" +) + +// PossibleSKUNameValues returns the possible values for the SKUName const type. +func PossibleSKUNameValues() []SKUName { + return []SKUName{ + SKUNamePremiumLRS, + SKUNamePremiumZRS, + SKUNameStandardGRS, + SKUNameStandardGZRS, + SKUNameStandardLRS, + SKUNameStandardRAGRS, + SKUNameStandardRAGZRS, + SKUNameStandardZRS, + } +} + +// SKUTier - The SKU tier. This is based on the SKU name. +type SKUTier string + +const ( + SKUTierPremium SKUTier = "Premium" + SKUTierStandard SKUTier = "Standard" +) + +// PossibleSKUTierValues returns the possible values for the SKUTier const type. +func PossibleSKUTierValues() []SKUTier { + return []SKUTier{ + SKUTierPremium, + SKUTierStandard, + } +} + +// Schedule - This is a required field. This field is used to schedule an inventory formation. +type Schedule string + +const ( + ScheduleDaily Schedule = "Daily" + ScheduleWeekly Schedule = "Weekly" +) + +// PossibleScheduleValues returns the possible values for the Schedule const type. +func PossibleScheduleValues() []Schedule { + return []Schedule{ + ScheduleDaily, + ScheduleWeekly, + } +} + +// Services - The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), +// File (f). +type Services string + +const ( + ServicesB Services = "b" + ServicesF Services = "f" + ServicesQ Services = "q" + ServicesT Services = "t" +) + +// PossibleServicesValues returns the possible values for the Services const type. +func PossibleServicesValues() []Services { + return []Services{ + ServicesB, + ServicesF, + ServicesQ, + ServicesT, + } +} + +// ShareAccessTier - Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, +// and Cool. FileStorage account can choose Premium. +type ShareAccessTier string + +const ( + ShareAccessTierCool ShareAccessTier = "Cool" + ShareAccessTierHot ShareAccessTier = "Hot" + ShareAccessTierPremium ShareAccessTier = "Premium" + ShareAccessTierTransactionOptimized ShareAccessTier = "TransactionOptimized" +) + +// PossibleShareAccessTierValues returns the possible values for the ShareAccessTier const type. +func PossibleShareAccessTierValues() []ShareAccessTier { + return []ShareAccessTier{ + ShareAccessTierCool, + ShareAccessTierHot, + ShareAccessTierPremium, + ShareAccessTierTransactionOptimized, + } +} + +// SignedResource - The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), +// File (f), Share (s). +type SignedResource string + +const ( + SignedResourceB SignedResource = "b" + SignedResourceC SignedResource = "c" + SignedResourceF SignedResource = "f" + SignedResourceS SignedResource = "s" +) + +// PossibleSignedResourceValues returns the possible values for the SignedResource const type. +func PossibleSignedResourceValues() []SignedResource { + return []SignedResource{ + SignedResourceB, + SignedResourceC, + SignedResourceF, + SignedResourceS, + } +} + +// SignedResourceTypes - The signed resource types that are accessible with the account SAS. Service (s): Access to service-level +// APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs +// for blobs, queue messages, table entities, and files. +type SignedResourceTypes string + +const ( + SignedResourceTypesC SignedResourceTypes = "c" + SignedResourceTypesO SignedResourceTypes = "o" + SignedResourceTypesS SignedResourceTypes = "s" +) + +// PossibleSignedResourceTypesValues returns the possible values for the SignedResourceTypes const type. +func PossibleSignedResourceTypesValues() []SignedResourceTypes { + return []SignedResourceTypes{ + SignedResourceTypesC, + SignedResourceTypesO, + SignedResourceTypesS, + } +} + +// State - Gets the state of virtual network rule. +type State string + +const ( + StateDeprovisioning State = "Deprovisioning" + StateFailed State = "Failed" + StateNetworkSourceDeleted State = "NetworkSourceDeleted" + StateProvisioning State = "Provisioning" + StateSucceeded State = "Succeeded" +) + +// PossibleStateValues returns the possible values for the State const type. +func PossibleStateValues() []State { + return []State{ + StateDeprovisioning, + StateFailed, + StateNetworkSourceDeleted, + StateProvisioning, + StateSucceeded, + } +} + +type StorageAccountExpand string + +const ( + StorageAccountExpandBlobRestoreStatus StorageAccountExpand = "blobRestoreStatus" + StorageAccountExpandGeoReplicationStats StorageAccountExpand = "geoReplicationStats" +) + +// PossibleStorageAccountExpandValues returns the possible values for the StorageAccountExpand const type. +func PossibleStorageAccountExpandValues() []StorageAccountExpand { + return []StorageAccountExpand{ + StorageAccountExpandBlobRestoreStatus, + StorageAccountExpandGeoReplicationStats, + } +} + +// UsageUnit - Gets the unit of measurement. +type UsageUnit string + +const ( + UsageUnitBytes UsageUnit = "Bytes" + UsageUnitBytesPerSecond UsageUnit = "BytesPerSecond" + UsageUnitCount UsageUnit = "Count" + UsageUnitCountsPerSecond UsageUnit = "CountsPerSecond" + UsageUnitPercent UsageUnit = "Percent" + UsageUnitSeconds UsageUnit = "Seconds" +) + +// PossibleUsageUnitValues returns the possible values for the UsageUnit const type. +func PossibleUsageUnitValues() []UsageUnit { + return []UsageUnit{ + UsageUnitBytes, + UsageUnitBytesPerSecond, + UsageUnitCount, + UsageUnitCountsPerSecond, + UsageUnitPercent, + UsageUnitSeconds, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go new file mode 100644 index 000000000..438fc77ee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go @@ -0,0 +1,163 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DeletedAccountsClient contains the methods for the DeletedAccounts group. +// Don't use this type directly, use NewDeletedAccountsClient() instead. +type DeletedAccountsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDeletedAccountsClient creates a new instance of DeletedAccountsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDeletedAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeletedAccountsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeletedAccountsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get properties of specified deleted account resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - deletedAccountName - Name of the deleted storage account. +// - location - The location of the deleted storage account. +// - options - DeletedAccountsClientGetOptions contains the optional parameters for the DeletedAccountsClient.Get method. +func (client *DeletedAccountsClient) Get(ctx context.Context, deletedAccountName string, location string, options *DeletedAccountsClientGetOptions) (DeletedAccountsClientGetResponse, error) { + var err error + const operationName = "DeletedAccountsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, deletedAccountName, location, options) + if err != nil { + return DeletedAccountsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeletedAccountsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeletedAccountsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, deletedAccountName string, location string, options *DeletedAccountsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}" + if deletedAccountName == "" { + return nil, errors.New("parameter deletedAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deletedAccountName}", url.PathEscape(deletedAccountName)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DeletedAccountsClient) getHandleResponse(resp *http.Response) (DeletedAccountsClientGetResponse, error) { + result := DeletedAccountsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedAccount); err != nil { + return DeletedAccountsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists deleted accounts under the subscription. +// +// Generated from API version 2023-01-01 +// - options - DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager +// method. +func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClientListOptions) *runtime.Pager[DeletedAccountsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DeletedAccountsClientListResponse]{ + More: func(page DeletedAccountsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeletedAccountsClientListResponse) (DeletedAccountsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeletedAccountsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return DeletedAccountsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, options *DeletedAccountsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DeletedAccountsClient) listHandleResponse(resp *http.Response) (DeletedAccountsClientListResponse, error) { + result := DeletedAccountsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedAccountListResult); err != nil { + return DeletedAccountsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go new file mode 100644 index 000000000..1aaa4eaf0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go @@ -0,0 +1,347 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// EncryptionScopesClient contains the methods for the EncryptionScopes group. +// Don't use this type directly, use NewEncryptionScopesClient() instead. +type EncryptionScopesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEncryptionScopesClient creates a new instance of EncryptionScopesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEncryptionScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EncryptionScopesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EncryptionScopesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Returns the properties for the specified encryption scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - encryptionScopeName - The name of the encryption scope within the specified storage account. Encryption scope names must +// be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - options - EncryptionScopesClientGetOptions contains the optional parameters for the EncryptionScopesClient.Get method. +func (client *EncryptionScopesClient) Get(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientGetOptions) (EncryptionScopesClientGetResponse, error) { + var err error + const operationName = "EncryptionScopesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, options) + if err != nil { + return EncryptionScopesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EncryptionScopesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EncryptionScopesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if encryptionScopeName == "" { + return nil, errors.New("parameter encryptionScopeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionScopeName}", url.PathEscape(encryptionScopeName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *EncryptionScopesClient) getHandleResponse(resp *http.Response) (EncryptionScopesClientGetResponse, error) { + result := EncryptionScopesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil { + return EncryptionScopesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the encryption scopes available under the specified storage account. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - EncryptionScopesClientListOptions contains the optional parameters for the EncryptionScopesClient.NewListPager +// method. +func (client *EncryptionScopesClient) NewListPager(resourceGroupName string, accountName string, options *EncryptionScopesClientListOptions) *runtime.Pager[EncryptionScopesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[EncryptionScopesClientListResponse]{ + More: func(page EncryptionScopesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EncryptionScopesClientListResponse) (EncryptionScopesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EncryptionScopesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return EncryptionScopesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *EncryptionScopesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + if options != nil && options.Maxpagesize != nil { + reqQP.Set("$maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Include != nil { + reqQP.Set("$include", string(*options.Include)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *EncryptionScopesClient) listHandleResponse(resp *http.Response) (EncryptionScopesClientListResponse, error) { + result := EncryptionScopesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScopeListResult); err != nil { + return EncryptionScopesClientListResponse{}, err + } + return result, nil +} + +// Patch - Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope +// does not already exist. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - encryptionScopeName - The name of the encryption scope within the specified storage account. Encryption scope names must +// be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - encryptionScope - Encryption scope properties to be used for the update. +// - options - EncryptionScopesClientPatchOptions contains the optional parameters for the EncryptionScopesClient.Patch method. +func (client *EncryptionScopesClient) Patch(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPatchOptions) (EncryptionScopesClientPatchResponse, error) { + var err error + const operationName = "EncryptionScopesClient.Patch" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.patchCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, encryptionScope, options) + if err != nil { + return EncryptionScopesClientPatchResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EncryptionScopesClientPatchResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EncryptionScopesClientPatchResponse{}, err + } + resp, err := client.patchHandleResponse(httpResp) + return resp, err +} + +// patchCreateRequest creates the Patch request. +func (client *EncryptionScopesClient) patchCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if encryptionScopeName == "" { + return nil, errors.New("parameter encryptionScopeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionScopeName}", url.PathEscape(encryptionScopeName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, encryptionScope); err != nil { + return nil, err + } + return req, nil +} + +// patchHandleResponse handles the Patch response. +func (client *EncryptionScopesClient) patchHandleResponse(resp *http.Response) (EncryptionScopesClientPatchResponse, error) { + result := EncryptionScopesClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil { + return EncryptionScopesClientPatchResponse{}, err + } + return result, nil +} + +// Put - Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope +// is already created and a subsequent request is issued with different properties, the +// encryption scope properties will be updated per the specified request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - encryptionScopeName - The name of the encryption scope within the specified storage account. Encryption scope names must +// be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every +// dash (-) character must be immediately preceded and followed by a letter or number. +// - encryptionScope - Encryption scope properties to be used for the create or update. +// - options - EncryptionScopesClientPutOptions contains the optional parameters for the EncryptionScopesClient.Put method. +func (client *EncryptionScopesClient) Put(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPutOptions) (EncryptionScopesClientPutResponse, error) { + var err error + const operationName = "EncryptionScopesClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, encryptionScope, options) + if err != nil { + return EncryptionScopesClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EncryptionScopesClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return EncryptionScopesClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *EncryptionScopesClient) putCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if encryptionScopeName == "" { + return nil, errors.New("parameter encryptionScopeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionScopeName}", url.PathEscape(encryptionScopeName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, encryptionScope); err != nil { + return nil, err + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *EncryptionScopesClient) putHandleResponse(resp *http.Response) (EncryptionScopesClientPutResponse, error) { + result := EncryptionScopesClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil { + return EncryptionScopesClientPutResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileservices_client.go new file mode 100644 index 000000000..238ba98c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileservices_client.go @@ -0,0 +1,249 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FileServicesClient contains the methods for the FileServices group. +// Don't use this type directly, use NewFileServicesClient() instead. +type FileServicesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFileServicesClient creates a new instance of FileServicesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFileServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FileServicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FileServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetServiceProperties - Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource +// Sharing) rules. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - FileServicesClientGetServicePropertiesOptions contains the optional parameters for the FileServicesClient.GetServiceProperties +// method. +func (client *FileServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientGetServicePropertiesOptions) (FileServicesClientGetServicePropertiesResponse, error) { + var err error + const operationName = "FileServicesClient.GetServiceProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return FileServicesClientGetServicePropertiesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileServicesClientGetServicePropertiesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileServicesClientGetServicePropertiesResponse{}, err + } + resp, err := client.getServicePropertiesHandleResponse(httpResp) + return resp, err +} + +// getServicePropertiesCreateRequest creates the GetServiceProperties request. +func (client *FileServicesClient) getServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientGetServicePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{FileServicesName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getServicePropertiesHandleResponse handles the GetServiceProperties response. +func (client *FileServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (FileServicesClientGetServicePropertiesResponse, error) { + result := FileServicesClientGetServicePropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileServiceProperties); err != nil { + return FileServicesClientGetServicePropertiesResponse{}, err + } + return result, nil +} + +// List - List all file services in storage accounts +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - FileServicesClientListOptions contains the optional parameters for the FileServicesClient.List method. +func (client *FileServicesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientListOptions) (FileServicesClientListResponse, error) { + var err error + const operationName = "FileServicesClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return FileServicesClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileServicesClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileServicesClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// listCreateRequest creates the List request. +func (client *FileServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FileServicesClient) listHandleResponse(resp *http.Response) (FileServicesClientListResponse, error) { + result := FileServicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileServiceItems); err != nil { + return FileServicesClientListResponse{}, err + } + return result, nil +} + +// SetServiceProperties - Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource +// Sharing) rules. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. +// - options - FileServicesClientSetServicePropertiesOptions contains the optional parameters for the FileServicesClient.SetServiceProperties +// method. +func (client *FileServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters FileServiceProperties, options *FileServicesClientSetServicePropertiesOptions) (FileServicesClientSetServicePropertiesResponse, error) { + var err error + const operationName = "FileServicesClient.SetServiceProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return FileServicesClientSetServicePropertiesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileServicesClientSetServicePropertiesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileServicesClientSetServicePropertiesResponse{}, err + } + resp, err := client.setServicePropertiesHandleResponse(httpResp) + return resp, err +} + +// setServicePropertiesCreateRequest creates the SetServiceProperties request. +func (client *FileServicesClient) setServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters FileServiceProperties, options *FileServicesClientSetServicePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{FileServicesName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// setServicePropertiesHandleResponse handles the SetServiceProperties response. +func (client *FileServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (FileServicesClientSetServicePropertiesResponse, error) { + result := FileServicesClientSetServicePropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileServiceProperties); err != nil { + return FileServicesClientSetServicePropertiesResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileshares_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileshares_client.go new file mode 100644 index 000000000..df9e8df21 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fileshares_client.go @@ -0,0 +1,572 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FileSharesClient contains the methods for the FileShares group. +// Don't use this type directly, use NewFileSharesClient() instead. +type FileSharesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFileSharesClient creates a new instance of FileSharesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFileSharesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FileSharesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FileSharesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates a new share under the specified account as described by request body. The share resource includes metadata +// and properties for that share. It does not include a list of the files contained by +// the share. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63 +// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) +// character must be immediately preceded and followed by a letter or number. +// - fileShare - Properties of the file share to create. +// - options - FileSharesClientCreateOptions contains the optional parameters for the FileSharesClient.Create method. +func (client *FileSharesClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientCreateOptions) (FileSharesClientCreateResponse, error) { + var err error + const operationName = "FileSharesClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, shareName, fileShare, options) + if err != nil { + return FileSharesClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileSharesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FileSharesClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *FileSharesClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), 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", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, fileShare); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *FileSharesClient) createHandleResponse(resp *http.Response) (FileSharesClientCreateResponse, error) { + result := FileSharesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil { + return FileSharesClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes specified share under its account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63 +// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) +// character must be immediately preceded and followed by a letter or number. +// - options - FileSharesClientDeleteOptions contains the optional parameters for the FileSharesClient.Delete method. +func (client *FileSharesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientDeleteOptions) (FileSharesClientDeleteResponse, error) { + var err error + const operationName = "FileSharesClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, shareName, options) + if err != nil { + return FileSharesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileSharesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return FileSharesClientDeleteResponse{}, err + } + return FileSharesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FileSharesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + if options != nil && options.Include != nil { + reqQP.Set("$include", *options.Include) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.XMSSnapshot != nil { + req.Raw().Header["x-ms-snapshot"] = []string{*options.XMSSnapshot} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets properties of a specified share. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63 +// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) +// character must be immediately preceded and followed by a letter or number. +// - options - FileSharesClientGetOptions contains the optional parameters for the FileSharesClient.Get method. +func (client *FileSharesClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientGetOptions) (FileSharesClientGetResponse, error) { + var err error + const operationName = "FileSharesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, shareName, options) + if err != nil { + return FileSharesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileSharesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileSharesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FileSharesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.XMSSnapshot != nil { + req.Raw().Header["x-ms-snapshot"] = []string{*options.XMSSnapshot} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FileSharesClient) getHandleResponse(resp *http.Response) (FileSharesClientGetResponse, error) { + result := FileSharesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil { + return FileSharesClientGetResponse{}, err + } + return result, nil +} + +// Lease - The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can +// be 15 to 60 seconds, or can be infinite. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63 +// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) +// character must be immediately preceded and followed by a letter or number. +// - options - FileSharesClientLeaseOptions contains the optional parameters for the FileSharesClient.Lease method. +func (client *FileSharesClient) Lease(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientLeaseOptions) (FileSharesClientLeaseResponse, error) { + var err error + const operationName = "FileSharesClient.Lease" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.leaseCreateRequest(ctx, resourceGroupName, accountName, shareName, options) + if err != nil { + return FileSharesClientLeaseResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileSharesClientLeaseResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileSharesClientLeaseResponse{}, err + } + resp, err := client.leaseHandleResponse(httpResp) + return resp, err +} + +// leaseCreateRequest creates the Lease request. +func (client *FileSharesClient) leaseCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientLeaseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.XMSSnapshot != nil { + req.Raw().Header["x-ms-snapshot"] = []string{*options.XMSSnapshot} + } + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// leaseHandleResponse handles the Lease response. +func (client *FileSharesClient) leaseHandleResponse(resp *http.Response) (FileSharesClientLeaseResponse, error) { + result := FileSharesClientLeaseResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.LeaseShareResponse); err != nil { + return FileSharesClientLeaseResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all shares. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - FileSharesClientListOptions contains the optional parameters for the FileSharesClient.NewListPager method. +func (client *FileSharesClient) NewListPager(resourceGroupName string, accountName string, options *FileSharesClientListOptions) *runtime.Pager[FileSharesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FileSharesClientListResponse]{ + More: func(page FileSharesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FileSharesClientListResponse) (FileSharesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FileSharesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return FileSharesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *FileSharesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *FileSharesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + if options != nil && options.Maxpagesize != nil { + reqQP.Set("$maxpagesize", *options.Maxpagesize) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + 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 +} + +// listHandleResponse handles the List response. +func (client *FileSharesClient) listHandleResponse(resp *http.Response) (FileSharesClientListResponse, error) { + result := FileSharesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileShareItems); err != nil { + return FileSharesClientListResponse{}, err + } + return result, nil +} + +// Restore - Restore a file share within a valid retention days if share soft delete is enabled +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63 +// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) +// character must be immediately preceded and followed by a letter or number. +// - options - FileSharesClientRestoreOptions contains the optional parameters for the FileSharesClient.Restore method. +func (client *FileSharesClient) Restore(ctx context.Context, resourceGroupName string, accountName string, shareName string, deletedShare DeletedShare, options *FileSharesClientRestoreOptions) (FileSharesClientRestoreResponse, error) { + var err error + const operationName = "FileSharesClient.Restore" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restoreCreateRequest(ctx, resourceGroupName, accountName, shareName, deletedShare, options) + if err != nil { + return FileSharesClientRestoreResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileSharesClientRestoreResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileSharesClientRestoreResponse{}, err + } + return FileSharesClientRestoreResponse{}, nil +} + +// restoreCreateRequest creates the Restore request. +func (client *FileSharesClient) restoreCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, deletedShare DeletedShare, options *FileSharesClientRestoreOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, deletedShare); err != nil { + return nil, err + } + return req, nil +} + +// Update - Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. +// Update fails if the specified share does not already exist. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - shareName - The name of the file share within the specified storage account. File share names must be between 3 and 63 +// characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) +// character must be immediately preceded and followed by a letter or number. +// - fileShare - Properties to update for the file share. +// - options - FileSharesClientUpdateOptions contains the optional parameters for the FileSharesClient.Update method. +func (client *FileSharesClient) Update(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientUpdateOptions) (FileSharesClientUpdateResponse, error) { + var err error + const operationName = "FileSharesClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, shareName, fileShare, options) + if err != nil { + return FileSharesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileSharesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileSharesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *FileSharesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if shareName == "" { + return nil, errors.New("parameter shareName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{shareName}", url.PathEscape(shareName)) + if client.subscriptionID == "" { + return 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, fileShare); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *FileSharesClient) updateHandleResponse(resp *http.Response) (FileSharesClientUpdateResponse, error) { + result := FileSharesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil { + return FileSharesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/localusers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/localusers_client.go new file mode 100644 index 000000000..614a876e4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/localusers_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LocalUsersClient contains the methods for the LocalUsers group. +// Don't use this type directly, use NewLocalUsersClient() instead. +type LocalUsersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLocalUsersClient creates a new instance of LocalUsersClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewLocalUsersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocalUsersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LocalUsersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or update the properties of a local user associated with the storage account +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only +// within the storage account. +// - properties - The local user associated with a storage account. +// - options - LocalUsersClientCreateOrUpdateOptions contains the optional parameters for the LocalUsersClient.CreateOrUpdate +// method. +func (client *LocalUsersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, username string, properties LocalUser, options *LocalUsersClientCreateOrUpdateOptions) (LocalUsersClientCreateOrUpdateResponse, error) { + var err error + const operationName = "LocalUsersClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, username, properties, options) + if err != nil { + return LocalUsersClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalUsersClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocalUsersClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LocalUsersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, properties LocalUser, options *LocalUsersClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if username == "" { + return nil, errors.New("parameter username cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *LocalUsersClient) createOrUpdateHandleResponse(resp *http.Response) (LocalUsersClientCreateOrUpdateResponse, error) { + result := LocalUsersClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalUser); err != nil { + return LocalUsersClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the local user associated with the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only +// within the storage account. +// - options - LocalUsersClientDeleteOptions contains the optional parameters for the LocalUsersClient.Delete method. +func (client *LocalUsersClient) Delete(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientDeleteOptions) (LocalUsersClientDeleteResponse, error) { + var err error + const operationName = "LocalUsersClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, username, options) + if err != nil { + return LocalUsersClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalUsersClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return LocalUsersClientDeleteResponse{}, err + } + return LocalUsersClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LocalUsersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if username == "" { + return nil, errors.New("parameter username cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the local user of the storage account by username. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only +// within the storage account. +// - options - LocalUsersClientGetOptions contains the optional parameters for the LocalUsersClient.Get method. +func (client *LocalUsersClient) Get(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientGetOptions) (LocalUsersClientGetResponse, error) { + var err error + const operationName = "LocalUsersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, username, options) + if err != nil { + return LocalUsersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalUsersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocalUsersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *LocalUsersClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if username == "" { + return nil, errors.New("parameter username cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LocalUsersClient) getHandleResponse(resp *http.Response) (LocalUsersClientGetResponse, error) { + result := LocalUsersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalUser); err != nil { + return LocalUsersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List the local users associated with the storage account. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - LocalUsersClientListOptions contains the optional parameters for the LocalUsersClient.NewListPager method. +func (client *LocalUsersClient) NewListPager(resourceGroupName string, accountName string, options *LocalUsersClientListOptions) *runtime.Pager[LocalUsersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LocalUsersClientListResponse]{ + More: func(page LocalUsersClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *LocalUsersClientListResponse) (LocalUsersClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LocalUsersClient.NewListPager") + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return LocalUsersClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalUsersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalUsersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *LocalUsersClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *LocalUsersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LocalUsersClient) listHandleResponse(resp *http.Response) (LocalUsersClientListResponse, error) { + result := LocalUsersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalUsers); err != nil { + return LocalUsersClientListResponse{}, err + } + return result, nil +} + +// ListKeys - List SSH authorized keys and shared key of the local user. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only +// within the storage account. +// - options - LocalUsersClientListKeysOptions contains the optional parameters for the LocalUsersClient.ListKeys method. +func (client *LocalUsersClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientListKeysOptions) (LocalUsersClientListKeysResponse, error) { + var err error + const operationName = "LocalUsersClient.ListKeys" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listKeysCreateRequest(ctx, resourceGroupName, accountName, username, options) + if err != nil { + return LocalUsersClientListKeysResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalUsersClientListKeysResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocalUsersClientListKeysResponse{}, err + } + resp, err := client.listKeysHandleResponse(httpResp) + return resp, err +} + +// listKeysCreateRequest creates the ListKeys request. +func (client *LocalUsersClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientListKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/listKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if username == "" { + return nil, errors.New("parameter username cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listKeysHandleResponse handles the ListKeys response. +func (client *LocalUsersClient) listKeysHandleResponse(resp *http.Response) (LocalUsersClientListKeysResponse, error) { + result := LocalUsersClientListKeysResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalUserKeys); err != nil { + return LocalUsersClientListKeysResponse{}, err + } + return result, nil +} + +// RegeneratePassword - Regenerate the local user SSH password. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - username - The name of local user. The username must contain lowercase letters and numbers only. It must be unique only +// within the storage account. +// - options - LocalUsersClientRegeneratePasswordOptions contains the optional parameters for the LocalUsersClient.RegeneratePassword +// method. +func (client *LocalUsersClient) RegeneratePassword(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientRegeneratePasswordOptions) (LocalUsersClientRegeneratePasswordResponse, error) { + var err error + const operationName = "LocalUsersClient.RegeneratePassword" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.regeneratePasswordCreateRequest(ctx, resourceGroupName, accountName, username, options) + if err != nil { + return LocalUsersClientRegeneratePasswordResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalUsersClientRegeneratePasswordResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocalUsersClientRegeneratePasswordResponse{}, err + } + resp, err := client.regeneratePasswordHandleResponse(httpResp) + return resp, err +} + +// regeneratePasswordCreateRequest creates the RegeneratePassword request. +func (client *LocalUsersClient) regeneratePasswordCreateRequest(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientRegeneratePasswordOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/regeneratePassword" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if username == "" { + return nil, errors.New("parameter username cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{username}", url.PathEscape(username)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// regeneratePasswordHandleResponse handles the RegeneratePassword response. +func (client *LocalUsersClient) regeneratePasswordHandleResponse(resp *http.Response) (LocalUsersClientRegeneratePasswordResponse, error) { + result := LocalUsersClientRegeneratePasswordResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalUserRegeneratePasswordResult); err != nil { + return LocalUsersClientRegeneratePasswordResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go new file mode 100644 index 000000000..4f3f96365 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go @@ -0,0 +1,249 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagementPoliciesClient contains the methods for the ManagementPolicies group. +// Don't use this type directly, use NewManagementPoliciesClient() instead. +type ManagementPoliciesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagementPoliciesClient creates a new instance of ManagementPoliciesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagementPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementPoliciesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagementPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Sets the managementpolicy to the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - managementPolicyName - The name of the Storage Account Management Policy. It should always be 'default' +// - properties - The ManagementPolicy set to a storage account. +// - options - ManagementPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ManagementPoliciesClient.CreateOrUpdate +// method. +func (client *ManagementPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, properties ManagementPolicy, options *ManagementPoliciesClientCreateOrUpdateOptions) (ManagementPoliciesClientCreateOrUpdateResponse, error) { + var err error + const operationName = "ManagementPoliciesClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, managementPolicyName, properties, options) + if err != nil { + return ManagementPoliciesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementPoliciesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementPoliciesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagementPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, properties ManagementPolicy, options *ManagementPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if managementPolicyName == "" { + return nil, errors.New("parameter managementPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementPolicyName}", url.PathEscape(string(managementPolicyName))) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ManagementPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ManagementPoliciesClientCreateOrUpdateResponse, error) { + result := ManagementPoliciesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagementPolicy); err != nil { + return ManagementPoliciesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the managementpolicy associated with the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - managementPolicyName - The name of the Storage Account Management Policy. It should always be 'default' +// - options - ManagementPoliciesClientDeleteOptions contains the optional parameters for the ManagementPoliciesClient.Delete +// method. +func (client *ManagementPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientDeleteOptions) (ManagementPoliciesClientDeleteResponse, error) { + var err error + const operationName = "ManagementPoliciesClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, managementPolicyName, options) + if err != nil { + return ManagementPoliciesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementPoliciesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ManagementPoliciesClientDeleteResponse{}, err + } + return ManagementPoliciesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagementPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if managementPolicyName == "" { + return nil, errors.New("parameter managementPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementPolicyName}", url.PathEscape(string(managementPolicyName))) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets the managementpolicy associated with the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - managementPolicyName - The name of the Storage Account Management Policy. It should always be 'default' +// - options - ManagementPoliciesClientGetOptions contains the optional parameters for the ManagementPoliciesClient.Get method. +func (client *ManagementPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientGetOptions) (ManagementPoliciesClientGetResponse, error) { + var err error + const operationName = "ManagementPoliciesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, managementPolicyName, options) + if err != nil { + return ManagementPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagementPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if managementPolicyName == "" { + return nil, errors.New("parameter managementPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementPolicyName}", url.PathEscape(string(managementPolicyName))) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagementPoliciesClient) getHandleResponse(resp *http.Response) (ManagementPoliciesClientGetResponse, error) { + result := ManagementPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagementPolicy); err != nil { + return ManagementPoliciesClientGetResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models.go new file mode 100644 index 000000000..3a9b23aab --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models.go @@ -0,0 +1,2832 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import "time" + +type AccessPolicy struct { + // Expiry time of the access policy + ExpiryTime *time.Time + + // List of abbreviated permissions. + Permission *string + + // Start time of the access policy + StartTime *time.Time +} + +// Account - The storage account. +type Account struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation + + // The identity of the resource. + Identity *Identity + + // Properties of the storage account. + Properties *AccountProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Gets the Kind. + Kind *Kind + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Gets the SKU. + SKU *SKU + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AccountCheckNameAvailabilityParameters - The parameters used to check the availability of the storage account name. +type AccountCheckNameAvailabilityParameters struct { + // REQUIRED; The storage account name. + Name *string + + // CONSTANT; The type of resource, Microsoft.Storage/storageAccounts + // Field has constant value "Microsoft.Storage/storageAccounts", any specified value is ignored. + Type *string +} + +// AccountCreateParameters - The parameters used when creating a storage account. +type AccountCreateParameters struct { + // REQUIRED; Required. Indicates the type of storage account. + Kind *Kind + + // REQUIRED; Required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo + // Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource + // cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. + Location *string + + // REQUIRED; Required. Gets or sets the SKU name. + SKU *SKU + + // Optional. Set the extended location of the resource. If not set, the storage account will be created in Azure main region. + // Otherwise it will be created in the specified extended location + ExtendedLocation *ExtendedLocation + + // The identity of the resource. + Identity *Identity + + // The parameters used to create the storage account. + Properties *AccountPropertiesCreateParameters + + // Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this + // resource (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than + // 256 characters. + Tags map[string]*string +} + +// AccountImmutabilityPolicyProperties - This defines account-level immutability policy properties. +type AccountImmutabilityPolicyProperties struct { + // This property can only be changed for disabled and unlocked time-based retention policies. When enabled, new blocks can + // be written to an append blob while maintaining immutability protection and + // compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. + AllowProtectedAppendWrites *bool + + // The immutability period for the blobs in the container since the policy creation, in days. + ImmutabilityPeriodSinceCreationInDays *int32 + + // The ImmutabilityPolicy state defines the mode of the policy. Disabled state disables the policy, Unlocked state allows + // increase and decrease of immutability retention time and also allows toggling + // allowProtectedAppendWrites property, Locked state only allows the increase of the immutability retention time. A policy + // can only be created in a Disabled or Unlocked state and can be toggled between + // the two states. Only a policy in an Unlocked state can transition to a Locked state which cannot be reverted. + State *AccountImmutabilityPolicyState +} + +// AccountInternetEndpoints - The URIs that are used to perform a retrieval of a public blob, file, web or dfs object via +// a internet routing endpoint. +type AccountInternetEndpoints struct { + // READ-ONLY; Gets the blob endpoint. + Blob *string + + // READ-ONLY; Gets the dfs endpoint. + Dfs *string + + // READ-ONLY; Gets the file endpoint. + File *string + + // READ-ONLY; Gets the web endpoint. + Web *string +} + +// AccountKey - An access key for the storage account. +type AccountKey struct { + // READ-ONLY; Creation time of the key, in round trip date format. + CreationTime *time.Time + + // READ-ONLY; Name of the key. + KeyName *string + + // READ-ONLY; Permissions for the key -- read-only or full permissions. + Permissions *KeyPermission + + // READ-ONLY; Base 64-encoded value of the key. + Value *string +} + +// AccountListKeysResult - The response from the ListKeys operation. +type AccountListKeysResult struct { + // READ-ONLY; Gets the list of storage account keys and their properties for the specified storage account. + Keys []*AccountKey +} + +// AccountListResult - The response from the List Storage Accounts operation. +type AccountListResult struct { + // READ-ONLY; Request URL that can be used to query next page of storage accounts. Returned when total number of requested + // storage accounts exceed maximum page size. + NextLink *string + + // READ-ONLY; Gets the list of storage accounts and their properties. + Value []*Account +} + +// AccountMicrosoftEndpoints - The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object +// via a microsoft routing endpoint. +type AccountMicrosoftEndpoints struct { + // READ-ONLY; Gets the blob endpoint. + Blob *string + + // READ-ONLY; Gets the dfs endpoint. + Dfs *string + + // READ-ONLY; Gets the file endpoint. + File *string + + // READ-ONLY; Gets the queue endpoint. + Queue *string + + // READ-ONLY; Gets the table endpoint. + Table *string + + // READ-ONLY; Gets the web endpoint. + Web *string +} + +// AccountMigration - The parameters or status associated with an ongoing or enqueued storage account migration in order to +// update its current SKU or region. +type AccountMigration struct { + // REQUIRED; The properties of a storage account’s ongoing or enqueued migration. + StorageAccountMigrationDetails *AccountMigrationProperties + + // current value is 'default' for customer initiated migration + Name *string + + // SrpAccountMigrationType in ARM contract which is 'accountMigrations' + Type *string + + // READ-ONLY; Migration Resource Id + ID *string +} + +// AccountMigrationProperties - The properties of a storage account’s ongoing or enqueued migration. +type AccountMigrationProperties struct { + // REQUIRED; Target sku name for the account + TargetSKUName *SKUName + + // READ-ONLY; Reason for migration failure + MigrationFailedDetailedReason *string + + // READ-ONLY; Error code for migration failure + MigrationFailedReason *string + + // READ-ONLY; Current status of migration + MigrationStatus *MigrationStatus +} + +// AccountProperties - Properties of the storage account. +type AccountProperties struct { + // Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is false + // for this property. + AllowBlobPublicAccess *bool + + // Allow or disallow cross AAD tenant object replication. Set this property to true for new or existing accounts only if object + // replication policies will involve storage accounts in different AAD + // tenants. The default interpretation is false for new accounts to follow best security practices by default. + AllowCrossTenantReplication *bool + + // Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If + // false, then all requests, including shared access signatures, must be authorized + // with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. + AllowSharedKeyAccess *bool + + // Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. + AllowedCopyScope *AllowedCopyScope + + // Provides the identity based authentication settings for Azure Files. + AzureFilesIdentityBasedAuthentication *AzureFilesIdentityBasedAuthentication + + // Allows you to specify the type of endpoint. Set this to AzureDNSZone to create a large number of accounts in a single subscription, + // which creates accounts in an Azure DNS Zone and the endpoint URL + // will have an alphanumeric DNS Zone identifier. + DNSEndpointType *DNSEndpointType + + // A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false + // for this property. + DefaultToOAuthAuthentication *bool + + // Allows https traffic only to storage service if sets to true. + EnableHTTPSTrafficOnly *bool + + // NFS 3.0 protocol support enabled if set to true. + EnableNfsV3 *bool + + // The property is immutable and can only be set to true at the account creation time. When set to true, it enables object + // level immutability for all the containers in the account by default. + ImmutableStorageWithVersioning *ImmutableStorageAccount + + // Account HierarchicalNamespace enabled if sets to true. + IsHnsEnabled *bool + + // Enables local users feature, if set to true + IsLocalUserEnabled *bool + + // Enables Secure File Transfer Protocol, if set to true + IsSftpEnabled *bool + + // Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. + LargeFileSharesState *LargeFileSharesState + + // Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. + MinimumTLSVersion *MinimumTLSVersion + + // Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + PublicNetworkAccess *PublicNetworkAccess + + // Maintains information about the network routing choice opted by the user for data transfer + RoutingPreference *RoutingPreference + + // This property is readOnly and is set by server during asynchronous storage account sku conversion operations. + StorageAccountSKUConversionStatus *AccountSKUConversionStatus + + // READ-ONLY; Required for storage accounts where kind = BlobStorage. The access tier is used for billing. The 'Premium' access + // tier is the default value for premium block blobs storage account type and it cannot + // be changed for the premium block blobs storage account type. + AccessTier *AccessTier + + // READ-ONLY; If customer initiated account migration is in progress, the value will be true else it will be null. + AccountMigrationInProgress *bool + + // READ-ONLY; Blob restore status + BlobRestoreStatus *BlobRestoreStatus + + // READ-ONLY; Gets the creation date and time of the storage account in UTC. + CreationTime *time.Time + + // READ-ONLY; Gets the custom domain the user assigned to this storage account. + CustomDomain *CustomDomain + + // READ-ONLY; Encryption settings to be used for server-side encryption for the storage account. + Encryption *Encryption + + // READ-ONLY; If the failover is in progress, the value will be true, otherwise, it will be null. + FailoverInProgress *bool + + // READ-ONLY; Geo Replication Stats + GeoReplicationStats *GeoReplicationStats + + // READ-ONLY; This property will be set to true or false on an event of ongoing migration. Default value is null. + IsSKUConversionBlocked *bool + + // READ-ONLY; Storage account keys creation time. + KeyCreationTime *KeyCreationTime + + // READ-ONLY; KeyPolicy assigned to the storage account. + KeyPolicy *KeyPolicy + + // READ-ONLY; Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent + // timestamp is retained. This element is not returned if there has never been a failover + // instance. Only available if the accountType is StandardGRS or StandardRAGRS. + LastGeoFailoverTime *time.Time + + // READ-ONLY; Network rule set + NetworkRuleSet *NetworkRuleSet + + // READ-ONLY; Gets the URLs that are used to perform a retrieval of a public blob, queue, or table object. Note that StandardZRS + // and PremiumLRS accounts only return the blob endpoint. + PrimaryEndpoints *Endpoints + + // READ-ONLY; Gets the location of the primary data center for the storage account. + PrimaryLocation *string + + // READ-ONLY; List of private endpoint connection associated with the specified storage account + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; Gets the status of the storage account at the time the operation was called. + ProvisioningState *ProvisioningState + + // READ-ONLY; SasPolicy assigned to the storage account. + SasPolicy *SasPolicy + + // READ-ONLY; Gets the URLs that are used to perform a retrieval of a public blob, queue, or table object from the secondary + // location of the storage account. Only available if the SKU name is Standard_RAGRS. + SecondaryEndpoints *Endpoints + + // READ-ONLY; Gets the location of the geo-replicated secondary for the storage account. Only available if the accountType + // is StandardGRS or StandardRAGRS. + SecondaryLocation *string + + // READ-ONLY; Gets the status indicating whether the primary location of the storage account is available or unavailable. + StatusOfPrimary *AccountStatus + + // READ-ONLY; Gets the status indicating whether the secondary location of the storage account is available or unavailable. + // Only available if the SKU name is StandardGRS or StandardRAGRS. + StatusOfSecondary *AccountStatus +} + +// AccountPropertiesCreateParameters - The parameters used to create the storage account. +type AccountPropertiesCreateParameters struct { + // Required for storage accounts where kind = BlobStorage. The access tier is used for billing. The 'Premium' access tier + // is the default value for premium block blobs storage account type and it cannot + // be changed for the premium block blobs storage account type. + AccessTier *AccessTier + + // Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is false + // for this property. + AllowBlobPublicAccess *bool + + // Allow or disallow cross AAD tenant object replication. Set this property to true for new or existing accounts only if object + // replication policies will involve storage accounts in different AAD + // tenants. The default interpretation is false for new accounts to follow best security practices by default. + AllowCrossTenantReplication *bool + + // Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If + // false, then all requests, including shared access signatures, must be authorized + // with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. + AllowSharedKeyAccess *bool + + // Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. + AllowedCopyScope *AllowedCopyScope + + // Provides the identity based authentication settings for Azure Files. + AzureFilesIdentityBasedAuthentication *AzureFilesIdentityBasedAuthentication + + // User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage + // account at this time. To clear the existing custom domain, use an empty string + // for the custom domain name property. + CustomDomain *CustomDomain + + // Allows you to specify the type of endpoint. Set this to AzureDNSZone to create a large number of accounts in a single subscription, + // which creates accounts in an Azure DNS Zone and the endpoint URL + // will have an alphanumeric DNS Zone identifier. + DNSEndpointType *DNSEndpointType + + // A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false + // for this property. + DefaultToOAuthAuthentication *bool + + // Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. + EnableHTTPSTrafficOnly *bool + + // NFS 3.0 protocol support enabled if set to true. + EnableNfsV3 *bool + + // Encryption settings to be used for server-side encryption for the storage account. + Encryption *Encryption + + // The property is immutable and can only be set to true at the account creation time. When set to true, it enables object + // level immutability for all the new containers in the account by default. + ImmutableStorageWithVersioning *ImmutableStorageAccount + + // Account HierarchicalNamespace enabled if sets to true. + IsHnsEnabled *bool + + // Enables local users feature, if set to true + IsLocalUserEnabled *bool + + // Enables Secure File Transfer Protocol, if set to true + IsSftpEnabled *bool + + // KeyPolicy assigned to the storage account. + KeyPolicy *KeyPolicy + + // Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. + LargeFileSharesState *LargeFileSharesState + + // Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. + MinimumTLSVersion *MinimumTLSVersion + + // Network rule set + NetworkRuleSet *NetworkRuleSet + + // Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + PublicNetworkAccess *PublicNetworkAccess + + // Maintains information about the network routing choice opted by the user for data transfer + RoutingPreference *RoutingPreference + + // SasPolicy assigned to the storage account. + SasPolicy *SasPolicy +} + +// AccountPropertiesUpdateParameters - The parameters used when updating a storage account. +type AccountPropertiesUpdateParameters struct { + // Required for storage accounts where kind = BlobStorage. The access tier is used for billing. The 'Premium' access tier + // is the default value for premium block blobs storage account type and it cannot + // be changed for the premium block blobs storage account type. + AccessTier *AccessTier + + // Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is false + // for this property. + AllowBlobPublicAccess *bool + + // Allow or disallow cross AAD tenant object replication. Set this property to true for new or existing accounts only if object + // replication policies will involve storage accounts in different AAD + // tenants. The default interpretation is false for new accounts to follow best security practices by default. + AllowCrossTenantReplication *bool + + // Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If + // false, then all requests, including shared access signatures, must be authorized + // with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. + AllowSharedKeyAccess *bool + + // Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. + AllowedCopyScope *AllowedCopyScope + + // Provides the identity based authentication settings for Azure Files. + AzureFilesIdentityBasedAuthentication *AzureFilesIdentityBasedAuthentication + + // Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported + // per storage account at this time. To clear the existing custom domain, use an + // empty string for the custom domain name property. + CustomDomain *CustomDomain + + // Allows you to specify the type of endpoint. Set this to AzureDNSZone to create a large number of accounts in a single subscription, + // which creates accounts in an Azure DNS Zone and the endpoint URL + // will have an alphanumeric DNS Zone identifier. + DNSEndpointType *DNSEndpointType + + // A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false + // for this property. + DefaultToOAuthAuthentication *bool + + // Allows https traffic only to storage service if sets to true. + EnableHTTPSTrafficOnly *bool + + // Not applicable. Azure Storage encryption at rest is enabled by default for all storage accounts and cannot be disabled. + Encryption *Encryption + + // The property is immutable and can only be set to true at the account creation time. When set to true, it enables object + // level immutability for all the containers in the account by default. + ImmutableStorageWithVersioning *ImmutableStorageAccount + + // Enables local users feature, if set to true + IsLocalUserEnabled *bool + + // Enables Secure File Transfer Protocol, if set to true + IsSftpEnabled *bool + + // KeyPolicy assigned to the storage account. + KeyPolicy *KeyPolicy + + // Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. + LargeFileSharesState *LargeFileSharesState + + // Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. + MinimumTLSVersion *MinimumTLSVersion + + // Network rule set + NetworkRuleSet *NetworkRuleSet + + // Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + PublicNetworkAccess *PublicNetworkAccess + + // Maintains information about the network routing choice opted by the user for data transfer + RoutingPreference *RoutingPreference + + // SasPolicy assigned to the storage account. + SasPolicy *SasPolicy +} + +// AccountRegenerateKeyParameters - The parameters used to regenerate the storage account key. +type AccountRegenerateKeyParameters struct { + // REQUIRED; The name of storage keys that want to be regenerated, possible values are key1, key2, kerb1, kerb2. + KeyName *string +} + +// AccountSKUConversionStatus - This defines the sku conversion status object for asynchronous sku conversions. +type AccountSKUConversionStatus struct { + // This property represents the target sku name to which the account sku is being converted asynchronously. + TargetSKUName *SKUName + + // READ-ONLY; This property represents the sku conversion end time. + EndTime *string + + // READ-ONLY; This property indicates the current sku conversion status. + SKUConversionStatus *SKUConversionStatus + + // READ-ONLY; This property represents the sku conversion start time. + StartTime *string +} + +// AccountSasParameters - The parameters to list SAS credentials of a storage account. +type AccountSasParameters struct { + // REQUIRED; The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), + // Add (a), Create (c), Update (u) and Process (p). + Permissions *Permissions + + // REQUIRED; The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; + // Container (c): Access to container-level APIs; Object (o): Access to object-level APIs + // for blobs, queue messages, table entities, and files. + ResourceTypes *SignedResourceTypes + + // REQUIRED; The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), + // File (f). + Services *Services + + // REQUIRED; The time at which the shared access signature becomes invalid. + SharedAccessExpiryTime *time.Time + + // An IP address or a range of IP addresses from which to accept requests. + IPAddressOrRange *string + + // The key to sign the account SAS token with. + KeyToSign *string + + // The protocol permitted for a request made with the account SAS. + Protocols *HTTPProtocol + + // The time at which the SAS becomes valid. + SharedAccessStartTime *time.Time +} + +// AccountUpdateParameters - The parameters that can be provided when updating the storage account properties. +type AccountUpdateParameters struct { + // The identity of the resource. + Identity *Identity + + // Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. + Kind *Kind + + // The parameters used when updating a storage account. + Properties *AccountPropertiesUpdateParameters + + // Gets or sets the SKU name. Note that the SKU name cannot be updated to StandardZRS, PremiumLRS or Premium_ZRS, nor can + // accounts of those SKU names be updated to any other value. + SKU *SKU + + // Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this + // resource (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. + Tags map[string]*string +} + +// ActiveDirectoryProperties - Settings properties for Active Directory (AD). +type ActiveDirectoryProperties struct { + // REQUIRED; Specifies the domain GUID. + DomainGUID *string + + // REQUIRED; Specifies the primary domain that the AD DNS server is authoritative for. + DomainName *string + + // Specifies the Active Directory account type for Azure Storage. + AccountType *ActiveDirectoryPropertiesAccountType + + // Specifies the security identifier (SID) for Azure Storage. + AzureStorageSid *string + + // Specifies the security identifier (SID). + DomainSid *string + + // Specifies the Active Directory forest to get. + ForestName *string + + // Specifies the NetBIOS domain name. + NetBiosDomainName *string + + // Specifies the Active Directory SAMAccountName for Azure Storage. + SamAccountName *string +} + +// AzureEntityResource - The resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AzureFilesIdentityBasedAuthentication - Settings for Azure Files identity based authentication. +type AzureFilesIdentityBasedAuthentication struct { + // REQUIRED; Indicates the directory service used. Note that this enum may be extended in the future. + DirectoryServiceOptions *DirectoryServiceOptions + + // Required if directoryServiceOptions are AD, optional if they are AADKERB. + ActiveDirectoryProperties *ActiveDirectoryProperties + + // Default share permission for users using Kerberos authentication if RBAC role is not assigned. + DefaultSharePermission *DefaultSharePermission +} + +// BlobContainer - Properties of the blob container, including Id, resource name, resource type, Etag. +type BlobContainer struct { + // Properties of the blob container. + ContainerProperties *ContainerProperties + + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BlobInventoryCreationTime - This property defines the creation time based filtering condition. Blob Inventory schema parameter +// 'Creation-Time' is mandatory with this filter. +type BlobInventoryCreationTime struct { + // When set the policy filters the objects that are created in the last N days. Where N is an integer value between 1 to 36500. + LastNDays *int32 +} + +// BlobInventoryPolicy - The storage account blob inventory policy. +type BlobInventoryPolicy struct { + // Returns the storage account blob inventory policy rules. + Properties *BlobInventoryPolicyProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BlobInventoryPolicyDefinition - An object that defines the blob inventory rule. +type BlobInventoryPolicyDefinition struct { + // REQUIRED; This is a required field, it specifies the format for the inventory files. + Format *Format + + // REQUIRED; This is a required field. This field specifies the scope of the inventory created either at the blob or container + // level. + ObjectType *ObjectType + + // REQUIRED; This is a required field. This field is used to schedule an inventory formation. + Schedule *Schedule + + // REQUIRED; This is a required field. This field specifies the fields and properties of the object to be included in the + // inventory. The Schema field value 'Name' is always required. The valid values for this + // field for the 'Blob' definition.objectType include 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, + // AccessTier, AccessTierChangeTime, AccessTierInferred, Tags, Expiry-Time, + // hdiisfolder, Owner, Group, Permissions, Acl, Snapshot, VersionId, IsCurrentVersion, Metadata, LastAccessTime, Tags, Etag, + // ContentType, ContentEncoding, ContentLanguage, ContentCRC64, CacheControl, + // ContentDisposition, LeaseStatus, LeaseState, LeaseDuration, ServerEncrypted, Deleted, DeletionId, DeletedTime, RemainingRetentionDays, + // ImmutabilityPolicyUntilDate, ImmutabilityPolicyMode, LegalHold, + // CopyId, CopyStatus, CopySource, CopyProgress, CopyCompletionTime, CopyStatusDescription, CustomerProvidedKeySha256, RehydratePriority, + // ArchiveStatus, XmsBlobSequenceNumber, EncryptionScope, + // IncrementalCopy, TagCount'. For Blob object type schema field value 'DeletedTime' is applicable only for Hns enabled accounts. + // The valid values for 'Container' definition.objectType include 'Name, + // Last-Modified, Metadata, LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold, Etag, + // DefaultEncryptionScope, DenyEncryptionScopeOverride, + // ImmutableStorageWithVersioningEnabled, Deleted, Version, DeletedTime, RemainingRetentionDays'. Schema field values 'Expiry-Time, + // hdiisfolder, Owner, Group, Permissions, Acl, DeletionId' are valid only + // for Hns enabled accounts.Schema field values 'Tags, TagCount' are only valid for Non-Hns accounts. + SchemaFields []*string + + // An object that defines the filter set. + Filters *BlobInventoryPolicyFilter +} + +// BlobInventoryPolicyFilter - An object that defines the blob inventory rule filter conditions. For 'Blob' definition.objectType +// all filter properties are applicable, 'blobTypes' is required and others are optional. For +// 'Container' definition.objectType only prefixMatch is applicable and is optional. +type BlobInventoryPolicyFilter struct { + // An array of predefined enum values. Valid values include blockBlob, appendBlob, pageBlob. Hns accounts does not support + // pageBlobs. This field is required when definition.objectType property is set to + // 'Blob'. + BlobTypes []*string + + // This property is used to filter objects based on the object creation time + CreationTime *BlobInventoryCreationTime + + // An array of strings with maximum 10 blob prefixes to be excluded from the inventory. + ExcludePrefix []*string + + // Includes blob versions in blob inventory when value is set to true. The definition.schemaFields values 'VersionId and IsCurrentVersion' + // are required if this property is set to true, else they must be + // excluded. + IncludeBlobVersions *bool + + // For 'Container' definition.objectType the definition.schemaFields must include 'Deleted, Version, DeletedTime and RemainingRetentionDays'. + // For 'Blob' definition.objectType and HNS enabled storage + // accounts the definition.schemaFields must include 'DeletionId, Deleted, DeletedTime and RemainingRetentionDays' and for + // Hns disabled accounts the definition.schemaFields must include 'Deleted and + // RemainingRetentionDays', else it must be excluded. + IncludeDeleted *bool + + // Includes blob snapshots in blob inventory when value is set to true. The definition.schemaFields value 'Snapshot' is required + // if this property is set to true, else it must be excluded. + IncludeSnapshots *bool + + // An array of strings with maximum 10 blob prefixes to be included in the inventory. + PrefixMatch []*string +} + +// BlobInventoryPolicyProperties - The storage account blob inventory policy properties. +type BlobInventoryPolicyProperties struct { + // REQUIRED; The storage account blob inventory policy object. It is composed of policy rules. + Policy *BlobInventoryPolicySchema + + // READ-ONLY; Returns the last modified date and time of the blob inventory policy. + LastModifiedTime *time.Time +} + +// BlobInventoryPolicyRule - An object that wraps the blob inventory rule. Each rule is uniquely defined by name. +type BlobInventoryPolicyRule struct { + // REQUIRED; An object that defines the blob inventory policy rule. + Definition *BlobInventoryPolicyDefinition + + // REQUIRED; Container name where blob inventory files are stored. Must be pre-created. + Destination *string + + // REQUIRED; Rule is enabled when set to true. + Enabled *bool + + // REQUIRED; A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be + // unique within a policy. + Name *string +} + +// BlobInventoryPolicySchema - The storage account blob inventory policy rules. +type BlobInventoryPolicySchema struct { + // REQUIRED; Policy is enabled if set to true. + Enabled *bool + + // REQUIRED; The storage account blob inventory policy rules. The rule is applied when it is enabled. + Rules []*BlobInventoryPolicyRule + + // REQUIRED; The valid value is Inventory + Type *InventoryRuleType + + // READ-ONLY; Deprecated Property from API version 2021-04-01 onwards, the required destination container name must be specified + // at the rule level 'policy.rule.destination' + Destination *string +} + +// BlobRestoreParameters - Blob restore parameters +type BlobRestoreParameters struct { + // REQUIRED; Blob ranges to restore. + BlobRanges []*BlobRestoreRange + + // REQUIRED; Restore blob to the specified time. + TimeToRestore *time.Time +} + +// BlobRestoreRange - Blob range +type BlobRestoreRange struct { + // REQUIRED; Blob end range. This is exclusive. Empty means account end. + EndRange *string + + // REQUIRED; Blob start range. This is inclusive. Empty means account start. + StartRange *string +} + +// BlobRestoreStatus - Blob restore status. +type BlobRestoreStatus struct { + // READ-ONLY; Failure reason when blob restore is failed. + FailureReason *string + + // READ-ONLY; Blob restore request parameters. + Parameters *BlobRestoreParameters + + // READ-ONLY; Id for tracking blob restore request. + RestoreID *string + + // READ-ONLY; The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. + // - Complete: Indicates that blob restore has been completed successfully. - Failed: + // Indicates that blob restore is failed. + Status *BlobRestoreProgressStatus +} + +type BlobServiceItems struct { + // READ-ONLY; List of blob services returned. + Value []*BlobServiceProperties +} + +// BlobServiceProperties - The properties of a storage account’s Blob service. +type BlobServiceProperties struct { + // The properties of a storage account’s Blob service. + BlobServiceProperties *BlobServicePropertiesProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Sku name and tier. + SKU *SKU + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BlobServicePropertiesProperties - The properties of a storage account’s Blob service. +type BlobServicePropertiesProperties struct { + // Deprecated in favor of isVersioningEnabled property. + AutomaticSnapshotPolicyEnabled *bool + + // The blob service properties for change feed events. + ChangeFeed *ChangeFeed + + // The blob service properties for container soft delete. + ContainerDeleteRetentionPolicy *DeleteRetentionPolicy + + // Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule + // elements are included in the request body, all CORS rules will be deleted, and + // CORS will be disabled for the Blob service. + Cors *CorsRules + + // DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version + // is not specified. Possible values include version 2008-10-27 and all more + // recent versions. + DefaultServiceVersion *string + + // The blob service properties for blob soft delete. + DeleteRetentionPolicy *DeleteRetentionPolicy + + // Versioning is enabled if set to true. + IsVersioningEnabled *bool + + // The blob service property to configure last access time based tracking policy. + LastAccessTimeTrackingPolicy *LastAccessTimeTrackingPolicy + + // The blob service properties for blob restore policy. + RestorePolicy *RestorePolicyProperties +} + +// ChangeFeed - The blob service properties for change feed events. +type ChangeFeed struct { + // Indicates whether change feed event logging is enabled for the Blob service. + Enabled *bool + + // Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). + // A null value indicates an infinite retention of the change feed. + RetentionInDays *int32 +} + +// CheckNameAvailabilityResult - The CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + // READ-ONLY; Gets an error message explaining the Reason value in more detail. + Message *string + + // READ-ONLY; Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. + // If false, the name has already been taken or is invalid and cannot be used. + NameAvailable *bool + + // READ-ONLY; Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable + // is false. + Reason *Reason +} + +// ContainerProperties - The properties of a container. +type ContainerProperties struct { + // Default the container to use specified encryption scope for all writes. + DefaultEncryptionScope *string + + // Block override of encryption scope from the container default. + DenyEncryptionScopeOverride *bool + + // Enable NFSv3 all squash on blob container. + EnableNfsV3AllSquash *bool + + // Enable NFSv3 root squash on blob container. + EnableNfsV3RootSquash *bool + + // The object level immutability property of the container. The property is immutable and can only be set to true at the container + // creation time. Existing containers must undergo a migration process. + ImmutableStorageWithVersioning *ImmutableStorageWithVersioning + + // A name-value pair to associate with the container as metadata. + Metadata map[string]*string + + // Specifies whether data in the container may be accessed publicly and the level of access. + PublicAccess *PublicAccess + + // READ-ONLY; Indicates whether the blob container was deleted. + Deleted *bool + + // READ-ONLY; Blob container deletion time. + DeletedTime *time.Time + + // READ-ONLY; The hasImmutabilityPolicy public property is set to true by SRP if ImmutabilityPolicy has been created for this + // container. The hasImmutabilityPolicy public property is set to false by SRP if + // ImmutabilityPolicy has not been created for this container. + HasImmutabilityPolicy *bool + + // READ-ONLY; The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold + // public property is set to false by SRP if all existing legal hold tags are cleared out. + // There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. + HasLegalHold *bool + + // READ-ONLY; The ImmutabilityPolicy property of the container. + ImmutabilityPolicy *ImmutabilityPolicyProperties + + // READ-ONLY; Returns the date and time the container was last modified. + LastModifiedTime *time.Time + + // READ-ONLY; Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. + LeaseDuration *LeaseDuration + + // READ-ONLY; Lease state of the container. + LeaseState *LeaseState + + // READ-ONLY; The lease status of the container. + LeaseStatus *LeaseStatus + + // READ-ONLY; The LegalHold property of the container. + LegalHold *LegalHoldProperties + + // READ-ONLY; Remaining retention days for soft deleted blob container. + RemainingRetentionDays *int32 + + // READ-ONLY; The version of the deleted blob container. + Version *string +} + +// CorsRule - Specifies a CORS rule for the Blob service. +type CorsRule struct { + // REQUIRED; Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. + AllowedHeaders []*string + + // REQUIRED; Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. + AllowedMethods []*CorsRuleAllowedMethodsItem + + // REQUIRED; Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow + // all domains + AllowedOrigins []*string + + // REQUIRED; Required if CorsRule element is present. A list of response headers to expose to CORS clients. + ExposedHeaders []*string + + // REQUIRED; Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight + // response. + MaxAgeInSeconds *int32 +} + +// CorsRules - Sets the CORS rules. You can include up to five CorsRule elements in the request. +type CorsRules struct { + // The List of CORS rules. You can include up to five CorsRule elements in the request. + CorsRules []*CorsRule +} + +// CustomDomain - The custom domain assigned to this storage account. This can be set via Update. +type CustomDomain struct { + // REQUIRED; Gets or sets the custom domain name assigned to the storage account. Name is the CNAME source. + Name *string + + // Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + UseSubDomainName *bool +} + +// DateAfterCreation - Object to define snapshot and version action conditions. +type DateAfterCreation struct { + // REQUIRED; Value indicating the age in days after creation + DaysAfterCreationGreaterThan *float32 + + // Value indicating the age in days after last blob tier change time. This property is only applicable for tierToArchive actions + // and requires daysAfterCreationGreaterThan to be set for snapshots and blob + // version based actions. The blob will be archived if both the conditions are satisfied. + DaysAfterLastTierChangeGreaterThan *float32 +} + +// DateAfterModification - Object to define the base blob action conditions. Properties daysAfterModificationGreaterThan, +// daysAfterLastAccessTimeGreaterThan and daysAfterCreationGreaterThan are mutually exclusive. The +// daysAfterLastTierChangeGreaterThan property is only applicable for tierToArchive actions which requires daysAfterModificationGreaterThan +// to be set, also it cannot be used in conjunction with +// daysAfterLastAccessTimeGreaterThan or daysAfterCreationGreaterThan. +type DateAfterModification struct { + // Value indicating the age in days after blob creation. + DaysAfterCreationGreaterThan *float32 + + // Value indicating the age in days after last blob access. This property can only be used in conjunction with last access + // time tracking policy + DaysAfterLastAccessTimeGreaterThan *float32 + + // Value indicating the age in days after last blob tier change time. This property is only applicable for tierToArchive actions + // and requires daysAfterModificationGreaterThan to be set for baseBlobs + // based actions. The blob will be archived if both the conditions are satisfied. + DaysAfterLastTierChangeGreaterThan *float32 + + // Value indicating the age in days after last modification + DaysAfterModificationGreaterThan *float32 +} + +// DeleteRetentionPolicy - The service properties for soft delete. +type DeleteRetentionPolicy struct { + // This property when set to true allows deletion of the soft deleted blob versions and snapshots. This property cannot be + // used blob restore policy. This property only applies to blob service and does + // not apply to containers or file share. + AllowPermanentDelete *bool + + // Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum + // value can be 365. + Days *int32 + + // Indicates whether DeleteRetentionPolicy is enabled. + Enabled *bool +} + +// DeletedAccount - Deleted storage account +type DeletedAccount struct { + // Properties of the deleted account. + Properties *DeletedAccountProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DeletedAccountListResult - The response from the List Deleted Accounts operation. +type DeletedAccountListResult struct { + // READ-ONLY; Request URL that can be used to query next page of deleted accounts. Returned when total number of requested + // deleted accounts exceed maximum page size. + NextLink *string + + // READ-ONLY; Gets the list of deleted accounts and their properties. + Value []*DeletedAccount +} + +// DeletedAccountProperties - Attributes of a deleted storage account. +type DeletedAccountProperties struct { + // READ-ONLY; Creation time of the deleted account. + CreationTime *string + + // READ-ONLY; Deletion time of the deleted account. + DeletionTime *string + + // READ-ONLY; Location of the deleted account. + Location *string + + // READ-ONLY; Can be used to attempt recovering this deleted account via PutStorageAccount API. + RestoreReference *string + + // READ-ONLY; Full resource id of the original storage account. + StorageAccountResourceID *string +} + +// DeletedShare - The deleted share to be restored. +type DeletedShare struct { + // REQUIRED; Required. Identify the name of the deleted share that will be restored. + DeletedShareName *string + + // REQUIRED; Required. Identify the version of the deleted share that will be restored. + DeletedShareVersion *string +} + +// Dimension of blobs, possibly be blob type or access tier. +type Dimension struct { + // Display name of dimension. + DisplayName *string + + // Display name of dimension. + Name *string +} + +// Encryption - The encryption settings on the storage account. +type Encryption struct { + // The identity to be used with service-side encryption at rest. + EncryptionIdentity *EncryptionIdentity + + // The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault + KeySource *KeySource + + // Properties provided by key vault. + KeyVaultProperties *KeyVaultProperties + + // A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for + // data at rest. + RequireInfrastructureEncryption *bool + + // List of services which support encryption. + Services *EncryptionServices +} + +// EncryptionIdentity - Encryption identity for the storage account. +type EncryptionIdentity struct { + // ClientId of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys + // server-side encryption on the storage account. + EncryptionFederatedIdentityClientID *string + + // Resource identifier of the UserAssigned identity to be associated with server-side encryption on the storage account. + EncryptionUserAssignedIdentity *string +} + +// EncryptionScope - The Encryption Scope resource. +type EncryptionScope struct { + // Properties of the encryption scope. + EncryptionScopeProperties *EncryptionScopeProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EncryptionScopeKeyVaultProperties - The key vault properties for the encryption scope. This is a required field if encryption +// scope 'source' attribute is set to 'Microsoft.KeyVault'. +type EncryptionScopeKeyVaultProperties struct { + // The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the + // identifier to enable customer-managed key support on this encryption scope. + KeyURI *string + + // READ-ONLY; The object identifier of the current versioned Key Vault Key in use. + CurrentVersionedKeyIdentifier *string + + // READ-ONLY; Timestamp of last rotation of the Key Vault Key. + LastKeyRotationTimestamp *time.Time +} + +// EncryptionScopeListResult - List of encryption scopes requested, and if paging is required, a URL to the next page of encryption +// scopes. +type EncryptionScopeListResult struct { + // READ-ONLY; Request URL that can be used to query next page of encryption scopes. Returned when total number of requested + // encryption scopes exceeds the maximum page size. + NextLink *string + + // READ-ONLY; List of encryption scopes requested. + Value []*EncryptionScope +} + +// EncryptionScopeProperties - Properties of the encryption scope. +type EncryptionScopeProperties struct { + // The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set + // to 'Microsoft.KeyVault'. + KeyVaultProperties *EncryptionScopeKeyVaultProperties + + // A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for + // data at rest. + RequireInfrastructureEncryption *bool + + // The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. + Source *EncryptionScopeSource + + // The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. + State *EncryptionScopeState + + // READ-ONLY; Gets the creation date and time of the encryption scope in UTC. + CreationTime *time.Time + + // READ-ONLY; Gets the last modification date and time of the encryption scope in UTC. + LastModifiedTime *time.Time +} + +// EncryptionService - A service that allows server-side encryption to be used. +type EncryptionService struct { + // A boolean indicating whether or not the service encrypts the data as it is stored. Encryption at rest is enabled by default + // today and cannot be disabled. + Enabled *bool + + // Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption + // key will be used. 'Service' key type implies that a default service key is used. + KeyType *KeyType + + // READ-ONLY; Gets a rough estimate of the date/time when the encryption was last enabled by the user. Data is encrypted at + // rest by default today and cannot be disabled. + LastEnabledTime *time.Time +} + +// EncryptionServices - A list of services that support encryption. +type EncryptionServices struct { + // The encryption function of the blob storage service. + Blob *EncryptionService + + // The encryption function of the file storage service. + File *EncryptionService + + // The encryption function of the queue storage service. + Queue *EncryptionService + + // The encryption function of the table storage service. + Table *EncryptionService +} + +// Endpoints - The URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs object. +type Endpoints struct { + // Gets the internet routing storage endpoints + InternetEndpoints *AccountInternetEndpoints + + // Gets the microsoft routing storage endpoints. + MicrosoftEndpoints *AccountMicrosoftEndpoints + + // READ-ONLY; Gets the blob endpoint. + Blob *string + + // READ-ONLY; Gets the dfs endpoint. + Dfs *string + + // READ-ONLY; Gets the file endpoint. + File *string + + // READ-ONLY; Gets the queue endpoint. + Queue *string + + // READ-ONLY; Gets the table endpoint. + Table *string + + // READ-ONLY; Gets the web endpoint. + Web *string +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// ErrorResponse - An error response from the storage resource provider. +type ErrorResponse struct { + // Azure Storage Resource Provider error response body. + Error *ErrorResponseBody +} + +// ErrorResponseAutoGenerated - 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 ErrorResponseAutoGenerated struct { + // The error object. + Error *ErrorDetail +} + +// ErrorResponseBody - Error response body contract. +type ErrorResponseBody struct { + // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string + + // A message describing the error, intended to be suitable for display in a user interface. + Message *string +} + +// ExtendedLocation - The complex type of the extended location. +type ExtendedLocation struct { + // The name of the extended location. + Name *string + + // The type of the extended location. + Type *ExtendedLocationTypes +} + +type FileServiceItems struct { + // READ-ONLY; List of file services returned. + Value []*FileServiceProperties +} + +// FileServiceProperties - The properties of File services in storage account. +type FileServiceProperties struct { + // The properties of File services in storage account. + FileServiceProperties *FileServicePropertiesProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Sku name and tier. + SKU *SKU + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FileServicePropertiesProperties - The properties of File services in storage account. +type FileServicePropertiesProperties struct { + // Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule + // elements are included in the request body, all CORS rules will be deleted, and + // CORS will be disabled for the File service. + Cors *CorsRules + + // Protocol settings for file service + ProtocolSettings *ProtocolSettings + + // The file service properties for share soft delete. + ShareDeleteRetentionPolicy *DeleteRetentionPolicy +} + +// FileShare - Properties of the file share, including Id, resource name, resource type, Etag. +type FileShare struct { + // Properties of the file share. + FileShareProperties *FileShareProperties + + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FileShareItem - The file share properties be listed out. +type FileShareItem struct { + // The file share properties be listed out. + Properties *FileShareProperties + + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FileShareItems - Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next +// page of shares. +type FileShareItems struct { + // READ-ONLY; Request URL that can be used to query next page of shares. Returned when total number of requested shares exceed + // maximum page size. + NextLink *string + + // READ-ONLY; List of file shares returned. + Value []*FileShareItem +} + +// FileShareProperties - The properties of the file share. +type FileShareProperties struct { + // Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage + // account can choose Premium. + AccessTier *ShareAccessTier + + // The authentication protocol that is used for the file share. Can only be specified when creating a share. + EnabledProtocols *EnabledProtocols + + // A name-value pair to associate with the share as metadata. + Metadata map[string]*string + + // The property is for NFS share only. The default is NoRootSquash. + RootSquash *RootSquashType + + // The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File + // Shares, the maximum size is 102400. + ShareQuota *int32 + + // List of stored access policies specified on the share. + SignedIdentifiers []*SignedIdentifier + + // READ-ONLY; Indicates the last modification time for share access tier. + AccessTierChangeTime *time.Time + + // READ-ONLY; Indicates if there is a pending transition for access tier. + AccessTierStatus *string + + // READ-ONLY; Indicates whether the share was deleted. + Deleted *bool + + // READ-ONLY; The deleted time if the share was deleted. + DeletedTime *time.Time + + // READ-ONLY; Returns the date and time the share was last modified. + LastModifiedTime *time.Time + + // READ-ONLY; Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased. + LeaseDuration *LeaseDuration + + // READ-ONLY; Lease state of the share. + LeaseState *LeaseState + + // READ-ONLY; The lease status of the share. + LeaseStatus *LeaseStatus + + // READ-ONLY; Remaining retention days for share that was soft deleted. + RemainingRetentionDays *int32 + + // READ-ONLY; The approximate size of the data stored on the share. Note that this value may not include all recently created + // or recently resized files. + ShareUsageBytes *int64 + + // READ-ONLY; Creation time of share snapshot returned in the response of list shares with expand param "snapshots". + SnapshotTime *time.Time + + // READ-ONLY; The version of the share. + Version *string +} + +// GeoReplicationStats - Statistics related to replication for storage account's Blob, Table, Queue and File services. It +// is only available when geo-redundant replication is enabled for the storage account. +type GeoReplicationStats struct { + // READ-ONLY; A boolean flag which indicates whether or not account failover is supported for the account. + CanFailover *bool + + // READ-ONLY; A boolean flag which indicates whether or not planned account failover is supported for the account. + CanPlannedFailover *bool + + // READ-ONLY; All primary writes preceding this UTC date/time value are guaranteed to be available for read operations. Primary + // writes following this point in time may or may not be available for reads. Element may + // be default value if value of LastSyncTime is not available, this can happen if secondary is offline or we are in bootstrap. + LastSyncTime *time.Time + + // READ-ONLY; The redundancy type of the account after an account failover is performed. + PostFailoverRedundancy *PostFailoverRedundancy + + // READ-ONLY; The redundancy type of the account after a planned account failover is performed. + PostPlannedFailoverRedundancy *PostPlannedFailoverRedundancy + + // READ-ONLY; The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is + // active and operational. - Bootstrap: Indicates initial synchronization from the primary + // location to the secondary location is in progress.This typically occurs when replication is first enabled. - Unavailable: + // Indicates that the secondary location is temporarily unavailable. + Status *GeoReplicationStatus +} + +// IPRule - IP rule with specific IP or IP range in CIDR format. +type IPRule struct { + // REQUIRED; Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. + IPAddressOrRange *string + + // The action of IP ACL rule. + Action *string +} + +// Identity for the resource. +type Identity struct { + // REQUIRED; The identity type. + Type *IdentityType + + // Gets or sets a list of key value pairs that describe the set of User Assigned identities that will be used with this storage + // account. The key is the ARM resource identifier of the identity. Only 1 + // User Assigned identity is permitted here. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of resource. + TenantID *string +} + +// ImmutabilityPolicy - The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. +type ImmutabilityPolicy struct { + // REQUIRED; The properties of an ImmutabilityPolicy of a blob container. + Properties *ImmutabilityPolicyProperty + + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ImmutabilityPolicyProperties - The properties of an ImmutabilityPolicy of a blob container. +type ImmutabilityPolicyProperties struct { + // The properties of an ImmutabilityPolicy of a blob container. + Properties *ImmutabilityPolicyProperty + + // READ-ONLY; ImmutabilityPolicy Etag. + Etag *string + + // READ-ONLY; The ImmutabilityPolicy update history of the blob container. + UpdateHistory []*UpdateHistoryProperty +} + +// ImmutabilityPolicyProperty - The properties of an ImmutabilityPolicy of a blob container. +type ImmutabilityPolicyProperty struct { + // This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to + // an append blob while maintaining immutability protection and compliance. Only + // new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy + // API. + AllowProtectedAppendWrites *bool + + // This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to + // both 'Append and Bock Blobs' while maintaining immutability protection and + // compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be + // changed with ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + // 'allowProtectedAppendWritesAll' properties are mutually exclusive. + AllowProtectedAppendWritesAll *bool + + // The immutability period for the blobs in the container since the policy creation, in days. + ImmutabilityPeriodSinceCreationInDays *int32 + + // READ-ONLY; The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. + State *ImmutabilityPolicyState +} + +// ImmutableStorageAccount - This property enables and defines account-level immutability. Enabling the feature auto-enables +// Blob Versioning. +type ImmutableStorageAccount struct { + // A boolean flag which enables account-level immutability. All the containers under such an account have object-level immutability + // enabled by default. + Enabled *bool + + // Specifies the default account-level immutability policy which is inherited and applied to objects that do not possess an + // explicit immutability policy at the object level. The object-level immutability + // policy has higher precedence than the container-level immutability policy, which has a higher precedence than the account-level + // immutability policy. + ImmutabilityPolicy *AccountImmutabilityPolicyProperties +} + +// ImmutableStorageWithVersioning - Object level immutability properties of the container. +type ImmutableStorageWithVersioning struct { + // This is an immutable property, when set to true it enables object level immutability at the container level. + Enabled *bool + + // READ-ONLY; This property denotes the container level immutability to object level immutability migration state. + MigrationState *MigrationState + + // READ-ONLY; Returns the date and time the object level immutability was enabled. + TimeStamp *time.Time +} + +// KeyCreationTime - Storage account keys creation time. +type KeyCreationTime struct { + Key1 *time.Time + Key2 *time.Time +} + +// KeyPolicy assigned to the storage account. +type KeyPolicy struct { + // REQUIRED; The key expiration period in days. + KeyExpirationPeriodInDays *int32 +} + +// KeyVaultProperties - Properties of key vault. +type KeyVaultProperties struct { + // The name of KeyVault key. + KeyName *string + + // The Uri of KeyVault. + KeyVaultURI *string + + // The version of KeyVault key. + KeyVersion *string + + // READ-ONLY; This is a read only property that represents the expiration time of the current version of the customer managed + // key used for encryption. + CurrentVersionedKeyExpirationTimestamp *time.Time + + // READ-ONLY; The object identifier of the current versioned Key Vault Key in use. + CurrentVersionedKeyIdentifier *string + + // READ-ONLY; Timestamp of last rotation of the Key Vault Key. + LastKeyRotationTimestamp *time.Time +} + +// LastAccessTimeTrackingPolicy - The blob service properties for Last access time based tracking policy. +type LastAccessTimeTrackingPolicy struct { + // REQUIRED; When set to true last access time based tracking is enabled. + Enable *bool + + // An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only + BlobType []*string + + // Name of the policy. The valid value is AccessTimeTracking. This field is currently read only + Name *Name + + // The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This + // field is currently read only with value as 1 + TrackingGranularityInDays *int32 +} + +// LeaseContainerRequest - Lease Container request schema. +type LeaseContainerRequest struct { + // REQUIRED; Specifies the lease action. Can be one of the available actions. + Action *LeaseContainerRequestAction + + // Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and + // 60. + BreakPeriod *int32 + + // Required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. + LeaseDuration *int32 + + // Identifies the lease. Can be specified in any valid GUID string format. + LeaseID *string + + // Optional for acquire, required for change. Proposed lease ID, in a GUID string format. + ProposedLeaseID *string +} + +// LeaseContainerResponse - Lease Container response schema. +type LeaseContainerResponse struct { + // Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release + // the lease. + LeaseID *string + + // Approximate time remaining in the lease period, in seconds. + LeaseTimeSeconds *string +} + +// LeaseShareRequest - Lease Share request schema. +type LeaseShareRequest struct { + // REQUIRED; Specifies the lease action. Can be one of the available actions. + Action *LeaseShareAction + + // Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and + // 60. + BreakPeriod *int32 + + // Required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. + LeaseDuration *int32 + + // Identifies the lease. Can be specified in any valid GUID string format. + LeaseID *string + + // Optional for acquire, required for change. Proposed lease ID, in a GUID string format. + ProposedLeaseID *string +} + +// LeaseShareResponse - Lease Share response schema. +type LeaseShareResponse struct { + // Returned unique lease ID that must be included with any request to delete the share, or to renew, change, or release the + // lease. + LeaseID *string + + // Approximate time remaining in the lease period, in seconds. + LeaseTimeSeconds *string +} + +// LegalHold - The LegalHold property of a blob container. +type LegalHold struct { + // REQUIRED; Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + Tags []*string + + // When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining legal hold protection and compliance. + // Only new blocks can be added and any existing blocks cannot be modified + // or deleted. + AllowProtectedAppendWritesAll *bool + + // READ-ONLY; The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold + // public property is set to false by SRP if all existing legal hold tags are cleared out. + // There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. + HasLegalHold *bool +} + +// LegalHoldProperties - The LegalHold property of a blob container. +type LegalHoldProperties struct { + // Protected append blob writes history. + ProtectedAppendWritesHistory *ProtectedAppendWritesHistory + + // The list of LegalHold tags of a blob container. + Tags []*TagProperty + + // READ-ONLY; The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold + // public property is set to false by SRP if all existing legal hold tags are cleared out. + // There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. + HasLegalHold *bool +} + +// ListAccountSasResponse - The List SAS credentials operation response. +type ListAccountSasResponse struct { + // READ-ONLY; List SAS credentials of storage account. + AccountSasToken *string +} + +// ListBlobInventoryPolicy - List of blob inventory policies returned. +type ListBlobInventoryPolicy struct { + // READ-ONLY; List of blob inventory policies. + Value []*BlobInventoryPolicy +} + +// ListContainerItem - The blob container properties be listed out. +type ListContainerItem struct { + // The blob container properties be listed out. + Properties *ContainerProperties + + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ListContainerItems - Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to +// next page of containers. +type ListContainerItems struct { + // READ-ONLY; Request URL that can be used to query next page of containers. Returned when total number of requested containers + // exceed maximum page size. + NextLink *string + + // READ-ONLY; List of blobs containers returned. + Value []*ListContainerItem +} + +type ListQueue struct { + // List Queue resource properties. + QueueProperties *ListQueueProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +type ListQueueProperties struct { + // A name-value pair that represents queue metadata. + Metadata map[string]*string +} + +// ListQueueResource - Response schema. Contains list of queues returned +type ListQueueResource struct { + // READ-ONLY; Request URL that can be used to list next page of queues + NextLink *string + + // READ-ONLY; List of queues returned. + Value []*ListQueue +} + +type ListQueueServices struct { + // READ-ONLY; List of queue services returned. + Value []*QueueServiceProperties +} + +// ListServiceSasResponse - The List service SAS credentials operation response. +type ListServiceSasResponse struct { + // READ-ONLY; List service SAS credentials of specific resource. + ServiceSasToken *string +} + +// ListTableResource - Response schema. Contains list of tables returned +type ListTableResource struct { + // READ-ONLY; Request URL that can be used to query next page of tables + NextLink *string + + // READ-ONLY; List of tables returned. + Value []*Table +} + +type ListTableServices struct { + // READ-ONLY; List of table services returned. + Value []*TableServiceProperties +} + +// LocalUser - The local user associated with the storage accounts. +type LocalUser struct { + // Storage account local user properties. + Properties *LocalUserProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// LocalUserKeys - The Storage Account Local User keys. +type LocalUserKeys struct { + // Optional, local user ssh authorized keys for SFTP. + SSHAuthorizedKeys []*SSHPublicKey + + // READ-ONLY; Auto generated by the server for SMB authentication. + SharedKey *string +} + +// LocalUserProperties - The Storage Account Local User properties. +type LocalUserProperties struct { + // Indicates whether ssh key exists. Set it to false to remove existing SSH key. + HasSSHKey *bool + + // Indicates whether ssh password exists. Set it to false to remove existing SSH password. + HasSSHPassword *bool + + // Indicates whether shared key exists. Set it to false to remove existing shared key. + HasSharedKey *bool + + // Optional, local user home directory. + HomeDirectory *string + + // The permission scopes of the local user. + PermissionScopes []*PermissionScope + + // Optional, local user ssh authorized keys for SFTP. + SSHAuthorizedKeys []*SSHPublicKey + + // READ-ONLY; A unique Security Identifier that is generated by the server. + Sid *string +} + +// LocalUserRegeneratePasswordResult - The secrets of Storage Account Local User. +type LocalUserRegeneratePasswordResult struct { + // READ-ONLY; Auto generated password by the server for SSH authentication if hasSshPassword is set to true on the creation + // of local user. + SSHPassword *string +} + +// LocalUsers - List storage account local users. +type LocalUsers struct { + // The local users associated with the storage account. + Value []*LocalUser +} + +// ManagementPolicy - The Get Storage Account ManagementPolicies operation response. +type ManagementPolicy struct { + // Returns the Storage Account Data Policies Rules. + Properties *ManagementPolicyProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ManagementPolicyAction - Actions are applied to the filtered blobs when the execution condition is met. +type ManagementPolicyAction struct { + // The management policy action for base blob + BaseBlob *ManagementPolicyBaseBlob + + // The management policy action for snapshot + Snapshot *ManagementPolicySnapShot + + // The management policy action for version + Version *ManagementPolicyVersion +} + +// ManagementPolicyBaseBlob - Management policy action for base blob. +type ManagementPolicyBaseBlob struct { + // The function to delete the blob + Delete *DateAfterModification + + // This property enables auto tiering of a blob from cool to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. + EnableAutoTierToHotFromCool *bool + + // The function to tier blobs to archive storage. + TierToArchive *DateAfterModification + + // The function to tier blobs to cold storage. + TierToCold *DateAfterModification + + // The function to tier blobs to cool storage. + TierToCool *DateAfterModification + + // The function to tier blobs to hot storage. This action can only be used with Premium Block Blob Storage Accounts + TierToHot *DateAfterModification +} + +// ManagementPolicyDefinition - An object that defines the Lifecycle rule. Each definition is made up with a filters set and +// an actions set. +type ManagementPolicyDefinition struct { + // REQUIRED; An object that defines the action set. + Actions *ManagementPolicyAction + + // An object that defines the filter set. + Filters *ManagementPolicyFilter +} + +// ManagementPolicyFilter - Filters limit rule actions to a subset of blobs within the storage account. If multiple filters +// are defined, a logical AND is performed on all filters. +type ManagementPolicyFilter struct { + // REQUIRED; An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete + // actions are supported for appendBlob. + BlobTypes []*string + + // An array of blob index tag based filters, there can be at most 10 tag filters + BlobIndexMatch []*TagFilter + + // An array of strings for prefixes to be match. + PrefixMatch []*string +} + +// ManagementPolicyProperties - The Storage Account ManagementPolicy properties. +type ManagementPolicyProperties struct { + // REQUIRED; The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + Policy *ManagementPolicySchema + + // READ-ONLY; Returns the date and time the ManagementPolicies was last modified. + LastModifiedTime *time.Time +} + +// ManagementPolicyRule - An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. +type ManagementPolicyRule struct { + // REQUIRED; An object that defines the Lifecycle rule. + Definition *ManagementPolicyDefinition + + // REQUIRED; A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be + // unique within a policy. + Name *string + + // REQUIRED; The valid value is Lifecycle + Type *RuleType + + // Rule is enabled if set to true. + Enabled *bool +} + +// ManagementPolicySchema - The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. +type ManagementPolicySchema struct { + // REQUIRED; The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + Rules []*ManagementPolicyRule +} + +// ManagementPolicySnapShot - Management policy action for snapshot. +type ManagementPolicySnapShot struct { + // The function to delete the blob snapshot + Delete *DateAfterCreation + + // The function to tier blob snapshot to archive storage. + TierToArchive *DateAfterCreation + + // The function to tier blobs to cold storage. + TierToCold *DateAfterCreation + + // The function to tier blob snapshot to cool storage. + TierToCool *DateAfterCreation + + // The function to tier blobs to hot storage. This action can only be used with Premium Block Blob Storage Accounts + TierToHot *DateAfterCreation +} + +// ManagementPolicyVersion - Management policy action for blob version. +type ManagementPolicyVersion struct { + // The function to delete the blob version + Delete *DateAfterCreation + + // The function to tier blob version to archive storage. + TierToArchive *DateAfterCreation + + // The function to tier blobs to cold storage. + TierToCold *DateAfterCreation + + // The function to tier blob version to cool storage. + TierToCool *DateAfterCreation + + // The function to tier blobs to hot storage. This action can only be used with Premium Block Blob Storage Accounts + TierToHot *DateAfterCreation +} + +// MetricSpecification - Metric specification of operation. +type MetricSpecification struct { + // Aggregation type could be Average. + AggregationType *string + + // The category this metric specification belong to, could be Capacity. + Category *string + + // Dimensions of blobs, including blob type and access tier. + Dimensions []*Dimension + + // Display description of metric specification. + DisplayDescription *string + + // Display name of metric specification. + DisplayName *string + + // The property to decide fill gap with zero or not. + FillGapWithZero *bool + + // Name of metric specification. + Name *string + + // Account Resource Id. + ResourceIDDimensionNameOverride *string + + // Unit could be Bytes or Count. + Unit *string +} + +// Multichannel setting. Applies to Premium FileStorage only. +type Multichannel struct { + // Indicates whether multichannel is enabled + Enabled *bool +} + +// NetworkRuleSet - Network rule set +type NetworkRuleSet struct { + // REQUIRED; Specifies the default action of allow or deny when no other rules match. + DefaultAction *DefaultAction + + // Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices + // (For example, "Logging, Metrics"), or None to bypass none + // of those traffics. + Bypass *Bypass + + // Sets the IP ACL rules + IPRules []*IPRule + + // Sets the resource access rules + ResourceAccessRules []*ResourceAccessRule + + // Sets the virtual network rules + VirtualNetworkRules []*VirtualNetworkRule +} + +// ObjectReplicationPolicies - List storage account object replication policies. +type ObjectReplicationPolicies struct { + // The replication policy between two storage accounts. + Value []*ObjectReplicationPolicy +} + +// ObjectReplicationPolicy - The replication policy between two storage accounts. Multiple rules can be defined in one policy. +type ObjectReplicationPolicy struct { + // Returns the Storage Account Object Replication Policy. + Properties *ObjectReplicationPolicyProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ObjectReplicationPolicyFilter - Filters limit replication to a subset of blobs within the storage account. A logical OR +// is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all +// filters. +type ObjectReplicationPolicyFilter struct { + // Blobs created after the time will be replicated to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. + // Example: 2020-02-19T16:05:00Z + MinCreationTime *string + + // Optional. Filters the results to replicate only blobs whose names begin with the specified prefix. + PrefixMatch []*string +} + +// ObjectReplicationPolicyProperties - The Storage Account ObjectReplicationPolicy properties. +type ObjectReplicationPolicyProperties struct { + // REQUIRED; Required. Destination account name. It should be full resource id if allowCrossTenantReplication set to false. + DestinationAccount *string + + // REQUIRED; Required. Source account name. It should be full resource id if allowCrossTenantReplication set to false. + SourceAccount *string + + // The storage account object replication rules. + Rules []*ObjectReplicationPolicyRule + + // READ-ONLY; Indicates when the policy is enabled on the source account. + EnabledTime *time.Time + + // READ-ONLY; A unique id for object replication policy. + PolicyID *string +} + +// ObjectReplicationPolicyRule - The replication policy rule between two containers. +type ObjectReplicationPolicyRule struct { + // REQUIRED; Required. Destination container name. + DestinationContainer *string + + // REQUIRED; Required. Source container name. + SourceContainer *string + + // Optional. An object that defines the filter set. + Filters *ObjectReplicationPolicyFilter + + // Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. + RuleID *string +} + +// Operation - Storage REST API operation definition. +type Operation struct { + // Display metadata associated with the operation. + Display *OperationDisplay + + // Operation name: {provider}/{resource}/{operation} + Name *string + + // Properties of operation, include metric specifications. + OperationProperties *OperationProperties + + // The origin of operations. + Origin *string +} + +// OperationDisplay - Display metadata associated with the operation. +type OperationDisplay struct { + // Description of the operation. + Description *string + + // Type of operation: get, read, delete, etc. + Operation *string + + // Service provider: Microsoft Storage. + Provider *string + + // Resource on which the operation is performed etc. + Resource *string +} + +// OperationListResult - Result of the request to list Storage operations. It contains a list of operations and a URL link +// to get the next set of results. +type OperationListResult struct { + // List of Storage operations supported by the Storage resource provider. + Value []*Operation +} + +// OperationProperties - Properties of operation, include metric specifications. +type OperationProperties struct { + // One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification +} + +type PermissionScope struct { + // REQUIRED; The permissions for the local user. Possible values include: Read (r), Write (w), Delete (d), List (l), and Create + // (c). + Permissions *string + + // REQUIRED; The name of resource, normally the container name or the file share name, used by the local user. + ResourceName *string + + // REQUIRED; The service used by the local user, e.g. blob, file. + Service *string +} + +// PrivateEndpoint - The Private Endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for Private Endpoint + ID *string +} + +// PrivateEndpointConnection - The Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + // Resource properties. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account +type PrivateEndpointConnectionListResult struct { + // Array of private endpoint connections + Value []*PrivateEndpointConnection +} + +// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The resource of private end point. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + // Resource properties. + Properties *PrivateLinkResourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateLinkResourceListResult - A list of private link resources +type PrivateLinkResourceListResult struct { + // Array of private link resources + Value []*PrivateLinkResource +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource Private link DNS zone name. + RequiredZoneNames []*string + + // READ-ONLY; The private link resource group id. + GroupID *string + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string +} + +// 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. + ActionRequired *string + + // The reason for approval/rejection of the connection. + Description *string + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus +} + +// ProtectedAppendWritesHistory - Protected append writes history setting for the blob container with Legal holds. +type ProtectedAppendWritesHistory struct { + // When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining legal hold protection and compliance. + // Only new blocks can be added and any existing blocks cannot be modified + // or deleted. + AllowProtectedAppendWritesAll *bool + + // READ-ONLY; Returns the date and time the tag was added. + Timestamp *time.Time +} + +// ProtocolSettings - Protocol settings for file service +type ProtocolSettings struct { + // Setting for SMB protocol + Smb *SmbSetting +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +type Queue struct { + // Queue resource properties. + QueueProperties *QueueProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +type QueueProperties struct { + // A name-value pair that represents queue metadata. + Metadata map[string]*string + + // READ-ONLY; Integer indicating an approximate number of messages in the queue. This number is not lower than the actual + // number of messages in the queue, but could be higher. + ApproximateMessageCount *int32 +} + +// QueueServiceProperties - The properties of a storage account’s Queue service. +type QueueServiceProperties struct { + // The properties of a storage account’s Queue service. + QueueServiceProperties *QueueServicePropertiesProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// QueueServicePropertiesProperties - The properties of a storage account’s Queue service. +type QueueServicePropertiesProperties struct { + // Specifies CORS rules for the Queue service. You can include up to five CorsRule elements in the request. If no CorsRule + // elements are included in the request body, all CORS rules will be deleted, and + // CORS will be disabled for the Queue service. + Cors *CorsRules +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceAccessRule - Resource Access Rule. +type ResourceAccessRule struct { + // Resource Id + ResourceID *string + + // Tenant Id + TenantID *string +} + +// RestorePolicyProperties - The blob service properties for blob restore policy +type RestorePolicyProperties struct { + // REQUIRED; Blob restore is enabled if set to true. + Enabled *bool + + // how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. + Days *int32 + + // READ-ONLY; Deprecated in favor of minRestoreTime property. + LastEnabledTime *time.Time + + // READ-ONLY; Returns the minimum date and time that the restore can be started. + MinRestoreTime *time.Time +} + +// Restriction - The restriction because of which SKU cannot be used. +type Restriction struct { + // The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when + // the SKU has requiredQuotas parameter as the subscription does not belong to that + // quota. The "NotAvailableForSubscription" is related to capacity at DC. + ReasonCode *ReasonCode + + // READ-ONLY; The type of restrictions. As of now only possible value for this is location. + Type *string + + // 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 +} + +// RoutingPreference - Routing preference defines the type of network, either microsoft or internet routing to be used to +// deliver the user data, the default option is microsoft routing +type RoutingPreference struct { + // A boolean flag which indicates whether internet routing storage endpoints are to be published + PublishInternetEndpoints *bool + + // A boolean flag which indicates whether microsoft routing storage endpoints are to be published + PublishMicrosoftEndpoints *bool + + // Routing Choice defines the kind of network routing opted by the user. + RoutingChoice *RoutingChoice +} + +// SKU - The SKU of the storage account. +type SKU struct { + // REQUIRED; The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called + // accountType. + Name *SKUName + + // READ-ONLY; The SKU tier. This is based on the SKU name. + Tier *SKUTier +} + +// SKUCapability - The capability information in the specified SKU, including file encryption, network ACLs, change notification, +// etc. +type SKUCapability struct { + // READ-ONLY; The name of capability, The capability information in the specified SKU, including file encryption, network + // ACLs, change notification, etc. + Name *string + + // READ-ONLY; A string value to indicate states of given capability. Possibly 'true' or 'false'. + Value *string +} + +// SKUInformation - Storage SKU and its properties +type SKUInformation struct { + // REQUIRED; The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called + // accountType. + Name *SKUName + + // The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + Restrictions []*Restriction + + // READ-ONLY; The capability information in the specified SKU, including file encryption, network ACLs, change notification, + // etc. + Capabilities []*SKUCapability + + // READ-ONLY; Indicates the type of storage account. + Kind *Kind + + // READ-ONLY; The set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. + // West US, East US, Southeast Asia, etc.). + Locations []*string + + // READ-ONLY; The type of the resource, usually it is 'storageAccounts'. + ResourceType *string + + // READ-ONLY; The SKU tier. This is based on the SKU name. + Tier *SKUTier +} + +// SKUListResult - The response from the List Storage SKUs operation. +type SKUListResult struct { + // READ-ONLY; Get the list result of storage SKUs and their properties. + Value []*SKUInformation +} + +type SSHPublicKey struct { + // Optional. It is used to store the function/usage of the key + Description *string + + // Ssh public key base64 encoded. The format should be: ' ', e.g. ssh-rsa AAAABBBB + Key *string +} + +// SasPolicy assigned to the storage account. +type SasPolicy struct { + // REQUIRED; The SAS expiration action. Can only be Log. + ExpirationAction *ExpirationAction + + // REQUIRED; The SAS expiration period, DD.HH:MM:SS. + SasExpirationPeriod *string +} + +// ServiceSasParameters - The parameters to list service SAS credentials of a specific resource. +type ServiceSasParameters struct { + // REQUIRED; The canonical path to the signed resource. + CanonicalizedResource *string + + // The response header override for cache control. + CacheControl *string + + // The response header override for content disposition. + ContentDisposition *string + + // The response header override for content encoding. + ContentEncoding *string + + // The response header override for content language. + ContentLanguage *string + + // The response header override for content type. + ContentType *string + + // An IP address or a range of IP addresses from which to accept requests. + IPAddressOrRange *string + + // A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or + // table. + Identifier *string + + // The key to sign the account SAS token with. + KeyToSign *string + + // The end of partition key. + PartitionKeyEnd *string + + // The start of partition key. + PartitionKeyStart *string + + // The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), + // Create (c), Update (u) and Process (p). + Permissions *Permissions + + // The protocol permitted for a request made with the account SAS. + Protocols *HTTPProtocol + + // The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share + // (s). + Resource *SignedResource + + // The end of row key. + RowKeyEnd *string + + // The start of row key. + RowKeyStart *string + + // The time at which the shared access signature becomes invalid. + SharedAccessExpiryTime *time.Time + + // The time at which the SAS becomes valid. + SharedAccessStartTime *time.Time +} + +// ServiceSpecification - One property of operation, include metric specifications. +type ServiceSpecification struct { + // Metric specifications of operation. + MetricSpecifications []*MetricSpecification +} + +type SignedIdentifier struct { + // Access policy + AccessPolicy *AccessPolicy + + // An unique identifier of the stored access policy. + ID *string +} + +// SmbSetting - Setting for SMB protocol +type SmbSetting struct { + // SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be passed as a string with delimiter + // ';'. + AuthenticationMethods *string + + // SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as + // a string with delimiter ';'. + ChannelEncryption *string + + // Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be passed as a string with delimiter + // ';' + KerberosTicketEncryption *string + + // Multichannel setting. Applies to Premium FileStorage only. + Multichannel *Multichannel + + // SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a string with + // delimiter ';'. + Versions *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// Table - Properties of the table, including Id, resource name, resource type. +type Table struct { + // Table resource properties. + TableProperties *TableProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TableAccessPolicy - Table Access Policy Properties Object. +type TableAccessPolicy struct { + // REQUIRED; Required. List of abbreviated permissions. Supported permission values include 'r','a','u','d' + Permission *string + + // Expiry time of the access policy + ExpiryTime *time.Time + + // Start time of the access policy + StartTime *time.Time +} + +type TableProperties struct { + // List of stored access policies specified on the table. + SignedIdentifiers []*TableSignedIdentifier + + // READ-ONLY; Table name under the specified account + TableName *string +} + +// TableServiceProperties - The properties of a storage account’s Table service. +type TableServiceProperties struct { + // The properties of a storage account’s Table service. + TableServiceProperties *TableServicePropertiesProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TableServicePropertiesProperties - The properties of a storage account’s Table service. +type TableServicePropertiesProperties struct { + // Specifies CORS rules for the Table service. You can include up to five CorsRule elements in the request. If no CorsRule + // elements are included in the request body, all CORS rules will be deleted, and + // CORS will be disabled for the Table service. + Cors *CorsRules +} + +// TableSignedIdentifier - Object to set Table Access Policy. +type TableSignedIdentifier struct { + // REQUIRED; unique-64-character-value of the stored access policy. + ID *string + + // Access policy + AccessPolicy *TableAccessPolicy +} + +// TagFilter - Blob index tag based filtering for blob objects +type TagFilter struct { + // REQUIRED; This is the filter tag name, it can have 1 - 128 characters + Name *string + + // REQUIRED; This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) + // is currently supported + Op *string + + // REQUIRED; This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters + Value *string +} + +// TagProperty - A tag of the LegalHold of a blob container. +type TagProperty struct { + // READ-ONLY; Returns the Object ID of the user who added the tag. + ObjectIdentifier *string + + // READ-ONLY; The tag value. + Tag *string + + // READ-ONLY; Returns the Tenant ID that issued the token for the user who added the tag. + TenantID *string + + // READ-ONLY; Returns the date and time the tag was added. + Timestamp *time.Time + + // READ-ONLY; Returns the User Principal Name of the user who added the tag. + Upn *string +} + +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' +type TrackedResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// UpdateHistoryProperty - An update history of the ImmutabilityPolicy of a blob container. +type UpdateHistoryProperty struct { + // This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to + // an append blob while maintaining immutability protection and compliance. Only + // new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy + // API. + AllowProtectedAppendWrites *bool + + // This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to + // both 'Append and Bock Blobs' while maintaining immutability protection and + // compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be + // changed with ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and + // 'allowProtectedAppendWritesAll' properties are mutually exclusive. + AllowProtectedAppendWritesAll *bool + + // READ-ONLY; The immutability period for the blobs in the container since the policy creation, in days. + ImmutabilityPeriodSinceCreationInDays *int32 + + // READ-ONLY; Returns the Object ID of the user who updated the ImmutabilityPolicy. + ObjectIdentifier *string + + // READ-ONLY; Returns the Tenant ID that issued the token for the user who updated the ImmutabilityPolicy. + TenantID *string + + // READ-ONLY; Returns the date and time the ImmutabilityPolicy was updated. + Timestamp *time.Time + + // READ-ONLY; The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. + Update *ImmutabilityPolicyUpdateType + + // READ-ONLY; Returns the User Principal Name of the user who updated the ImmutabilityPolicy. + Upn *string +} + +// Usage - Describes Storage Resource Usage. +type Usage struct { + // READ-ONLY; Gets the current count of the allocated resources in the subscription. + CurrentValue *int32 + + // READ-ONLY; Gets the maximum count of the resources that can be allocated in the subscription. + Limit *int32 + + // READ-ONLY; Gets the name of the type of usage. + Name *UsageName + + // READ-ONLY; Gets the unit of measurement. + Unit *UsageUnit +} + +// UsageListResult - The response from the List Usages operation. +type UsageListResult struct { + // Gets or sets the list of Storage Resource Usages. + Value []*Usage +} + +// UsageName - The usage names that can be used; currently limited to StorageAccount. +type UsageName struct { + // READ-ONLY; Gets a localized string describing the resource name. + LocalizedValue *string + + // READ-ONLY; Gets a string describing the resource name. + Value *string +} + +// UserAssignedIdentity for the resource. +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the identity. + ClientID *string + + // READ-ONLY; The principal ID of the identity. + PrincipalID *string +} + +// VirtualNetworkRule - Virtual Network rule. +type VirtualNetworkRule struct { + // REQUIRED; Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + VirtualNetworkResourceID *string + + // The action of virtual network rule. + Action *string + + // Gets the state of virtual network rule. + State *State +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models_serde.go new file mode 100644 index 000000000..0c96a0902 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/models_serde.go @@ -0,0 +1,6851 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AccessPolicy. +func (a AccessPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "expiryTime", a.ExpiryTime) + populate(objectMap, "permission", a.Permission) + populateDateTimeRFC3339(objectMap, "startTime", a.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessPolicy. +func (a *AccessPolicy) UnmarshalJSON(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 "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &a.ExpiryTime) + delete(rawMsg, key) + case "permission": + err = unpopulate(val, "Permission", &a.Permission) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(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 Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", a.ExtendedLocation) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "kind", a.Kind) + 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 Account. +func (a *Account) UnmarshalJSON(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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &a.ExtendedLocation) + 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 "kind": + err = unpopulate(val, "Kind", &a.Kind) + 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 AccountCheckNameAvailabilityParameters. +func (a AccountCheckNameAvailabilityParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + objectMap["type"] = "Microsoft.Storage/storageAccounts" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountCheckNameAvailabilityParameters. +func (a *AccountCheckNameAvailabilityParameters) UnmarshalJSON(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 "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 AccountCreateParameters. +func (a AccountCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", a.ExtendedLocation) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "location", a.Location) + 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 AccountCreateParameters. +func (a *AccountCreateParameters) UnmarshalJSON(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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &a.ExtendedLocation) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountImmutabilityPolicyProperties. +func (a AccountImmutabilityPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowProtectedAppendWrites", a.AllowProtectedAppendWrites) + populate(objectMap, "immutabilityPeriodSinceCreationInDays", a.ImmutabilityPeriodSinceCreationInDays) + populate(objectMap, "state", a.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountImmutabilityPolicyProperties. +func (a *AccountImmutabilityPolicyProperties) UnmarshalJSON(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 "allowProtectedAppendWrites": + err = unpopulate(val, "AllowProtectedAppendWrites", &a.AllowProtectedAppendWrites) + delete(rawMsg, key) + case "immutabilityPeriodSinceCreationInDays": + err = unpopulate(val, "ImmutabilityPeriodSinceCreationInDays", &a.ImmutabilityPeriodSinceCreationInDays) + 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 AccountInternetEndpoints. +func (a AccountInternetEndpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blob", a.Blob) + populate(objectMap, "dfs", a.Dfs) + populate(objectMap, "file", a.File) + populate(objectMap, "web", a.Web) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountInternetEndpoints. +func (a *AccountInternetEndpoints) UnmarshalJSON(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 "blob": + err = unpopulate(val, "Blob", &a.Blob) + delete(rawMsg, key) + case "dfs": + err = unpopulate(val, "Dfs", &a.Dfs) + delete(rawMsg, key) + case "file": + err = unpopulate(val, "File", &a.File) + delete(rawMsg, key) + case "web": + err = unpopulate(val, "Web", &a.Web) + 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 AccountKey. +func (a AccountKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "creationTime", a.CreationTime) + populate(objectMap, "keyName", a.KeyName) + populate(objectMap, "permissions", a.Permissions) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountKey. +func (a *AccountKey) UnmarshalJSON(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 "creationTime": + err = unpopulateDateTimeRFC3339(val, "CreationTime", &a.CreationTime) + delete(rawMsg, key) + case "keyName": + err = unpopulate(val, "KeyName", &a.KeyName) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &a.Permissions) + 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 AccountListKeysResult. +func (a AccountListKeysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keys", a.Keys) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountListKeysResult. +func (a *AccountListKeysResult) UnmarshalJSON(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 "keys": + err = unpopulate(val, "Keys", &a.Keys) + 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 AccountListResult. +func (a AccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountListResult. +func (a *AccountListResult) UnmarshalJSON(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 AccountMicrosoftEndpoints. +func (a AccountMicrosoftEndpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blob", a.Blob) + populate(objectMap, "dfs", a.Dfs) + populate(objectMap, "file", a.File) + populate(objectMap, "queue", a.Queue) + populate(objectMap, "table", a.Table) + populate(objectMap, "web", a.Web) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountMicrosoftEndpoints. +func (a *AccountMicrosoftEndpoints) UnmarshalJSON(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 "blob": + err = unpopulate(val, "Blob", &a.Blob) + delete(rawMsg, key) + case "dfs": + err = unpopulate(val, "Dfs", &a.Dfs) + delete(rawMsg, key) + case "file": + err = unpopulate(val, "File", &a.File) + delete(rawMsg, key) + case "queue": + err = unpopulate(val, "Queue", &a.Queue) + delete(rawMsg, key) + case "table": + err = unpopulate(val, "Table", &a.Table) + delete(rawMsg, key) + case "web": + err = unpopulate(val, "Web", &a.Web) + 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 AccountMigration. +func (a AccountMigration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.StorageAccountMigrationDetails) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountMigration. +func (a *AccountMigration) UnmarshalJSON(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, "StorageAccountMigrationDetails", &a.StorageAccountMigrationDetails) + 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 AccountMigrationProperties. +func (a AccountMigrationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "migrationFailedDetailedReason", a.MigrationFailedDetailedReason) + populate(objectMap, "migrationFailedReason", a.MigrationFailedReason) + populate(objectMap, "migrationStatus", a.MigrationStatus) + populate(objectMap, "targetSkuName", a.TargetSKUName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountMigrationProperties. +func (a *AccountMigrationProperties) UnmarshalJSON(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 "migrationFailedDetailedReason": + err = unpopulate(val, "MigrationFailedDetailedReason", &a.MigrationFailedDetailedReason) + delete(rawMsg, key) + case "migrationFailedReason": + err = unpopulate(val, "MigrationFailedReason", &a.MigrationFailedReason) + delete(rawMsg, key) + case "migrationStatus": + err = unpopulate(val, "MigrationStatus", &a.MigrationStatus) + delete(rawMsg, key) + case "targetSkuName": + err = unpopulate(val, "TargetSKUName", &a.TargetSKUName) + 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 AccountProperties. +func (a AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessTier", a.AccessTier) + populate(objectMap, "accountMigrationInProgress", a.AccountMigrationInProgress) + populate(objectMap, "allowBlobPublicAccess", a.AllowBlobPublicAccess) + populate(objectMap, "allowCrossTenantReplication", a.AllowCrossTenantReplication) + populate(objectMap, "allowSharedKeyAccess", a.AllowSharedKeyAccess) + populate(objectMap, "allowedCopyScope", a.AllowedCopyScope) + populate(objectMap, "azureFilesIdentityBasedAuthentication", a.AzureFilesIdentityBasedAuthentication) + populate(objectMap, "blobRestoreStatus", a.BlobRestoreStatus) + populateDateTimeRFC3339(objectMap, "creationTime", a.CreationTime) + populate(objectMap, "customDomain", a.CustomDomain) + populate(objectMap, "dnsEndpointType", a.DNSEndpointType) + populate(objectMap, "defaultToOAuthAuthentication", a.DefaultToOAuthAuthentication) + populate(objectMap, "supportsHttpsTrafficOnly", a.EnableHTTPSTrafficOnly) + populate(objectMap, "isNfsV3Enabled", a.EnableNfsV3) + populate(objectMap, "encryption", a.Encryption) + populate(objectMap, "failoverInProgress", a.FailoverInProgress) + populate(objectMap, "geoReplicationStats", a.GeoReplicationStats) + populate(objectMap, "immutableStorageWithVersioning", a.ImmutableStorageWithVersioning) + populate(objectMap, "isHnsEnabled", a.IsHnsEnabled) + populate(objectMap, "isLocalUserEnabled", a.IsLocalUserEnabled) + populate(objectMap, "isSkuConversionBlocked", a.IsSKUConversionBlocked) + populate(objectMap, "isSftpEnabled", a.IsSftpEnabled) + populate(objectMap, "keyCreationTime", a.KeyCreationTime) + populate(objectMap, "keyPolicy", a.KeyPolicy) + populate(objectMap, "largeFileSharesState", a.LargeFileSharesState) + populateDateTimeRFC3339(objectMap, "lastGeoFailoverTime", a.LastGeoFailoverTime) + populate(objectMap, "minimumTlsVersion", a.MinimumTLSVersion) + populate(objectMap, "networkAcls", a.NetworkRuleSet) + populate(objectMap, "primaryEndpoints", a.PrimaryEndpoints) + populate(objectMap, "primaryLocation", a.PrimaryLocation) + populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) + populate(objectMap, "routingPreference", a.RoutingPreference) + populate(objectMap, "sasPolicy", a.SasPolicy) + populate(objectMap, "secondaryEndpoints", a.SecondaryEndpoints) + populate(objectMap, "secondaryLocation", a.SecondaryLocation) + populate(objectMap, "statusOfPrimary", a.StatusOfPrimary) + populate(objectMap, "statusOfSecondary", a.StatusOfSecondary) + populate(objectMap, "storageAccountSkuConversionStatus", a.StorageAccountSKUConversionStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountProperties. +func (a *AccountProperties) UnmarshalJSON(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 "accessTier": + err = unpopulate(val, "AccessTier", &a.AccessTier) + delete(rawMsg, key) + case "accountMigrationInProgress": + err = unpopulate(val, "AccountMigrationInProgress", &a.AccountMigrationInProgress) + delete(rawMsg, key) + case "allowBlobPublicAccess": + err = unpopulate(val, "AllowBlobPublicAccess", &a.AllowBlobPublicAccess) + delete(rawMsg, key) + case "allowCrossTenantReplication": + err = unpopulate(val, "AllowCrossTenantReplication", &a.AllowCrossTenantReplication) + delete(rawMsg, key) + case "allowSharedKeyAccess": + err = unpopulate(val, "AllowSharedKeyAccess", &a.AllowSharedKeyAccess) + delete(rawMsg, key) + case "allowedCopyScope": + err = unpopulate(val, "AllowedCopyScope", &a.AllowedCopyScope) + delete(rawMsg, key) + case "azureFilesIdentityBasedAuthentication": + err = unpopulate(val, "AzureFilesIdentityBasedAuthentication", &a.AzureFilesIdentityBasedAuthentication) + delete(rawMsg, key) + case "blobRestoreStatus": + err = unpopulate(val, "BlobRestoreStatus", &a.BlobRestoreStatus) + delete(rawMsg, key) + case "creationTime": + err = unpopulateDateTimeRFC3339(val, "CreationTime", &a.CreationTime) + delete(rawMsg, key) + case "customDomain": + err = unpopulate(val, "CustomDomain", &a.CustomDomain) + delete(rawMsg, key) + case "dnsEndpointType": + err = unpopulate(val, "DNSEndpointType", &a.DNSEndpointType) + delete(rawMsg, key) + case "defaultToOAuthAuthentication": + err = unpopulate(val, "DefaultToOAuthAuthentication", &a.DefaultToOAuthAuthentication) + delete(rawMsg, key) + case "supportsHttpsTrafficOnly": + err = unpopulate(val, "EnableHTTPSTrafficOnly", &a.EnableHTTPSTrafficOnly) + delete(rawMsg, key) + case "isNfsV3Enabled": + err = unpopulate(val, "EnableNfsV3", &a.EnableNfsV3) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &a.Encryption) + delete(rawMsg, key) + case "failoverInProgress": + err = unpopulate(val, "FailoverInProgress", &a.FailoverInProgress) + delete(rawMsg, key) + case "geoReplicationStats": + err = unpopulate(val, "GeoReplicationStats", &a.GeoReplicationStats) + delete(rawMsg, key) + case "immutableStorageWithVersioning": + err = unpopulate(val, "ImmutableStorageWithVersioning", &a.ImmutableStorageWithVersioning) + delete(rawMsg, key) + case "isHnsEnabled": + err = unpopulate(val, "IsHnsEnabled", &a.IsHnsEnabled) + delete(rawMsg, key) + case "isLocalUserEnabled": + err = unpopulate(val, "IsLocalUserEnabled", &a.IsLocalUserEnabled) + delete(rawMsg, key) + case "isSkuConversionBlocked": + err = unpopulate(val, "IsSKUConversionBlocked", &a.IsSKUConversionBlocked) + delete(rawMsg, key) + case "isSftpEnabled": + err = unpopulate(val, "IsSftpEnabled", &a.IsSftpEnabled) + delete(rawMsg, key) + case "keyCreationTime": + err = unpopulate(val, "KeyCreationTime", &a.KeyCreationTime) + delete(rawMsg, key) + case "keyPolicy": + err = unpopulate(val, "KeyPolicy", &a.KeyPolicy) + delete(rawMsg, key) + case "largeFileSharesState": + err = unpopulate(val, "LargeFileSharesState", &a.LargeFileSharesState) + delete(rawMsg, key) + case "lastGeoFailoverTime": + err = unpopulateDateTimeRFC3339(val, "LastGeoFailoverTime", &a.LastGeoFailoverTime) + delete(rawMsg, key) + case "minimumTlsVersion": + err = unpopulate(val, "MinimumTLSVersion", &a.MinimumTLSVersion) + delete(rawMsg, key) + case "networkAcls": + err = unpopulate(val, "NetworkRuleSet", &a.NetworkRuleSet) + delete(rawMsg, key) + case "primaryEndpoints": + err = unpopulate(val, "PrimaryEndpoints", &a.PrimaryEndpoints) + delete(rawMsg, key) + case "primaryLocation": + err = unpopulate(val, "PrimaryLocation", &a.PrimaryLocation) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + delete(rawMsg, key) + case "routingPreference": + err = unpopulate(val, "RoutingPreference", &a.RoutingPreference) + delete(rawMsg, key) + case "sasPolicy": + err = unpopulate(val, "SasPolicy", &a.SasPolicy) + delete(rawMsg, key) + case "secondaryEndpoints": + err = unpopulate(val, "SecondaryEndpoints", &a.SecondaryEndpoints) + delete(rawMsg, key) + case "secondaryLocation": + err = unpopulate(val, "SecondaryLocation", &a.SecondaryLocation) + delete(rawMsg, key) + case "statusOfPrimary": + err = unpopulate(val, "StatusOfPrimary", &a.StatusOfPrimary) + delete(rawMsg, key) + case "statusOfSecondary": + err = unpopulate(val, "StatusOfSecondary", &a.StatusOfSecondary) + delete(rawMsg, key) + case "storageAccountSkuConversionStatus": + err = unpopulate(val, "StorageAccountSKUConversionStatus", &a.StorageAccountSKUConversionStatus) + 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 AccountPropertiesCreateParameters. +func (a AccountPropertiesCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessTier", a.AccessTier) + populate(objectMap, "allowBlobPublicAccess", a.AllowBlobPublicAccess) + populate(objectMap, "allowCrossTenantReplication", a.AllowCrossTenantReplication) + populate(objectMap, "allowSharedKeyAccess", a.AllowSharedKeyAccess) + populate(objectMap, "allowedCopyScope", a.AllowedCopyScope) + populate(objectMap, "azureFilesIdentityBasedAuthentication", a.AzureFilesIdentityBasedAuthentication) + populate(objectMap, "customDomain", a.CustomDomain) + populate(objectMap, "dnsEndpointType", a.DNSEndpointType) + populate(objectMap, "defaultToOAuthAuthentication", a.DefaultToOAuthAuthentication) + populate(objectMap, "supportsHttpsTrafficOnly", a.EnableHTTPSTrafficOnly) + populate(objectMap, "isNfsV3Enabled", a.EnableNfsV3) + populate(objectMap, "encryption", a.Encryption) + populate(objectMap, "immutableStorageWithVersioning", a.ImmutableStorageWithVersioning) + populate(objectMap, "isHnsEnabled", a.IsHnsEnabled) + populate(objectMap, "isLocalUserEnabled", a.IsLocalUserEnabled) + populate(objectMap, "isSftpEnabled", a.IsSftpEnabled) + populate(objectMap, "keyPolicy", a.KeyPolicy) + populate(objectMap, "largeFileSharesState", a.LargeFileSharesState) + populate(objectMap, "minimumTlsVersion", a.MinimumTLSVersion) + populate(objectMap, "networkAcls", a.NetworkRuleSet) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) + populate(objectMap, "routingPreference", a.RoutingPreference) + populate(objectMap, "sasPolicy", a.SasPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountPropertiesCreateParameters. +func (a *AccountPropertiesCreateParameters) UnmarshalJSON(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 "accessTier": + err = unpopulate(val, "AccessTier", &a.AccessTier) + delete(rawMsg, key) + case "allowBlobPublicAccess": + err = unpopulate(val, "AllowBlobPublicAccess", &a.AllowBlobPublicAccess) + delete(rawMsg, key) + case "allowCrossTenantReplication": + err = unpopulate(val, "AllowCrossTenantReplication", &a.AllowCrossTenantReplication) + delete(rawMsg, key) + case "allowSharedKeyAccess": + err = unpopulate(val, "AllowSharedKeyAccess", &a.AllowSharedKeyAccess) + delete(rawMsg, key) + case "allowedCopyScope": + err = unpopulate(val, "AllowedCopyScope", &a.AllowedCopyScope) + delete(rawMsg, key) + case "azureFilesIdentityBasedAuthentication": + err = unpopulate(val, "AzureFilesIdentityBasedAuthentication", &a.AzureFilesIdentityBasedAuthentication) + delete(rawMsg, key) + case "customDomain": + err = unpopulate(val, "CustomDomain", &a.CustomDomain) + delete(rawMsg, key) + case "dnsEndpointType": + err = unpopulate(val, "DNSEndpointType", &a.DNSEndpointType) + delete(rawMsg, key) + case "defaultToOAuthAuthentication": + err = unpopulate(val, "DefaultToOAuthAuthentication", &a.DefaultToOAuthAuthentication) + delete(rawMsg, key) + case "supportsHttpsTrafficOnly": + err = unpopulate(val, "EnableHTTPSTrafficOnly", &a.EnableHTTPSTrafficOnly) + delete(rawMsg, key) + case "isNfsV3Enabled": + err = unpopulate(val, "EnableNfsV3", &a.EnableNfsV3) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &a.Encryption) + delete(rawMsg, key) + case "immutableStorageWithVersioning": + err = unpopulate(val, "ImmutableStorageWithVersioning", &a.ImmutableStorageWithVersioning) + delete(rawMsg, key) + case "isHnsEnabled": + err = unpopulate(val, "IsHnsEnabled", &a.IsHnsEnabled) + delete(rawMsg, key) + case "isLocalUserEnabled": + err = unpopulate(val, "IsLocalUserEnabled", &a.IsLocalUserEnabled) + delete(rawMsg, key) + case "isSftpEnabled": + err = unpopulate(val, "IsSftpEnabled", &a.IsSftpEnabled) + delete(rawMsg, key) + case "keyPolicy": + err = unpopulate(val, "KeyPolicy", &a.KeyPolicy) + delete(rawMsg, key) + case "largeFileSharesState": + err = unpopulate(val, "LargeFileSharesState", &a.LargeFileSharesState) + delete(rawMsg, key) + case "minimumTlsVersion": + err = unpopulate(val, "MinimumTLSVersion", &a.MinimumTLSVersion) + delete(rawMsg, key) + case "networkAcls": + err = unpopulate(val, "NetworkRuleSet", &a.NetworkRuleSet) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + delete(rawMsg, key) + case "routingPreference": + err = unpopulate(val, "RoutingPreference", &a.RoutingPreference) + delete(rawMsg, key) + case "sasPolicy": + err = unpopulate(val, "SasPolicy", &a.SasPolicy) + 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 AccountPropertiesUpdateParameters. +func (a AccountPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessTier", a.AccessTier) + populate(objectMap, "allowBlobPublicAccess", a.AllowBlobPublicAccess) + populate(objectMap, "allowCrossTenantReplication", a.AllowCrossTenantReplication) + populate(objectMap, "allowSharedKeyAccess", a.AllowSharedKeyAccess) + populate(objectMap, "allowedCopyScope", a.AllowedCopyScope) + populate(objectMap, "azureFilesIdentityBasedAuthentication", a.AzureFilesIdentityBasedAuthentication) + populate(objectMap, "customDomain", a.CustomDomain) + populate(objectMap, "dnsEndpointType", a.DNSEndpointType) + populate(objectMap, "defaultToOAuthAuthentication", a.DefaultToOAuthAuthentication) + populate(objectMap, "supportsHttpsTrafficOnly", a.EnableHTTPSTrafficOnly) + populate(objectMap, "encryption", a.Encryption) + populate(objectMap, "immutableStorageWithVersioning", a.ImmutableStorageWithVersioning) + populate(objectMap, "isLocalUserEnabled", a.IsLocalUserEnabled) + populate(objectMap, "isSftpEnabled", a.IsSftpEnabled) + populate(objectMap, "keyPolicy", a.KeyPolicy) + populate(objectMap, "largeFileSharesState", a.LargeFileSharesState) + populate(objectMap, "minimumTlsVersion", a.MinimumTLSVersion) + populate(objectMap, "networkAcls", a.NetworkRuleSet) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) + populate(objectMap, "routingPreference", a.RoutingPreference) + populate(objectMap, "sasPolicy", a.SasPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountPropertiesUpdateParameters. +func (a *AccountPropertiesUpdateParameters) UnmarshalJSON(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 "accessTier": + err = unpopulate(val, "AccessTier", &a.AccessTier) + delete(rawMsg, key) + case "allowBlobPublicAccess": + err = unpopulate(val, "AllowBlobPublicAccess", &a.AllowBlobPublicAccess) + delete(rawMsg, key) + case "allowCrossTenantReplication": + err = unpopulate(val, "AllowCrossTenantReplication", &a.AllowCrossTenantReplication) + delete(rawMsg, key) + case "allowSharedKeyAccess": + err = unpopulate(val, "AllowSharedKeyAccess", &a.AllowSharedKeyAccess) + delete(rawMsg, key) + case "allowedCopyScope": + err = unpopulate(val, "AllowedCopyScope", &a.AllowedCopyScope) + delete(rawMsg, key) + case "azureFilesIdentityBasedAuthentication": + err = unpopulate(val, "AzureFilesIdentityBasedAuthentication", &a.AzureFilesIdentityBasedAuthentication) + delete(rawMsg, key) + case "customDomain": + err = unpopulate(val, "CustomDomain", &a.CustomDomain) + delete(rawMsg, key) + case "dnsEndpointType": + err = unpopulate(val, "DNSEndpointType", &a.DNSEndpointType) + delete(rawMsg, key) + case "defaultToOAuthAuthentication": + err = unpopulate(val, "DefaultToOAuthAuthentication", &a.DefaultToOAuthAuthentication) + delete(rawMsg, key) + case "supportsHttpsTrafficOnly": + err = unpopulate(val, "EnableHTTPSTrafficOnly", &a.EnableHTTPSTrafficOnly) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &a.Encryption) + delete(rawMsg, key) + case "immutableStorageWithVersioning": + err = unpopulate(val, "ImmutableStorageWithVersioning", &a.ImmutableStorageWithVersioning) + delete(rawMsg, key) + case "isLocalUserEnabled": + err = unpopulate(val, "IsLocalUserEnabled", &a.IsLocalUserEnabled) + delete(rawMsg, key) + case "isSftpEnabled": + err = unpopulate(val, "IsSftpEnabled", &a.IsSftpEnabled) + delete(rawMsg, key) + case "keyPolicy": + err = unpopulate(val, "KeyPolicy", &a.KeyPolicy) + delete(rawMsg, key) + case "largeFileSharesState": + err = unpopulate(val, "LargeFileSharesState", &a.LargeFileSharesState) + delete(rawMsg, key) + case "minimumTlsVersion": + err = unpopulate(val, "MinimumTLSVersion", &a.MinimumTLSVersion) + delete(rawMsg, key) + case "networkAcls": + err = unpopulate(val, "NetworkRuleSet", &a.NetworkRuleSet) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + delete(rawMsg, key) + case "routingPreference": + err = unpopulate(val, "RoutingPreference", &a.RoutingPreference) + delete(rawMsg, key) + case "sasPolicy": + err = unpopulate(val, "SasPolicy", &a.SasPolicy) + 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 AccountRegenerateKeyParameters. +func (a AccountRegenerateKeyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyName", a.KeyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountRegenerateKeyParameters. +func (a *AccountRegenerateKeyParameters) UnmarshalJSON(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 "keyName": + err = unpopulate(val, "KeyName", &a.KeyName) + 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 AccountSKUConversionStatus. +func (a AccountSKUConversionStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endTime", a.EndTime) + populate(objectMap, "skuConversionStatus", a.SKUConversionStatus) + populate(objectMap, "startTime", a.StartTime) + populate(objectMap, "targetSkuName", a.TargetSKUName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountSKUConversionStatus. +func (a *AccountSKUConversionStatus) UnmarshalJSON(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 "endTime": + err = unpopulate(val, "EndTime", &a.EndTime) + delete(rawMsg, key) + case "skuConversionStatus": + err = unpopulate(val, "SKUConversionStatus", &a.SKUConversionStatus) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &a.StartTime) + delete(rawMsg, key) + case "targetSkuName": + err = unpopulate(val, "TargetSKUName", &a.TargetSKUName) + 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 AccountSasParameters. +func (a AccountSasParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "signedIp", a.IPAddressOrRange) + populate(objectMap, "keyToSign", a.KeyToSign) + populate(objectMap, "signedPermission", a.Permissions) + populate(objectMap, "signedProtocol", a.Protocols) + populate(objectMap, "signedResourceTypes", a.ResourceTypes) + populate(objectMap, "signedServices", a.Services) + populateDateTimeRFC3339(objectMap, "signedExpiry", a.SharedAccessExpiryTime) + populateDateTimeRFC3339(objectMap, "signedStart", a.SharedAccessStartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountSasParameters. +func (a *AccountSasParameters) UnmarshalJSON(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 "signedIp": + err = unpopulate(val, "IPAddressOrRange", &a.IPAddressOrRange) + delete(rawMsg, key) + case "keyToSign": + err = unpopulate(val, "KeyToSign", &a.KeyToSign) + delete(rawMsg, key) + case "signedPermission": + err = unpopulate(val, "Permissions", &a.Permissions) + delete(rawMsg, key) + case "signedProtocol": + err = unpopulate(val, "Protocols", &a.Protocols) + delete(rawMsg, key) + case "signedResourceTypes": + err = unpopulate(val, "ResourceTypes", &a.ResourceTypes) + delete(rawMsg, key) + case "signedServices": + err = unpopulate(val, "Services", &a.Services) + delete(rawMsg, key) + case "signedExpiry": + err = unpopulateDateTimeRFC3339(val, "SharedAccessExpiryTime", &a.SharedAccessExpiryTime) + delete(rawMsg, key) + case "signedStart": + err = unpopulateDateTimeRFC3339(val, "SharedAccessStartTime", &a.SharedAccessStartTime) + 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 AccountUpdateParameters. +func (a AccountUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "kind", a.Kind) + 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 AccountUpdateParameters. +func (a *AccountUpdateParameters) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &a.Identity) + 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 "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 ActiveDirectoryProperties. +func (a ActiveDirectoryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountType", a.AccountType) + populate(objectMap, "azureStorageSid", a.AzureStorageSid) + populate(objectMap, "domainGuid", a.DomainGUID) + populate(objectMap, "domainName", a.DomainName) + populate(objectMap, "domainSid", a.DomainSid) + populate(objectMap, "forestName", a.ForestName) + populate(objectMap, "netBiosDomainName", a.NetBiosDomainName) + populate(objectMap, "samAccountName", a.SamAccountName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryProperties. +func (a *ActiveDirectoryProperties) UnmarshalJSON(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 "accountType": + err = unpopulate(val, "AccountType", &a.AccountType) + delete(rawMsg, key) + case "azureStorageSid": + err = unpopulate(val, "AzureStorageSid", &a.AzureStorageSid) + delete(rawMsg, key) + case "domainGuid": + err = unpopulate(val, "DomainGUID", &a.DomainGUID) + delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &a.DomainName) + delete(rawMsg, key) + case "domainSid": + err = unpopulate(val, "DomainSid", &a.DomainSid) + delete(rawMsg, key) + case "forestName": + err = unpopulate(val, "ForestName", &a.ForestName) + delete(rawMsg, key) + case "netBiosDomainName": + err = unpopulate(val, "NetBiosDomainName", &a.NetBiosDomainName) + delete(rawMsg, key) + case "samAccountName": + err = unpopulate(val, "SamAccountName", &a.SamAccountName) + 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 AzureEntityResource. +func (a AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureEntityResource. +func (a *AzureEntityResource) UnmarshalJSON(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 "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 AzureFilesIdentityBasedAuthentication. +func (a AzureFilesIdentityBasedAuthentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activeDirectoryProperties", a.ActiveDirectoryProperties) + populate(objectMap, "defaultSharePermission", a.DefaultSharePermission) + populate(objectMap, "directoryServiceOptions", a.DirectoryServiceOptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFilesIdentityBasedAuthentication. +func (a *AzureFilesIdentityBasedAuthentication) UnmarshalJSON(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 "activeDirectoryProperties": + err = unpopulate(val, "ActiveDirectoryProperties", &a.ActiveDirectoryProperties) + delete(rawMsg, key) + case "defaultSharePermission": + err = unpopulate(val, "DefaultSharePermission", &a.DefaultSharePermission) + delete(rawMsg, key) + case "directoryServiceOptions": + err = unpopulate(val, "DirectoryServiceOptions", &a.DirectoryServiceOptions) + 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 BlobContainer. +func (b BlobContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", b.ContainerProperties) + populate(objectMap, "etag", b.Etag) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobContainer. +func (b *BlobContainer) UnmarshalJSON(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 "properties": + err = unpopulate(val, "ContainerProperties", &b.ContainerProperties) + delete(rawMsg, 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 "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 BlobInventoryCreationTime. +func (b BlobInventoryCreationTime) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lastNDays", b.LastNDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobInventoryCreationTime. +func (b *BlobInventoryCreationTime) UnmarshalJSON(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 "lastNDays": + err = unpopulate(val, "LastNDays", &b.LastNDays) + 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 BlobInventoryPolicy. +func (b BlobInventoryPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobInventoryPolicy. +func (b *BlobInventoryPolicy) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + 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 BlobInventoryPolicyDefinition. +func (b BlobInventoryPolicyDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "filters", b.Filters) + populate(objectMap, "format", b.Format) + populate(objectMap, "objectType", b.ObjectType) + populate(objectMap, "schedule", b.Schedule) + populate(objectMap, "schemaFields", b.SchemaFields) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobInventoryPolicyDefinition. +func (b *BlobInventoryPolicyDefinition) UnmarshalJSON(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 "filters": + err = unpopulate(val, "Filters", &b.Filters) + delete(rawMsg, key) + case "format": + err = unpopulate(val, "Format", &b.Format) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &b.ObjectType) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &b.Schedule) + delete(rawMsg, key) + case "schemaFields": + err = unpopulate(val, "SchemaFields", &b.SchemaFields) + 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 BlobInventoryPolicyFilter. +func (b BlobInventoryPolicyFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobTypes", b.BlobTypes) + populate(objectMap, "creationTime", b.CreationTime) + populate(objectMap, "excludePrefix", b.ExcludePrefix) + populate(objectMap, "includeBlobVersions", b.IncludeBlobVersions) + populate(objectMap, "includeDeleted", b.IncludeDeleted) + populate(objectMap, "includeSnapshots", b.IncludeSnapshots) + populate(objectMap, "prefixMatch", b.PrefixMatch) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobInventoryPolicyFilter. +func (b *BlobInventoryPolicyFilter) UnmarshalJSON(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 "blobTypes": + err = unpopulate(val, "BlobTypes", &b.BlobTypes) + delete(rawMsg, key) + case "creationTime": + err = unpopulate(val, "CreationTime", &b.CreationTime) + delete(rawMsg, key) + case "excludePrefix": + err = unpopulate(val, "ExcludePrefix", &b.ExcludePrefix) + delete(rawMsg, key) + case "includeBlobVersions": + err = unpopulate(val, "IncludeBlobVersions", &b.IncludeBlobVersions) + delete(rawMsg, key) + case "includeDeleted": + err = unpopulate(val, "IncludeDeleted", &b.IncludeDeleted) + delete(rawMsg, key) + case "includeSnapshots": + err = unpopulate(val, "IncludeSnapshots", &b.IncludeSnapshots) + delete(rawMsg, key) + case "prefixMatch": + err = unpopulate(val, "PrefixMatch", &b.PrefixMatch) + 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 BlobInventoryPolicyProperties. +func (b BlobInventoryPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "lastModifiedTime", b.LastModifiedTime) + populate(objectMap, "policy", b.Policy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobInventoryPolicyProperties. +func (b *BlobInventoryPolicyProperties) UnmarshalJSON(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 "lastModifiedTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedTime", &b.LastModifiedTime) + delete(rawMsg, key) + case "policy": + err = unpopulate(val, "Policy", &b.Policy) + 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 BlobInventoryPolicyRule. +func (b BlobInventoryPolicyRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "definition", b.Definition) + populate(objectMap, "destination", b.Destination) + populate(objectMap, "enabled", b.Enabled) + populate(objectMap, "name", b.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobInventoryPolicyRule. +func (b *BlobInventoryPolicyRule) UnmarshalJSON(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 "definition": + err = unpopulate(val, "Definition", &b.Definition) + delete(rawMsg, key) + case "destination": + err = unpopulate(val, "Destination", &b.Destination) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &b.Enabled) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + 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 BlobInventoryPolicySchema. +func (b BlobInventoryPolicySchema) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destination", b.Destination) + populate(objectMap, "enabled", b.Enabled) + populate(objectMap, "rules", b.Rules) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobInventoryPolicySchema. +func (b *BlobInventoryPolicySchema) UnmarshalJSON(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 "destination": + err = unpopulate(val, "Destination", &b.Destination) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &b.Enabled) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &b.Rules) + 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 BlobRestoreParameters. +func (b BlobRestoreParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobRanges", b.BlobRanges) + populateDateTimeRFC3339(objectMap, "timeToRestore", b.TimeToRestore) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobRestoreParameters. +func (b *BlobRestoreParameters) UnmarshalJSON(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 "blobRanges": + err = unpopulate(val, "BlobRanges", &b.BlobRanges) + delete(rawMsg, key) + case "timeToRestore": + err = unpopulateDateTimeRFC3339(val, "TimeToRestore", &b.TimeToRestore) + 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 BlobRestoreRange. +func (b BlobRestoreRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endRange", b.EndRange) + populate(objectMap, "startRange", b.StartRange) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobRestoreRange. +func (b *BlobRestoreRange) UnmarshalJSON(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 "endRange": + err = unpopulate(val, "EndRange", &b.EndRange) + delete(rawMsg, key) + case "startRange": + err = unpopulate(val, "StartRange", &b.StartRange) + 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 BlobRestoreStatus. +func (b BlobRestoreStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "failureReason", b.FailureReason) + populate(objectMap, "parameters", b.Parameters) + populate(objectMap, "restoreId", b.RestoreID) + populate(objectMap, "status", b.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobRestoreStatus. +func (b *BlobRestoreStatus) UnmarshalJSON(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 "failureReason": + err = unpopulate(val, "FailureReason", &b.FailureReason) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &b.Parameters) + delete(rawMsg, key) + case "restoreId": + err = unpopulate(val, "RestoreID", &b.RestoreID) + 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 BlobServiceItems. +func (b BlobServiceItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobServiceItems. +func (b *BlobServiceItems) UnmarshalJSON(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 BlobServiceProperties. +func (b BlobServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", b.BlobServiceProperties) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "sku", b.SKU) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobServiceProperties. +func (b *BlobServiceProperties) UnmarshalJSON(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 "properties": + err = unpopulate(val, "BlobServiceProperties", &b.BlobServiceProperties) + 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 "sku": + err = unpopulate(val, "SKU", &b.SKU) + 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 BlobServicePropertiesProperties. +func (b BlobServicePropertiesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "automaticSnapshotPolicyEnabled", b.AutomaticSnapshotPolicyEnabled) + populate(objectMap, "changeFeed", b.ChangeFeed) + populate(objectMap, "containerDeleteRetentionPolicy", b.ContainerDeleteRetentionPolicy) + populate(objectMap, "cors", b.Cors) + populate(objectMap, "defaultServiceVersion", b.DefaultServiceVersion) + populate(objectMap, "deleteRetentionPolicy", b.DeleteRetentionPolicy) + populate(objectMap, "isVersioningEnabled", b.IsVersioningEnabled) + populate(objectMap, "lastAccessTimeTrackingPolicy", b.LastAccessTimeTrackingPolicy) + populate(objectMap, "restorePolicy", b.RestorePolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobServicePropertiesProperties. +func (b *BlobServicePropertiesProperties) UnmarshalJSON(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 "automaticSnapshotPolicyEnabled": + err = unpopulate(val, "AutomaticSnapshotPolicyEnabled", &b.AutomaticSnapshotPolicyEnabled) + delete(rawMsg, key) + case "changeFeed": + err = unpopulate(val, "ChangeFeed", &b.ChangeFeed) + delete(rawMsg, key) + case "containerDeleteRetentionPolicy": + err = unpopulate(val, "ContainerDeleteRetentionPolicy", &b.ContainerDeleteRetentionPolicy) + delete(rawMsg, key) + case "cors": + err = unpopulate(val, "Cors", &b.Cors) + delete(rawMsg, key) + case "defaultServiceVersion": + err = unpopulate(val, "DefaultServiceVersion", &b.DefaultServiceVersion) + delete(rawMsg, key) + case "deleteRetentionPolicy": + err = unpopulate(val, "DeleteRetentionPolicy", &b.DeleteRetentionPolicy) + delete(rawMsg, key) + case "isVersioningEnabled": + err = unpopulate(val, "IsVersioningEnabled", &b.IsVersioningEnabled) + delete(rawMsg, key) + case "lastAccessTimeTrackingPolicy": + err = unpopulate(val, "LastAccessTimeTrackingPolicy", &b.LastAccessTimeTrackingPolicy) + delete(rawMsg, key) + case "restorePolicy": + err = unpopulate(val, "RestorePolicy", &b.RestorePolicy) + 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 ChangeFeed. +func (c ChangeFeed) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", c.Enabled) + populate(objectMap, "retentionInDays", c.RetentionInDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChangeFeed. +func (c *ChangeFeed) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &c.Enabled) + delete(rawMsg, key) + case "retentionInDays": + err = unpopulate(val, "RetentionInDays", &c.RetentionInDays) + 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 CheckNameAvailabilityResult. +func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. +func (c *CheckNameAvailabilityResult) UnmarshalJSON(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 "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 ContainerProperties. +func (c ContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultEncryptionScope", c.DefaultEncryptionScope) + populate(objectMap, "deleted", c.Deleted) + populateDateTimeRFC3339(objectMap, "deletedTime", c.DeletedTime) + populate(objectMap, "denyEncryptionScopeOverride", c.DenyEncryptionScopeOverride) + populate(objectMap, "enableNfsV3AllSquash", c.EnableNfsV3AllSquash) + populate(objectMap, "enableNfsV3RootSquash", c.EnableNfsV3RootSquash) + populate(objectMap, "hasImmutabilityPolicy", c.HasImmutabilityPolicy) + populate(objectMap, "hasLegalHold", c.HasLegalHold) + populate(objectMap, "immutabilityPolicy", c.ImmutabilityPolicy) + populate(objectMap, "immutableStorageWithVersioning", c.ImmutableStorageWithVersioning) + populateDateTimeRFC3339(objectMap, "lastModifiedTime", c.LastModifiedTime) + populate(objectMap, "leaseDuration", c.LeaseDuration) + populate(objectMap, "leaseState", c.LeaseState) + populate(objectMap, "leaseStatus", c.LeaseStatus) + populate(objectMap, "legalHold", c.LegalHold) + populate(objectMap, "metadata", c.Metadata) + populate(objectMap, "publicAccess", c.PublicAccess) + populate(objectMap, "remainingRetentionDays", c.RemainingRetentionDays) + populate(objectMap, "version", c.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerProperties. +func (c *ContainerProperties) UnmarshalJSON(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 "defaultEncryptionScope": + err = unpopulate(val, "DefaultEncryptionScope", &c.DefaultEncryptionScope) + delete(rawMsg, key) + case "deleted": + err = unpopulate(val, "Deleted", &c.Deleted) + delete(rawMsg, key) + case "deletedTime": + err = unpopulateDateTimeRFC3339(val, "DeletedTime", &c.DeletedTime) + delete(rawMsg, key) + case "denyEncryptionScopeOverride": + err = unpopulate(val, "DenyEncryptionScopeOverride", &c.DenyEncryptionScopeOverride) + delete(rawMsg, key) + case "enableNfsV3AllSquash": + err = unpopulate(val, "EnableNfsV3AllSquash", &c.EnableNfsV3AllSquash) + delete(rawMsg, key) + case "enableNfsV3RootSquash": + err = unpopulate(val, "EnableNfsV3RootSquash", &c.EnableNfsV3RootSquash) + delete(rawMsg, key) + case "hasImmutabilityPolicy": + err = unpopulate(val, "HasImmutabilityPolicy", &c.HasImmutabilityPolicy) + delete(rawMsg, key) + case "hasLegalHold": + err = unpopulate(val, "HasLegalHold", &c.HasLegalHold) + delete(rawMsg, key) + case "immutabilityPolicy": + err = unpopulate(val, "ImmutabilityPolicy", &c.ImmutabilityPolicy) + delete(rawMsg, key) + case "immutableStorageWithVersioning": + err = unpopulate(val, "ImmutableStorageWithVersioning", &c.ImmutableStorageWithVersioning) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedTime", &c.LastModifiedTime) + delete(rawMsg, key) + case "leaseDuration": + err = unpopulate(val, "LeaseDuration", &c.LeaseDuration) + delete(rawMsg, key) + case "leaseState": + err = unpopulate(val, "LeaseState", &c.LeaseState) + delete(rawMsg, key) + case "leaseStatus": + err = unpopulate(val, "LeaseStatus", &c.LeaseStatus) + delete(rawMsg, key) + case "legalHold": + err = unpopulate(val, "LegalHold", &c.LegalHold) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &c.Metadata) + delete(rawMsg, key) + case "publicAccess": + err = unpopulate(val, "PublicAccess", &c.PublicAccess) + delete(rawMsg, key) + case "remainingRetentionDays": + err = unpopulate(val, "RemainingRetentionDays", &c.RemainingRetentionDays) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &c.Version) + 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 CorsRule. +func (c CorsRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedHeaders", c.AllowedHeaders) + populate(objectMap, "allowedMethods", c.AllowedMethods) + populate(objectMap, "allowedOrigins", c.AllowedOrigins) + populate(objectMap, "exposedHeaders", c.ExposedHeaders) + populate(objectMap, "maxAgeInSeconds", c.MaxAgeInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CorsRule. +func (c *CorsRule) UnmarshalJSON(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 "allowedHeaders": + err = unpopulate(val, "AllowedHeaders", &c.AllowedHeaders) + delete(rawMsg, key) + case "allowedMethods": + err = unpopulate(val, "AllowedMethods", &c.AllowedMethods) + delete(rawMsg, key) + case "allowedOrigins": + err = unpopulate(val, "AllowedOrigins", &c.AllowedOrigins) + delete(rawMsg, key) + case "exposedHeaders": + err = unpopulate(val, "ExposedHeaders", &c.ExposedHeaders) + delete(rawMsg, key) + case "maxAgeInSeconds": + err = unpopulate(val, "MaxAgeInSeconds", &c.MaxAgeInSeconds) + 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 CorsRules. +func (c CorsRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "corsRules", c.CorsRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CorsRules. +func (c *CorsRules) UnmarshalJSON(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 "corsRules": + err = unpopulate(val, "CorsRules", &c.CorsRules) + 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 CustomDomain. +func (c CustomDomain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "useSubDomainName", c.UseSubDomainName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomDomain. +func (c *CustomDomain) UnmarshalJSON(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 "useSubDomainName": + err = unpopulate(val, "UseSubDomainName", &c.UseSubDomainName) + 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 DateAfterCreation. +func (d DateAfterCreation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "daysAfterCreationGreaterThan", d.DaysAfterCreationGreaterThan) + populate(objectMap, "daysAfterLastTierChangeGreaterThan", d.DaysAfterLastTierChangeGreaterThan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DateAfterCreation. +func (d *DateAfterCreation) UnmarshalJSON(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 "daysAfterCreationGreaterThan": + err = unpopulate(val, "DaysAfterCreationGreaterThan", &d.DaysAfterCreationGreaterThan) + delete(rawMsg, key) + case "daysAfterLastTierChangeGreaterThan": + err = unpopulate(val, "DaysAfterLastTierChangeGreaterThan", &d.DaysAfterLastTierChangeGreaterThan) + 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 DateAfterModification. +func (d DateAfterModification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "daysAfterCreationGreaterThan", d.DaysAfterCreationGreaterThan) + populate(objectMap, "daysAfterLastAccessTimeGreaterThan", d.DaysAfterLastAccessTimeGreaterThan) + populate(objectMap, "daysAfterLastTierChangeGreaterThan", d.DaysAfterLastTierChangeGreaterThan) + populate(objectMap, "daysAfterModificationGreaterThan", d.DaysAfterModificationGreaterThan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DateAfterModification. +func (d *DateAfterModification) UnmarshalJSON(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 "daysAfterCreationGreaterThan": + err = unpopulate(val, "DaysAfterCreationGreaterThan", &d.DaysAfterCreationGreaterThan) + delete(rawMsg, key) + case "daysAfterLastAccessTimeGreaterThan": + err = unpopulate(val, "DaysAfterLastAccessTimeGreaterThan", &d.DaysAfterLastAccessTimeGreaterThan) + delete(rawMsg, key) + case "daysAfterLastTierChangeGreaterThan": + err = unpopulate(val, "DaysAfterLastTierChangeGreaterThan", &d.DaysAfterLastTierChangeGreaterThan) + delete(rawMsg, key) + case "daysAfterModificationGreaterThan": + err = unpopulate(val, "DaysAfterModificationGreaterThan", &d.DaysAfterModificationGreaterThan) + 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 DeleteRetentionPolicy. +func (d DeleteRetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowPermanentDelete", d.AllowPermanentDelete) + populate(objectMap, "days", d.Days) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeleteRetentionPolicy. +func (d *DeleteRetentionPolicy) UnmarshalJSON(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 "allowPermanentDelete": + err = unpopulate(val, "AllowPermanentDelete", &d.AllowPermanentDelete) + delete(rawMsg, key) + case "days": + err = unpopulate(val, "Days", &d.Days) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + 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 DeletedAccount. +func (d DeletedAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 DeletedAccount. +func (d *DeletedAccount) UnmarshalJSON(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 DeletedAccountListResult. +func (d DeletedAccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedAccountListResult. +func (d *DeletedAccountListResult) UnmarshalJSON(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 DeletedAccountProperties. +func (d DeletedAccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "creationTime", d.CreationTime) + populate(objectMap, "deletionTime", d.DeletionTime) + populate(objectMap, "location", d.Location) + populate(objectMap, "restoreReference", d.RestoreReference) + populate(objectMap, "storageAccountResourceId", d.StorageAccountResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedAccountProperties. +func (d *DeletedAccountProperties) UnmarshalJSON(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 "creationTime": + err = unpopulate(val, "CreationTime", &d.CreationTime) + delete(rawMsg, key) + case "deletionTime": + err = unpopulate(val, "DeletionTime", &d.DeletionTime) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "restoreReference": + err = unpopulate(val, "RestoreReference", &d.RestoreReference) + delete(rawMsg, key) + case "storageAccountResourceId": + err = unpopulate(val, "StorageAccountResourceID", &d.StorageAccountResourceID) + 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 DeletedShare. +func (d DeletedShare) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deletedShareName", d.DeletedShareName) + populate(objectMap, "deletedShareVersion", d.DeletedShareVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedShare. +func (d *DeletedShare) UnmarshalJSON(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 "deletedShareName": + err = unpopulate(val, "DeletedShareName", &d.DeletedShareName) + delete(rawMsg, key) + case "deletedShareVersion": + err = unpopulate(val, "DeletedShareVersion", &d.DeletedShareVersion) + 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]any) + populate(objectMap, "displayName", d.DisplayName) + 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 "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 Encryption. +func (e Encryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", e.EncryptionIdentity) + populate(objectMap, "keySource", e.KeySource) + populate(objectMap, "keyvaultproperties", e.KeyVaultProperties) + populate(objectMap, "requireInfrastructureEncryption", e.RequireInfrastructureEncryption) + populate(objectMap, "services", e.Services) + 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 "identity": + err = unpopulate(val, "EncryptionIdentity", &e.EncryptionIdentity) + delete(rawMsg, key) + case "keySource": + err = unpopulate(val, "KeySource", &e.KeySource) + delete(rawMsg, key) + case "keyvaultproperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) + delete(rawMsg, key) + case "requireInfrastructureEncryption": + err = unpopulate(val, "RequireInfrastructureEncryption", &e.RequireInfrastructureEncryption) + delete(rawMsg, key) + case "services": + err = unpopulate(val, "Services", &e.Services) + 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 EncryptionIdentity. +func (e EncryptionIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "federatedIdentityClientId", e.EncryptionFederatedIdentityClientID) + populate(objectMap, "userAssignedIdentity", e.EncryptionUserAssignedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionIdentity. +func (e *EncryptionIdentity) UnmarshalJSON(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 "federatedIdentityClientId": + err = unpopulate(val, "EncryptionFederatedIdentityClientID", &e.EncryptionFederatedIdentityClientID) + delete(rawMsg, key) + case "userAssignedIdentity": + err = unpopulate(val, "EncryptionUserAssignedIdentity", &e.EncryptionUserAssignedIdentity) + 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 EncryptionScope. +func (e EncryptionScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", e.EncryptionScopeProperties) + 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 EncryptionScope. +func (e *EncryptionScope) UnmarshalJSON(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 "properties": + err = unpopulate(val, "EncryptionScopeProperties", &e.EncryptionScopeProperties) + 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 "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 EncryptionScopeKeyVaultProperties. +func (e EncryptionScopeKeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentVersionedKeyIdentifier", e.CurrentVersionedKeyIdentifier) + populate(objectMap, "keyUri", e.KeyURI) + populateDateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", e.LastKeyRotationTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionScopeKeyVaultProperties. +func (e *EncryptionScopeKeyVaultProperties) UnmarshalJSON(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 "currentVersionedKeyIdentifier": + err = unpopulate(val, "CurrentVersionedKeyIdentifier", &e.CurrentVersionedKeyIdentifier) + delete(rawMsg, key) + case "keyUri": + err = unpopulate(val, "KeyURI", &e.KeyURI) + delete(rawMsg, key) + case "lastKeyRotationTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastKeyRotationTimestamp", &e.LastKeyRotationTimestamp) + 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 EncryptionScopeListResult. +func (e EncryptionScopeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionScopeListResult. +func (e *EncryptionScopeListResult) UnmarshalJSON(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 EncryptionScopeProperties. +func (e EncryptionScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "creationTime", e.CreationTime) + populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) + populateDateTimeRFC3339(objectMap, "lastModifiedTime", e.LastModifiedTime) + populate(objectMap, "requireInfrastructureEncryption", e.RequireInfrastructureEncryption) + populate(objectMap, "source", e.Source) + populate(objectMap, "state", e.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionScopeProperties. +func (e *EncryptionScopeProperties) UnmarshalJSON(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 "creationTime": + err = unpopulateDateTimeRFC3339(val, "CreationTime", &e.CreationTime) + delete(rawMsg, key) + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedTime", &e.LastModifiedTime) + delete(rawMsg, key) + case "requireInfrastructureEncryption": + err = unpopulate(val, "RequireInfrastructureEncryption", &e.RequireInfrastructureEncryption) + 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 EncryptionService. +func (e EncryptionService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", e.Enabled) + populate(objectMap, "keyType", e.KeyType) + populateDateTimeRFC3339(objectMap, "lastEnabledTime", e.LastEnabledTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionService. +func (e *EncryptionService) UnmarshalJSON(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 "keyType": + err = unpopulate(val, "KeyType", &e.KeyType) + delete(rawMsg, key) + case "lastEnabledTime": + err = unpopulateDateTimeRFC3339(val, "LastEnabledTime", &e.LastEnabledTime) + 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 EncryptionServices. +func (e EncryptionServices) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blob", e.Blob) + populate(objectMap, "file", e.File) + populate(objectMap, "queue", e.Queue) + populate(objectMap, "table", e.Table) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionServices. +func (e *EncryptionServices) UnmarshalJSON(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 "blob": + err = unpopulate(val, "Blob", &e.Blob) + delete(rawMsg, key) + case "file": + err = unpopulate(val, "File", &e.File) + delete(rawMsg, key) + case "queue": + err = unpopulate(val, "Queue", &e.Queue) + delete(rawMsg, key) + case "table": + err = unpopulate(val, "Table", &e.Table) + 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 Endpoints. +func (e Endpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blob", e.Blob) + populate(objectMap, "dfs", e.Dfs) + populate(objectMap, "file", e.File) + populate(objectMap, "internetEndpoints", e.InternetEndpoints) + populate(objectMap, "microsoftEndpoints", e.MicrosoftEndpoints) + populate(objectMap, "queue", e.Queue) + populate(objectMap, "table", e.Table) + populate(objectMap, "web", e.Web) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Endpoints. +func (e *Endpoints) UnmarshalJSON(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 "blob": + err = unpopulate(val, "Blob", &e.Blob) + delete(rawMsg, key) + case "dfs": + err = unpopulate(val, "Dfs", &e.Dfs) + delete(rawMsg, key) + case "file": + err = unpopulate(val, "File", &e.File) + delete(rawMsg, key) + case "internetEndpoints": + err = unpopulate(val, "InternetEndpoints", &e.InternetEndpoints) + delete(rawMsg, key) + case "microsoftEndpoints": + err = unpopulate(val, "MicrosoftEndpoints", &e.MicrosoftEndpoints) + delete(rawMsg, key) + case "queue": + err = unpopulate(val, "Queue", &e.Queue) + delete(rawMsg, key) + case "table": + err = unpopulate(val, "Table", &e.Table) + delete(rawMsg, key) + case "web": + err = unpopulate(val, "Web", &e.Web) + 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 ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(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 "info": + err = unpopulate(val, "Info", &e.Info) + 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 ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(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 "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + 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]any) + 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 ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) UnmarshalJSON(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 ErrorResponseBody. +func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. +func (e *ErrorResponseBody) UnmarshalJSON(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) + } + 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]any) + 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 FileServiceItems. +func (f FileServiceItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileServiceItems. +func (f *FileServiceItems) UnmarshalJSON(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 "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 FileServiceProperties. +func (f FileServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", f.FileServiceProperties) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "sku", f.SKU) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileServiceProperties. +func (f *FileServiceProperties) UnmarshalJSON(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 "properties": + err = unpopulate(val, "FileServiceProperties", &f.FileServiceProperties) + 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 "sku": + err = unpopulate(val, "SKU", &f.SKU) + 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 FileServicePropertiesProperties. +func (f FileServicePropertiesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cors", f.Cors) + populate(objectMap, "protocolSettings", f.ProtocolSettings) + populate(objectMap, "shareDeleteRetentionPolicy", f.ShareDeleteRetentionPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileServicePropertiesProperties. +func (f *FileServicePropertiesProperties) UnmarshalJSON(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 "cors": + err = unpopulate(val, "Cors", &f.Cors) + delete(rawMsg, key) + case "protocolSettings": + err = unpopulate(val, "ProtocolSettings", &f.ProtocolSettings) + delete(rawMsg, key) + case "shareDeleteRetentionPolicy": + err = unpopulate(val, "ShareDeleteRetentionPolicy", &f.ShareDeleteRetentionPolicy) + 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 FileShare. +func (f FileShare) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", f.Etag) + populate(objectMap, "properties", f.FileShareProperties) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileShare. +func (f *FileShare) UnmarshalJSON(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 "properties": + err = unpopulate(val, "FileShareProperties", &f.FileShareProperties) + 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 "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 FileShareItem. +func (f FileShareItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 FileShareItem. +func (f *FileShareItem) UnmarshalJSON(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 FileShareItems. +func (f FileShareItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileShareItems. +func (f *FileShareItems) UnmarshalJSON(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 FileShareProperties. +func (f FileShareProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessTier", f.AccessTier) + populateDateTimeRFC3339(objectMap, "accessTierChangeTime", f.AccessTierChangeTime) + populate(objectMap, "accessTierStatus", f.AccessTierStatus) + populate(objectMap, "deleted", f.Deleted) + populateDateTimeRFC3339(objectMap, "deletedTime", f.DeletedTime) + populate(objectMap, "enabledProtocols", f.EnabledProtocols) + populateDateTimeRFC3339(objectMap, "lastModifiedTime", f.LastModifiedTime) + populate(objectMap, "leaseDuration", f.LeaseDuration) + populate(objectMap, "leaseState", f.LeaseState) + populate(objectMap, "leaseStatus", f.LeaseStatus) + populate(objectMap, "metadata", f.Metadata) + populate(objectMap, "remainingRetentionDays", f.RemainingRetentionDays) + populate(objectMap, "rootSquash", f.RootSquash) + populate(objectMap, "shareQuota", f.ShareQuota) + populate(objectMap, "shareUsageBytes", f.ShareUsageBytes) + populate(objectMap, "signedIdentifiers", f.SignedIdentifiers) + populateDateTimeRFC3339(objectMap, "snapshotTime", f.SnapshotTime) + populate(objectMap, "version", f.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileShareProperties. +func (f *FileShareProperties) UnmarshalJSON(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 "accessTier": + err = unpopulate(val, "AccessTier", &f.AccessTier) + delete(rawMsg, key) + case "accessTierChangeTime": + err = unpopulateDateTimeRFC3339(val, "AccessTierChangeTime", &f.AccessTierChangeTime) + delete(rawMsg, key) + case "accessTierStatus": + err = unpopulate(val, "AccessTierStatus", &f.AccessTierStatus) + delete(rawMsg, key) + case "deleted": + err = unpopulate(val, "Deleted", &f.Deleted) + delete(rawMsg, key) + case "deletedTime": + err = unpopulateDateTimeRFC3339(val, "DeletedTime", &f.DeletedTime) + delete(rawMsg, key) + case "enabledProtocols": + err = unpopulate(val, "EnabledProtocols", &f.EnabledProtocols) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedTime", &f.LastModifiedTime) + delete(rawMsg, key) + case "leaseDuration": + err = unpopulate(val, "LeaseDuration", &f.LeaseDuration) + delete(rawMsg, key) + case "leaseState": + err = unpopulate(val, "LeaseState", &f.LeaseState) + delete(rawMsg, key) + case "leaseStatus": + err = unpopulate(val, "LeaseStatus", &f.LeaseStatus) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &f.Metadata) + delete(rawMsg, key) + case "remainingRetentionDays": + err = unpopulate(val, "RemainingRetentionDays", &f.RemainingRetentionDays) + delete(rawMsg, key) + case "rootSquash": + err = unpopulate(val, "RootSquash", &f.RootSquash) + delete(rawMsg, key) + case "shareQuota": + err = unpopulate(val, "ShareQuota", &f.ShareQuota) + delete(rawMsg, key) + case "shareUsageBytes": + err = unpopulate(val, "ShareUsageBytes", &f.ShareUsageBytes) + delete(rawMsg, key) + case "signedIdentifiers": + err = unpopulate(val, "SignedIdentifiers", &f.SignedIdentifiers) + delete(rawMsg, key) + case "snapshotTime": + err = unpopulateDateTimeRFC3339(val, "SnapshotTime", &f.SnapshotTime) + 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 GeoReplicationStats. +func (g GeoReplicationStats) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "canFailover", g.CanFailover) + populate(objectMap, "canPlannedFailover", g.CanPlannedFailover) + populateDateTimeRFC3339(objectMap, "lastSyncTime", g.LastSyncTime) + populate(objectMap, "postFailoverRedundancy", g.PostFailoverRedundancy) + populate(objectMap, "postPlannedFailoverRedundancy", g.PostPlannedFailoverRedundancy) + populate(objectMap, "status", g.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GeoReplicationStats. +func (g *GeoReplicationStats) UnmarshalJSON(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 "canFailover": + err = unpopulate(val, "CanFailover", &g.CanFailover) + delete(rawMsg, key) + case "canPlannedFailover": + err = unpopulate(val, "CanPlannedFailover", &g.CanPlannedFailover) + delete(rawMsg, key) + case "lastSyncTime": + err = unpopulateDateTimeRFC3339(val, "LastSyncTime", &g.LastSyncTime) + delete(rawMsg, key) + case "postFailoverRedundancy": + err = unpopulate(val, "PostFailoverRedundancy", &g.PostFailoverRedundancy) + delete(rawMsg, key) + case "postPlannedFailoverRedundancy": + err = unpopulate(val, "PostPlannedFailoverRedundancy", &g.PostPlannedFailoverRedundancy) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) + 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 IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["action"] = "Allow" + populate(objectMap, "value", i.IPAddressOrRange) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "IPAddressOrRange", &i.IPAddressOrRange) + 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 Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(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 "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + 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 ImmutabilityPolicy. +func (i ImmutabilityPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 ImmutabilityPolicy. +func (i *ImmutabilityPolicy) UnmarshalJSON(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 ImmutabilityPolicyProperties. +func (i ImmutabilityPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "updateHistory", i.UpdateHistory) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImmutabilityPolicyProperties. +func (i *ImmutabilityPolicyProperties) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "updateHistory": + err = unpopulate(val, "UpdateHistory", &i.UpdateHistory) + 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 ImmutabilityPolicyProperty. +func (i ImmutabilityPolicyProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowProtectedAppendWrites", i.AllowProtectedAppendWrites) + populate(objectMap, "allowProtectedAppendWritesAll", i.AllowProtectedAppendWritesAll) + populate(objectMap, "immutabilityPeriodSinceCreationInDays", i.ImmutabilityPeriodSinceCreationInDays) + populate(objectMap, "state", i.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImmutabilityPolicyProperty. +func (i *ImmutabilityPolicyProperty) UnmarshalJSON(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 "allowProtectedAppendWrites": + err = unpopulate(val, "AllowProtectedAppendWrites", &i.AllowProtectedAppendWrites) + delete(rawMsg, key) + case "allowProtectedAppendWritesAll": + err = unpopulate(val, "AllowProtectedAppendWritesAll", &i.AllowProtectedAppendWritesAll) + delete(rawMsg, key) + case "immutabilityPeriodSinceCreationInDays": + err = unpopulate(val, "ImmutabilityPeriodSinceCreationInDays", &i.ImmutabilityPeriodSinceCreationInDays) + 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 ImmutableStorageAccount. +func (i ImmutableStorageAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", i.Enabled) + populate(objectMap, "immutabilityPolicy", i.ImmutabilityPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImmutableStorageAccount. +func (i *ImmutableStorageAccount) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &i.Enabled) + delete(rawMsg, key) + case "immutabilityPolicy": + err = unpopulate(val, "ImmutabilityPolicy", &i.ImmutabilityPolicy) + 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 ImmutableStorageWithVersioning. +func (i ImmutableStorageWithVersioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", i.Enabled) + populate(objectMap, "migrationState", i.MigrationState) + populateDateTimeRFC3339(objectMap, "timeStamp", i.TimeStamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImmutableStorageWithVersioning. +func (i *ImmutableStorageWithVersioning) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &i.Enabled) + delete(rawMsg, key) + case "migrationState": + err = unpopulate(val, "MigrationState", &i.MigrationState) + delete(rawMsg, key) + case "timeStamp": + err = unpopulateDateTimeRFC3339(val, "TimeStamp", &i.TimeStamp) + 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 KeyCreationTime. +func (k KeyCreationTime) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "key1", k.Key1) + populateDateTimeRFC3339(objectMap, "key2", k.Key2) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyCreationTime. +func (k *KeyCreationTime) UnmarshalJSON(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 "key1": + err = unpopulateDateTimeRFC3339(val, "Key1", &k.Key1) + delete(rawMsg, key) + case "key2": + err = unpopulateDateTimeRFC3339(val, "Key2", &k.Key2) + 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 KeyPolicy. +func (k KeyPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyExpirationPeriodInDays", k.KeyExpirationPeriodInDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyPolicy. +func (k *KeyPolicy) UnmarshalJSON(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 "keyExpirationPeriodInDays": + err = unpopulate(val, "KeyExpirationPeriodInDays", &k.KeyExpirationPeriodInDays) + 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 KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "currentVersionedKeyExpirationTimestamp", k.CurrentVersionedKeyExpirationTimestamp) + populate(objectMap, "currentVersionedKeyIdentifier", k.CurrentVersionedKeyIdentifier) + populate(objectMap, "keyname", k.KeyName) + populate(objectMap, "keyvaulturi", k.KeyVaultURI) + populate(objectMap, "keyversion", k.KeyVersion) + populateDateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) UnmarshalJSON(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 "currentVersionedKeyExpirationTimestamp": + err = unpopulateDateTimeRFC3339(val, "CurrentVersionedKeyExpirationTimestamp", &k.CurrentVersionedKeyExpirationTimestamp) + delete(rawMsg, key) + case "currentVersionedKeyIdentifier": + err = unpopulate(val, "CurrentVersionedKeyIdentifier", &k.CurrentVersionedKeyIdentifier) + delete(rawMsg, key) + case "keyname": + err = unpopulate(val, "KeyName", &k.KeyName) + delete(rawMsg, key) + case "keyvaulturi": + err = unpopulate(val, "KeyVaultURI", &k.KeyVaultURI) + delete(rawMsg, key) + case "keyversion": + err = unpopulate(val, "KeyVersion", &k.KeyVersion) + delete(rawMsg, key) + case "lastKeyRotationTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastKeyRotationTimestamp", &k.LastKeyRotationTimestamp) + 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 LastAccessTimeTrackingPolicy. +func (l LastAccessTimeTrackingPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobType", l.BlobType) + populate(objectMap, "enable", l.Enable) + populate(objectMap, "name", l.Name) + populate(objectMap, "trackingGranularityInDays", l.TrackingGranularityInDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LastAccessTimeTrackingPolicy. +func (l *LastAccessTimeTrackingPolicy) UnmarshalJSON(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 "blobType": + err = unpopulate(val, "BlobType", &l.BlobType) + delete(rawMsg, key) + case "enable": + err = unpopulate(val, "Enable", &l.Enable) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "trackingGranularityInDays": + err = unpopulate(val, "TrackingGranularityInDays", &l.TrackingGranularityInDays) + 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 LeaseContainerRequest. +func (l LeaseContainerRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", l.Action) + populate(objectMap, "breakPeriod", l.BreakPeriod) + populate(objectMap, "leaseDuration", l.LeaseDuration) + populate(objectMap, "leaseId", l.LeaseID) + populate(objectMap, "proposedLeaseId", l.ProposedLeaseID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LeaseContainerRequest. +func (l *LeaseContainerRequest) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &l.Action) + delete(rawMsg, key) + case "breakPeriod": + err = unpopulate(val, "BreakPeriod", &l.BreakPeriod) + delete(rawMsg, key) + case "leaseDuration": + err = unpopulate(val, "LeaseDuration", &l.LeaseDuration) + delete(rawMsg, key) + case "leaseId": + err = unpopulate(val, "LeaseID", &l.LeaseID) + delete(rawMsg, key) + case "proposedLeaseId": + err = unpopulate(val, "ProposedLeaseID", &l.ProposedLeaseID) + 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 LeaseContainerResponse. +func (l LeaseContainerResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "leaseId", l.LeaseID) + populate(objectMap, "leaseTimeSeconds", l.LeaseTimeSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LeaseContainerResponse. +func (l *LeaseContainerResponse) UnmarshalJSON(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 "leaseId": + err = unpopulate(val, "LeaseID", &l.LeaseID) + delete(rawMsg, key) + case "leaseTimeSeconds": + err = unpopulate(val, "LeaseTimeSeconds", &l.LeaseTimeSeconds) + 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 LeaseShareRequest. +func (l LeaseShareRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", l.Action) + populate(objectMap, "breakPeriod", l.BreakPeriod) + populate(objectMap, "leaseDuration", l.LeaseDuration) + populate(objectMap, "leaseId", l.LeaseID) + populate(objectMap, "proposedLeaseId", l.ProposedLeaseID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LeaseShareRequest. +func (l *LeaseShareRequest) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &l.Action) + delete(rawMsg, key) + case "breakPeriod": + err = unpopulate(val, "BreakPeriod", &l.BreakPeriod) + delete(rawMsg, key) + case "leaseDuration": + err = unpopulate(val, "LeaseDuration", &l.LeaseDuration) + delete(rawMsg, key) + case "leaseId": + err = unpopulate(val, "LeaseID", &l.LeaseID) + delete(rawMsg, key) + case "proposedLeaseId": + err = unpopulate(val, "ProposedLeaseID", &l.ProposedLeaseID) + 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 LeaseShareResponse. +func (l LeaseShareResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "leaseId", l.LeaseID) + populate(objectMap, "leaseTimeSeconds", l.LeaseTimeSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LeaseShareResponse. +func (l *LeaseShareResponse) UnmarshalJSON(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 "leaseId": + err = unpopulate(val, "LeaseID", &l.LeaseID) + delete(rawMsg, key) + case "leaseTimeSeconds": + err = unpopulate(val, "LeaseTimeSeconds", &l.LeaseTimeSeconds) + 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 LegalHold. +func (l LegalHold) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowProtectedAppendWritesAll", l.AllowProtectedAppendWritesAll) + populate(objectMap, "hasLegalHold", l.HasLegalHold) + populate(objectMap, "tags", l.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LegalHold. +func (l *LegalHold) UnmarshalJSON(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 "allowProtectedAppendWritesAll": + err = unpopulate(val, "AllowProtectedAppendWritesAll", &l.AllowProtectedAppendWritesAll) + delete(rawMsg, key) + case "hasLegalHold": + err = unpopulate(val, "HasLegalHold", &l.HasLegalHold) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + 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 LegalHoldProperties. +func (l LegalHoldProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hasLegalHold", l.HasLegalHold) + populate(objectMap, "protectedAppendWritesHistory", l.ProtectedAppendWritesHistory) + populate(objectMap, "tags", l.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LegalHoldProperties. +func (l *LegalHoldProperties) UnmarshalJSON(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 "hasLegalHold": + err = unpopulate(val, "HasLegalHold", &l.HasLegalHold) + delete(rawMsg, key) + case "protectedAppendWritesHistory": + err = unpopulate(val, "ProtectedAppendWritesHistory", &l.ProtectedAppendWritesHistory) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + 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 ListAccountSasResponse. +func (l ListAccountSasResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountSasToken", l.AccountSasToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListAccountSasResponse. +func (l *ListAccountSasResponse) UnmarshalJSON(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 "accountSasToken": + err = unpopulate(val, "AccountSasToken", &l.AccountSasToken) + 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 ListBlobInventoryPolicy. +func (l ListBlobInventoryPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListBlobInventoryPolicy. +func (l *ListBlobInventoryPolicy) UnmarshalJSON(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 "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 ListContainerItem. +func (l ListContainerItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 ListContainerItem. +func (l *ListContainerItem) UnmarshalJSON(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 ListContainerItems. +func (l ListContainerItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListContainerItems. +func (l *ListContainerItems) UnmarshalJSON(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 ListQueue. +func (l ListQueue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.QueueProperties) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListQueue. +func (l *ListQueue) UnmarshalJSON(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, "QueueProperties", &l.QueueProperties) + 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 ListQueueProperties. +func (l ListQueueProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "metadata", l.Metadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListQueueProperties. +func (l *ListQueueProperties) UnmarshalJSON(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 "metadata": + err = unpopulate(val, "Metadata", &l.Metadata) + 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 ListQueueResource. +func (l ListQueueResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListQueueResource. +func (l *ListQueueResource) UnmarshalJSON(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 ListQueueServices. +func (l ListQueueServices) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListQueueServices. +func (l *ListQueueServices) UnmarshalJSON(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 "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 ListServiceSasResponse. +func (l ListServiceSasResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serviceSasToken", l.ServiceSasToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListServiceSasResponse. +func (l *ListServiceSasResponse) UnmarshalJSON(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 "serviceSasToken": + err = unpopulate(val, "ServiceSasToken", &l.ServiceSasToken) + 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 ListTableResource. +func (l ListTableResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListTableResource. +func (l *ListTableResource) UnmarshalJSON(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 ListTableServices. +func (l ListTableServices) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListTableServices. +func (l *ListTableServices) UnmarshalJSON(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 "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 LocalUser. +func (l LocalUser) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalUser. +func (l *LocalUser) UnmarshalJSON(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) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + 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 LocalUserKeys. +func (l LocalUserKeys) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sshAuthorizedKeys", l.SSHAuthorizedKeys) + populate(objectMap, "sharedKey", l.SharedKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalUserKeys. +func (l *LocalUserKeys) UnmarshalJSON(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 "sshAuthorizedKeys": + err = unpopulate(val, "SSHAuthorizedKeys", &l.SSHAuthorizedKeys) + delete(rawMsg, key) + case "sharedKey": + err = unpopulate(val, "SharedKey", &l.SharedKey) + 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 LocalUserProperties. +func (l LocalUserProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hasSshKey", l.HasSSHKey) + populate(objectMap, "hasSshPassword", l.HasSSHPassword) + populate(objectMap, "hasSharedKey", l.HasSharedKey) + populate(objectMap, "homeDirectory", l.HomeDirectory) + populate(objectMap, "permissionScopes", l.PermissionScopes) + populate(objectMap, "sshAuthorizedKeys", l.SSHAuthorizedKeys) + populate(objectMap, "sid", l.Sid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalUserProperties. +func (l *LocalUserProperties) UnmarshalJSON(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 "hasSshKey": + err = unpopulate(val, "HasSSHKey", &l.HasSSHKey) + delete(rawMsg, key) + case "hasSshPassword": + err = unpopulate(val, "HasSSHPassword", &l.HasSSHPassword) + delete(rawMsg, key) + case "hasSharedKey": + err = unpopulate(val, "HasSharedKey", &l.HasSharedKey) + delete(rawMsg, key) + case "homeDirectory": + err = unpopulate(val, "HomeDirectory", &l.HomeDirectory) + delete(rawMsg, key) + case "permissionScopes": + err = unpopulate(val, "PermissionScopes", &l.PermissionScopes) + delete(rawMsg, key) + case "sshAuthorizedKeys": + err = unpopulate(val, "SSHAuthorizedKeys", &l.SSHAuthorizedKeys) + delete(rawMsg, key) + case "sid": + err = unpopulate(val, "Sid", &l.Sid) + 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 LocalUserRegeneratePasswordResult. +func (l LocalUserRegeneratePasswordResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sshPassword", l.SSHPassword) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalUserRegeneratePasswordResult. +func (l *LocalUserRegeneratePasswordResult) UnmarshalJSON(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 "sshPassword": + err = unpopulate(val, "SSHPassword", &l.SSHPassword) + 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 LocalUsers. +func (l LocalUsers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalUsers. +func (l *LocalUsers) UnmarshalJSON(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 "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 ManagementPolicy. +func (m ManagementPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicy. +func (m *ManagementPolicy) UnmarshalJSON(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) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + 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 ManagementPolicyAction. +func (m ManagementPolicyAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseBlob", m.BaseBlob) + populate(objectMap, "snapshot", m.Snapshot) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicyAction. +func (m *ManagementPolicyAction) UnmarshalJSON(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 "baseBlob": + err = unpopulate(val, "BaseBlob", &m.BaseBlob) + delete(rawMsg, key) + case "snapshot": + err = unpopulate(val, "Snapshot", &m.Snapshot) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + 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 ManagementPolicyBaseBlob. +func (m ManagementPolicyBaseBlob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "delete", m.Delete) + populate(objectMap, "enableAutoTierToHotFromCool", m.EnableAutoTierToHotFromCool) + populate(objectMap, "tierToArchive", m.TierToArchive) + populate(objectMap, "tierToCold", m.TierToCold) + populate(objectMap, "tierToCool", m.TierToCool) + populate(objectMap, "tierToHot", m.TierToHot) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicyBaseBlob. +func (m *ManagementPolicyBaseBlob) UnmarshalJSON(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 "delete": + err = unpopulate(val, "Delete", &m.Delete) + delete(rawMsg, key) + case "enableAutoTierToHotFromCool": + err = unpopulate(val, "EnableAutoTierToHotFromCool", &m.EnableAutoTierToHotFromCool) + delete(rawMsg, key) + case "tierToArchive": + err = unpopulate(val, "TierToArchive", &m.TierToArchive) + delete(rawMsg, key) + case "tierToCold": + err = unpopulate(val, "TierToCold", &m.TierToCold) + delete(rawMsg, key) + case "tierToCool": + err = unpopulate(val, "TierToCool", &m.TierToCool) + delete(rawMsg, key) + case "tierToHot": + err = unpopulate(val, "TierToHot", &m.TierToHot) + 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 ManagementPolicyDefinition. +func (m ManagementPolicyDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", m.Actions) + populate(objectMap, "filters", m.Filters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicyDefinition. +func (m *ManagementPolicyDefinition) UnmarshalJSON(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 "actions": + err = unpopulate(val, "Actions", &m.Actions) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, "Filters", &m.Filters) + 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 ManagementPolicyFilter. +func (m ManagementPolicyFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobIndexMatch", m.BlobIndexMatch) + populate(objectMap, "blobTypes", m.BlobTypes) + populate(objectMap, "prefixMatch", m.PrefixMatch) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicyFilter. +func (m *ManagementPolicyFilter) UnmarshalJSON(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 "blobIndexMatch": + err = unpopulate(val, "BlobIndexMatch", &m.BlobIndexMatch) + delete(rawMsg, key) + case "blobTypes": + err = unpopulate(val, "BlobTypes", &m.BlobTypes) + delete(rawMsg, key) + case "prefixMatch": + err = unpopulate(val, "PrefixMatch", &m.PrefixMatch) + 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 ManagementPolicyProperties. +func (m ManagementPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "lastModifiedTime", m.LastModifiedTime) + populate(objectMap, "policy", m.Policy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicyProperties. +func (m *ManagementPolicyProperties) UnmarshalJSON(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 "lastModifiedTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedTime", &m.LastModifiedTime) + delete(rawMsg, key) + case "policy": + err = unpopulate(val, "Policy", &m.Policy) + 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 ManagementPolicyRule. +func (m ManagementPolicyRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "definition", m.Definition) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "name", m.Name) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicyRule. +func (m *ManagementPolicyRule) UnmarshalJSON(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 "definition": + err = unpopulate(val, "Definition", &m.Definition) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + 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 ManagementPolicySchema. +func (m ManagementPolicySchema) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "rules", m.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicySchema. +func (m *ManagementPolicySchema) UnmarshalJSON(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 "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 ManagementPolicySnapShot. +func (m ManagementPolicySnapShot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "delete", m.Delete) + populate(objectMap, "tierToArchive", m.TierToArchive) + populate(objectMap, "tierToCold", m.TierToCold) + populate(objectMap, "tierToCool", m.TierToCool) + populate(objectMap, "tierToHot", m.TierToHot) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicySnapShot. +func (m *ManagementPolicySnapShot) UnmarshalJSON(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 "delete": + err = unpopulate(val, "Delete", &m.Delete) + delete(rawMsg, key) + case "tierToArchive": + err = unpopulate(val, "TierToArchive", &m.TierToArchive) + delete(rawMsg, key) + case "tierToCold": + err = unpopulate(val, "TierToCold", &m.TierToCold) + delete(rawMsg, key) + case "tierToCool": + err = unpopulate(val, "TierToCool", &m.TierToCool) + delete(rawMsg, key) + case "tierToHot": + err = unpopulate(val, "TierToHot", &m.TierToHot) + 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 ManagementPolicyVersion. +func (m ManagementPolicyVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "delete", m.Delete) + populate(objectMap, "tierToArchive", m.TierToArchive) + populate(objectMap, "tierToCold", m.TierToCold) + populate(objectMap, "tierToCool", m.TierToCool) + populate(objectMap, "tierToHot", m.TierToHot) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementPolicyVersion. +func (m *ManagementPolicyVersion) UnmarshalJSON(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 "delete": + err = unpopulate(val, "Delete", &m.Delete) + delete(rawMsg, key) + case "tierToArchive": + err = unpopulate(val, "TierToArchive", &m.TierToArchive) + delete(rawMsg, key) + case "tierToCold": + err = unpopulate(val, "TierToCold", &m.TierToCold) + delete(rawMsg, key) + case "tierToCool": + err = unpopulate(val, "TierToCool", &m.TierToCool) + delete(rawMsg, key) + case "tierToHot": + err = unpopulate(val, "TierToHot", &m.TierToHot) + 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]any) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "category", m.Category) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + populate(objectMap, "name", m.Name) + populate(objectMap, "resourceIdDimensionNameOverride", m.ResourceIDDimensionNameOverride) + 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 "category": + err = unpopulate(val, "Category", &m.Category) + 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 "fillGapWithZero": + err = unpopulate(val, "FillGapWithZero", &m.FillGapWithZero) + 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 "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 Multichannel. +func (m Multichannel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Multichannel. +func (m *Multichannel) UnmarshalJSON(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 "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + 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 NetworkRuleSet. +func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bypass", n.Bypass) + populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) + populate(objectMap, "resourceAccessRules", n.ResourceAccessRules) + populate(objectMap, "virtualNetworkRules", n.VirtualNetworkRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. +func (n *NetworkRuleSet) UnmarshalJSON(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 "bypass": + err = unpopulate(val, "Bypass", &n.Bypass) + delete(rawMsg, key) + case "defaultAction": + err = unpopulate(val, "DefaultAction", &n.DefaultAction) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) + case "resourceAccessRules": + err = unpopulate(val, "ResourceAccessRules", &n.ResourceAccessRules) + delete(rawMsg, key) + case "virtualNetworkRules": + err = unpopulate(val, "VirtualNetworkRules", &n.VirtualNetworkRules) + 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 ObjectReplicationPolicies. +func (o ObjectReplicationPolicies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ObjectReplicationPolicies. +func (o *ObjectReplicationPolicies) UnmarshalJSON(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 ObjectReplicationPolicy. +func (o ObjectReplicationPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 ObjectReplicationPolicy. +func (o *ObjectReplicationPolicy) UnmarshalJSON(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 "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 ObjectReplicationPolicyFilter. +func (o ObjectReplicationPolicyFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "minCreationTime", o.MinCreationTime) + populate(objectMap, "prefixMatch", o.PrefixMatch) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ObjectReplicationPolicyFilter. +func (o *ObjectReplicationPolicyFilter) UnmarshalJSON(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 "minCreationTime": + err = unpopulate(val, "MinCreationTime", &o.MinCreationTime) + delete(rawMsg, key) + case "prefixMatch": + err = unpopulate(val, "PrefixMatch", &o.PrefixMatch) + 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 ObjectReplicationPolicyProperties. +func (o ObjectReplicationPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationAccount", o.DestinationAccount) + populateDateTimeRFC3339(objectMap, "enabledTime", o.EnabledTime) + populate(objectMap, "policyId", o.PolicyID) + populate(objectMap, "rules", o.Rules) + populate(objectMap, "sourceAccount", o.SourceAccount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ObjectReplicationPolicyProperties. +func (o *ObjectReplicationPolicyProperties) UnmarshalJSON(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 "destinationAccount": + err = unpopulate(val, "DestinationAccount", &o.DestinationAccount) + delete(rawMsg, key) + case "enabledTime": + err = unpopulateDateTimeRFC3339(val, "EnabledTime", &o.EnabledTime) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &o.PolicyID) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &o.Rules) + delete(rawMsg, key) + case "sourceAccount": + err = unpopulate(val, "SourceAccount", &o.SourceAccount) + 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 ObjectReplicationPolicyRule. +func (o ObjectReplicationPolicyRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationContainer", o.DestinationContainer) + populate(objectMap, "filters", o.Filters) + populate(objectMap, "ruleId", o.RuleID) + populate(objectMap, "sourceContainer", o.SourceContainer) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ObjectReplicationPolicyRule. +func (o *ObjectReplicationPolicyRule) UnmarshalJSON(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 "destinationContainer": + err = unpopulate(val, "DestinationContainer", &o.DestinationContainer) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, "Filters", &o.Filters) + delete(rawMsg, key) + case "ruleId": + err = unpopulate(val, "RuleID", &o.RuleID) + delete(rawMsg, key) + case "sourceContainer": + err = unpopulate(val, "SourceContainer", &o.SourceContainer) + 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]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.OperationProperties) + populate(objectMap, "origin", o.Origin) + 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 "properties": + err = unpopulate(val, "OperationProperties", &o.OperationProperties) + 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 OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + 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 OperationProperties. +func (o OperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serviceSpecification", o.ServiceSpecification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationProperties. +func (o *OperationProperties) UnmarshalJSON(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 PermissionScope. +func (p PermissionScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "permissions", p.Permissions) + populate(objectMap, "resourceName", p.ResourceName) + populate(objectMap, "service", p.Service) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionScope. +func (p *PermissionScope) UnmarshalJSON(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 "permissions": + err = unpopulate(val, "Permissions", &p.Permissions) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &p.ResourceName) + delete(rawMsg, key) + case "service": + err = unpopulate(val, "Service", &p.Service) + 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]any) + 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]any) + 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]any) + 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 "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]any) + 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]any) + 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]any) + 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]any) + 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]any) + populate(objectMap, "actionRequired", p.ActionRequired) + 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 "actionRequired": + err = unpopulate(val, "ActionRequired", &p.ActionRequired) + 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 ProtectedAppendWritesHistory. +func (p ProtectedAppendWritesHistory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowProtectedAppendWritesAll", p.AllowProtectedAppendWritesAll) + populateDateTimeRFC3339(objectMap, "timestamp", p.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedAppendWritesHistory. +func (p *ProtectedAppendWritesHistory) UnmarshalJSON(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 "allowProtectedAppendWritesAll": + err = unpopulate(val, "AllowProtectedAppendWritesAll", &p.AllowProtectedAppendWritesAll) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &p.Timestamp) + 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 ProtocolSettings. +func (p ProtocolSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "smb", p.Smb) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtocolSettings. +func (p *ProtocolSettings) UnmarshalJSON(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 "smb": + err = unpopulate(val, "Smb", &p.Smb) + 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]any) + 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 Queue. +func (q Queue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", q.ID) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", q.QueueProperties) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Queue. +func (q *Queue) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "QueueProperties", &q.QueueProperties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &q.Type) + 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 QueueProperties. +func (q QueueProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "approximateMessageCount", q.ApproximateMessageCount) + populate(objectMap, "metadata", q.Metadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueueProperties. +func (q *QueueProperties) UnmarshalJSON(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 "approximateMessageCount": + err = unpopulate(val, "ApproximateMessageCount", &q.ApproximateMessageCount) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &q.Metadata) + 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 QueueServiceProperties. +func (q QueueServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", q.ID) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", q.QueueServiceProperties) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueueServiceProperties. +func (q *QueueServiceProperties) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "QueueServiceProperties", &q.QueueServiceProperties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &q.Type) + 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 QueueServicePropertiesProperties. +func (q QueueServicePropertiesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cors", q.Cors) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueueServicePropertiesProperties. +func (q *QueueServicePropertiesProperties) UnmarshalJSON(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 "cors": + err = unpopulate(val, "Cors", &q.Cors) + 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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + 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 "name": + err = unpopulate(val, "Name", &r.Name) + 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 ResourceAccessRule. +func (r ResourceAccessRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceId", r.ResourceID) + populate(objectMap, "tenantId", r.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAccessRule. +func (r *ResourceAccessRule) UnmarshalJSON(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 "resourceId": + err = unpopulate(val, "ResourceID", &r.ResourceID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &r.TenantID) + 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 RestorePolicyProperties. +func (r RestorePolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "days", r.Days) + populate(objectMap, "enabled", r.Enabled) + populateDateTimeRFC3339(objectMap, "lastEnabledTime", r.LastEnabledTime) + populateDateTimeRFC3339(objectMap, "minRestoreTime", r.MinRestoreTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePolicyProperties. +func (r *RestorePolicyProperties) UnmarshalJSON(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) + case "lastEnabledTime": + err = unpopulateDateTimeRFC3339(val, "LastEnabledTime", &r.LastEnabledTime) + delete(rawMsg, key) + case "minRestoreTime": + err = unpopulateDateTimeRFC3339(val, "MinRestoreTime", &r.MinRestoreTime) + 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 Restriction. +func (r Restriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "reasonCode", r.ReasonCode) + populate(objectMap, "type", r.Type) + populate(objectMap, "values", r.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Restriction. +func (r *Restriction) UnmarshalJSON(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 "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 RoutingPreference. +func (r RoutingPreference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publishInternetEndpoints", r.PublishInternetEndpoints) + populate(objectMap, "publishMicrosoftEndpoints", r.PublishMicrosoftEndpoints) + populate(objectMap, "routingChoice", r.RoutingChoice) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingPreference. +func (r *RoutingPreference) UnmarshalJSON(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 "publishInternetEndpoints": + err = unpopulate(val, "PublishInternetEndpoints", &r.PublishInternetEndpoints) + delete(rawMsg, key) + case "publishMicrosoftEndpoints": + err = unpopulate(val, "PublishMicrosoftEndpoints", &r.PublishMicrosoftEndpoints) + delete(rawMsg, key) + case "routingChoice": + err = unpopulate(val, "RoutingChoice", &r.RoutingChoice) + 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]any) + 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 "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 SKUCapability. +func (s SKUCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUCapability. +func (s *SKUCapability) UnmarshalJSON(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 "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 SKUInformation. +func (s SKUInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capabilities", s.Capabilities) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "locations", s.Locations) + populate(objectMap, "name", s.Name) + populate(objectMap, "resourceType", s.ResourceType) + populate(objectMap, "restrictions", s.Restrictions) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUInformation. +func (s *SKUInformation) UnmarshalJSON(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 "capabilities": + err = unpopulate(val, "Capabilities", &s.Capabilities) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &s.Locations) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &s.ResourceType) + delete(rawMsg, key) + case "restrictions": + err = unpopulate(val, "Restrictions", &s.Restrictions) + 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 SKUListResult. +func (s SKUListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUListResult. +func (s *SKUListResult) UnmarshalJSON(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 SSHPublicKey. +func (s SSHPublicKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + populate(objectMap, "key", s.Key) + 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 "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "key": + err = unpopulate(val, "Key", &s.Key) + 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 SasPolicy. +func (s SasPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "expirationAction", s.ExpirationAction) + populate(objectMap, "sasExpirationPeriod", s.SasExpirationPeriod) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SasPolicy. +func (s *SasPolicy) UnmarshalJSON(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 "expirationAction": + err = unpopulate(val, "ExpirationAction", &s.ExpirationAction) + delete(rawMsg, key) + case "sasExpirationPeriod": + err = unpopulate(val, "SasExpirationPeriod", &s.SasExpirationPeriod) + 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 ServiceSasParameters. +func (s ServiceSasParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "rscc", s.CacheControl) + populate(objectMap, "canonicalizedResource", s.CanonicalizedResource) + populate(objectMap, "rscd", s.ContentDisposition) + populate(objectMap, "rsce", s.ContentEncoding) + populate(objectMap, "rscl", s.ContentLanguage) + populate(objectMap, "rsct", s.ContentType) + populate(objectMap, "signedIp", s.IPAddressOrRange) + populate(objectMap, "signedIdentifier", s.Identifier) + populate(objectMap, "keyToSign", s.KeyToSign) + populate(objectMap, "endPk", s.PartitionKeyEnd) + populate(objectMap, "startPk", s.PartitionKeyStart) + populate(objectMap, "signedPermission", s.Permissions) + populate(objectMap, "signedProtocol", s.Protocols) + populate(objectMap, "signedResource", s.Resource) + populate(objectMap, "endRk", s.RowKeyEnd) + populate(objectMap, "startRk", s.RowKeyStart) + populateDateTimeRFC3339(objectMap, "signedExpiry", s.SharedAccessExpiryTime) + populateDateTimeRFC3339(objectMap, "signedStart", s.SharedAccessStartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceSasParameters. +func (s *ServiceSasParameters) UnmarshalJSON(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 "rscc": + err = unpopulate(val, "CacheControl", &s.CacheControl) + delete(rawMsg, key) + case "canonicalizedResource": + err = unpopulate(val, "CanonicalizedResource", &s.CanonicalizedResource) + delete(rawMsg, key) + case "rscd": + err = unpopulate(val, "ContentDisposition", &s.ContentDisposition) + delete(rawMsg, key) + case "rsce": + err = unpopulate(val, "ContentEncoding", &s.ContentEncoding) + delete(rawMsg, key) + case "rscl": + err = unpopulate(val, "ContentLanguage", &s.ContentLanguage) + delete(rawMsg, key) + case "rsct": + err = unpopulate(val, "ContentType", &s.ContentType) + delete(rawMsg, key) + case "signedIp": + err = unpopulate(val, "IPAddressOrRange", &s.IPAddressOrRange) + delete(rawMsg, key) + case "signedIdentifier": + err = unpopulate(val, "Identifier", &s.Identifier) + delete(rawMsg, key) + case "keyToSign": + err = unpopulate(val, "KeyToSign", &s.KeyToSign) + delete(rawMsg, key) + case "endPk": + err = unpopulate(val, "PartitionKeyEnd", &s.PartitionKeyEnd) + delete(rawMsg, key) + case "startPk": + err = unpopulate(val, "PartitionKeyStart", &s.PartitionKeyStart) + delete(rawMsg, key) + case "signedPermission": + err = unpopulate(val, "Permissions", &s.Permissions) + delete(rawMsg, key) + case "signedProtocol": + err = unpopulate(val, "Protocols", &s.Protocols) + delete(rawMsg, key) + case "signedResource": + err = unpopulate(val, "Resource", &s.Resource) + delete(rawMsg, key) + case "endRk": + err = unpopulate(val, "RowKeyEnd", &s.RowKeyEnd) + delete(rawMsg, key) + case "startRk": + err = unpopulate(val, "RowKeyStart", &s.RowKeyStart) + delete(rawMsg, key) + case "signedExpiry": + err = unpopulateDateTimeRFC3339(val, "SharedAccessExpiryTime", &s.SharedAccessExpiryTime) + delete(rawMsg, key) + case "signedStart": + err = unpopulateDateTimeRFC3339(val, "SharedAccessStartTime", &s.SharedAccessStartTime) + 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 ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceSpecification. +func (s *ServiceSpecification) UnmarshalJSON(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 "metricSpecifications": + err = unpopulate(val, "MetricSpecifications", &s.MetricSpecifications) + 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 SignedIdentifier. +func (s SignedIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessPolicy", s.AccessPolicy) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SignedIdentifier. +func (s *SignedIdentifier) UnmarshalJSON(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 "accessPolicy": + err = unpopulate(val, "AccessPolicy", &s.AccessPolicy) + 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 SmbSetting. +func (s SmbSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationMethods", s.AuthenticationMethods) + populate(objectMap, "channelEncryption", s.ChannelEncryption) + populate(objectMap, "kerberosTicketEncryption", s.KerberosTicketEncryption) + populate(objectMap, "multichannel", s.Multichannel) + populate(objectMap, "versions", s.Versions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SmbSetting. +func (s *SmbSetting) UnmarshalJSON(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 "authenticationMethods": + err = unpopulate(val, "AuthenticationMethods", &s.AuthenticationMethods) + delete(rawMsg, key) + case "channelEncryption": + err = unpopulate(val, "ChannelEncryption", &s.ChannelEncryption) + delete(rawMsg, key) + case "kerberosTicketEncryption": + err = unpopulate(val, "KerberosTicketEncryption", &s.KerberosTicketEncryption) + delete(rawMsg, key) + case "multichannel": + err = unpopulate(val, "Multichannel", &s.Multichannel) + delete(rawMsg, key) + case "versions": + err = unpopulate(val, "Versions", &s.Versions) + 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]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 Table. +func (t Table) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.TableProperties) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Table. +func (t *Table) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "TableProperties", &t.TableProperties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TableAccessPolicy. +func (t TableAccessPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "expiryTime", t.ExpiryTime) + populate(objectMap, "permission", t.Permission) + populateDateTimeRFC3339(objectMap, "startTime", t.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TableAccessPolicy. +func (t *TableAccessPolicy) UnmarshalJSON(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 "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &t.ExpiryTime) + delete(rawMsg, key) + case "permission": + err = unpopulate(val, "Permission", &t.Permission) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(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 TableProperties. +func (t TableProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "signedIdentifiers", t.SignedIdentifiers) + populate(objectMap, "tableName", t.TableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TableProperties. +func (t *TableProperties) UnmarshalJSON(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 "signedIdentifiers": + err = unpopulate(val, "SignedIdentifiers", &t.SignedIdentifiers) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &t.TableName) + 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 TableServiceProperties. +func (t TableServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.TableServiceProperties) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TableServiceProperties. +func (t *TableServiceProperties) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "TableServiceProperties", &t.TableServiceProperties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 TableServicePropertiesProperties. +func (t TableServicePropertiesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cors", t.Cors) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TableServicePropertiesProperties. +func (t *TableServicePropertiesProperties) UnmarshalJSON(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 "cors": + err = unpopulate(val, "Cors", &t.Cors) + 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 TableSignedIdentifier. +func (t TableSignedIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessPolicy", t.AccessPolicy) + populate(objectMap, "id", t.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TableSignedIdentifier. +func (t *TableSignedIdentifier) UnmarshalJSON(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 "accessPolicy": + err = unpopulate(val, "AccessPolicy", &t.AccessPolicy) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + 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 TagFilter. +func (t TagFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", t.Name) + populate(objectMap, "op", t.Op) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagFilter. +func (t *TagFilter) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "op": + err = unpopulate(val, "Op", &t.Op) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TagProperty. +func (t TagProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "objectIdentifier", t.ObjectIdentifier) + populate(objectMap, "tag", t.Tag) + populate(objectMap, "tenantId", t.TenantID) + populateDateTimeRFC3339(objectMap, "timestamp", t.Timestamp) + populate(objectMap, "upn", t.Upn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagProperty. +func (t *TagProperty) UnmarshalJSON(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 "objectIdentifier": + err = unpopulate(val, "ObjectIdentifier", &t.ObjectIdentifier) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &t.Tag) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &t.TenantID) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &t.Timestamp) + delete(rawMsg, key) + case "upn": + err = unpopulate(val, "Upn", &t.Upn) + 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 TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(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 "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) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + 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 UpdateHistoryProperty. +func (u UpdateHistoryProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowProtectedAppendWrites", u.AllowProtectedAppendWrites) + populate(objectMap, "allowProtectedAppendWritesAll", u.AllowProtectedAppendWritesAll) + populate(objectMap, "immutabilityPeriodSinceCreationInDays", u.ImmutabilityPeriodSinceCreationInDays) + populate(objectMap, "objectIdentifier", u.ObjectIdentifier) + populate(objectMap, "tenantId", u.TenantID) + populateDateTimeRFC3339(objectMap, "timestamp", u.Timestamp) + populate(objectMap, "update", u.Update) + populate(objectMap, "upn", u.Upn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateHistoryProperty. +func (u *UpdateHistoryProperty) UnmarshalJSON(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 "allowProtectedAppendWrites": + err = unpopulate(val, "AllowProtectedAppendWrites", &u.AllowProtectedAppendWrites) + delete(rawMsg, key) + case "allowProtectedAppendWritesAll": + err = unpopulate(val, "AllowProtectedAppendWritesAll", &u.AllowProtectedAppendWritesAll) + delete(rawMsg, key) + case "immutabilityPeriodSinceCreationInDays": + err = unpopulate(val, "ImmutabilityPeriodSinceCreationInDays", &u.ImmutabilityPeriodSinceCreationInDays) + delete(rawMsg, key) + case "objectIdentifier": + err = unpopulate(val, "ObjectIdentifier", &u.ObjectIdentifier) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &u.TenantID) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &u.Timestamp) + delete(rawMsg, key) + case "update": + err = unpopulate(val, "Update", &u.Update) + delete(rawMsg, key) + case "upn": + err = unpopulate(val, "Upn", &u.Upn) + 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]any) + populate(objectMap, "currentValue", u.CurrentValue) + 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 "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 UsageListResult. +func (u UsageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsageListResult. +func (u *UsageListResult) UnmarshalJSON(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 "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 UsageName. +func (u UsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(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 VirtualNetworkRule. +func (v VirtualNetworkRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["action"] = "Allow" + populate(objectMap, "state", v.State) + populate(objectMap, "id", v.VirtualNetworkResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRule. +func (v *VirtualNetworkRule) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &v.Action) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &v.State) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "VirtualNetworkResourceID", &v.VirtualNetworkResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) 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/storage/armstorage/objectreplicationpolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go new file mode 100644 index 000000000..dc91e8ca3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go @@ -0,0 +1,324 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ObjectReplicationPoliciesClient contains the methods for the ObjectReplicationPolicies group. +// Don't use this type directly, use NewObjectReplicationPoliciesClient() instead. +type ObjectReplicationPoliciesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewObjectReplicationPoliciesClient creates a new instance of ObjectReplicationPoliciesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewObjectReplicationPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ObjectReplicationPoliciesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ObjectReplicationPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or update the object replication policy of the storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - objectReplicationPolicyID - For the destination account, provide the value 'default'. Configure the policy on the destination +// account first. For the source account, provide the value of the policy ID that is returned when you +// download the policy that was defined on the destination account. The policy is downloaded as a JSON file. +// - properties - The object replication policy set to a storage account. A unique policy ID will be created if absent. +// - options - ObjectReplicationPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ObjectReplicationPoliciesClient.CreateOrUpdate +// method. +func (client *ObjectReplicationPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, properties ObjectReplicationPolicy, options *ObjectReplicationPoliciesClientCreateOrUpdateOptions) (ObjectReplicationPoliciesClientCreateOrUpdateResponse, error) { + var err error + const operationName = "ObjectReplicationPoliciesClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, objectReplicationPolicyID, properties, options) + if err != nil { + return ObjectReplicationPoliciesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ObjectReplicationPoliciesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ObjectReplicationPoliciesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ObjectReplicationPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, properties ObjectReplicationPolicy, options *ObjectReplicationPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if objectReplicationPolicyID == "" { + return nil, errors.New("parameter objectReplicationPolicyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{objectReplicationPolicyId}", url.PathEscape(objectReplicationPolicyID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ObjectReplicationPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ObjectReplicationPoliciesClientCreateOrUpdateResponse, error) { + result := ObjectReplicationPoliciesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ObjectReplicationPolicy); err != nil { + return ObjectReplicationPoliciesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the object replication policy associated with the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - objectReplicationPolicyID - For the destination account, provide the value 'default'. Configure the policy on the destination +// account first. For the source account, provide the value of the policy ID that is returned when you +// download the policy that was defined on the destination account. The policy is downloaded as a JSON file. +// - options - ObjectReplicationPoliciesClientDeleteOptions contains the optional parameters for the ObjectReplicationPoliciesClient.Delete +// method. +func (client *ObjectReplicationPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientDeleteOptions) (ObjectReplicationPoliciesClientDeleteResponse, error) { + var err error + const operationName = "ObjectReplicationPoliciesClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, objectReplicationPolicyID, options) + if err != nil { + return ObjectReplicationPoliciesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ObjectReplicationPoliciesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ObjectReplicationPoliciesClientDeleteResponse{}, err + } + return ObjectReplicationPoliciesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ObjectReplicationPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if objectReplicationPolicyID == "" { + return nil, errors.New("parameter objectReplicationPolicyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{objectReplicationPolicyId}", url.PathEscape(objectReplicationPolicyID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the object replication policy of the storage account by policy ID. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - objectReplicationPolicyID - For the destination account, provide the value 'default'. Configure the policy on the destination +// account first. For the source account, provide the value of the policy ID that is returned when you +// download the policy that was defined on the destination account. The policy is downloaded as a JSON file. +// - options - ObjectReplicationPoliciesClientGetOptions contains the optional parameters for the ObjectReplicationPoliciesClient.Get +// method. +func (client *ObjectReplicationPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientGetOptions) (ObjectReplicationPoliciesClientGetResponse, error) { + var err error + const operationName = "ObjectReplicationPoliciesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, objectReplicationPolicyID, options) + if err != nil { + return ObjectReplicationPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ObjectReplicationPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ObjectReplicationPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ObjectReplicationPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if objectReplicationPolicyID == "" { + return nil, errors.New("parameter objectReplicationPolicyID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{objectReplicationPolicyId}", url.PathEscape(objectReplicationPolicyID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ObjectReplicationPoliciesClient) getHandleResponse(resp *http.Response) (ObjectReplicationPoliciesClientGetResponse, error) { + result := ObjectReplicationPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ObjectReplicationPolicy); err != nil { + return ObjectReplicationPoliciesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List the object replication policies associated with the storage account. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - ObjectReplicationPoliciesClientListOptions contains the optional parameters for the ObjectReplicationPoliciesClient.NewListPager +// method. +func (client *ObjectReplicationPoliciesClient) NewListPager(resourceGroupName string, accountName string, options *ObjectReplicationPoliciesClientListOptions) *runtime.Pager[ObjectReplicationPoliciesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ObjectReplicationPoliciesClientListResponse]{ + More: func(page ObjectReplicationPoliciesClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ObjectReplicationPoliciesClientListResponse) (ObjectReplicationPoliciesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ObjectReplicationPoliciesClient.NewListPager") + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return ObjectReplicationPoliciesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ObjectReplicationPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ObjectReplicationPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ObjectReplicationPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *ObjectReplicationPoliciesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ObjectReplicationPoliciesClient) listHandleResponse(resp *http.Response) (ObjectReplicationPoliciesClientListResponse, error) { + result := ObjectReplicationPoliciesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ObjectReplicationPolicies); err != nil { + return ObjectReplicationPoliciesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/operations_client.go new file mode 100644 index 000000000..74621df13 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/operations_client.go @@ -0,0 +1,89 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "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/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 { + internal *arm.Client +} + +// 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all of the available Storage Rest API operations. +// +// Generated from API version 2023-01-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager 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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Storage/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-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/storage/armstorage/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/options.go new file mode 100644 index 000000000..d143bdb48 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/options.go @@ -0,0 +1,577 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +// AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions contains the optional parameters for the AccountsClient.BeginAbortHierarchicalNamespaceMigration +// method. +type AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. +type AccountsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.BeginCustomerInitiatedMigration +// method. +type AccountsClientBeginCustomerInitiatedMigrationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginFailoverOptions contains the optional parameters for the AccountsClient.BeginFailover method. +type AccountsClientBeginFailoverOptions struct { + // The parameter is set to 'Planned' to indicate whether a Planned failover is requested.. Specifying any value will set the + // value to Planned. + FailoverType *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginHierarchicalNamespaceMigrationOptions contains the optional parameters for the AccountsClient.BeginHierarchicalNamespaceMigration +// method. +type AccountsClientBeginHierarchicalNamespaceMigrationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginRestoreBlobRangesOptions contains the optional parameters for the AccountsClient.BeginRestoreBlobRanges +// method. +type AccountsClientBeginRestoreBlobRangesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientCheckNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckNameAvailability +// method. +type AccountsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientDeleteOptions contains the optional parameters for the AccountsClient.Delete method. +type AccountsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientGetCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.GetCustomerInitiatedMigration +// method. +type AccountsClientGetCustomerInitiatedMigrationOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientGetPropertiesOptions contains the optional parameters for the AccountsClient.GetProperties method. +type AccountsClientGetPropertiesOptions struct { + // May be used to expand the properties within account's properties. By default, data is not included when fetching properties. + // Currently we only support geoReplicationStats and blobRestoreStatus. + Expand *StorageAccountExpand +} + +// AccountsClientListAccountSASOptions contains the optional parameters for the AccountsClient.ListAccountSAS method. +type AccountsClientListAccountSASOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager +// method. +type AccountsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method. +type AccountsClientListKeysOptions struct { + // Specifies type of the key to be listed. Possible value is kerb.. Specifying any value will set the value to kerb. + Expand *string +} + +// AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method. +type AccountsClientListOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListServiceSASOptions contains the optional parameters for the AccountsClient.ListServiceSAS method. +type AccountsClientListServiceSASOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientRegenerateKeyOptions contains the optional parameters for the AccountsClient.RegenerateKey method. +type AccountsClientRegenerateKeyOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientRevokeUserDelegationKeysOptions contains the optional parameters for the AccountsClient.RevokeUserDelegationKeys +// method. +type AccountsClientRevokeUserDelegationKeysOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientUpdateOptions contains the optional parameters for the AccountsClient.Update method. +type AccountsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// BlobContainersClientBeginObjectLevelWormOptions contains the optional parameters for the BlobContainersClient.BeginObjectLevelWorm +// method. +type BlobContainersClientBeginObjectLevelWormOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BlobContainersClientClearLegalHoldOptions contains the optional parameters for the BlobContainersClient.ClearLegalHold +// method. +type BlobContainersClientClearLegalHoldOptions struct { + // placeholder for future optional parameters +} + +// BlobContainersClientCreateOptions contains the optional parameters for the BlobContainersClient.Create method. +type BlobContainersClientCreateOptions struct { + // placeholder for future optional parameters +} + +// BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.CreateOrUpdateImmutabilityPolicy +// method. +type BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions struct { + // The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation + // only if the immutability policy already exists. If omitted, this operation will + // always be applied. + IfMatch *string + + // The ImmutabilityPolicy Properties that will be created or updated to a blob container. + Parameters *ImmutabilityPolicy +} + +// BlobContainersClientDeleteImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.DeleteImmutabilityPolicy +// method. +type BlobContainersClientDeleteImmutabilityPolicyOptions struct { + // placeholder for future optional parameters +} + +// BlobContainersClientDeleteOptions contains the optional parameters for the BlobContainersClient.Delete method. +type BlobContainersClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// BlobContainersClientExtendImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.ExtendImmutabilityPolicy +// method. +type BlobContainersClientExtendImmutabilityPolicyOptions struct { + // The ImmutabilityPolicy Properties that will be extended for a blob container. + Parameters *ImmutabilityPolicy +} + +// BlobContainersClientGetImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.GetImmutabilityPolicy +// method. +type BlobContainersClientGetImmutabilityPolicyOptions struct { + // The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation + // only if the immutability policy already exists. If omitted, this operation will + // always be applied. + IfMatch *string +} + +// BlobContainersClientGetOptions contains the optional parameters for the BlobContainersClient.Get method. +type BlobContainersClientGetOptions struct { + // placeholder for future optional parameters +} + +// BlobContainersClientLeaseOptions contains the optional parameters for the BlobContainersClient.Lease method. +type BlobContainersClientLeaseOptions struct { + // Lease Container request body. + Parameters *LeaseContainerRequest +} + +// BlobContainersClientListOptions contains the optional parameters for the BlobContainersClient.NewListPager method. +type BlobContainersClientListOptions struct { + // Optional. When specified, only container names starting with the filter will be listed. + Filter *string + + // Optional, used to include the properties for soft deleted blob containers. + Include *ListContainersInclude + + // Optional. Specified maximum number of containers that can be included in the list. + Maxpagesize *string +} + +// BlobContainersClientLockImmutabilityPolicyOptions contains the optional parameters for the BlobContainersClient.LockImmutabilityPolicy +// method. +type BlobContainersClientLockImmutabilityPolicyOptions struct { + // placeholder for future optional parameters +} + +// BlobContainersClientSetLegalHoldOptions contains the optional parameters for the BlobContainersClient.SetLegalHold method. +type BlobContainersClientSetLegalHoldOptions struct { + // placeholder for future optional parameters +} + +// BlobContainersClientUpdateOptions contains the optional parameters for the BlobContainersClient.Update method. +type BlobContainersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// BlobInventoryPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BlobInventoryPoliciesClient.CreateOrUpdate +// method. +type BlobInventoryPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// BlobInventoryPoliciesClientDeleteOptions contains the optional parameters for the BlobInventoryPoliciesClient.Delete method. +type BlobInventoryPoliciesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// BlobInventoryPoliciesClientGetOptions contains the optional parameters for the BlobInventoryPoliciesClient.Get method. +type BlobInventoryPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// BlobInventoryPoliciesClientListOptions contains the optional parameters for the BlobInventoryPoliciesClient.NewListPager +// method. +type BlobInventoryPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + +// BlobServicesClientGetServicePropertiesOptions contains the optional parameters for the BlobServicesClient.GetServiceProperties +// method. +type BlobServicesClientGetServicePropertiesOptions struct { + // placeholder for future optional parameters +} + +// BlobServicesClientListOptions contains the optional parameters for the BlobServicesClient.NewListPager method. +type BlobServicesClientListOptions struct { + // placeholder for future optional parameters +} + +// BlobServicesClientSetServicePropertiesOptions contains the optional parameters for the BlobServicesClient.SetServiceProperties +// method. +type BlobServicesClientSetServicePropertiesOptions struct { + // placeholder for future optional parameters +} + +// DeletedAccountsClientGetOptions contains the optional parameters for the DeletedAccountsClient.Get method. +type DeletedAccountsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager method. +type DeletedAccountsClientListOptions struct { + // placeholder for future optional parameters +} + +// EncryptionScopesClientGetOptions contains the optional parameters for the EncryptionScopesClient.Get method. +type EncryptionScopesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EncryptionScopesClientListOptions contains the optional parameters for the EncryptionScopesClient.NewListPager method. +type EncryptionScopesClientListOptions struct { + // Optional. When specified, only encryption scope names starting with the filter will be listed. + Filter *string + + // Optional, when specified, will list encryption scopes with the specific state. Defaults to All + Include *ListEncryptionScopesInclude + + // Optional, specifies the maximum number of encryption scopes that will be included in the list response. + Maxpagesize *int32 +} + +// EncryptionScopesClientPatchOptions contains the optional parameters for the EncryptionScopesClient.Patch method. +type EncryptionScopesClientPatchOptions struct { + // placeholder for future optional parameters +} + +// EncryptionScopesClientPutOptions contains the optional parameters for the EncryptionScopesClient.Put method. +type EncryptionScopesClientPutOptions struct { + // placeholder for future optional parameters +} + +// FileServicesClientGetServicePropertiesOptions contains the optional parameters for the FileServicesClient.GetServiceProperties +// method. +type FileServicesClientGetServicePropertiesOptions struct { + // placeholder for future optional parameters +} + +// FileServicesClientListOptions contains the optional parameters for the FileServicesClient.List method. +type FileServicesClientListOptions struct { + // placeholder for future optional parameters +} + +// FileServicesClientSetServicePropertiesOptions contains the optional parameters for the FileServicesClient.SetServiceProperties +// method. +type FileServicesClientSetServicePropertiesOptions struct { + // placeholder for future optional parameters +} + +// FileSharesClientCreateOptions contains the optional parameters for the FileSharesClient.Create method. +type FileSharesClientCreateOptions struct { + // Optional, used to expand the properties within share's properties. Valid values are: snapshots. Should be passed as a string + // with delimiter ',' + Expand *string +} + +// FileSharesClientDeleteOptions contains the optional parameters for the FileSharesClient.Delete method. +type FileSharesClientDeleteOptions struct { + // Optional. Valid values are: snapshots, leased-snapshots, none. The default value is snapshots. For 'snapshots', the file + // share is deleted including all of its file share snapshots. If the file share + // contains leased-snapshots, the deletion fails. For 'leased-snapshots', the file share is deleted included all of its file + // share snapshots (leased/unleased). For 'none', the file share is deleted if it + // has no share snapshots. If the file share contains any snapshots (leased or unleased), the deletion fails. + Include *string + + // Optional, used to delete a snapshot. + XMSSnapshot *string +} + +// FileSharesClientGetOptions contains the optional parameters for the FileSharesClient.Get method. +type FileSharesClientGetOptions struct { + // Optional, used to expand the properties within share's properties. Valid values are: stats. Should be passed as a string + // with delimiter ','. + Expand *string + + // Optional, used to retrieve properties of a snapshot. + XMSSnapshot *string +} + +// FileSharesClientLeaseOptions contains the optional parameters for the FileSharesClient.Lease method. +type FileSharesClientLeaseOptions struct { + // Lease Share request body. + Parameters *LeaseShareRequest + + // Optional. Specify the snapshot time to lease a snapshot. + XMSSnapshot *string +} + +// FileSharesClientListOptions contains the optional parameters for the FileSharesClient.NewListPager method. +type FileSharesClientListOptions struct { + // Optional, used to expand the properties within share's properties. Valid values are: deleted, snapshots. Should be passed + // as a string with delimiter ',' + Expand *string + + // Optional. When specified, only share names starting with the filter will be listed. + Filter *string + + // Optional. Specified maximum number of shares that can be included in the list. + Maxpagesize *string +} + +// FileSharesClientRestoreOptions contains the optional parameters for the FileSharesClient.Restore method. +type FileSharesClientRestoreOptions struct { + // placeholder for future optional parameters +} + +// FileSharesClientUpdateOptions contains the optional parameters for the FileSharesClient.Update method. +type FileSharesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// LocalUsersClientCreateOrUpdateOptions contains the optional parameters for the LocalUsersClient.CreateOrUpdate method. +type LocalUsersClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// LocalUsersClientDeleteOptions contains the optional parameters for the LocalUsersClient.Delete method. +type LocalUsersClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// LocalUsersClientGetOptions contains the optional parameters for the LocalUsersClient.Get method. +type LocalUsersClientGetOptions struct { + // placeholder for future optional parameters +} + +// LocalUsersClientListKeysOptions contains the optional parameters for the LocalUsersClient.ListKeys method. +type LocalUsersClientListKeysOptions struct { + // placeholder for future optional parameters +} + +// LocalUsersClientListOptions contains the optional parameters for the LocalUsersClient.NewListPager method. +type LocalUsersClientListOptions struct { + // placeholder for future optional parameters +} + +// LocalUsersClientRegeneratePasswordOptions contains the optional parameters for the LocalUsersClient.RegeneratePassword +// method. +type LocalUsersClientRegeneratePasswordOptions struct { + // placeholder for future optional parameters +} + +// ManagementPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ManagementPoliciesClient.CreateOrUpdate +// method. +type ManagementPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagementPoliciesClientDeleteOptions contains the optional parameters for the ManagementPoliciesClient.Delete method. +type ManagementPoliciesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagementPoliciesClientGetOptions contains the optional parameters for the ManagementPoliciesClient.Get method. +type ManagementPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ObjectReplicationPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ObjectReplicationPoliciesClient.CreateOrUpdate +// method. +type ObjectReplicationPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ObjectReplicationPoliciesClientDeleteOptions contains the optional parameters for the ObjectReplicationPoliciesClient.Delete +// method. +type ObjectReplicationPoliciesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ObjectReplicationPoliciesClientGetOptions contains the optional parameters for the ObjectReplicationPoliciesClient.Get +// method. +type ObjectReplicationPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ObjectReplicationPoliciesClientListOptions contains the optional parameters for the ObjectReplicationPoliciesClient.NewListPager +// method. +type ObjectReplicationPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete +// method. +type PrivateEndpointConnectionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put +// method. +type PrivateEndpointConnectionsClientPutOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByStorageAccountOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByStorageAccount +// method. +type PrivateLinkResourcesClientListByStorageAccountOptions struct { + // placeholder for future optional parameters +} + +// QueueClientCreateOptions contains the optional parameters for the QueueClient.Create method. +type QueueClientCreateOptions struct { + // placeholder for future optional parameters +} + +// QueueClientDeleteOptions contains the optional parameters for the QueueClient.Delete method. +type QueueClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// QueueClientGetOptions contains the optional parameters for the QueueClient.Get method. +type QueueClientGetOptions struct { + // placeholder for future optional parameters +} + +// QueueClientListOptions contains the optional parameters for the QueueClient.NewListPager method. +type QueueClientListOptions struct { + // Optional, When specified, only the queues with a name starting with the given filter will be listed. + Filter *string + + // Optional, a maximum number of queues that should be included in a list queue response + Maxpagesize *string +} + +// QueueClientUpdateOptions contains the optional parameters for the QueueClient.Update method. +type QueueClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// QueueServicesClientGetServicePropertiesOptions contains the optional parameters for the QueueServicesClient.GetServiceProperties +// method. +type QueueServicesClientGetServicePropertiesOptions struct { + // placeholder for future optional parameters +} + +// QueueServicesClientListOptions contains the optional parameters for the QueueServicesClient.List method. +type QueueServicesClientListOptions struct { + // placeholder for future optional parameters +} + +// QueueServicesClientSetServicePropertiesOptions contains the optional parameters for the QueueServicesClient.SetServiceProperties +// method. +type QueueServicesClientSetServicePropertiesOptions struct { + // placeholder for future optional parameters +} + +// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. +type SKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// TableClientCreateOptions contains the optional parameters for the TableClient.Create method. +type TableClientCreateOptions struct { + // The parameters to provide to create a table. + Parameters *Table +} + +// TableClientDeleteOptions contains the optional parameters for the TableClient.Delete method. +type TableClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// TableClientGetOptions contains the optional parameters for the TableClient.Get method. +type TableClientGetOptions struct { + // placeholder for future optional parameters +} + +// TableClientListOptions contains the optional parameters for the TableClient.NewListPager method. +type TableClientListOptions struct { + // placeholder for future optional parameters +} + +// TableClientUpdateOptions contains the optional parameters for the TableClient.Update method. +type TableClientUpdateOptions struct { + // The parameters to provide to create a table. + Parameters *Table +} + +// TableServicesClientGetServicePropertiesOptions contains the optional parameters for the TableServicesClient.GetServiceProperties +// method. +type TableServicesClientGetServicePropertiesOptions struct { + // placeholder for future optional parameters +} + +// TableServicesClientListOptions contains the optional parameters for the TableServicesClient.List method. +type TableServicesClientListOptions struct { + // placeholder for future optional parameters +} + +// TableServicesClientSetServicePropertiesOptions contains the optional parameters for the TableServicesClient.SetServiceProperties +// method. +type TableServicesClientSetServicePropertiesOptions struct { + // placeholder for future optional parameters +} + +// UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.NewListByLocationPager method. +type UsagesClientListByLocationOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go new file mode 100644 index 000000000..cde0f2d21 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go @@ -0,0 +1,318 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Delete - Deletes the specified private endpoint connection associated with the storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - options - PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete +// method. +func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteOptions) (PrivateEndpointConnectionsClientDeleteResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientDeleteResponse{}, err + } + return PrivateEndpointConnectionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified private endpoint connection associated with the storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all the private endpoint connections associated with the storage account. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, accountName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListResponse]{ + More: func(page PrivateEndpointConnectionsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListPager") + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { + result := PrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} + +// Put - Update the state of specified private endpoint connection associated with the storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource +// - properties - The private endpoint connection properties. +// - options - PrivateEndpointConnectionsClientPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Put +// method. +func (client *PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientPutOptions) (PrivateEndpointConnectionsClientPutResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, properties, options) + if err != nil { + return PrivateEndpointConnectionsClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *PrivateEndpointConnectionsClient) putHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientPutResponse, error) { + result := PrivateEndpointConnectionsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientPutResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go new file mode 100644 index 000000000..7127815f0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/privatelinkresources_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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// ListByStorageAccount - Gets the private link resources that need to be created for a storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - PrivateLinkResourcesClientListByStorageAccountOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByStorageAccount +// method. +func (client *PrivateLinkResourcesClient) ListByStorageAccount(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesClientListByStorageAccountOptions) (PrivateLinkResourcesClientListByStorageAccountResponse, error) { + var err error + const operationName = "PrivateLinkResourcesClient.ListByStorageAccount" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listByStorageAccountCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return PrivateLinkResourcesClientListByStorageAccountResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesClientListByStorageAccountResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientListByStorageAccountResponse{}, err + } + resp, err := client.listByStorageAccountHandleResponse(httpResp) + return resp, err +} + +// listByStorageAccountCreateRequest creates the ListByStorageAccount request. +func (client *PrivateLinkResourcesClient) listByStorageAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesClientListByStorageAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByStorageAccountHandleResponse handles the ListByStorageAccount response. +func (client *PrivateLinkResourcesClient) listByStorageAccountHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListByStorageAccountResponse, error) { + result := PrivateLinkResourcesClientListByStorageAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesClientListByStorageAccountResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queue_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queue_client.go new file mode 100644 index 000000000..743fcc983 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queue_client.go @@ -0,0 +1,401 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// QueueClient contains the methods for the Queue group. +// Don't use this type directly, use NewQueueClient() instead. +type QueueClient struct { + internal *arm.Client + subscriptionID string +} + +// NewQueueClient creates a new instance of QueueClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewQueueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QueueClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &QueueClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates a new queue with the specified queue name, under the specified account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - queueName - A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must +// comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with +// an alphanumeric character and it cannot have two consecutive dash(-) characters. +// - queue - Queue properties and metadata to be created with +// - options - QueueClientCreateOptions contains the optional parameters for the QueueClient.Create method. +func (client *QueueClient) Create(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientCreateOptions) (QueueClientCreateResponse, error) { + var err error + const operationName = "QueueClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, queueName, queue, options) + if err != nil { + return QueueClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return QueueClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return QueueClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *QueueClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if queueName == "" { + return nil, errors.New("parameter queueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{queueName}", url.PathEscape(queueName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, queue); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *QueueClient) createHandleResponse(resp *http.Response) (QueueClientCreateResponse, error) { + result := QueueClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Queue); err != nil { + return QueueClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the queue with the specified queue name, under the specified account if it exists. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - queueName - A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must +// comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with +// an alphanumeric character and it cannot have two consecutive dash(-) characters. +// - options - QueueClientDeleteOptions contains the optional parameters for the QueueClient.Delete method. +func (client *QueueClient) Delete(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientDeleteOptions) (QueueClientDeleteResponse, error) { + var err error + const operationName = "QueueClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, queueName, options) + if err != nil { + return QueueClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return QueueClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return QueueClientDeleteResponse{}, err + } + return QueueClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *QueueClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if queueName == "" { + return nil, errors.New("parameter queueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{queueName}", url.PathEscape(queueName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the queue with the specified queue name, under the specified account if it exists. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - queueName - A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must +// comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with +// an alphanumeric character and it cannot have two consecutive dash(-) characters. +// - options - QueueClientGetOptions contains the optional parameters for the QueueClient.Get method. +func (client *QueueClient) Get(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientGetOptions) (QueueClientGetResponse, error) { + var err error + const operationName = "QueueClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, queueName, options) + if err != nil { + return QueueClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return QueueClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return QueueClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *QueueClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if queueName == "" { + return nil, errors.New("parameter queueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{queueName}", url.PathEscape(queueName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *QueueClient) getHandleResponse(resp *http.Response) (QueueClientGetResponse, error) { + result := QueueClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Queue); err != nil { + return QueueClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of all the queues under the specified storage account +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - QueueClientListOptions contains the optional parameters for the QueueClient.NewListPager method. +func (client *QueueClient) NewListPager(resourceGroupName string, accountName string, options *QueueClientListOptions) *runtime.Pager[QueueClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[QueueClientListResponse]{ + More: func(page QueueClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *QueueClientListResponse) (QueueClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "QueueClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return QueueClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *QueueClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *QueueClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + if options != nil && options.Maxpagesize != nil { + reqQP.Set("$maxpagesize", *options.Maxpagesize) + } + 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 *QueueClient) listHandleResponse(resp *http.Response) (QueueClientListResponse, error) { + result := QueueClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListQueueResource); err != nil { + return QueueClientListResponse{}, err + } + return result, nil +} + +// Update - Creates a new queue with the specified queue name, under the specified account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - queueName - A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must +// comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with +// an alphanumeric character and it cannot have two consecutive dash(-) characters. +// - queue - Queue properties and metadata to be created with +// - options - QueueClientUpdateOptions contains the optional parameters for the QueueClient.Update method. +func (client *QueueClient) Update(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientUpdateOptions) (QueueClientUpdateResponse, error) { + var err error + const operationName = "QueueClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, queueName, queue, options) + if err != nil { + return QueueClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return QueueClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return QueueClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *QueueClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if queueName == "" { + return nil, errors.New("parameter queueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{queueName}", url.PathEscape(queueName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, queue); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *QueueClient) updateHandleResponse(resp *http.Response) (QueueClientUpdateResponse, error) { + result := QueueClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Queue); err != nil { + return QueueClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queueservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queueservices_client.go new file mode 100644 index 000000000..75786fe94 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/queueservices_client.go @@ -0,0 +1,250 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// QueueServicesClient contains the methods for the QueueServices group. +// Don't use this type directly, use NewQueueServicesClient() instead. +type QueueServicesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewQueueServicesClient creates a new instance of QueueServicesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewQueueServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QueueServicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &QueueServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetServiceProperties - Gets the properties of a storage account’s Queue service, including properties for Storage Analytics +// and CORS (Cross-Origin Resource Sharing) rules. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - QueueServicesClientGetServicePropertiesOptions contains the optional parameters for the QueueServicesClient.GetServiceProperties +// method. +func (client *QueueServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientGetServicePropertiesOptions) (QueueServicesClientGetServicePropertiesResponse, error) { + var err error + const operationName = "QueueServicesClient.GetServiceProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return QueueServicesClientGetServicePropertiesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return QueueServicesClientGetServicePropertiesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return QueueServicesClientGetServicePropertiesResponse{}, err + } + resp, err := client.getServicePropertiesHandleResponse(httpResp) + return resp, err +} + +// getServicePropertiesCreateRequest creates the GetServiceProperties request. +func (client *QueueServicesClient) getServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientGetServicePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{queueServiceName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getServicePropertiesHandleResponse handles the GetServiceProperties response. +func (client *QueueServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (QueueServicesClientGetServicePropertiesResponse, error) { + result := QueueServicesClientGetServicePropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.QueueServiceProperties); err != nil { + return QueueServicesClientGetServicePropertiesResponse{}, err + } + return result, nil +} + +// List - List all queue services for the storage account +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - QueueServicesClientListOptions contains the optional parameters for the QueueServicesClient.List method. +func (client *QueueServicesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientListOptions) (QueueServicesClientListResponse, error) { + var err error + const operationName = "QueueServicesClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return QueueServicesClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return QueueServicesClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return QueueServicesClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// listCreateRequest creates the List request. +func (client *QueueServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *QueueServicesClient) listHandleResponse(resp *http.Response) (QueueServicesClientListResponse, error) { + result := QueueServicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListQueueServices); err != nil { + return QueueServicesClientListResponse{}, err + } + return result, nil +} + +// SetServiceProperties - Sets the properties of a storage account’s Queue service, including properties for Storage Analytics +// and CORS (Cross-Origin Resource Sharing) rules. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The properties of a storage account’s Queue service, only properties for Storage Analytics and CORS (Cross-Origin +// Resource Sharing) rules can be specified. +// - options - QueueServicesClientSetServicePropertiesOptions contains the optional parameters for the QueueServicesClient.SetServiceProperties +// method. +func (client *QueueServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters QueueServiceProperties, options *QueueServicesClientSetServicePropertiesOptions) (QueueServicesClientSetServicePropertiesResponse, error) { + var err error + const operationName = "QueueServicesClient.SetServiceProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return QueueServicesClientSetServicePropertiesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return QueueServicesClientSetServicePropertiesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return QueueServicesClientSetServicePropertiesResponse{}, err + } + resp, err := client.setServicePropertiesHandleResponse(httpResp) + return resp, err +} + +// setServicePropertiesCreateRequest creates the SetServiceProperties request. +func (client *QueueServicesClient) setServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters QueueServiceProperties, options *QueueServicesClientSetServicePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/{queueServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{queueServiceName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// setServicePropertiesHandleResponse handles the SetServiceProperties response. +func (client *QueueServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (QueueServicesClientSetServicePropertiesResponse, error) { + result := QueueServicesClientSetServicePropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.QueueServiceProperties); err != nil { + return QueueServicesClientSetServicePropertiesResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/response_types.go new file mode 100644 index 000000000..e5b7eb742 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/response_types.go @@ -0,0 +1,557 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +// AccountsClientAbortHierarchicalNamespaceMigrationResponse contains the response from method AccountsClient.BeginAbortHierarchicalNamespaceMigration. +type AccountsClientAbortHierarchicalNamespaceMigrationResponse struct { + // placeholder for future response values +} + +// AccountsClientCheckNameAvailabilityResponse contains the response from method AccountsClient.CheckNameAvailability. +type AccountsClientCheckNameAvailabilityResponse struct { + // The CheckNameAvailability operation response. + CheckNameAvailabilityResult +} + +// AccountsClientCreateResponse contains the response from method AccountsClient.BeginCreate. +type AccountsClientCreateResponse struct { + // The storage account. + Account +} + +// AccountsClientCustomerInitiatedMigrationResponse contains the response from method AccountsClient.BeginCustomerInitiatedMigration. +type AccountsClientCustomerInitiatedMigrationResponse struct { + // placeholder for future response values +} + +// AccountsClientDeleteResponse contains the response from method AccountsClient.Delete. +type AccountsClientDeleteResponse struct { + // placeholder for future response values +} + +// AccountsClientFailoverResponse contains the response from method AccountsClient.BeginFailover. +type AccountsClientFailoverResponse struct { + // placeholder for future response values +} + +// AccountsClientGetCustomerInitiatedMigrationResponse contains the response from method AccountsClient.GetCustomerInitiatedMigration. +type AccountsClientGetCustomerInitiatedMigrationResponse struct { + // The parameters or status associated with an ongoing or enqueued storage account migration in order to update its current + // SKU or region. + AccountMigration +} + +// AccountsClientGetPropertiesResponse contains the response from method AccountsClient.GetProperties. +type AccountsClientGetPropertiesResponse struct { + // The storage account. + Account +} + +// AccountsClientHierarchicalNamespaceMigrationResponse contains the response from method AccountsClient.BeginHierarchicalNamespaceMigration. +type AccountsClientHierarchicalNamespaceMigrationResponse struct { + // placeholder for future response values +} + +// AccountsClientListAccountSASResponse contains the response from method AccountsClient.ListAccountSAS. +type AccountsClientListAccountSASResponse struct { + // The List SAS credentials operation response. + ListAccountSasResponse +} + +// AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.NewListByResourceGroupPager. +type AccountsClientListByResourceGroupResponse struct { + // The response from the List Storage Accounts operation. + AccountListResult +} + +// AccountsClientListKeysResponse contains the response from method AccountsClient.ListKeys. +type AccountsClientListKeysResponse struct { + // The response from the ListKeys operation. + AccountListKeysResult +} + +// AccountsClientListResponse contains the response from method AccountsClient.NewListPager. +type AccountsClientListResponse struct { + // The response from the List Storage Accounts operation. + AccountListResult +} + +// AccountsClientListServiceSASResponse contains the response from method AccountsClient.ListServiceSAS. +type AccountsClientListServiceSASResponse struct { + // The List service SAS credentials operation response. + ListServiceSasResponse +} + +// AccountsClientRegenerateKeyResponse contains the response from method AccountsClient.RegenerateKey. +type AccountsClientRegenerateKeyResponse struct { + // The response from the ListKeys operation. + AccountListKeysResult +} + +// AccountsClientRestoreBlobRangesResponse contains the response from method AccountsClient.BeginRestoreBlobRanges. +type AccountsClientRestoreBlobRangesResponse struct { + // Blob restore status. + BlobRestoreStatus +} + +// AccountsClientRevokeUserDelegationKeysResponse contains the response from method AccountsClient.RevokeUserDelegationKeys. +type AccountsClientRevokeUserDelegationKeysResponse struct { + // placeholder for future response values +} + +// AccountsClientUpdateResponse contains the response from method AccountsClient.Update. +type AccountsClientUpdateResponse struct { + // The storage account. + Account +} + +// BlobContainersClientClearLegalHoldResponse contains the response from method BlobContainersClient.ClearLegalHold. +type BlobContainersClientClearLegalHoldResponse struct { + // The LegalHold property of a blob container. + LegalHold +} + +// BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse contains the response from method BlobContainersClient.CreateOrUpdateImmutabilityPolicy. +type BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse struct { + // The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. + ImmutabilityPolicy + + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// BlobContainersClientCreateResponse contains the response from method BlobContainersClient.Create. +type BlobContainersClientCreateResponse struct { + // Properties of the blob container, including Id, resource name, resource type, Etag. + BlobContainer +} + +// BlobContainersClientDeleteImmutabilityPolicyResponse contains the response from method BlobContainersClient.DeleteImmutabilityPolicy. +type BlobContainersClientDeleteImmutabilityPolicyResponse struct { + // The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. + ImmutabilityPolicy + + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// BlobContainersClientDeleteResponse contains the response from method BlobContainersClient.Delete. +type BlobContainersClientDeleteResponse struct { + // placeholder for future response values +} + +// BlobContainersClientExtendImmutabilityPolicyResponse contains the response from method BlobContainersClient.ExtendImmutabilityPolicy. +type BlobContainersClientExtendImmutabilityPolicyResponse struct { + // The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. + ImmutabilityPolicy + + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// BlobContainersClientGetImmutabilityPolicyResponse contains the response from method BlobContainersClient.GetImmutabilityPolicy. +type BlobContainersClientGetImmutabilityPolicyResponse struct { + // The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. + ImmutabilityPolicy + + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// BlobContainersClientGetResponse contains the response from method BlobContainersClient.Get. +type BlobContainersClientGetResponse struct { + // Properties of the blob container, including Id, resource name, resource type, Etag. + BlobContainer +} + +// BlobContainersClientLeaseResponse contains the response from method BlobContainersClient.Lease. +type BlobContainersClientLeaseResponse struct { + // Lease Container response schema. + LeaseContainerResponse +} + +// BlobContainersClientListResponse contains the response from method BlobContainersClient.NewListPager. +type BlobContainersClientListResponse struct { + // Response schema. Contains list of blobs returned, and if paging is requested or required, a URL to next page of containers. + ListContainerItems +} + +// BlobContainersClientLockImmutabilityPolicyResponse contains the response from method BlobContainersClient.LockImmutabilityPolicy. +type BlobContainersClientLockImmutabilityPolicyResponse struct { + // The ImmutabilityPolicy property of a blob container, including Id, resource name, resource type, Etag. + ImmutabilityPolicy + + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// BlobContainersClientObjectLevelWormResponse contains the response from method BlobContainersClient.BeginObjectLevelWorm. +type BlobContainersClientObjectLevelWormResponse struct { + // placeholder for future response values +} + +// BlobContainersClientSetLegalHoldResponse contains the response from method BlobContainersClient.SetLegalHold. +type BlobContainersClientSetLegalHoldResponse struct { + // The LegalHold property of a blob container. + LegalHold +} + +// BlobContainersClientUpdateResponse contains the response from method BlobContainersClient.Update. +type BlobContainersClientUpdateResponse struct { + // Properties of the blob container, including Id, resource name, resource type, Etag. + BlobContainer +} + +// BlobInventoryPoliciesClientCreateOrUpdateResponse contains the response from method BlobInventoryPoliciesClient.CreateOrUpdate. +type BlobInventoryPoliciesClientCreateOrUpdateResponse struct { + // The storage account blob inventory policy. + BlobInventoryPolicy +} + +// BlobInventoryPoliciesClientDeleteResponse contains the response from method BlobInventoryPoliciesClient.Delete. +type BlobInventoryPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// BlobInventoryPoliciesClientGetResponse contains the response from method BlobInventoryPoliciesClient.Get. +type BlobInventoryPoliciesClientGetResponse struct { + // The storage account blob inventory policy. + BlobInventoryPolicy +} + +// BlobInventoryPoliciesClientListResponse contains the response from method BlobInventoryPoliciesClient.NewListPager. +type BlobInventoryPoliciesClientListResponse struct { + // List of blob inventory policies returned. + ListBlobInventoryPolicy +} + +// BlobServicesClientGetServicePropertiesResponse contains the response from method BlobServicesClient.GetServiceProperties. +type BlobServicesClientGetServicePropertiesResponse struct { + // The properties of a storage account’s Blob service. + BlobServiceProperties +} + +// BlobServicesClientListResponse contains the response from method BlobServicesClient.NewListPager. +type BlobServicesClientListResponse struct { + BlobServiceItems +} + +// BlobServicesClientSetServicePropertiesResponse contains the response from method BlobServicesClient.SetServiceProperties. +type BlobServicesClientSetServicePropertiesResponse struct { + // The properties of a storage account’s Blob service. + BlobServiceProperties +} + +// DeletedAccountsClientGetResponse contains the response from method DeletedAccountsClient.Get. +type DeletedAccountsClientGetResponse struct { + // Deleted storage account + DeletedAccount +} + +// DeletedAccountsClientListResponse contains the response from method DeletedAccountsClient.NewListPager. +type DeletedAccountsClientListResponse struct { + // The response from the List Deleted Accounts operation. + DeletedAccountListResult +} + +// EncryptionScopesClientGetResponse contains the response from method EncryptionScopesClient.Get. +type EncryptionScopesClientGetResponse struct { + // The Encryption Scope resource. + EncryptionScope +} + +// EncryptionScopesClientListResponse contains the response from method EncryptionScopesClient.NewListPager. +type EncryptionScopesClientListResponse struct { + // List of encryption scopes requested, and if paging is required, a URL to the next page of encryption scopes. + EncryptionScopeListResult +} + +// EncryptionScopesClientPatchResponse contains the response from method EncryptionScopesClient.Patch. +type EncryptionScopesClientPatchResponse struct { + // The Encryption Scope resource. + EncryptionScope +} + +// EncryptionScopesClientPutResponse contains the response from method EncryptionScopesClient.Put. +type EncryptionScopesClientPutResponse struct { + // The Encryption Scope resource. + EncryptionScope +} + +// FileServicesClientGetServicePropertiesResponse contains the response from method FileServicesClient.GetServiceProperties. +type FileServicesClientGetServicePropertiesResponse struct { + // The properties of File services in storage account. + FileServiceProperties +} + +// FileServicesClientListResponse contains the response from method FileServicesClient.List. +type FileServicesClientListResponse struct { + FileServiceItems +} + +// FileServicesClientSetServicePropertiesResponse contains the response from method FileServicesClient.SetServiceProperties. +type FileServicesClientSetServicePropertiesResponse struct { + // The properties of File services in storage account. + FileServiceProperties +} + +// FileSharesClientCreateResponse contains the response from method FileSharesClient.Create. +type FileSharesClientCreateResponse struct { + // Properties of the file share, including Id, resource name, resource type, Etag. + FileShare +} + +// FileSharesClientDeleteResponse contains the response from method FileSharesClient.Delete. +type FileSharesClientDeleteResponse struct { + // placeholder for future response values +} + +// FileSharesClientGetResponse contains the response from method FileSharesClient.Get. +type FileSharesClientGetResponse struct { + // Properties of the file share, including Id, resource name, resource type, Etag. + FileShare +} + +// FileSharesClientLeaseResponse contains the response from method FileSharesClient.Lease. +type FileSharesClientLeaseResponse struct { + // Lease Share response schema. + LeaseShareResponse + + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// FileSharesClientListResponse contains the response from method FileSharesClient.NewListPager. +type FileSharesClientListResponse struct { + // Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. + FileShareItems +} + +// FileSharesClientRestoreResponse contains the response from method FileSharesClient.Restore. +type FileSharesClientRestoreResponse struct { + // placeholder for future response values +} + +// FileSharesClientUpdateResponse contains the response from method FileSharesClient.Update. +type FileSharesClientUpdateResponse struct { + // Properties of the file share, including Id, resource name, resource type, Etag. + FileShare +} + +// LocalUsersClientCreateOrUpdateResponse contains the response from method LocalUsersClient.CreateOrUpdate. +type LocalUsersClientCreateOrUpdateResponse struct { + // The local user associated with the storage accounts. + LocalUser +} + +// LocalUsersClientDeleteResponse contains the response from method LocalUsersClient.Delete. +type LocalUsersClientDeleteResponse struct { + // placeholder for future response values +} + +// LocalUsersClientGetResponse contains the response from method LocalUsersClient.Get. +type LocalUsersClientGetResponse struct { + // The local user associated with the storage accounts. + LocalUser +} + +// LocalUsersClientListKeysResponse contains the response from method LocalUsersClient.ListKeys. +type LocalUsersClientListKeysResponse struct { + // The Storage Account Local User keys. + LocalUserKeys +} + +// LocalUsersClientListResponse contains the response from method LocalUsersClient.NewListPager. +type LocalUsersClientListResponse struct { + // List storage account local users. + LocalUsers +} + +// LocalUsersClientRegeneratePasswordResponse contains the response from method LocalUsersClient.RegeneratePassword. +type LocalUsersClientRegeneratePasswordResponse struct { + // The secrets of Storage Account Local User. + LocalUserRegeneratePasswordResult +} + +// ManagementPoliciesClientCreateOrUpdateResponse contains the response from method ManagementPoliciesClient.CreateOrUpdate. +type ManagementPoliciesClientCreateOrUpdateResponse struct { + // The Get Storage Account ManagementPolicies operation response. + ManagementPolicy +} + +// ManagementPoliciesClientDeleteResponse contains the response from method ManagementPoliciesClient.Delete. +type ManagementPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagementPoliciesClientGetResponse contains the response from method ManagementPoliciesClient.Get. +type ManagementPoliciesClientGetResponse struct { + // The Get Storage Account ManagementPolicies operation response. + ManagementPolicy +} + +// ObjectReplicationPoliciesClientCreateOrUpdateResponse contains the response from method ObjectReplicationPoliciesClient.CreateOrUpdate. +type ObjectReplicationPoliciesClientCreateOrUpdateResponse struct { + // The replication policy between two storage accounts. Multiple rules can be defined in one policy. + ObjectReplicationPolicy +} + +// ObjectReplicationPoliciesClientDeleteResponse contains the response from method ObjectReplicationPoliciesClient.Delete. +type ObjectReplicationPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// ObjectReplicationPoliciesClientGetResponse contains the response from method ObjectReplicationPoliciesClient.Get. +type ObjectReplicationPoliciesClientGetResponse struct { + // The replication policy between two storage accounts. Multiple rules can be defined in one policy. + ObjectReplicationPolicy +} + +// ObjectReplicationPoliciesClientListResponse contains the response from method ObjectReplicationPoliciesClient.NewListPager. +type ObjectReplicationPoliciesClientListResponse struct { + // List storage account object replication policies. + ObjectReplicationPolicies +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of + // results. + OperationListResult +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. +type PrivateEndpointConnectionsClientListResponse struct { + // List of private endpoint connection associated with the specified storage account + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsClientPutResponse contains the response from method PrivateEndpointConnectionsClient.Put. +type PrivateEndpointConnectionsClientPutResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnection +} + +// PrivateLinkResourcesClientListByStorageAccountResponse contains the response from method PrivateLinkResourcesClient.ListByStorageAccount. +type PrivateLinkResourcesClientListByStorageAccountResponse struct { + // A list of private link resources + PrivateLinkResourceListResult +} + +// QueueClientCreateResponse contains the response from method QueueClient.Create. +type QueueClientCreateResponse struct { + Queue +} + +// QueueClientDeleteResponse contains the response from method QueueClient.Delete. +type QueueClientDeleteResponse struct { + // placeholder for future response values +} + +// QueueClientGetResponse contains the response from method QueueClient.Get. +type QueueClientGetResponse struct { + Queue +} + +// QueueClientListResponse contains the response from method QueueClient.NewListPager. +type QueueClientListResponse struct { + // Response schema. Contains list of queues returned + ListQueueResource +} + +// QueueClientUpdateResponse contains the response from method QueueClient.Update. +type QueueClientUpdateResponse struct { + Queue +} + +// QueueServicesClientGetServicePropertiesResponse contains the response from method QueueServicesClient.GetServiceProperties. +type QueueServicesClientGetServicePropertiesResponse struct { + // The properties of a storage account’s Queue service. + QueueServiceProperties +} + +// QueueServicesClientListResponse contains the response from method QueueServicesClient.List. +type QueueServicesClientListResponse struct { + ListQueueServices +} + +// QueueServicesClientSetServicePropertiesResponse contains the response from method QueueServicesClient.SetServiceProperties. +type QueueServicesClientSetServicePropertiesResponse struct { + // The properties of a storage account’s Queue service. + QueueServiceProperties +} + +// SKUsClientListResponse contains the response from method SKUsClient.NewListPager. +type SKUsClientListResponse struct { + // The response from the List Storage SKUs operation. + SKUListResult +} + +// TableClientCreateResponse contains the response from method TableClient.Create. +type TableClientCreateResponse struct { + // Properties of the table, including Id, resource name, resource type. + Table +} + +// TableClientDeleteResponse contains the response from method TableClient.Delete. +type TableClientDeleteResponse struct { + // placeholder for future response values +} + +// TableClientGetResponse contains the response from method TableClient.Get. +type TableClientGetResponse struct { + // Properties of the table, including Id, resource name, resource type. + Table +} + +// TableClientListResponse contains the response from method TableClient.NewListPager. +type TableClientListResponse struct { + // Response schema. Contains list of tables returned + ListTableResource +} + +// TableClientUpdateResponse contains the response from method TableClient.Update. +type TableClientUpdateResponse struct { + // Properties of the table, including Id, resource name, resource type. + Table +} + +// TableServicesClientGetServicePropertiesResponse contains the response from method TableServicesClient.GetServiceProperties. +type TableServicesClientGetServicePropertiesResponse struct { + // The properties of a storage account’s Table service. + TableServiceProperties +} + +// TableServicesClientListResponse contains the response from method TableServicesClient.List. +type TableServicesClientListResponse struct { + ListTableServices +} + +// TableServicesClientSetServicePropertiesResponse contains the response from method TableServicesClient.SetServiceProperties. +type TableServicesClientSetServicePropertiesResponse struct { + // The properties of a storage account’s Table service. + TableServiceProperties +} + +// UsagesClientListByLocationResponse contains the response from method UsagesClient.NewListByLocationPager. +type UsagesClientListByLocationResponse struct { + // The response from the List Usages operation. + UsageListResult +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/skus_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/skus_client.go new file mode 100644 index 000000000..db7979df3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/skus_client.go @@ -0,0 +1,99 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SKUsClient contains the methods for the SKUs group. +// Don't use this type directly, use NewSKUsClient() instead. +type SKUsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSKUsClient creates a new instance of SKUsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SKUsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Lists the available SKUs supported by Microsoft.Storage for given subscription. +// +// Generated from API version 2023-01-01 +// - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. +func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ + More: func(page SKUsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *SKUsClientListResponse) (SKUsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SKUsClient.NewListPager") + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return SKUsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SKUsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SKUsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SKUsClient) listHandleResponse(resp *http.Response) (SKUsClientListResponse, error) { + result := SKUsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUListResult); err != nil { + return SKUsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/table_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/table_client.go new file mode 100644 index 000000000..169dd385e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/table_client.go @@ -0,0 +1,395 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TableClient contains the methods for the Table group. +// Don't use this type directly, use NewTableClient() instead. +type TableClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTableClient creates a new instance of TableClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTableClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TableClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TableClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates a new table with the specified table name, under the specified account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - tableName - A table name must be unique within a storage account and must be between 3 and 63 characters.The name must +// comprise of only alphanumeric characters and it cannot begin with a numeric character. +// - options - TableClientCreateOptions contains the optional parameters for the TableClient.Create method. +func (client *TableClient) Create(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientCreateOptions) (TableClientCreateResponse, error) { + var err error + const operationName = "TableClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, tableName, options) + if err != nil { + return TableClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TableClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TableClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *TableClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if tableName == "" { + return nil, errors.New("parameter tableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tableName}", url.PathEscape(tableName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *TableClient) createHandleResponse(resp *http.Response) (TableClientCreateResponse, error) { + result := TableClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Table); err != nil { + return TableClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the table with the specified table name, under the specified account if it exists. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - tableName - A table name must be unique within a storage account and must be between 3 and 63 characters.The name must +// comprise of only alphanumeric characters and it cannot begin with a numeric character. +// - options - TableClientDeleteOptions contains the optional parameters for the TableClient.Delete method. +func (client *TableClient) Delete(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientDeleteOptions) (TableClientDeleteResponse, error) { + var err error + const operationName = "TableClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, tableName, options) + if err != nil { + return TableClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TableClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TableClientDeleteResponse{}, err + } + return TableClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TableClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if tableName == "" { + return nil, errors.New("parameter tableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tableName}", url.PathEscape(tableName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the table with the specified table name, under the specified account if it exists. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - tableName - A table name must be unique within a storage account and must be between 3 and 63 characters.The name must +// comprise of only alphanumeric characters and it cannot begin with a numeric character. +// - options - TableClientGetOptions contains the optional parameters for the TableClient.Get method. +func (client *TableClient) Get(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientGetOptions) (TableClientGetResponse, error) { + var err error + const operationName = "TableClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, tableName, options) + if err != nil { + return TableClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TableClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TableClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TableClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if tableName == "" { + return nil, errors.New("parameter tableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tableName}", url.PathEscape(tableName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TableClient) getHandleResponse(resp *http.Response) (TableClientGetResponse, error) { + result := TableClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Table); err != nil { + return TableClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of all the tables under the specified storage account +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - TableClientListOptions contains the optional parameters for the TableClient.NewListPager method. +func (client *TableClient) NewListPager(resourceGroupName string, accountName string, options *TableClientListOptions) *runtime.Pager[TableClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TableClientListResponse]{ + More: func(page TableClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TableClientListResponse) (TableClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TableClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return TableClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TableClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *TableClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TableClient) listHandleResponse(resp *http.Response) (TableClientListResponse, error) { + result := TableClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListTableResource); err != nil { + return TableClientListResponse{}, err + } + return result, nil +} + +// Update - Creates a new table with the specified table name, under the specified account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - tableName - A table name must be unique within a storage account and must be between 3 and 63 characters.The name must +// comprise of only alphanumeric characters and it cannot begin with a numeric character. +// - options - TableClientUpdateOptions contains the optional parameters for the TableClient.Update method. +func (client *TableClient) Update(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientUpdateOptions) (TableClientUpdateResponse, error) { + var err error + const operationName = "TableClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, tableName, options) + if err != nil { + return TableClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TableClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TableClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *TableClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if tableName == "" { + return nil, errors.New("parameter tableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tableName}", url.PathEscape(tableName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *TableClient) updateHandleResponse(resp *http.Response) (TableClientUpdateResponse, error) { + result := TableClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Table); err != nil { + return TableClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/tableservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/tableservices_client.go new file mode 100644 index 000000000..f53f5f982 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/tableservices_client.go @@ -0,0 +1,250 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TableServicesClient contains the methods for the TableServices group. +// Don't use this type directly, use NewTableServicesClient() instead. +type TableServicesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTableServicesClient creates a new instance of TableServicesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTableServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TableServicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TableServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetServiceProperties - Gets the properties of a storage account’s Table service, including properties for Storage Analytics +// and CORS (Cross-Origin Resource Sharing) rules. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - TableServicesClientGetServicePropertiesOptions contains the optional parameters for the TableServicesClient.GetServiceProperties +// method. +func (client *TableServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientGetServicePropertiesOptions) (TableServicesClientGetServicePropertiesResponse, error) { + var err error + const operationName = "TableServicesClient.GetServiceProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return TableServicesClientGetServicePropertiesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TableServicesClientGetServicePropertiesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TableServicesClientGetServicePropertiesResponse{}, err + } + resp, err := client.getServicePropertiesHandleResponse(httpResp) + return resp, err +} + +// getServicePropertiesCreateRequest creates the GetServiceProperties request. +func (client *TableServicesClient) getServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientGetServicePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{tableServiceName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getServicePropertiesHandleResponse handles the GetServiceProperties response. +func (client *TableServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (TableServicesClientGetServicePropertiesResponse, error) { + result := TableServicesClientGetServicePropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TableServiceProperties); err != nil { + return TableServicesClientGetServicePropertiesResponse{}, err + } + return result, nil +} + +// List - List all table services for the storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - options - TableServicesClientListOptions contains the optional parameters for the TableServicesClient.List method. +func (client *TableServicesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientListOptions) (TableServicesClientListResponse, error) { + var err error + const operationName = "TableServicesClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return TableServicesClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TableServicesClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TableServicesClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// listCreateRequest creates the List request. +func (client *TableServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TableServicesClient) listHandleResponse(resp *http.Response) (TableServicesClientListResponse, error) { + result := TableServicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListTableServices); err != nil { + return TableServicesClientListResponse{}, err + } + return result, nil +} + +// SetServiceProperties - Sets the properties of a storage account’s Table service, including properties for Storage Analytics +// and CORS (Cross-Origin Resource Sharing) rules. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The properties of a storage account’s Table service, only properties for Storage Analytics and CORS (Cross-Origin +// Resource Sharing) rules can be specified. +// - options - TableServicesClientSetServicePropertiesOptions contains the optional parameters for the TableServicesClient.SetServiceProperties +// method. +func (client *TableServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters TableServiceProperties, options *TableServicesClientSetServicePropertiesOptions) (TableServicesClientSetServicePropertiesResponse, error) { + var err error + const operationName = "TableServicesClient.SetServiceProperties" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return TableServicesClientSetServicePropertiesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TableServicesClientSetServicePropertiesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TableServicesClientSetServicePropertiesResponse{}, err + } + resp, err := client.setServicePropertiesHandleResponse(httpResp) + return resp, err +} + +// setServicePropertiesCreateRequest creates the SetServiceProperties request. +func (client *TableServicesClient) setServicePropertiesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters TableServiceProperties, options *TableServicesClientSetServicePropertiesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/{tableServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{tableServiceName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// setServicePropertiesHandleResponse handles the SetServiceProperties response. +func (client *TableServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (TableServicesClientSetServicePropertiesResponse, error) { + result := TableServicesClientSetServicePropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TableServiceProperties); err != nil { + return TableServicesClientSetServicePropertiesResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/time_rfc3339.go new file mode 100644 index 000000000..201ffd255 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// 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+)*"*$`) + +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func populateDateTimeRFC3339(m map[string]any, 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] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateTimeRFC3339 + 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/storage/armstorage/usages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/usages_client.go new file mode 100644 index 000000000..2f4a974fa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/usages_client.go @@ -0,0 +1,105 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstorage + +import ( + "context" + "errors" + "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/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 { + internal *arm.Client + subscriptionID string +} + +// NewUsagesClient creates a new instance of UsagesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - 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) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UsagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByLocationPager - Gets the current usage count and the limit for the resources of the location under the subscription. +// +// Generated from API version 2023-01-01 +// - location - The location of the Azure Storage resource. +// - options - UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.NewListByLocationPager +// method. +func (client *UsagesClient) NewListByLocationPager(location string, options *UsagesClientListByLocationOptions) *runtime.Pager[UsagesClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[UsagesClientListByLocationResponse]{ + More: func(page UsagesClientListByLocationResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *UsagesClientListByLocationResponse) (UsagesClientListByLocationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UsagesClient.NewListByLocationPager") + req, err := client.listByLocationCreateRequest(ctx, location, options) + if err != nil { + return UsagesClientListByLocationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UsagesClientListByLocationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UsagesClientListByLocationResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *UsagesClient) listByLocationCreateRequest(ctx context.Context, location string, options *UsagesClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *UsagesClient) listByLocationHandleResponse(resp *http.Response) (UsagesClientListByLocationResponse, error) { + result := UsagesClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UsageListResult); err != nil { + return UsagesClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/CHANGELOG.md deleted file mode 100644 index 52911e4cc..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/_meta.json deleted file mode 100644 index d93378dba..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", - "tag": "package-resources-2018-05", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-resources-2018-05 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/client.go deleted file mode 100644 index d7360b529..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [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). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package resources implements the Azure ARM Resources service API version 2018-05-01. -// -// Provides operations for working with resources and resource groups. -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Resources - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Resources. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/deploymentoperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/deploymentoperations.go deleted file mode 100644 index e836486da..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/deploymentoperations.go +++ /dev/null @@ -1,469 +0,0 @@ -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DeploymentOperationsClient is the provides operations for working with resources and resource groups. -type DeploymentOperationsClient struct { - BaseClient -} - -// NewDeploymentOperationsClient creates an instance of the DeploymentOperationsClient client. -func NewDeploymentOperationsClient(subscriptionID string) DeploymentOperationsClient { - return NewDeploymentOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDeploymentOperationsClientWithBaseURI creates an instance of the DeploymentOperationsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewDeploymentOperationsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentOperationsClient { - return DeploymentOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a deployments operation. -// Parameters: -// 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. -func (client DeploymentOperationsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, operationID string) (result DeploymentOperation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentOperationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, deploymentName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DeploymentOperationsClient) GetPreparer(ctx context.Context, resourceGroupName string, deploymentName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentOperationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DeploymentOperationsClient) GetResponder(resp *http.Response) (result DeploymentOperation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtSubscriptionScope gets a deployments operation. -// Parameters: -// deploymentName - the name of the deployment. -// operationID - the ID of the operation to get. -func (client DeploymentOperationsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string, operationID string) (result DeploymentOperation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.GetAtSubscriptionScope") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentOperationsClient", "GetAtSubscriptionScope", err.Error()) - } - - req, err := client.GetAtSubscriptionScopePreparer(ctx, deploymentName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtSubscriptionScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtSubscriptionScope", resp, "Failure sending request") - return - } - - result, err = client.GetAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "GetAtSubscriptionScope", resp, "Failure responding to request") - return - } - - return -} - -// GetAtSubscriptionScopePreparer prepares the GetAtSubscriptionScope request. -func (client DeploymentOperationsClient) GetAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAtSubscriptionScopeSender sends the GetAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentOperationsClient) GetAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAtSubscriptionScopeResponder handles the response to the GetAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentOperationsClient) GetAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentOperation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all deployments operations for a deployment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// deploymentName - the name of the deployment with the operation to get. -// top - the number of results to return. -func (client DeploymentOperationsClient) List(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.List") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentOperationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, deploymentName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure sending request") - return - } - - result.dolr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DeploymentOperationsClient) ListPreparer(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentOperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DeploymentOperationsClient) ListResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DeploymentOperationsClient) listNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) { - req, err := lastResults.deploymentOperationsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DeploymentOperationsClient) ListComplete(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, deploymentName, top) - return -} - -// ListAtSubscriptionScope gets all deployments operations for a deployment. -// Parameters: -// deploymentName - the name of the deployment with the operation to get. -// top - the number of results to return. -func (client DeploymentOperationsClient) ListAtSubscriptionScope(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtSubscriptionScope") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentOperationsClient", "ListAtSubscriptionScope", err.Error()) - } - - result.fn = client.listAtSubscriptionScopeNextResults - req, err := client.ListAtSubscriptionScopePreparer(ctx, deploymentName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtSubscriptionScopeSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtSubscriptionScope", resp, "Failure sending request") - return - } - - result.dolr, err = client.ListAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "ListAtSubscriptionScope", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request. -func (client DeploymentOperationsClient) ListAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentOperationsClient) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentOperationsClient) ListAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAtSubscriptionScopeNextResults retrieves the next set of results, if any. -func (client DeploymentOperationsClient) listAtSubscriptionScopeNextResults(ctx context.Context, lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) { - req, err := lastResults.deploymentOperationsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtSubscriptionScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAtSubscriptionScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtSubscriptionScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "listAtSubscriptionScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAtSubscriptionScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client DeploymentOperationsClient) ListAtSubscriptionScopeComplete(ctx context.Context, deploymentName string, top *int32) (result DeploymentOperationsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsClient.ListAtSubscriptionScope") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAtSubscriptionScope(ctx, deploymentName, top) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/deployments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/deployments.go deleted file mode 100644 index 72b2bd557..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/deployments.go +++ /dev/null @@ -1,1618 +0,0 @@ -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DeploymentsClient is the provides operations for working with resources and resource groups. -type DeploymentsClient struct { - BaseClient -} - -// NewDeploymentsClient creates an instance of the DeploymentsClient client. -func NewDeploymentsClient(subscriptionID string) DeploymentsClient { - return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { - return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateTemplateHash calculate the hash of the given template. -// Parameters: -// templateParameter - the template provided to calculate hash. -func (client DeploymentsClient) CalculateTemplateHash(ctx context.Context, templateParameter interface{}) (result TemplateHashResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CalculateTemplateHash") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CalculateTemplateHashPreparer(ctx, templateParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CalculateTemplateHash", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateTemplateHashSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CalculateTemplateHash", resp, "Failure sending request") - return - } - - result, err = client.CalculateTemplateHashResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CalculateTemplateHash", resp, "Failure responding to request") - return - } - - return -} - -// CalculateTemplateHashPreparer prepares the CalculateTemplateHash request. -func (client DeploymentsClient) CalculateTemplateHashPreparer(ctx context.Context, templateParameter interface{}) (*http.Request, error) { - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Resources/calculateTemplateHash"), - autorest.WithJSON(templateParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateTemplateHashSender sends the CalculateTemplateHash request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CalculateTemplateHashSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateTemplateHashResponder handles the response to the CalculateTemplateHash request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CalculateTemplateHashResponder(resp *http.Response) (result TemplateHashResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// 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. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// deploymentName - the name of the deployment to cancel. -func (client DeploymentsClient) Cancel(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Cancel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "Cancel", err.Error()) - } - - req, err := client.CancelPreparer(ctx, resourceGroupName, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure responding to request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client DeploymentsClient) CancelPreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CancelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// 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. -// Parameters: -// deploymentName - the name of the deployment to cancel. -func (client DeploymentsClient) CancelAtSubscriptionScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CancelAtSubscriptionScope") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "CancelAtSubscriptionScope", err.Error()) - } - - req, err := client.CancelAtSubscriptionScopePreparer(ctx, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.CancelAtSubscriptionScopeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtSubscriptionScope", resp, "Failure sending request") - return - } - - result, err = client.CancelAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CancelAtSubscriptionScope", resp, "Failure responding to request") - return - } - - return -} - -// CancelAtSubscriptionScopePreparer prepares the CancelAtSubscriptionScope request. -func (client DeploymentsClient) CancelAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelAtSubscriptionScopeSender sends the CancelAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CancelAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelAtSubscriptionScopeResponder handles the response to the CancelAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CancelAtSubscriptionScopeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckExistence checks whether the deployment exists. -// Parameters: -// resourceGroupName - the name of the resource group with the deployment to check. The name is case -// insensitive. -// deploymentName - the name of the deployment to check. -func (client DeploymentsClient) CheckExistence(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistence") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "CheckExistence", err.Error()) - } - - req, err := client.CheckExistencePreparer(ctx, resourceGroupName, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", nil, "Failure preparing request") - return - } - - resp, err := client.CheckExistenceSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure sending request") - return - } - - result, err = client.CheckExistenceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure responding to request") - return - } - - return -} - -// CheckExistencePreparer prepares the CheckExistence request. -func (client DeploymentsClient) CheckExistencePreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckExistenceSender sends the CheckExistence request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckExistenceResponder handles the response to the CheckExistence request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckExistenceAtSubscriptionScope checks whether the deployment exists. -// Parameters: -// deploymentName - the name of the deployment to check. -func (client DeploymentsClient) CheckExistenceAtSubscriptionScope(ctx context.Context, deploymentName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CheckExistenceAtSubscriptionScope") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "CheckExistenceAtSubscriptionScope", err.Error()) - } - - req, err := client.CheckExistenceAtSubscriptionScopePreparer(ctx, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.CheckExistenceAtSubscriptionScopeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtSubscriptionScope", resp, "Failure sending request") - return - } - - result, err = client.CheckExistenceAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistenceAtSubscriptionScope", resp, "Failure responding to request") - return - } - - return -} - -// CheckExistenceAtSubscriptionScopePreparer prepares the CheckExistenceAtSubscriptionScope request. -func (client DeploymentsClient) CheckExistenceAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckExistenceAtSubscriptionScopeSender sends the CheckExistenceAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CheckExistenceAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckExistenceAtSubscriptionScopeResponder handles the response to the CheckExistenceAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CheckExistenceAtSubscriptionScopeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate you can provide the template and parameters directly in the request or link to JSON files. -// Parameters: -// 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. -func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, deploymentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentExtended, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAtSubscriptionScope you can provide the template and parameters directly in the request or link to -// JSON files. -// Parameters: -// deploymentName - the name of the deployment. -// parameters - additional parameters supplied to the operation. -func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateAtSubscriptionScopeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdateAtSubscriptionScope") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "CreateOrUpdateAtSubscriptionScope", err.Error()) - } - - req, err := client.CreateOrUpdateAtSubscriptionScopePreparer(ctx, deploymentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtSubscriptionScope", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateAtSubscriptionScopeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdateAtSubscriptionScope", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdateAtSubscriptionScopePreparer prepares the CreateOrUpdateAtSubscriptionScope request. -func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, parameters Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAtSubscriptionScopeSender sends the CreateOrUpdateAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScopeSender(req *http.Request) (future DeploymentsCreateOrUpdateAtSubscriptionScopeFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateAtSubscriptionScopeResponder handles the response to the CreateOrUpdateAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CreateOrUpdateAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete 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. -// Parameters: -// resourceGroupName - the name of the resource group with the deployment to delete. The name is case -// insensitive. -// deploymentName - the name of the deployment to delete. -func (client DeploymentsClient) Delete(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) DeleteSender(req *http.Request) (future DeploymentsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// 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. -// Parameters: -// deploymentName - the name of the deployment to delete. -func (client DeploymentsClient) DeleteAtSubscriptionScope(ctx context.Context, deploymentName string) (result DeploymentsDeleteAtSubscriptionScopeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.DeleteAtSubscriptionScope") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "DeleteAtSubscriptionScope", err.Error()) - } - - req, err := client.DeleteAtSubscriptionScopePreparer(ctx, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtSubscriptionScope", nil, "Failure preparing request") - return - } - - result, err = client.DeleteAtSubscriptionScopeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "DeleteAtSubscriptionScope", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteAtSubscriptionScopePreparer prepares the DeleteAtSubscriptionScope request. -func (client DeploymentsClient) DeleteAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAtSubscriptionScopeSender sends the DeleteAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) DeleteAtSubscriptionScopeSender(req *http.Request) (future DeploymentsDeleteAtSubscriptionScopeFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteAtSubscriptionScopeResponder handles the response to the DeleteAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) DeleteAtSubscriptionScopeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExportTemplate exports the template used for specified deployment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// deploymentName - the name of the deployment from which to get the template. -func (client DeploymentsClient) ExportTemplate(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentExportResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "ExportTemplate", err.Error()) - } - - req, err := client.ExportTemplatePreparer(ctx, resourceGroupName, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", nil, "Failure preparing request") - return - } - - resp, err := client.ExportTemplateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", resp, "Failure sending request") - return - } - - result, err = client.ExportTemplateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", resp, "Failure responding to request") - return - } - - return -} - -// ExportTemplatePreparer prepares the ExportTemplate request. -func (client DeploymentsClient) ExportTemplatePreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportTemplateSender sends the ExportTemplate request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) ExportTemplateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExportTemplateResponder handles the response to the ExportTemplate request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) ExportTemplateResponder(resp *http.Response) (result DeploymentExportResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ExportTemplateAtSubscriptionScope exports the template used for specified deployment. -// Parameters: -// deploymentName - the name of the deployment from which to get the template. -func (client DeploymentsClient) ExportTemplateAtSubscriptionScope(ctx context.Context, deploymentName string) (result DeploymentExportResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ExportTemplateAtSubscriptionScope") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "ExportTemplateAtSubscriptionScope", err.Error()) - } - - req, err := client.ExportTemplateAtSubscriptionScopePreparer(ctx, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.ExportTemplateAtSubscriptionScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtSubscriptionScope", resp, "Failure sending request") - return - } - - result, err = client.ExportTemplateAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplateAtSubscriptionScope", resp, "Failure responding to request") - return - } - - return -} - -// ExportTemplateAtSubscriptionScopePreparer prepares the ExportTemplateAtSubscriptionScope request. -func (client DeploymentsClient) ExportTemplateAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportTemplateAtSubscriptionScopeSender sends the ExportTemplateAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) ExportTemplateAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExportTemplateAtSubscriptionScopeResponder handles the response to the ExportTemplateAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) ExportTemplateAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentExportResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a deployment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// deploymentName - the name of the deployment to get. -func (client DeploymentsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentExtended, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DeploymentsClient) GetPreparer(ctx context.Context, resourceGroupName string, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentExtended, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtSubscriptionScope gets a deployment. -// Parameters: -// deploymentName - the name of the deployment to get. -func (client DeploymentsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string) (result DeploymentExtended, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetAtSubscriptionScope") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "GetAtSubscriptionScope", err.Error()) - } - - req, err := client.GetAtSubscriptionScopePreparer(ctx, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtSubscriptionScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtSubscriptionScope", resp, "Failure sending request") - return - } - - result, err = client.GetAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "GetAtSubscriptionScope", resp, "Failure responding to request") - return - } - - return -} - -// GetAtSubscriptionScopePreparer prepares the GetAtSubscriptionScope request. -func (client DeploymentsClient) GetAtSubscriptionScopePreparer(ctx context.Context, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAtSubscriptionScopeSender sends the GetAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) GetAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAtSubscriptionScopeResponder handles the response to the GetAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) GetAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentExtended, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtSubscriptionScope get all the deployments for a subscription. -// Parameters: -// filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq -// '{state}'. -// top - the number of results to get. If null is passed, returns all deployments. -func (client DeploymentsClient) ListAtSubscriptionScope(ctx context.Context, filter string, top *int32) (result DeploymentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtSubscriptionScope") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listAtSubscriptionScopeNextResults - req, err := client.ListAtSubscriptionScopePreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtSubscriptionScopeSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtSubscriptionScope", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListAtSubscriptionScope", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request. -func (client DeploymentsClient) ListAtSubscriptionScopePreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) ListAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAtSubscriptionScopeNextResults retrieves the next set of results, if any. -func (client DeploymentsClient) listAtSubscriptionScopeNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) { - req, err := lastResults.deploymentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtSubscriptionScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAtSubscriptionScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtSubscriptionScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listAtSubscriptionScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAtSubscriptionScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client DeploymentsClient) ListAtSubscriptionScopeComplete(ctx context.Context, filter string, top *int32) (result DeploymentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListAtSubscriptionScope") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAtSubscriptionScope(ctx, filter, top) - return -} - -// ListByResourceGroup get all the deployments for a resource group. -// Parameters: -// resourceGroupName - the name of the resource group with the deployments to get. The name is case -// insensitive. -// filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq -// '{state}'. -// top - the number of results to get. If null is passed, returns all deployments. -func (client DeploymentsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DeploymentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DeploymentsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) ListByResourceGroupResponder(resp *http.Response) (result DeploymentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client DeploymentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) { - req, err := lastResults.deploymentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DeploymentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DeploymentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, top) - return -} - -// Validate validates whether the specified template is syntactically correct and will be accepted by Azure Resource -// Manager.. -// Parameters: -// 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. -func (client DeploymentsClient) Validate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Validate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "Validate", err.Error()) - } - - req, err := client.ValidatePreparer(ctx, resourceGroupName, deploymentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", resp, "Failure sending request") - return - } - - result, err = client.ValidateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", resp, "Failure responding to request") - return - } - - return -} - -// ValidatePreparer prepares the Validate request. -func (client DeploymentsClient) ValidatePreparer(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateSender sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) ValidateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ValidateResponder handles the response to the Validate request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) ValidateResponder(resp *http.Response) (result DeploymentValidateResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ValidateAtSubscriptionScope validates whether the specified template is syntactically correct and will be accepted -// by Azure Resource Manager.. -// Parameters: -// deploymentName - the name of the deployment. -// parameters - parameters to validate. -func (client DeploymentsClient) ValidateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ValidateAtSubscriptionScope") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("resources.DeploymentsClient", "ValidateAtSubscriptionScope", err.Error()) - } - - req, err := client.ValidateAtSubscriptionScopePreparer(ctx, deploymentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateAtSubscriptionScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtSubscriptionScope", resp, "Failure sending request") - return - } - - result, err = client.ValidateAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ValidateAtSubscriptionScope", resp, "Failure responding to request") - return - } - - return -} - -// ValidateAtSubscriptionScopePreparer prepares the ValidateAtSubscriptionScope request. -func (client DeploymentsClient) ValidateAtSubscriptionScopePreparer(ctx context.Context, deploymentName string, parameters Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateAtSubscriptionScopeSender sends the ValidateAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) ValidateAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ValidateAtSubscriptionScopeResponder handles the response to the ValidateAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) ValidateAtSubscriptionScopeResponder(resp *http.Response) (result DeploymentValidateResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/enums.go deleted file mode 100644 index 90b8ab23b..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/enums.go +++ /dev/null @@ -1,56 +0,0 @@ -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DeploymentMode enumerates the values for deployment mode. -type DeploymentMode string - -const ( - // Complete ... - Complete DeploymentMode = "Complete" - // Incremental ... - Incremental DeploymentMode = "Incremental" -) - -// PossibleDeploymentModeValues returns an array of possible values for the DeploymentMode const type. -func PossibleDeploymentModeValues() []DeploymentMode { - return []DeploymentMode{Complete, Incremental} -} - -// OnErrorDeploymentType enumerates the values for on error deployment type. -type OnErrorDeploymentType string - -const ( - // LastSuccessful ... - LastSuccessful OnErrorDeploymentType = "LastSuccessful" - // SpecificDeployment ... - SpecificDeployment OnErrorDeploymentType = "SpecificDeployment" -) - -// PossibleOnErrorDeploymentTypeValues returns an array of possible values for the OnErrorDeploymentType const type. -func PossibleOnErrorDeploymentTypeValues() []OnErrorDeploymentType { - return []OnErrorDeploymentType{LastSuccessful, SpecificDeployment} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // None ... - None ResourceIdentityType = "None" - // SystemAssigned ... - SystemAssigned ResourceIdentityType = "SystemAssigned" - // SystemAssignedUserAssigned ... - SystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // UserAssigned ... - UserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/groups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/groups.go deleted file mode 100644 index bf6c5cfee..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/groups.go +++ /dev/null @@ -1,666 +0,0 @@ -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GroupsClient is the provides operations for working with resources and resource groups. -type GroupsClient struct { - BaseClient -} - -// NewGroupsClient creates an instance of the GroupsClient client. -func NewGroupsClient(subscriptionID string) GroupsClient { - return NewGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewGroupsClientWithBaseURI(baseURI string, subscriptionID string) GroupsClient { - return GroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckExistence checks whether a resource group exists. -// Parameters: -// resourceGroupName - the name of the resource group to check. The name is case insensitive. -func (client GroupsClient) CheckExistence(ctx context.Context, resourceGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.CheckExistence") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.GroupsClient", "CheckExistence", err.Error()) - } - - req, err := client.CheckExistencePreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", nil, "Failure preparing request") - return - } - - resp, err := client.CheckExistenceSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure sending request") - return - } - - result, err = client.CheckExistenceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure responding to request") - return - } - - return -} - -// CheckExistencePreparer prepares the CheckExistence request. -func (client GroupsClient) CheckExistencePreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckExistenceSender sends the CheckExistence request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckExistenceResponder handles the response to the CheckExistence request. The method always -// closes the http.Response Body. -func (client GroupsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates or updates a resource group. -// Parameters: -// 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. -func (client GroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parameters Group) (result Group, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.GroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, parameters Group) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Name = nil - parameters.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result Group, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete 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. -// Parameters: -// resourceGroupName - the name of the resource group to delete. The name is case insensitive. -func (client GroupsClient) Delete(ctx context.Context, resourceGroupName string) (result GroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.GroupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) DeleteSender(req *http.Request) (future GroupsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExportTemplate captures the specified resource group as a template. -// Parameters: -// resourceGroupName - the name of the resource group to export as a template. -// parameters - parameters for exporting the template. -func (client GroupsClient) ExportTemplate(ctx context.Context, resourceGroupName string, parameters ExportTemplateRequest) (result GroupExportResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.ExportTemplate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.GroupsClient", "ExportTemplate", err.Error()) - } - - req, err := client.ExportTemplatePreparer(ctx, resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", nil, "Failure preparing request") - return - } - - resp, err := client.ExportTemplateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", resp, "Failure sending request") - return - } - - result, err = client.ExportTemplateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", resp, "Failure responding to request") - return - } - - return -} - -// ExportTemplatePreparer prepares the ExportTemplate request. -func (client GroupsClient) ExportTemplatePreparer(ctx context.Context, resourceGroupName string, parameters ExportTemplateRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportTemplateSender sends the ExportTemplate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ExportTemplateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExportTemplateResponder handles the response to the ExportTemplate request. The method always -// closes the http.Response Body. -func (client GroupsClient) ExportTemplateResponder(resp *http.Response) (result GroupExportResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a resource group. -// Parameters: -// resourceGroupName - the name of the resource group to get. The name is case insensitive. -func (client GroupsClient) Get(ctx context.Context, resourceGroupName string) (result Group, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.GroupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupsClient) GetPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetResponder(resp *http.Response) (result Group, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the resource groups for a subscription. -// Parameters: -// filter - 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' -// top - the number of results to return. If null is passed, returns all resource groups. -func (client GroupsClient) List(ctx context.Context, filter string, top *int32) (result GroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.List") - defer func() { - sc := -1 - if result.glr.Response.Response != nil { - sc = result.glr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.glr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure sending request") - return - } - - result.glr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure responding to request") - return - } - if result.glr.hasNextLink() && result.glr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupsClient) ListPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client GroupsClient) listNextResults(ctx context.Context, lastResults GroupListResult) (result GroupListResult, err error) { - req, err := lastResults.groupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupsClient) ListComplete(ctx context.Context, filter string, top *int32) (result GroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter, top) - return -} - -// 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. -// Parameters: -// resourceGroupName - the name of the resource group to update. The name is case insensitive. -// parameters - parameters supplied to update a resource group. -func (client GroupsClient) Update(ctx context.Context, resourceGroupName string, parameters GroupPatchable) (result Group, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.GroupsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, parameters GroupPatchable) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GroupsClient) UpdateResponder(resp *http.Response) (result Group, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/models.go deleted file mode 100644 index 1de747860..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/models.go +++ /dev/null @@ -1,2552 +0,0 @@ -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources" - -// AliasPathType the type of the paths for alias. -type AliasPathType struct { - // Path - The path of an alias. - Path *string `json:"path,omitempty"` - // APIVersions - The API versions. - APIVersions *[]string `json:"apiVersions,omitempty"` -} - -// AliasType the alias type. -type AliasType struct { - // Name - The alias name. - Name *string `json:"name,omitempty"` - // Paths - The paths for an alias. - Paths *[]AliasPathType `json:"paths,omitempty"` -} - -// BasicDependency deployment dependency information. -type BasicDependency struct { - // ID - The ID of the dependency. - ID *string `json:"id,omitempty"` - // ResourceType - The dependency resource type. - ResourceType *string `json:"resourceType,omitempty"` - // ResourceName - The dependency resource name. - ResourceName *string `json:"resourceName,omitempty"` -} - -// CloudError an error response for a resource management request. -type CloudError struct { - Error *ErrorResponse `json:"error,omitempty"` -} - -// CreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CreateOrUpdateByIDFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (GenericResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CreateOrUpdateByIDFuture.Result. -func (future *CreateOrUpdateByIDFuture) result(client Client) (gr GenericResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateByIDFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { - gr, err = client.CreateOrUpdateByIDResponder(gr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") - } - } - return -} - -// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (GenericResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CreateOrUpdateFuture.Result. -func (future *CreateOrUpdateFuture) result(client Client) (gr GenericResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { - gr, err = client.CreateOrUpdateResponder(gr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", gr.Response.Response, "Failure responding to request") - } - } - return -} - -// DebugSetting ... -type DebugSetting struct { - // DetailLevel - 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"` -} - -// DeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type DeleteByIDFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeleteByIDFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeleteByIDFuture.Result. -func (future *DeleteByIDFuture) result(client Client) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteByIDFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.DeleteByIDFuture") - return - } - ar.Response = future.Response() - return -} - -// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type DeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeleteFuture.Result. -func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.DeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// Dependency deployment dependency information. -type Dependency struct { - // DependsOn - The list of dependencies. - DependsOn *[]BasicDependency `json:"dependsOn,omitempty"` - // ID - The ID of the dependency. - ID *string `json:"id,omitempty"` - // ResourceType - The dependency resource type. - ResourceType *string `json:"resourceType,omitempty"` - // ResourceName - The dependency resource name. - ResourceName *string `json:"resourceName,omitempty"` -} - -// Deployment deployment operation parameters. -type Deployment struct { - // Location - The location to store the deployment data. - Location *string `json:"location,omitempty"` - // Properties - The deployment properties. - Properties *DeploymentProperties `json:"properties,omitempty"` -} - -// DeploymentExportResult the deployment export result. -type DeploymentExportResult struct { - autorest.Response `json:"-"` - // Template - The template content. - Template interface{} `json:"template,omitempty"` -} - -// DeploymentExtended deployment information. -type DeploymentExtended struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The ID of the deployment. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the deployment. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the deployment. - Type *string `json:"type,omitempty"` - // Location - the location of the deployment. - Location *string `json:"location,omitempty"` - // Properties - Deployment properties. - Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentExtended. -func (de DeploymentExtended) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if de.Location != nil { - objectMap["location"] = de.Location - } - if de.Properties != nil { - objectMap["properties"] = de.Properties - } - return json.Marshal(objectMap) -} - -// DeploymentExtendedFilter deployment filter. -type DeploymentExtendedFilter struct { - // ProvisioningState - The provisioning state. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// DeploymentListResult list of deployments. -type DeploymentListResult struct { - autorest.Response `json:"-"` - // Value - An array of deployments. - Value *[]DeploymentExtended `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentListResult. -func (dlr DeploymentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dlr.Value != nil { - objectMap["value"] = dlr.Value - } - return json.Marshal(objectMap) -} - -// DeploymentListResultIterator provides access to a complete listing of DeploymentExtended values. -type DeploymentListResultIterator struct { - i int - page DeploymentListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DeploymentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DeploymentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DeploymentListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DeploymentListResultIterator) Response() DeploymentListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DeploymentListResultIterator) Value() DeploymentExtended { - if !iter.page.NotDone() { - return DeploymentExtended{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DeploymentListResultIterator type. -func NewDeploymentListResultIterator(page DeploymentListResultPage) DeploymentListResultIterator { - return DeploymentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DeploymentListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DeploymentListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// deploymentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DeploymentListResult) deploymentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dlr.NextLink))) -} - -// DeploymentListResultPage contains a page of DeploymentExtended values. -type DeploymentListResultPage struct { - fn func(context.Context, DeploymentListResult) (DeploymentListResult, error) - dlr DeploymentListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DeploymentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dlr) - if err != nil { - return err - } - page.dlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DeploymentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DeploymentListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DeploymentListResultPage) Response() DeploymentListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DeploymentListResultPage) Values() []DeploymentExtended { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DeploymentListResultPage type. -func NewDeploymentListResultPage(cur DeploymentListResult, getNextPage func(context.Context, DeploymentListResult) (DeploymentListResult, error)) DeploymentListResultPage { - return DeploymentListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DeploymentOperation deployment operation information. -type DeploymentOperation struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Full deployment operation ID. - ID *string `json:"id,omitempty"` - // OperationID - READ-ONLY; Deployment operation ID. - OperationID *string `json:"operationId,omitempty"` - // Properties - Deployment properties. - Properties *DeploymentOperationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentOperation. -func (do DeploymentOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if do.Properties != nil { - objectMap["properties"] = do.Properties - } - return json.Marshal(objectMap) -} - -// DeploymentOperationProperties deployment operation properties. -type DeploymentOperationProperties struct { - // ProvisioningState - READ-ONLY; The state of the provisioning. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Timestamp - READ-ONLY; The date and time of the operation. - Timestamp *date.Time `json:"timestamp,omitempty"` - // ServiceRequestID - READ-ONLY; Deployment operation service request id. - ServiceRequestID *string `json:"serviceRequestId,omitempty"` - // StatusCode - READ-ONLY; Operation status code. - StatusCode *string `json:"statusCode,omitempty"` - // StatusMessage - READ-ONLY; Operation status message. - StatusMessage interface{} `json:"statusMessage,omitempty"` - // TargetResource - READ-ONLY; The target resource. - TargetResource *TargetResource `json:"targetResource,omitempty"` - // Request - READ-ONLY; The HTTP request message. - Request *HTTPMessage `json:"request,omitempty"` - // Response - READ-ONLY; The HTTP response message. - Response *HTTPMessage `json:"response,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentOperationProperties. -func (dop DeploymentOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DeploymentOperationsListResult list of deployment operations. -type DeploymentOperationsListResult struct { - autorest.Response `json:"-"` - // Value - An array of deployment operations. - Value *[]DeploymentOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentOperationsListResult. -func (dolr DeploymentOperationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dolr.Value != nil { - objectMap["value"] = dolr.Value - } - return json.Marshal(objectMap) -} - -// DeploymentOperationsListResultIterator provides access to a complete listing of DeploymentOperation -// values. -type DeploymentOperationsListResultIterator struct { - i int - page DeploymentOperationsListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DeploymentOperationsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DeploymentOperationsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DeploymentOperationsListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DeploymentOperationsListResultIterator) Response() DeploymentOperationsListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DeploymentOperationsListResultIterator) Value() DeploymentOperation { - if !iter.page.NotDone() { - return DeploymentOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DeploymentOperationsListResultIterator type. -func NewDeploymentOperationsListResultIterator(page DeploymentOperationsListResultPage) DeploymentOperationsListResultIterator { - return DeploymentOperationsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dolr DeploymentOperationsListResult) IsEmpty() bool { - return dolr.Value == nil || len(*dolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dolr DeploymentOperationsListResult) hasNextLink() bool { - return dolr.NextLink != nil && len(*dolr.NextLink) != 0 -} - -// deploymentOperationsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dolr DeploymentOperationsListResult) deploymentOperationsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dolr.NextLink))) -} - -// DeploymentOperationsListResultPage contains a page of DeploymentOperation values. -type DeploymentOperationsListResultPage struct { - fn func(context.Context, DeploymentOperationsListResult) (DeploymentOperationsListResult, error) - dolr DeploymentOperationsListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DeploymentOperationsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentOperationsListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dolr) - if err != nil { - return err - } - page.dolr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DeploymentOperationsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DeploymentOperationsListResultPage) NotDone() bool { - return !page.dolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DeploymentOperationsListResultPage) Response() DeploymentOperationsListResult { - return page.dolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DeploymentOperationsListResultPage) Values() []DeploymentOperation { - if page.dolr.IsEmpty() { - return nil - } - return *page.dolr.Value -} - -// Creates a new instance of the DeploymentOperationsListResultPage type. -func NewDeploymentOperationsListResultPage(cur DeploymentOperationsListResult, getNextPage func(context.Context, DeploymentOperationsListResult) (DeploymentOperationsListResult, error)) DeploymentOperationsListResultPage { - return DeploymentOperationsListResultPage{ - fn: getNextPage, - dolr: cur, - } -} - -// DeploymentProperties deployment properties. -type DeploymentProperties struct { - // Template - 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"` - // TemplateLink - The URI of the template. Use either the templateLink property or the template property, but not both. - TemplateLink *TemplateLink `json:"templateLink,omitempty"` - // Parameters - 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"` - // ParametersLink - 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"` - // Mode - 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. Possible values include: 'Incremental', 'Complete' - Mode DeploymentMode `json:"mode,omitempty"` - // DebugSetting - The debug setting of the deployment. - DebugSetting *DebugSetting `json:"debugSetting,omitempty"` - // OnErrorDeployment - The deployment on error behavior. - OnErrorDeployment *OnErrorDeployment `json:"onErrorDeployment,omitempty"` -} - -// DeploymentPropertiesExtended deployment properties with additional details. -type DeploymentPropertiesExtended struct { - // ProvisioningState - READ-ONLY; The state of the provisioning. - ProvisioningState *string `json:"provisioningState,omitempty"` - // CorrelationID - READ-ONLY; The correlation ID of the deployment. - CorrelationID *string `json:"correlationId,omitempty"` - // Timestamp - READ-ONLY; The timestamp of the template deployment. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Outputs - Key/value pairs that represent deployment output. - Outputs interface{} `json:"outputs,omitempty"` - // Providers - The list of resource providers needed for the deployment. - Providers *[]Provider `json:"providers,omitempty"` - // Dependencies - The list of deployment dependencies. - Dependencies *[]Dependency `json:"dependencies,omitempty"` - // Template - The template content. Use only one of Template or TemplateLink. - Template interface{} `json:"template,omitempty"` - // TemplateLink - The URI referencing the template. Use only one of Template or TemplateLink. - TemplateLink *TemplateLink `json:"templateLink,omitempty"` - // Parameters - Deployment parameters. Use only one of Parameters or ParametersLink. - Parameters interface{} `json:"parameters,omitempty"` - // ParametersLink - The URI referencing the parameters. Use only one of Parameters or ParametersLink. - ParametersLink *ParametersLink `json:"parametersLink,omitempty"` - // Mode - The deployment mode. Possible values are Incremental and Complete. Possible values include: 'Incremental', 'Complete' - Mode DeploymentMode `json:"mode,omitempty"` - // DebugSetting - The debug setting of the deployment. - DebugSetting *DebugSetting `json:"debugSetting,omitempty"` - // OnErrorDeployment - The deployment on error behavior. - OnErrorDeployment *OnErrorDeploymentExtended `json:"onErrorDeployment,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentPropertiesExtended. -func (dpe DeploymentPropertiesExtended) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dpe.Outputs != nil { - objectMap["outputs"] = dpe.Outputs - } - if dpe.Providers != nil { - objectMap["providers"] = dpe.Providers - } - if dpe.Dependencies != nil { - objectMap["dependencies"] = dpe.Dependencies - } - if dpe.Template != nil { - objectMap["template"] = dpe.Template - } - if dpe.TemplateLink != nil { - objectMap["templateLink"] = dpe.TemplateLink - } - if dpe.Parameters != nil { - objectMap["parameters"] = dpe.Parameters - } - if dpe.ParametersLink != nil { - objectMap["parametersLink"] = dpe.ParametersLink - } - if dpe.Mode != "" { - objectMap["mode"] = dpe.Mode - } - if dpe.DebugSetting != nil { - objectMap["debugSetting"] = dpe.DebugSetting - } - if dpe.OnErrorDeployment != nil { - objectMap["onErrorDeployment"] = dpe.OnErrorDeployment - } - return json.Marshal(objectMap) -} - -// DeploymentsCreateOrUpdateAtSubscriptionScopeFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type DeploymentsCreateOrUpdateAtSubscriptionScopeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (DeploymentExtended, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsCreateOrUpdateAtSubscriptionScopeFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsCreateOrUpdateAtSubscriptionScopeFuture.Result. -func (future *DeploymentsCreateOrUpdateAtSubscriptionScopeFuture) result(client DeploymentsClient) (de DeploymentExtended, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - de.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { - de, err = client.CreateOrUpdateAtSubscriptionScopeResponder(de.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateAtSubscriptionScopeFuture", "Result", de.Response.Response, "Failure responding to request") - } - } - return -} - -// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DeploymentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (DeploymentExtended, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsCreateOrUpdateFuture.Result. -func (future *DeploymentsCreateOrUpdateFuture) result(client DeploymentsClient) (de DeploymentExtended, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - de.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { - de, err = client.CreateOrUpdateResponder(de.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", de.Response.Response, "Failure responding to request") - } - } - return -} - -// DeploymentsDeleteAtSubscriptionScopeFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DeploymentsDeleteAtSubscriptionScopeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsDeleteAtSubscriptionScopeFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsDeleteAtSubscriptionScopeFuture.Result. -func (future *DeploymentsDeleteAtSubscriptionScopeFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteAtSubscriptionScopeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteAtSubscriptionScopeFuture") - return - } - ar.Response = future.Response() - return -} - -// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DeploymentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsDeleteFuture.Result. -func (future *DeploymentsDeleteFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DeploymentValidateResult information from validate template deployment response. -type DeploymentValidateResult struct { - autorest.Response `json:"-"` - // Error - Validation error. - Error *ManagementErrorWithDetails `json:"error,omitempty"` - // Properties - The template deployment properties. - Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.) -type ErrorResponse struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorResponse `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExportTemplateRequest export resource group template request parameters. -type ExportTemplateRequest struct { - // ResourcesProperty - The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. - ResourcesProperty *[]string `json:"resources,omitempty"` - // Options - The export template options. A CSV-formatted list containing zero or more of the following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', 'SkipAllParameterization' - Options *string `json:"options,omitempty"` -} - -// GenericResource resource information. -type GenericResource struct { - autorest.Response `json:"-"` - // Plan - The plan of the resource. - Plan *Plan `json:"plan,omitempty"` - // Properties - The resource properties. - Properties interface{} `json:"properties,omitempty"` - // Kind - The kind of the resource. - Kind *string `json:"kind,omitempty"` - // ManagedBy - ID of the resource that manages this resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Sku - The SKU of the resource. - Sku *Sku `json:"sku,omitempty"` - // Identity - The identity of the resource. - Identity *Identity `json:"identity,omitempty"` - // ID - READ-ONLY; Resource ID - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GenericResource. -func (gr GenericResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gr.Plan != nil { - objectMap["plan"] = gr.Plan - } - if gr.Properties != nil { - objectMap["properties"] = gr.Properties - } - if gr.Kind != nil { - objectMap["kind"] = gr.Kind - } - if gr.ManagedBy != nil { - objectMap["managedBy"] = gr.ManagedBy - } - if gr.Sku != nil { - objectMap["sku"] = gr.Sku - } - if gr.Identity != nil { - objectMap["identity"] = gr.Identity - } - if gr.Location != nil { - objectMap["location"] = gr.Location - } - if gr.Tags != nil { - objectMap["tags"] = gr.Tags - } - return json.Marshal(objectMap) -} - -// GenericResourceExpanded resource information. -type GenericResourceExpanded struct { - // CreatedTime - READ-ONLY; The created time of the resource. This is only present if requested via the $expand query parameter. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; The changed time of the resource. This is only present if requested via the $expand query parameter. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. This is only present if requested via the $expand query parameter. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Plan - The plan of the resource. - Plan *Plan `json:"plan,omitempty"` - // Properties - The resource properties. - Properties interface{} `json:"properties,omitempty"` - // Kind - The kind of the resource. - Kind *string `json:"kind,omitempty"` - // ManagedBy - ID of the resource that manages this resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Sku - The SKU of the resource. - Sku *Sku `json:"sku,omitempty"` - // Identity - The identity of the resource. - Identity *Identity `json:"identity,omitempty"` - // ID - READ-ONLY; Resource ID - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GenericResourceExpanded. -func (gre GenericResourceExpanded) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gre.Plan != nil { - objectMap["plan"] = gre.Plan - } - if gre.Properties != nil { - objectMap["properties"] = gre.Properties - } - if gre.Kind != nil { - objectMap["kind"] = gre.Kind - } - if gre.ManagedBy != nil { - objectMap["managedBy"] = gre.ManagedBy - } - if gre.Sku != nil { - objectMap["sku"] = gre.Sku - } - if gre.Identity != nil { - objectMap["identity"] = gre.Identity - } - if gre.Location != nil { - objectMap["location"] = gre.Location - } - if gre.Tags != nil { - objectMap["tags"] = gre.Tags - } - return json.Marshal(objectMap) -} - -// GenericResourceFilter resource filter. -type GenericResourceFilter struct { - // ResourceType - The resource type. - ResourceType *string `json:"resourceType,omitempty"` - // Tagname - The tag name. - Tagname *string `json:"tagname,omitempty"` - // Tagvalue - The tag value. - Tagvalue *string `json:"tagvalue,omitempty"` -} - -// Group resource group information. -type Group struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The ID of the resource group. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource group. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource group. - Type *string `json:"type,omitempty"` - Properties *GroupProperties `json:"properties,omitempty"` - // Location - 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"` - // ManagedBy - The ID of the resource that manages this resource group. - ManagedBy *string `json:"managedBy,omitempty"` - // Tags - The tags attached to the resource group. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Group. -func (g Group) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if g.Properties != nil { - objectMap["properties"] = g.Properties - } - if g.Location != nil { - objectMap["location"] = g.Location - } - if g.ManagedBy != nil { - objectMap["managedBy"] = g.ManagedBy - } - if g.Tags != nil { - objectMap["tags"] = g.Tags - } - return json.Marshal(objectMap) -} - -// GroupExportResult resource group export result. -type GroupExportResult struct { - autorest.Response `json:"-"` - // Template - The template content. - Template interface{} `json:"template,omitempty"` - // Error - The error. - Error *ManagementErrorWithDetails `json:"error,omitempty"` -} - -// GroupFilter resource group filter. -type GroupFilter struct { - // TagName - The tag name. - TagName *string `json:"tagName,omitempty"` - // TagValue - The tag value. - TagValue *string `json:"tagValue,omitempty"` -} - -// GroupListResult list of resource groups. -type GroupListResult struct { - autorest.Response `json:"-"` - // Value - An array of resource groups. - Value *[]Group `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupListResult. -func (glr GroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if glr.Value != nil { - objectMap["value"] = glr.Value - } - return json.Marshal(objectMap) -} - -// GroupListResultIterator provides access to a complete listing of Group values. -type GroupListResultIterator struct { - i int - page GroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GroupListResultIterator) Response() GroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GroupListResultIterator) Value() Group { - if !iter.page.NotDone() { - return Group{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GroupListResultIterator type. -func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator { - return GroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (glr GroupListResult) IsEmpty() bool { - return glr.Value == nil || len(*glr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (glr GroupListResult) hasNextLink() bool { - return glr.NextLink != nil && len(*glr.NextLink) != 0 -} - -// groupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !glr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(glr.NextLink))) -} - -// GroupListResultPage contains a page of Group values. -type GroupListResultPage struct { - fn func(context.Context, GroupListResult) (GroupListResult, error) - glr GroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.glr) - if err != nil { - return err - } - page.glr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GroupListResultPage) NotDone() bool { - return !page.glr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GroupListResultPage) Response() GroupListResult { - return page.glr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GroupListResultPage) Values() []Group { - if page.glr.IsEmpty() { - return nil - } - return *page.glr.Value -} - -// Creates a new instance of the GroupListResultPage type. -func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { - return GroupListResultPage{ - fn: getNextPage, - glr: cur, - } -} - -// GroupPatchable resource group information. -type GroupPatchable struct { - // Name - The name of the resource group. - Name *string `json:"name,omitempty"` - Properties *GroupProperties `json:"properties,omitempty"` - // ManagedBy - The ID of the resource that manages this resource group. - ManagedBy *string `json:"managedBy,omitempty"` - // Tags - The tags attached to the resource group. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GroupPatchable. -func (gp GroupPatchable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gp.Name != nil { - objectMap["name"] = gp.Name - } - if gp.Properties != nil { - objectMap["properties"] = gp.Properties - } - if gp.ManagedBy != nil { - objectMap["managedBy"] = gp.ManagedBy - } - if gp.Tags != nil { - objectMap["tags"] = gp.Tags - } - return json.Marshal(objectMap) -} - -// GroupProperties the resource group properties. -type GroupProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupProperties. -func (gp GroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type GroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GroupsDeleteFuture.Result. -func (future *GroupsDeleteFuture) result(client GroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.GroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// HTTPMessage HTTP message. -type HTTPMessage struct { - // Content - HTTP message content. - Content interface{} `json:"content,omitempty"` -} - -// Identity identity for the resource. -type Identity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned', 'None' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - 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"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - if i.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = i.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// IdentityUserAssignedIdentitiesValue ... -type IdentityUserAssignedIdentitiesValue struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityUserAssignedIdentitiesValue. -func (iAiv IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListResult list of resource groups. -type ListResult struct { - autorest.Response `json:"-"` - // Value - An array of resources. - Value *[]GenericResourceExpanded `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListResult. -func (lr ListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lr.Value != nil { - objectMap["value"] = lr.Value - } - return json.Marshal(objectMap) -} - -// ListResultIterator provides access to a complete listing of GenericResourceExpanded values. -type ListResultIterator struct { - i int - page ListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListResultIterator) Response() ListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListResultIterator) Value() GenericResourceExpanded { - if !iter.page.NotDone() { - return GenericResourceExpanded{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListResultIterator type. -func NewListResultIterator(page ListResultPage) ListResultIterator { - return ListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lr ListResult) IsEmpty() bool { - return lr.Value == nil || len(*lr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lr ListResult) hasNextLink() bool { - return lr.NextLink != nil && len(*lr.NextLink) != 0 -} - -// listResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { - if !lr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lr.NextLink))) -} - -// ListResultPage contains a page of GenericResourceExpanded values. -type ListResultPage struct { - fn func(context.Context, ListResult) (ListResult, error) - lr ListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lr) - if err != nil { - return err - } - page.lr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListResultPage) NotDone() bool { - return !page.lr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListResultPage) Response() ListResult { - return page.lr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListResultPage) Values() []GenericResourceExpanded { - if page.lr.IsEmpty() { - return nil - } - return *page.lr.Value -} - -// Creates a new instance of the ListResultPage type. -func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { - return ListResultPage{ - fn: getNextPage, - lr: cur, - } -} - -// ManagementErrorWithDetails the detailed error message of resource management. -type ManagementErrorWithDetails struct { - // Code - READ-ONLY; The error code returned when exporting the template. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message describing the export error. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The target of the error. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; Validation error. - Details *[]ManagementErrorWithDetails `json:"details,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementErrorWithDetails. -func (mewd ManagementErrorWithDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MoveInfo parameters of move resources. -type MoveInfo struct { - // ResourcesProperty - The IDs of the resources. - ResourcesProperty *[]string `json:"resources,omitempty"` - // TargetResourceGroup - The target resource group. - TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` -} - -// MoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type MoveResourcesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MoveResourcesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for MoveResourcesFuture.Result. -func (future *MoveResourcesFuture) result(client Client) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.MoveResourcesFuture") - return - } - ar.Response = future.Response() - return -} - -// OnErrorDeployment deployment on error behavior. -type OnErrorDeployment struct { - // Type - The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment' - Type OnErrorDeploymentType `json:"type,omitempty"` - // DeploymentName - The deployment to be used on error case. - DeploymentName *string `json:"deploymentName,omitempty"` -} - -// OnErrorDeploymentExtended deployment on error behavior with additional details. -type OnErrorDeploymentExtended struct { - // ProvisioningState - READ-ONLY; The state of the provisioning for the on error deployment. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Type - The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment' - Type OnErrorDeploymentType `json:"type,omitempty"` - // DeploymentName - The deployment to be used on error case. - DeploymentName *string `json:"deploymentName,omitempty"` -} - -// MarshalJSON is the custom marshaler for OnErrorDeploymentExtended. -func (oede OnErrorDeploymentExtended) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oede.Type != "" { - objectMap["type"] = oede.Type - } - if oede.DeploymentName != nil { - objectMap["deploymentName"] = oede.DeploymentName - } - return json.Marshal(objectMap) -} - -// Operation microsoft.Resources operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Resources - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Profile, endpoint, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of the operation. - Description *string `json:"description,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 { - autorest.Response `json:"-"` - // Value - List of Microsoft.Resources operations. - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// ParametersLink entity representing the reference to the deployment parameters. -type ParametersLink struct { - // URI - The URI of the parameters file. - URI *string `json:"uri,omitempty"` - // ContentVersion - If included, must match the ContentVersion in the template. - ContentVersion *string `json:"contentVersion,omitempty"` -} - -// Plan plan for the resource. -type Plan struct { - // Name - The plan ID. - Name *string `json:"name,omitempty"` - // Publisher - The publisher ID. - Publisher *string `json:"publisher,omitempty"` - // Product - The offer ID. - Product *string `json:"product,omitempty"` - // PromotionCode - The promotion code. - PromotionCode *string `json:"promotionCode,omitempty"` - // Version - The plan's version. - Version *string `json:"version,omitempty"` -} - -// Provider resource provider information. -type Provider struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The provider ID. - ID *string `json:"id,omitempty"` - // Namespace - The namespace of the resource provider. - Namespace *string `json:"namespace,omitempty"` - // RegistrationState - READ-ONLY; The registration state of the provider. - RegistrationState *string `json:"registrationState,omitempty"` - // ResourceTypes - READ-ONLY; The collection of provider resource types. - ResourceTypes *[]ProviderResourceType `json:"resourceTypes,omitempty"` -} - -// MarshalJSON is the custom marshaler for Provider. -func (p Provider) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.Namespace != nil { - objectMap["namespace"] = p.Namespace - } - return json.Marshal(objectMap) -} - -// ProviderListResult list of resource providers. -type ProviderListResult struct { - autorest.Response `json:"-"` - // Value - An array of resource providers. - Value *[]Provider `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProviderListResult. -func (plr ProviderListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.Value != nil { - objectMap["value"] = plr.Value - } - return json.Marshal(objectMap) -} - -// ProviderListResultIterator provides access to a complete listing of Provider values. -type ProviderListResultIterator struct { - i int - page ProviderListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ProviderListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProviderListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ProviderListResultIterator) Response() ProviderListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ProviderListResultIterator) Value() Provider { - if !iter.page.NotDone() { - return Provider{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProviderListResultIterator type. -func NewProviderListResultIterator(page ProviderListResultPage) ProviderListResultIterator { - return ProviderListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plr ProviderListResult) IsEmpty() bool { - return plr.Value == nil || len(*plr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plr ProviderListResult) hasNextLink() bool { - return plr.NextLink != nil && len(*plr.NextLink) != 0 -} - -// providerListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plr ProviderListResult) providerListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plr.NextLink))) -} - -// ProviderListResultPage contains a page of Provider values. -type ProviderListResultPage struct { - fn func(context.Context, ProviderListResult) (ProviderListResult, error) - plr ProviderListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ProviderListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plr) - if err != nil { - return err - } - page.plr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ProviderListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProviderListResultPage) NotDone() bool { - return !page.plr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProviderListResultPage) Response() ProviderListResult { - return page.plr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProviderListResultPage) Values() []Provider { - if page.plr.IsEmpty() { - return nil - } - return *page.plr.Value -} - -// Creates a new instance of the ProviderListResultPage type. -func NewProviderListResultPage(cur ProviderListResult, getNextPage func(context.Context, ProviderListResult) (ProviderListResult, error)) ProviderListResultPage { - return ProviderListResultPage{ - fn: getNextPage, - plr: cur, - } -} - -// ProviderOperationDisplayProperties resource provider operation's display properties. -type ProviderOperationDisplayProperties struct { - // Publisher - Operation description. - Publisher *string `json:"publisher,omitempty"` - // Provider - Operation provider. - Provider *string `json:"provider,omitempty"` - // Resource - Operation resource. - Resource *string `json:"resource,omitempty"` - // Operation - Resource provider operation. - Operation *string `json:"operation,omitempty"` - // Description - Operation description. - Description *string `json:"description,omitempty"` -} - -// ProviderResourceType resource type managed by the resource provider. -type ProviderResourceType struct { - // ResourceType - The resource type. - ResourceType *string `json:"resourceType,omitempty"` - // Locations - The collection of locations where this resource type can be created. - Locations *[]string `json:"locations,omitempty"` - // Aliases - The aliases that are supported by this resource type. - Aliases *[]AliasType `json:"aliases,omitempty"` - // APIVersions - The API version. - APIVersions *[]string `json:"apiVersions,omitempty"` - // Properties - The properties. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for ProviderResourceType. -func (prt ProviderResourceType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prt.ResourceType != nil { - objectMap["resourceType"] = prt.ResourceType - } - if prt.Locations != nil { - objectMap["locations"] = prt.Locations - } - if prt.Aliases != nil { - objectMap["aliases"] = prt.Aliases - } - if prt.APIVersions != nil { - objectMap["apiVersions"] = prt.APIVersions - } - if prt.Properties != nil { - objectMap["properties"] = prt.Properties - } - return json.Marshal(objectMap) -} - -// Resource specified resource. -type Resource struct { - // ID - READ-ONLY; Resource ID - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Sku SKU for the resource. -type Sku struct { - // Name - The SKU name. - Name *string `json:"name,omitempty"` - // Tier - The SKU tier. - Tier *string `json:"tier,omitempty"` - // Size - The SKU size. - Size *string `json:"size,omitempty"` - // Family - The SKU family. - Family *string `json:"family,omitempty"` - // Model - The SKU model. - Model *string `json:"model,omitempty"` - // Capacity - The SKU capacity. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SubResource sub-resource. -type SubResource struct { - // ID - Resource ID - ID *string `json:"id,omitempty"` -} - -// TagCount tag count. -type TagCount struct { - // Type - Type of count. - Type *string `json:"type,omitempty"` - // Value - Value of count. - Value *int32 `json:"value,omitempty"` -} - -// TagDetails tag details. -type TagDetails struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The tag ID. - ID *string `json:"id,omitempty"` - // TagName - The tag name. - TagName *string `json:"tagName,omitempty"` - // Count - 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"` - // Values - The list of tag values. - Values *[]TagValue `json:"values,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagDetails. -func (td TagDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if td.TagName != nil { - objectMap["tagName"] = td.TagName - } - if td.Count != nil { - objectMap["count"] = td.Count - } - if td.Values != nil { - objectMap["values"] = td.Values - } - return json.Marshal(objectMap) -} - -// TagsListResult list of subscription tags. -type TagsListResult struct { - autorest.Response `json:"-"` - // Value - An array of tags. - Value *[]TagDetails `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagsListResult. -func (tlr TagsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tlr.Value != nil { - objectMap["value"] = tlr.Value - } - return json.Marshal(objectMap) -} - -// TagsListResultIterator provides access to a complete listing of TagDetails values. -type TagsListResultIterator struct { - i int - page TagsListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *TagsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *TagsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagsListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter TagsListResultIterator) Response() TagsListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter TagsListResultIterator) Value() TagDetails { - if !iter.page.NotDone() { - return TagDetails{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagsListResultIterator type. -func NewTagsListResultIterator(page TagsListResultPage) TagsListResultIterator { - return TagsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TagsListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TagsListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// tagsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TagsListResult) tagsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TagsListResultPage contains a page of TagDetails values. -type TagsListResultPage struct { - fn func(context.Context, TagsListResult) (TagsListResult, error) - tlr TagsListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *TagsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagsListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.tlr) - if err != nil { - return err - } - page.tlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *TagsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagsListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagsListResultPage) Response() TagsListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagsListResultPage) Values() []TagDetails { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TagsListResultPage type. -func NewTagsListResultPage(cur TagsListResult, getNextPage func(context.Context, TagsListResult) (TagsListResult, error)) TagsListResultPage { - return TagsListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TagValue tag information. -type TagValue struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The tag ID. - ID *string `json:"id,omitempty"` - // TagValue - The tag value. - TagValue *string `json:"tagValue,omitempty"` - // Count - The tag value count. - Count *TagCount `json:"count,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagValue. -func (tv TagValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tv.TagValue != nil { - objectMap["tagValue"] = tv.TagValue - } - if tv.Count != nil { - objectMap["count"] = tv.Count - } - return json.Marshal(objectMap) -} - -// TargetResource target resource. -type TargetResource struct { - // ID - The ID of the resource. - ID *string `json:"id,omitempty"` - // ResourceName - The name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // ResourceType - 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 { - autorest.Response `json:"-"` - // MinifiedTemplate - The minified template string. - MinifiedTemplate *string `json:"minifiedTemplate,omitempty"` - // TemplateHash - The template hash. - TemplateHash *string `json:"templateHash,omitempty"` -} - -// TemplateLink entity representing the reference to the template. -type TemplateLink struct { - // URI - The URI of the template to deploy. - URI *string `json:"uri,omitempty"` - // ContentVersion - If included, must match the ContentVersion in the template. - ContentVersion *string `json:"contentVersion,omitempty"` -} - -// UpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type UpdateByIDFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (GenericResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *UpdateByIDFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for UpdateByIDFuture.Result. -func (future *UpdateByIDFuture) result(client Client) (gr GenericResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.UpdateByIDFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { - gr, err = client.UpdateByIDResponder(gr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") - } - } - return -} - -// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type UpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (GenericResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *UpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for UpdateFuture.Result. -func (future *UpdateFuture) result(client Client) (gr GenericResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.UpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { - gr, err = client.UpdateResponder(gr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", gr.Response.Response, "Failure responding to request") - } - } - return -} - -// ValidateMoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ValidateMoveResourcesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ValidateMoveResourcesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ValidateMoveResourcesFuture.Result. -func (future *ValidateMoveResourcesFuture) result(client Client) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("resources.ValidateMoveResourcesFuture") - return - } - ar.Response = future.Response() - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/operations.go deleted file mode 100644 index a537283e5..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the provides operations for working with resources and resource groups. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Microsoft.Resources REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Resources/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/providers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/providers.go deleted file mode 100644 index 409c4917a..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/providers.go +++ /dev/null @@ -1,382 +0,0 @@ -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProvidersClient is the provides operations for working with resources and resource groups. -type ProvidersClient struct { - BaseClient -} - -// NewProvidersClient creates an instance of the ProvidersClient client. -func NewProvidersClient(subscriptionID string) ProvidersClient { - return NewProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProvidersClientWithBaseURI creates an instance of the ProvidersClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewProvidersClientWithBaseURI(baseURI string, subscriptionID string) ProvidersClient { - return ProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the specified resource provider. -// Parameters: -// resourceProviderNamespace - the namespace of the resource provider. -// expand - the $expand query parameter. For example, to include property aliases in response, use -// $expand=resourceTypes/aliases. -func (client ProvidersClient) Get(ctx context.Context, resourceProviderNamespace string, expand string) (result Provider, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceProviderNamespace, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProvidersClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProvidersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProvidersClient) GetResponder(resp *http.Response) (result Provider, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all resource providers for a subscription. -// Parameters: -// top - the number of results to return. If null is passed returns all deployments. -// expand - 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. -func (client ProvidersClient) List(ctx context.Context, top *int32, expand string) (result ProviderListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.List") - defer func() { - sc := -1 - if result.plr.Response.Response != nil { - sc = result.plr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, top, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.plr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure sending request") - return - } - - result.plr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure responding to request") - return - } - if result.plr.hasNextLink() && result.plr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ProvidersClient) ListPreparer(ctx context.Context, top *int32, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ProvidersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ProvidersClient) ListResponder(resp *http.Response) (result ProviderListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ProvidersClient) listNextResults(ctx context.Context, lastResults ProviderListResult) (result ProviderListResult, err error) { - req, err := lastResults.providerListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProvidersClient) ListComplete(ctx context.Context, top *int32, expand string) (result ProviderListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, top, expand) - return -} - -// Register registers a subscription with a resource provider. -// Parameters: -// resourceProviderNamespace - the namespace of the resource provider to register. -func (client ProvidersClient) Register(ctx context.Context, resourceProviderNamespace string) (result Provider, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.Register") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RegisterPreparer(ctx, resourceProviderNamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", nil, "Failure preparing request") - return - } - - resp, err := client.RegisterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure sending request") - return - } - - result, err = client.RegisterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure responding to request") - return - } - - return -} - -// RegisterPreparer prepares the Register request. -func (client ProvidersClient) RegisterPreparer(ctx context.Context, resourceProviderNamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegisterSender sends the Register request. The method will close the -// http.Response Body if it receives an error. -func (client ProvidersClient) RegisterSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegisterResponder handles the response to the Register request. The method always -// closes the http.Response Body. -func (client ProvidersClient) RegisterResponder(resp *http.Response) (result Provider, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Unregister unregisters a subscription from a resource provider. -// Parameters: -// resourceProviderNamespace - the namespace of the resource provider to unregister. -func (client ProvidersClient) Unregister(ctx context.Context, resourceProviderNamespace string) (result Provider, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProvidersClient.Unregister") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UnregisterPreparer(ctx, resourceProviderNamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", nil, "Failure preparing request") - return - } - - resp, err := client.UnregisterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure sending request") - return - } - - result, err = client.UnregisterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure responding to request") - return - } - - return -} - -// UnregisterPreparer prepares the Unregister request. -func (client ProvidersClient) UnregisterPreparer(ctx context.Context, resourceProviderNamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UnregisterSender sends the Unregister request. The method will close the -// http.Response Body if it receives an error. -func (client ProvidersClient) UnregisterSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UnregisterResponder handles the response to the Unregister request. The method always -// closes the http.Response Body. -func (client ProvidersClient) UnregisterResponder(resp *http.Response) (result Provider, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/resources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/resources.go deleted file mode 100644 index 0edce8e64..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/resources.go +++ /dev/null @@ -1,1360 +0,0 @@ -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// Client is the provides operations for working with resources and resource groups. -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckExistence checks whether a resource exists. -// Parameters: -// 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. -func (client Client) CheckExistence(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckExistence") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.Client", "CheckExistence", err.Error()) - } - - req, err := client.CheckExistencePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", nil, "Failure preparing request") - return - } - - resp, err := client.CheckExistenceSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", resp, "Failure sending request") - return - } - - result, err = client.CheckExistenceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", resp, "Failure responding to request") - return - } - - return -} - -// CheckExistencePreparer prepares the CheckExistence request. -func (client Client) CheckExistencePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckExistenceSender sends the CheckExistence request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CheckExistenceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckExistenceResponder handles the response to the CheckExistence request. The method always -// closes the http.Response Body. -func (client Client) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckExistenceByID checks by ID whether a resource exists. -// Parameters: -// 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. -func (client Client) CheckExistenceByID(ctx context.Context, resourceID string, APIVersion string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckExistenceByID") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckExistenceByIDPreparer(ctx, resourceID, APIVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistenceByID", nil, "Failure preparing request") - return - } - - resp, err := client.CheckExistenceByIDSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistenceByID", resp, "Failure sending request") - return - } - - result, err = client.CheckExistenceByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistenceByID", resp, "Failure responding to request") - return - } - - return -} - -// CheckExistenceByIDPreparer prepares the CheckExistenceByID request. -func (client Client) CheckExistenceByIDPreparer(ctx context.Context, resourceID string, APIVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckExistenceByIDSender sends the CheckExistenceByID request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CheckExistenceByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CheckExistenceByIDResponder handles the response to the CheckExistenceByID request. The method always -// closes the http.Response Body. -func (client Client) CheckExistenceByIDResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates a resource. -// Parameters: -// 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. -func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters GenericResource) (result CreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("resources.Client", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters GenericResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CreateOrUpdateSender(req *http.Request) (future CreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client Client) CreateOrUpdateResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateByID create a resource by ID. -// Parameters: -// 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. -func (client Client) CreateOrUpdateByID(ctx context.Context, resourceID string, APIVersion string, parameters GenericResource) (result CreateOrUpdateByIDFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdateByID") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("resources.Client", "CreateOrUpdateByID", err.Error()) - } - - req, err := client.CreateOrUpdateByIDPreparer(ctx, resourceID, APIVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdateByID", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateByIDSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdateByID", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. -func (client Client) CreateOrUpdateByIDPreparer(ctx context.Context, resourceID string, APIVersion string, parameters GenericResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CreateOrUpdateByIDSender(req *http.Request) (future CreateOrUpdateByIDFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always -// closes the http.Response Body. -func (client Client) CreateOrUpdateByIDResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a resource. -// Parameters: -// 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. -func (client Client) Delete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (result DeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.Client", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByID deletes a resource by ID. -// Parameters: -// 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. -func (client Client) DeleteByID(ctx context.Context, resourceID string, APIVersion string) (result DeleteByIDFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.DeleteByID") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteByIDPreparer(ctx, resourceID, APIVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "DeleteByID", nil, "Failure preparing request") - return - } - - result, err = client.DeleteByIDSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "DeleteByID", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteByIDPreparer prepares the DeleteByID request. -func (client Client) DeleteByIDPreparer(ctx context.Context, resourceID string, APIVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByIDSender sends the DeleteByID request. The method will close the -// http.Response Body if it receives an error. -func (client Client) DeleteByIDSender(req *http.Request) (future DeleteByIDFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteByIDResponder handles the response to the DeleteByID request. The method always -// closes the http.Response Body. -func (client Client) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a resource. -// Parameters: -// 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. -func (client Client) Get(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (result GenericResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.Client", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.Client", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client Client) GetResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID gets a resource by ID. -// Parameters: -// 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. -func (client Client) GetByID(ctx context.Context, resourceID string, APIVersion string) (result GenericResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetByID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByIDPreparer(ctx, resourceID, APIVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.Client", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client Client) GetByIDPreparer(ctx context.Context, resourceID string, APIVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client Client) GetByIDResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all the resources in a subscription. -// Parameters: -// filter - 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'

    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. -// expand - comma-separated list of additional properties to be included in the response. Valid values include -// `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resource groups. -func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, expand, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure sending request") - return - } - - result.lr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client Client) ListPreparer(ctx context.Context, filter string, expand string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client Client) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client Client) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.Client", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.Client", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListComplete(ctx context.Context, filter string, expand string, top *int32) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter, expand, top) - return -} - -// ListByResourceGroup get all the resources for a resource group. -// Parameters: -// resourceGroupName - the resource group with the resources to get. -// filter - 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'

    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. -// expand - comma-separated list of additional properties to be included in the response. Valid values include -// `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. -// top - the number of results to return. If null is passed, returns all resources. -func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, expand string, top *int32) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.Client", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, expand, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.Client", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.lr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, expand string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client Client) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, expand string, top *int32) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, expand, top) - return -} - -// MoveResources the resources to move must be in the same source resource group. 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. -// Parameters: -// sourceResourceGroupName - the name of the resource group containing the resources to move. -// parameters - parameters for moving resources. -func (client Client) MoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (result MoveResourcesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.MoveResources") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: sourceResourceGroupName, - Constraints: []validation.Constraint{{Target: "sourceResourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "sourceResourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "sourceResourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.Client", "MoveResources", err.Error()) - } - - req, err := client.MoveResourcesPreparer(ctx, sourceResourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "MoveResources", nil, "Failure preparing request") - return - } - - result, err = client.MoveResourcesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "MoveResources", result.Response(), "Failure sending request") - return - } - - return -} - -// MoveResourcesPreparer prepares the MoveResources request. -func (client Client) MoveResourcesPreparer(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MoveResourcesSender sends the MoveResources request. The method will close the -// http.Response Body if it receives an error. -func (client Client) MoveResourcesSender(req *http.Request) (future MoveResourcesFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// MoveResourcesResponder handles the response to the MoveResources request. The method always -// closes the http.Response Body. -func (client Client) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates a resource. -// Parameters: -// 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. -func (client Client) Update(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters GenericResource) (result UpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.Client", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, APIVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, APIVersion string, parameters GenericResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client Client) UpdateResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateByID updates a resource by ID. -// Parameters: -// 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. -func (client Client) UpdateByID(ctx context.Context, resourceID string, APIVersion string, parameters GenericResource) (result UpdateByIDFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.UpdateByID") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateByIDPreparer(ctx, resourceID, APIVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "UpdateByID", nil, "Failure preparing request") - return - } - - result, err = client.UpdateByIDSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "UpdateByID", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateByIDPreparer prepares the UpdateByID request. -func (client Client) UpdateByIDPreparer(ctx context.Context, resourceID string, APIVersion string, parameters GenericResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateByIDSender sends the UpdateByID request. The method will close the -// http.Response Body if it receives an error. -func (client Client) UpdateByIDSender(req *http.Request) (future UpdateByIDFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateByIDResponder handles the response to the UpdateByID request. The method always -// closes the http.Response Body. -func (client Client) UpdateByIDResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ValidateMoveResources this operation checks whether the specified resources can be moved to the target. The -// resources to move must be in the same source resource group. 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. -// Parameters: -// sourceResourceGroupName - the name of the resource group containing the resources to validate for move. -// parameters - parameters for moving resources. -func (client Client) ValidateMoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (result ValidateMoveResourcesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ValidateMoveResources") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: sourceResourceGroupName, - Constraints: []validation.Constraint{{Target: "sourceResourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "sourceResourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "sourceResourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("resources.Client", "ValidateMoveResources", err.Error()) - } - - req, err := client.ValidateMoveResourcesPreparer(ctx, sourceResourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "ValidateMoveResources", nil, "Failure preparing request") - return - } - - result, err = client.ValidateMoveResourcesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.Client", "ValidateMoveResources", result.Response(), "Failure sending request") - return - } - - return -} - -// ValidateMoveResourcesPreparer prepares the ValidateMoveResources request. -func (client Client) ValidateMoveResourcesPreparer(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateMoveResourcesSender sends the ValidateMoveResources request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ValidateMoveResourcesSender(req *http.Request) (future ValidateMoveResourcesFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ValidateMoveResourcesResponder handles the response to the ValidateMoveResources request. The method always -// closes the http.Response Body. -func (client Client) ValidateMoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/tags.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/tags.go deleted file mode 100644 index 1477ae573..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/tags.go +++ /dev/null @@ -1,443 +0,0 @@ -package resources - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TagsClient is the provides operations for working with resources and resource groups. -type TagsClient struct { - BaseClient -} - -// NewTagsClient creates an instance of the TagsClient client. -func NewTagsClient(subscriptionID string) TagsClient { - return NewTagsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagsClientWithBaseURI creates an instance of the TagsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTagsClientWithBaseURI(baseURI string, subscriptionID string) TagsClient { - return TagsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate the tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure -// have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. -// Parameters: -// tagName - the name of the tag to create. -func (client TagsClient) CreateOrUpdate(ctx context.Context, tagName string) (result TagDetails, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, tagName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TagsClient) CreateOrUpdatePreparer(ctx context.Context, tagName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagName": autorest.Encode("path", tagName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client TagsClient) CreateOrUpdateResponder(resp *http.Response) (result TagDetails, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateValue creates a tag value. The name of the tag must already exist. -// Parameters: -// tagName - the name of the tag. -// tagValue - the value of the tag to create. -func (client TagsClient) CreateOrUpdateValue(ctx context.Context, tagName string, tagValue string) (result TagValue, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.CreateOrUpdateValue") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdateValuePreparer(ctx, tagName, tagValue) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateValueSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateValueResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateValuePreparer prepares the CreateOrUpdateValue request. -func (client TagsClient) CreateOrUpdateValuePreparer(ctx context.Context, tagName string, tagValue string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagName": autorest.Encode("path", tagName), - "tagValue": autorest.Encode("path", tagValue), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateValueSender sends the CreateOrUpdateValue request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) CreateOrUpdateValueSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateValueResponder handles the response to the CreateOrUpdateValue request. The method always -// closes the http.Response Body. -func (client TagsClient) CreateOrUpdateValueResponder(resp *http.Response) (result TagValue, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete you must remove all values from a resource tag before you can delete it. -// Parameters: -// tagName - the name of the tag. -func (client TagsClient) Delete(ctx context.Context, tagName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, tagName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TagsClient) DeletePreparer(ctx context.Context, tagName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagName": autorest.Encode("path", tagName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TagsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteValue deletes a tag value. -// Parameters: -// tagName - the name of the tag. -// tagValue - the value of the tag to delete. -func (client TagsClient) DeleteValue(ctx context.Context, tagName string, tagValue string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.DeleteValue") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteValuePreparer(ctx, tagName, tagValue) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteValueSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure sending request") - return - } - - result, err = client.DeleteValueResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure responding to request") - return - } - - return -} - -// DeleteValuePreparer prepares the DeleteValue request. -func (client TagsClient) DeleteValuePreparer(ctx context.Context, tagName string, tagValue string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagName": autorest.Encode("path", tagName), - "tagValue": autorest.Encode("path", tagValue), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteValueSender sends the DeleteValue request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) DeleteValueSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteValueResponder handles the response to the DeleteValue request. The method always -// closes the http.Response Body. -func (client TagsClient) DeleteValueResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// List gets the names and values of all resource tags that are defined in a subscription. -func (client TagsClient) List(ctx context.Context) (result TagsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.List") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TagsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client TagsClient) ListResponder(resp *http.Response) (result TagsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client TagsClient) listNextResults(ctx context.Context, lastResults TagsListResult) (result TagsListResult, err error) { - req, err := lastResults.tagsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.TagsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.TagsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagsClient) ListComplete(ctx context.Context) (result TagsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/version.go deleted file mode 100644 index 4696ca2b7..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package resources - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " resources/2018-05-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} 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 index 548c2faeb..5d4c9f1d1 100644 --- 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 @@ -97,10 +97,11 @@ func NewAccessToken(homeID, env, realm, clientID string, cachedAt, expiresOn, ex // 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( + key := strings.Join( []string{a.HomeAccountID, a.Environment, a.CredentialType, a.ClientID, a.Realm, a.Scopes}, shared.CacheKeySeparator, ) + return strings.ToLower(key) } // FakeValidate enables tests to fake access token validation @@ -167,10 +168,11 @@ func NewIDToken(homeID, env, realm, clientID, idToken string) 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( + key := strings.Join( []string{id.HomeAccountID, id.Environment, id.CredentialType, id.ClientID, id.Realm}, shared.CacheKeySeparator, ) + return strings.ToLower(key) } // AppMetaData is the JSON representation of application metadata for encoding to storage. @@ -193,8 +195,9 @@ func NewAppMetaData(familyID, clientID, environment string) AppMetaData { // 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( + key := strings.Join( []string{"AppMetaData", a.Environment, a.ClientID}, shared.CacheKeySeparator, ) + return strings.ToLower(key) } 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 index 87d7d797b..5e1cae0b8 100644 --- 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 @@ -84,7 +84,7 @@ func (m *PartitionedManager) Read(ctx context.Context, authParameters authority. // 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() + authParameters.HomeAccountID = tokenResponse.HomeAccountID() homeAccountID := authParameters.HomeAccountID environment := authParameters.AuthorityInfo.Host realm := authParameters.AuthorityInfo.Tenant 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 index add751925..d3a39e005 100644 --- 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 @@ -134,8 +134,7 @@ 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 + homeAccountID := tokenResponse.HomeAccountID() environment := authParameters.AuthorityInfo.Host realm := authParameters.AuthorityInfo.Tenant clientID := authParameters.ClientID 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 deleted file mode 100644 index 1d8181924..000000000 --- a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/test_serialized_cache.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "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/oauth/ops/accesstokens/accesstokens.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/accesstokens.go index fa6bb61c8..003d38648 100644 --- 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 @@ -30,7 +30,7 @@ import ( "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/golang-jwt/jwt/v5" "github.com/google/uuid" ) 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 index b3892bf3f..3dd61d5b5 100644 --- 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 @@ -146,17 +146,6 @@ func (c *ClientInfo) UnmarshalJSON(b []byte) error { return nil } -// HomeAccountID creates the home account ID. -func (c ClientInfo) HomeAccountID() string { - if c.UID == "" { - return "" - } else if c.UTID == "" { - return fmt.Sprintf("%s.%s", c.UID, c.UID) - } else { - return fmt.Sprintf("%s.%s", c.UID, c.UTID) - } -} - // Scopes represents scopes in a TokenResponse. type Scopes struct { Slice []string @@ -206,6 +195,19 @@ func (tr *TokenResponse) ComputeScope(authParams authority.AuthParams) { tr.scopesComputed = true } +// HomeAccountID uniquely identifies the authenticated account, if any. It's "" when the token is an app token. +func (tr *TokenResponse) HomeAccountID() string { + id := tr.IDToken.Subject + if uid := tr.ClientInfo.UID; uid != "" { + utid := tr.ClientInfo.UTID + if utid == "" { + utid = uid + } + id = fmt.Sprintf("%s.%s", uid, utid) + } + return id +} + // Validate validates the TokenResponse has basic valid values. It must be called // after ComputeScopes() is called. func (tr *TokenResponse) Validate() error { @@ -231,7 +233,7 @@ func (tr *TokenResponse) CacheKey(authParams authority.AuthParams) string { return authParams.AppKey() } if authParams.IsConfidentialClient || authParams.AuthorizationType == authority.ATRefreshToken { - return tr.ClientInfo.HomeAccountID() + return tr.HomeAccountID() } return "" } @@ -294,10 +296,11 @@ func (rt RefreshToken) Key() string { fourth = rt.ClientID } - return strings.Join( + key := strings.Join( []string{rt.HomeAccountID, rt.Environment, rt.CredentialType, fourth}, shared.CacheKeySeparator, ) + return strings.ToLower(key) } func (rt RefreshToken) GetSecret() string { 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 index f7e12a71b..d8ab71356 100644 --- 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 @@ -46,7 +46,8 @@ func NewAccount(homeAccountID, env, realm, localAccountID, authorityType, userna // 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) + key := strings.Join([]string{acc.HomeAccountID, acc.Environment, acc.Realm}, CacheKeySeparator) + return strings.ToLower(key) } // IsZero checks the zero value of account. 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 index b76c0c569..2ac2d09e4 100644 --- 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 @@ -5,4 +5,4 @@ package version // Version is the version of this client package that is communicated to the server. -const Version = "1.0.0" +const Version = "1.1.1" 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 index cce05277e..88b217ded 100644 --- 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 @@ -24,8 +24,10 @@ import ( "crypto/rand" "crypto/sha256" "encoding/base64" + "errors" "fmt" "net/url" + "reflect" "strconv" "github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache" @@ -47,6 +49,8 @@ type AuthResult = base.AuthResult type Account = shared.Account +var errNoAccount = errors.New("no account was specified with public.WithAccount(), or the specified account is invalid") + // clientOptions configures the Client's behavior. type clientOptions struct { accessor cache.ExportReplace @@ -294,6 +298,10 @@ func (pca Client) AcquireTokenSilent(ctx context.Context, scopes []string, opts if err := options.ApplyOptions(&o, opts); err != nil { return AuthResult{}, err } + // an account is required to find user tokens in the cache + if reflect.ValueOf(o.account).IsZero() { + return AuthResult{}, errNoAccount + } silentParameters := base.AcquireTokenSilentParameters{ Scopes: scopes, @@ -473,6 +481,7 @@ func (pca Client) RemoveAccount(ctx context.Context, account Account) error { // interactiveAuthOptions contains the optional parameters used to acquire an access token for interactive auth code flow. type interactiveAuthOptions struct { claims, domainHint, loginHint, redirectURI, tenantID string + openURL func(url string) error } // AcquireInteractiveOption is implemented by options for AcquireTokenInteractive @@ -558,10 +567,33 @@ func WithRedirectURI(redirectURI string) interface { } } +// WithOpenURL allows you to provide a function to open the browser to complete the interactive login, instead of launching the system default browser. +func WithOpenURL(openURL func(url string) error) interface { + AcquireInteractiveOption + options.CallOption +} { + return struct { + AcquireInteractiveOption + options.CallOption + }{ + CallOption: options.NewCallOption( + func(a any) error { + switch t := a.(type) { + case *interactiveAuthOptions: + t.openURL = openURL + default: + return fmt.Errorf("unexpected options type %T", a) + } + return nil + }, + ), + } +} + // 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 // -// Options: [WithDomainHint], [WithLoginHint], [WithRedirectURI], [WithTenantID] +// Options: [WithDomainHint], [WithLoginHint], [WithOpenURL], [WithRedirectURI], [WithTenantID] func (pca Client) AcquireTokenInteractive(ctx context.Context, scopes []string, opts ...AcquireInteractiveOption) (AuthResult, error) { o := interactiveAuthOptions{} if err := options.ApplyOptions(&o, opts); err != nil { @@ -580,6 +612,9 @@ func (pca Client) AcquireTokenInteractive(ctx context.Context, scopes []string, return AuthResult{}, err } } + if o.openURL == nil { + o.openURL = browser.OpenURL + } authParams, err := pca.base.AuthParams.WithTenant(o.tenantID) if err != nil { return AuthResult{}, err @@ -593,7 +628,7 @@ func (pca Client) AcquireTokenInteractive(ctx context.Context, scopes []string, authParams.DomainHint = o.domainHint authParams.State = uuid.New().String() authParams.Prompt = "select_account" - res, err := pca.browserLogin(ctx, redirectURL, authParams) + res, err := pca.browserLogin(ctx, redirectURL, authParams, o.openURL) if err != nil { return AuthResult{}, err } @@ -617,11 +652,6 @@ type interactiveAuthResult struct { 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) { @@ -635,8 +665,8 @@ func parsePort(u *url.URL) (int, error) { 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) { +// browserLogin calls openURL and waits for a user to log in +func (pca Client) browserLogin(ctx context.Context, redirectURI *url.URL, params authority.AuthParams, openURL func(string) error) (interactiveAuthResult, error) { // start local redirect server so login can call us back port, err := parsePort(redirectURI) if err != nil { @@ -653,7 +683,7 @@ func (pca Client) browserLogin(ctx context.Context, redirectURI *url.URL, params return interactiveAuthResult{}, err } // open browser window so user can select credentials - if err := browserOpenURL(authURL); err != nil { + if err := openURL(authURL); err != nil { return interactiveAuthResult{}, err } // now wait until the logic calls us back diff --git a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md b/vendor/github.com/emicklei/go-restful/v3/CHANGES.md index 74a378157..352018e70 100644 --- a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md +++ b/vendor/github.com/emicklei/go-restful/v3/CHANGES.md @@ -1,10 +1,26 @@ # Change history of go-restful -## [v3.9.0] - 20221-07-21 +## [v3.10.2] - 2023-03-09 + +- introduced MergePathStrategy to be able to revert behaviour of path concatenation to 3.9.0 + see comment in Readme how to customize this behaviour. + +## [v3.10.1] - 2022-11-19 + +- fix broken 3.10.0 by using path package for joining paths + +## [v3.10.0] - 2022-10-11 - BROKEN + +- changed tokenizer to match std route match behavior; do not trimright the path (#511) +- Add MIME_ZIP (#512) +- Add MIME_ZIP and HEADER_ContentDisposition (#513) +- Changed how to get query parameter issue #510 + +## [v3.9.0] - 2022-07-21 - add support for http.Handler implementations to work as FilterFunction, issue #504 (thanks to https://github.com/ggicci) -## [v3.8.0] - 20221-06-06 +## [v3.8.0] - 2022-06-06 - use exact matching of allowed domain entries, issue #489 (#493) - this changes fixes [security] Authorization Bypass Through User-Controlled Key diff --git a/vendor/github.com/emicklei/go-restful/v3/README.md b/vendor/github.com/emicklei/go-restful/v3/README.md index 0625359dc..85da90128 100644 --- a/vendor/github.com/emicklei/go-restful/v3/README.md +++ b/vendor/github.com/emicklei/go-restful/v3/README.md @@ -96,6 +96,10 @@ There are several hooks to customize the behavior of the go-restful package. - Compression - Encoders for other serializers - Use [jsoniter](https://github.com/json-iterator/go) by building this package using a build tag, e.g. `go build -tags=jsoniter .` +- Use the variable `MergePathStrategy` to change the behaviour of composing the Route path given a root path and a local route path + - versions >= 3.10.1 has set the value to `PathJoinStrategy` that fixes a reported [security issue](https://github.com/advisories/GHSA-r48q-9g5r-8q2h) but may cause your services not to work correctly anymore. + - versions <= 3.9 had the behaviour that can be restored in newer versions by setting the value to `TrimSlashStrategy`. + - you can set value to a custom implementation (must implement MergePathStrategyFunc) ## Resources diff --git a/vendor/github.com/emicklei/go-restful/v3/constants.go b/vendor/github.com/emicklei/go-restful/v3/constants.go index 203439c5e..2328bde6c 100644 --- a/vendor/github.com/emicklei/go-restful/v3/constants.go +++ b/vendor/github.com/emicklei/go-restful/v3/constants.go @@ -7,12 +7,14 @@ package restful const ( MIME_XML = "application/xml" // Accept or Content-Type used in Consumes() and/or Produces() MIME_JSON = "application/json" // Accept or Content-Type used in Consumes() and/or Produces() + MIME_ZIP = "application/zip" // Accept or Content-Type used in Consumes() and/or Produces() MIME_OCTET = "application/octet-stream" // If Content-Type is not present in request, use the default HEADER_Allow = "Allow" HEADER_Accept = "Accept" HEADER_Origin = "Origin" HEADER_ContentType = "Content-Type" + HEADER_ContentDisposition = "Content-Disposition" HEADER_LastModified = "Last-Modified" HEADER_AcceptEncoding = "Accept-Encoding" HEADER_ContentEncoding = "Content-Encoding" diff --git a/vendor/github.com/emicklei/go-restful/v3/request.go b/vendor/github.com/emicklei/go-restful/v3/request.go index 5725a0759..0020095e8 100644 --- a/vendor/github.com/emicklei/go-restful/v3/request.go +++ b/vendor/github.com/emicklei/go-restful/v3/request.go @@ -31,7 +31,8 @@ func NewRequest(httpRequest *http.Request) *Request { // a "Unable to unmarshal content of type:" response is returned. // Valid values are restful.MIME_JSON and restful.MIME_XML // Example: -// restful.DefaultRequestContentType(restful.MIME_JSON) +// +// restful.DefaultRequestContentType(restful.MIME_JSON) func DefaultRequestContentType(mime string) { defaultRequestContentType = mime } @@ -48,7 +49,7 @@ func (r *Request) PathParameters() map[string]string { // QueryParameter returns the (first) Query parameter value by its name func (r *Request) QueryParameter(name string) string { - return r.Request.FormValue(name) + return r.Request.URL.Query().Get(name) } // QueryParameters returns the all the query parameters values by name diff --git a/vendor/github.com/emicklei/go-restful/v3/response.go b/vendor/github.com/emicklei/go-restful/v3/response.go index 8f0b56aa2..a41a92cc2 100644 --- a/vendor/github.com/emicklei/go-restful/v3/response.go +++ b/vendor/github.com/emicklei/go-restful/v3/response.go @@ -109,6 +109,9 @@ func (r *Response) EntityWriter() (EntityReaderWriter, bool) { if DefaultResponseMimeType == MIME_XML { return entityAccessRegistry.accessorAt(MIME_XML) } + if DefaultResponseMimeType == MIME_ZIP { + return entityAccessRegistry.accessorAt(MIME_ZIP) + } // Fallback to whatever the route says it can produce. // https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html for _, each := range r.routeProduces { diff --git a/vendor/github.com/emicklei/go-restful/v3/route.go b/vendor/github.com/emicklei/go-restful/v3/route.go index 193f4a6b0..ea05b3da8 100644 --- a/vendor/github.com/emicklei/go-restful/v3/route.go +++ b/vendor/github.com/emicklei/go-restful/v3/route.go @@ -164,7 +164,7 @@ func tokenizePath(path string) []string { if "/" == path { return nil } - return strings.Split(strings.Trim(path, "/"), "/") + return strings.Split(strings.TrimLeft(path, "/"), "/") } // for debugging @@ -176,3 +176,5 @@ func (r *Route) String() string { func (r *Route) EnableContentEncoding(enabled bool) { r.contentEncodingEnabled = &enabled } + +var TrimRightSlashEnabled = false diff --git a/vendor/github.com/emicklei/go-restful/v3/route_builder.go b/vendor/github.com/emicklei/go-restful/v3/route_builder.go index 23641b6dd..827f471de 100644 --- a/vendor/github.com/emicklei/go-restful/v3/route_builder.go +++ b/vendor/github.com/emicklei/go-restful/v3/route_builder.go @@ -7,6 +7,7 @@ package restful import ( "fmt" "os" + "path" "reflect" "runtime" "strings" @@ -46,11 +47,12 @@ type RouteBuilder struct { // Do evaluates each argument with the RouteBuilder itself. // This allows you to follow DRY principles without breaking the fluent programming style. // Example: -// ws.Route(ws.DELETE("/{name}").To(t.deletePerson).Do(Returns200, Returns500)) // -// func Returns500(b *RouteBuilder) { -// b.Returns(500, "Internal Server Error", restful.ServiceError{}) -// } +// ws.Route(ws.DELETE("/{name}").To(t.deletePerson).Do(Returns200, Returns500)) +// +// func Returns500(b *RouteBuilder) { +// b.Returns(500, "Internal Server Error", restful.ServiceError{}) +// } func (b *RouteBuilder) Do(oneArgBlocks ...func(*RouteBuilder)) *RouteBuilder { for _, each := range oneArgBlocks { each(b) @@ -351,8 +353,28 @@ func (b *RouteBuilder) Build() Route { return route } -func concatPath(path1, path2 string) string { - return strings.TrimRight(path1, "/") + "/" + strings.TrimLeft(path2, "/") +type MergePathStrategyFunc func(rootPath, routePath string) string + +var ( + // behavior >= 3.10 + PathJoinStrategy = func(rootPath, routePath string) string { + return path.Join(rootPath, routePath) + } + + // behavior <= 3.9 + TrimSlashStrategy = func(rootPath, routePath string) string { + return strings.TrimRight(rootPath, "/") + "/" + strings.TrimLeft(routePath, "/") + } + + // MergePathStrategy is the active strategy for merging a Route path when building the routing of all WebServices. + // The value is set to PathJoinStrategy + // PathJoinStrategy is a strategy that is more strict [Security - PRISMA-2022-0227] + MergePathStrategy = PathJoinStrategy +) + +// merge two paths using the current (package global) merge path strategy. +func concatPath(rootPath, routePath string) string { + return MergePathStrategy(rootPath, routePath) } var anonymousFuncCount int32 diff --git a/vendor/github.com/evanphx/json-patch/README.md b/vendor/github.com/evanphx/json-patch/README.md index 28e351693..97e319b21 100644 --- a/vendor/github.com/evanphx/json-patch/README.md +++ b/vendor/github.com/evanphx/json-patch/README.md @@ -4,7 +4,7 @@ well as for calculating & applying [RFC7396 JSON merge patches](https://tools.ietf.org/html/rfc7396). [![GoDoc](https://godoc.org/github.com/evanphx/json-patch?status.svg)](http://godoc.org/github.com/evanphx/json-patch) -[![Build Status](https://travis-ci.org/evanphx/json-patch.svg?branch=master)](https://travis-ci.org/evanphx/json-patch) +[![Build Status](https://github.com/evanphx/json-patch/actions/workflows/go.yml/badge.svg)](https://github.com/evanphx/json-patch/actions/workflows/go.yml) [![Report Card](https://goreportcard.com/badge/github.com/evanphx/json-patch)](https://goreportcard.com/report/github.com/evanphx/json-patch) # Get It! @@ -314,4 +314,4 @@ go test -cover ./... ``` Builds for pull requests are tested automatically -using [TravisCI](https://travis-ci.org/evanphx/json-patch). +using [GitHub Actions](https://github.com/evanphx/json-patch/actions/workflows/go.yml). diff --git a/vendor/github.com/evanphx/json-patch/patch.go b/vendor/github.com/evanphx/json-patch/patch.go index 4bce5936d..cd0274e1e 100644 --- a/vendor/github.com/evanphx/json-patch/patch.go +++ b/vendor/github.com/evanphx/json-patch/patch.go @@ -359,7 +359,7 @@ func findObject(pd *container, path string) (container, string) { next, ok := doc.get(decodePatchKey(part)) - if next == nil || ok != nil { + if next == nil || ok != nil || next.raw == nil { return nil, "" } @@ -568,6 +568,29 @@ func (p Patch) replace(doc *container, op Operation) error { return errors.Wrapf(err, "replace operation failed to decode path") } + if path == "" { + val := op.value() + + if val.which == eRaw { + if !val.tryDoc() { + if !val.tryAry() { + return errors.Wrapf(err, "replace operation value must be object or array") + } + } + } + + switch val.which { + case eAry: + *doc = &val.ary + case eDoc: + *doc = &val.doc + case eRaw: + return errors.Wrapf(err, "replace operation hit impossible case") + } + + return nil + } + con, key := findObject(doc, path) if con == nil { @@ -634,6 +657,25 @@ func (p Patch) test(doc *container, op Operation) error { return errors.Wrapf(err, "test operation failed to decode path") } + if path == "" { + var self lazyNode + + switch sv := (*doc).(type) { + case *partialDoc: + self.doc = *sv + self.which = eDoc + case *partialArray: + self.ary = *sv + self.which = eAry + } + + if self.equal(op.value()) { + return nil + } + + return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) + } + con, key := findObject(doc, path) if con == nil { @@ -646,7 +688,7 @@ func (p Patch) test(doc *container, op Operation) error { } if val == nil { - if op.value().raw == nil { + if op.value() == nil || op.value().raw == nil { return nil } return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) diff --git a/vendor/github.com/felixge/httpsnoop/.travis.yml b/vendor/github.com/felixge/httpsnoop/.travis.yml deleted file mode 100644 index bfc421200..000000000 --- a/vendor/github.com/felixge/httpsnoop/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: go - -go: - - 1.6 - - 1.7 - - 1.8 diff --git a/vendor/github.com/felixge/httpsnoop/Makefile b/vendor/github.com/felixge/httpsnoop/Makefile index 2d84889ae..4e12afdd9 100644 --- a/vendor/github.com/felixge/httpsnoop/Makefile +++ b/vendor/github.com/felixge/httpsnoop/Makefile @@ -1,7 +1,7 @@ .PHONY: ci generate clean ci: clean generate - go test -v ./... + go test -race -v ./... generate: go generate . diff --git a/vendor/github.com/felixge/httpsnoop/README.md b/vendor/github.com/felixge/httpsnoop/README.md index ddcecd13e..cf6b42f3d 100644 --- a/vendor/github.com/felixge/httpsnoop/README.md +++ b/vendor/github.com/felixge/httpsnoop/README.md @@ -7,8 +7,8 @@ http.Handlers. Doing this requires non-trivial wrapping of the http.ResponseWriter interface, which is also exposed for users interested in a more low-level API. -[![GoDoc](https://godoc.org/github.com/felixge/httpsnoop?status.svg)](https://godoc.org/github.com/felixge/httpsnoop) -[![Build Status](https://travis-ci.org/felixge/httpsnoop.svg?branch=master)](https://travis-ci.org/felixge/httpsnoop) +[![Go Reference](https://pkg.go.dev/badge/github.com/felixge/httpsnoop.svg)](https://pkg.go.dev/github.com/felixge/httpsnoop) +[![Build Status](https://github.com/felixge/httpsnoop/actions/workflows/main.yaml/badge.svg)](https://github.com/felixge/httpsnoop/actions/workflows/main.yaml) ## Usage Example diff --git a/vendor/github.com/felixge/httpsnoop/capture_metrics.go b/vendor/github.com/felixge/httpsnoop/capture_metrics.go index b77cc7c00..bec7b71b3 100644 --- a/vendor/github.com/felixge/httpsnoop/capture_metrics.go +++ b/vendor/github.com/felixge/httpsnoop/capture_metrics.go @@ -52,7 +52,7 @@ func (m *Metrics) CaptureMetrics(w http.ResponseWriter, fn func(http.ResponseWri return func(code int) { next(code) - if !headerWritten { + if !(code >= 100 && code <= 199) && !headerWritten { m.Code = code headerWritten = true } diff --git a/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go b/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go index 31cbdfb8e..101cedde6 100644 --- a/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go +++ b/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go @@ -1,5 +1,5 @@ // +build go1.8 -// Code generated by "httpsnoop/codegen"; DO NOT EDIT +// Code generated by "httpsnoop/codegen"; DO NOT EDIT. package httpsnoop diff --git a/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go b/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go index ab99c07c7..e0951df15 100644 --- a/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go +++ b/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go @@ -1,5 +1,5 @@ // +build !go1.8 -// Code generated by "httpsnoop/codegen"; DO NOT EDIT +// Code generated by "httpsnoop/codegen"; DO NOT EDIT. package httpsnoop diff --git a/vendor/github.com/fsnotify/fsnotify/.cirrus.yml b/vendor/github.com/fsnotify/fsnotify/.cirrus.yml new file mode 100644 index 000000000..ffc7b992b --- /dev/null +++ b/vendor/github.com/fsnotify/fsnotify/.cirrus.yml @@ -0,0 +1,13 @@ +freebsd_task: + name: 'FreeBSD' + freebsd_instance: + image_family: freebsd-13-2 + install_script: + - pkg update -f + - pkg install -y go + test_script: + # run tests as user "cirrus" instead of root + - pw useradd cirrus -m + - chown -R cirrus:cirrus . + - FSNOTIFY_BUFFER=4096 sudo --preserve-env=FSNOTIFY_BUFFER -u cirrus go test -parallel 1 -race ./... + - sudo --preserve-env=FSNOTIFY_BUFFER -u cirrus go test -parallel 1 -race ./... diff --git a/vendor/github.com/fsnotify/fsnotify/.gitignore b/vendor/github.com/fsnotify/fsnotify/.gitignore index 1d89d85ce..391cc076b 100644 --- a/vendor/github.com/fsnotify/fsnotify/.gitignore +++ b/vendor/github.com/fsnotify/fsnotify/.gitignore @@ -4,3 +4,4 @@ # Output of go build ./cmd/fsnotify /fsnotify +/fsnotify.exe diff --git a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md b/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md index 77f9593bd..e0e575754 100644 --- a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md +++ b/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md @@ -1,16 +1,87 @@ # Changelog -All notable changes to this project will be documented in this file. +Unreleased +---------- +Nothing yet. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +1.7.0 - 2023-10-22 +------------------ +This version of fsnotify needs Go 1.17. -## [Unreleased] +### Additions -Nothing yet. +- illumos: add FEN backend to support illumos and Solaris. ([#371]) + +- all: add `NewBufferedWatcher()` to use a buffered channel, which can be useful + in cases where you can't control the kernel buffer and receive a large number + of events in bursts. ([#550], [#572]) + +- all: add `AddWith()`, which is identical to `Add()` but allows passing + options. ([#521]) + +- windows: allow setting the ReadDirectoryChangesW() buffer size with + `fsnotify.WithBufferSize()`; the default of 64K is the highest value that + works on all platforms and is enough for most purposes, but in some cases a + highest buffer is needed. ([#521]) + +### Changes and fixes + +- inotify: remove watcher if a watched path is renamed ([#518]) + + After a rename the reported name wasn't updated, or even an empty string. + Inotify doesn't provide any good facilities to update it, so just remove the + watcher. This is already how it worked on kqueue and FEN. + + On Windows this does work, and remains working. + +- windows: don't listen for file attribute changes ([#520]) + + File attribute changes are sent as `FILE_ACTION_MODIFIED` by the Windows API, + with no way to see if they're a file write or attribute change, so would show + up as a fsnotify.Write event. This is never useful, and could result in many + spurious Write events. + +- windows: return `ErrEventOverflow` if the buffer is full ([#525]) + + Before it would merely return "short read", making it hard to detect this + error. + +- kqueue: make sure events for all files are delivered properly when removing a + watched directory ([#526]) + + Previously they would get sent with `""` (empty string) or `"."` as the path + name. + +- kqueue: don't emit spurious Create events for symbolic links ([#524]) + + The link would get resolved but kqueue would "forget" it already saw the link + itself, resulting on a Create for every Write event for the directory. + +- all: return `ErrClosed` on `Add()` when the watcher is closed ([#516]) + +- other: add `Watcher.Errors` and `Watcher.Events` to the no-op `Watcher` in + `backend_other.go`, making it easier to use on unsupported platforms such as + WASM, AIX, etc. ([#528]) + +- other: use the `backend_other.go` no-op if the `appengine` build tag is set; + Google AppEngine forbids usage of the unsafe package so the inotify backend + won't compile there. -## [1.6.0] - 2022-10-13 +[#371]: https://github.com/fsnotify/fsnotify/pull/371 +[#516]: https://github.com/fsnotify/fsnotify/pull/516 +[#518]: https://github.com/fsnotify/fsnotify/pull/518 +[#520]: https://github.com/fsnotify/fsnotify/pull/520 +[#521]: https://github.com/fsnotify/fsnotify/pull/521 +[#524]: https://github.com/fsnotify/fsnotify/pull/524 +[#525]: https://github.com/fsnotify/fsnotify/pull/525 +[#526]: https://github.com/fsnotify/fsnotify/pull/526 +[#528]: https://github.com/fsnotify/fsnotify/pull/528 +[#537]: https://github.com/fsnotify/fsnotify/pull/537 +[#550]: https://github.com/fsnotify/fsnotify/pull/550 +[#572]: https://github.com/fsnotify/fsnotify/pull/572 +1.6.0 - 2022-10-13 +------------------ This version of fsnotify needs Go 1.16 (this was already the case since 1.5.1, but not documented). It also increases the minimum Linux version to 2.6.32. diff --git a/vendor/github.com/fsnotify/fsnotify/README.md b/vendor/github.com/fsnotify/fsnotify/README.md index d4e6080fe..e480733d1 100644 --- a/vendor/github.com/fsnotify/fsnotify/README.md +++ b/vendor/github.com/fsnotify/fsnotify/README.md @@ -1,29 +1,31 @@ fsnotify is a Go library to provide cross-platform filesystem notifications on -Windows, Linux, macOS, and BSD systems. +Windows, Linux, macOS, BSD, and illumos. -Go 1.16 or newer is required; the full documentation is at +Go 1.17 or newer is required; the full documentation is at https://pkg.go.dev/github.com/fsnotify/fsnotify -**It's best to read the documentation at pkg.go.dev, as it's pinned to the last -released version, whereas this README is for the last development version which -may include additions/changes.** - --- Platform support: -| Adapter | OS | Status | -| --------------------- | ---------------| -------------------------------------------------------------| -| inotify | Linux 2.6.32+ | Supported | -| kqueue | BSD, macOS | Supported | -| ReadDirectoryChangesW | Windows | Supported | -| FSEvents | macOS | [Planned](https://github.com/fsnotify/fsnotify/issues/11) | -| FEN | Solaris 11 | [In Progress](https://github.com/fsnotify/fsnotify/pull/371) | -| fanotify | Linux 5.9+ | [Maybe](https://github.com/fsnotify/fsnotify/issues/114) | -| USN Journals | Windows | [Maybe](https://github.com/fsnotify/fsnotify/issues/53) | -| Polling | *All* | [Maybe](https://github.com/fsnotify/fsnotify/issues/9) | - -Linux and macOS should include Android and iOS, but these are currently untested. +| Backend | OS | Status | +| :-------------------- | :--------- | :------------------------------------------------------------------------ | +| inotify | Linux | Supported | +| kqueue | BSD, macOS | Supported | +| ReadDirectoryChangesW | Windows | Supported | +| FEN | illumos | Supported | +| fanotify | Linux 5.9+ | [Not yet](https://github.com/fsnotify/fsnotify/issues/114) | +| AHAFS | AIX | [aix branch]; experimental due to lack of maintainer and test environment | +| FSEvents | macOS | [Needs support in x/sys/unix][fsevents] | +| USN Journals | Windows | [Needs support in x/sys/windows][usn] | +| Polling | *All* | [Not yet](https://github.com/fsnotify/fsnotify/issues/9) | + +Linux and illumos should include Android and Solaris, but these are currently +untested. + +[fsevents]: https://github.com/fsnotify/fsnotify/issues/11#issuecomment-1279133120 +[usn]: https://github.com/fsnotify/fsnotify/issues/53#issuecomment-1279829847 +[aix branch]: https://github.com/fsnotify/fsnotify/issues/353#issuecomment-1284590129 Usage ----- @@ -83,20 +85,23 @@ run with: % go run ./cmd/fsnotify +Further detailed documentation can be found in godoc: +https://pkg.go.dev/github.com/fsnotify/fsnotify + FAQ --- ### Will a file still be watched when it's moved to another directory? No, not unless you are watching the location it was moved to. -### Are subdirectories watched too? +### Are subdirectories watched? No, you must add watches for any directory you want to watch (a recursive watcher is on the roadmap: [#18]). [#18]: https://github.com/fsnotify/fsnotify/issues/18 ### Do I have to watch the Error and Event channels in a goroutine? -As of now, yes (you can read both channels in the same goroutine using `select`, -you don't need a separate goroutine for both channels; see the example). +Yes. You can read both channels in the same goroutine using `select` (you don't +need a separate goroutine for both channels; see the example). ### Why don't notifications work with NFS, SMB, FUSE, /proc, or /sys? fsnotify requires support from underlying OS to work. The current NFS and SMB @@ -107,6 +112,32 @@ This could be fixed with a polling watcher ([#9]), but it's not yet implemented. [#9]: https://github.com/fsnotify/fsnotify/issues/9 +### Why do I get many Chmod events? +Some programs may generate a lot of attribute changes; for example Spotlight on +macOS, anti-virus programs, backup applications, and some others are known to do +this. As a rule, it's typically best to ignore Chmod events. They're often not +useful, and tend to cause problems. + +Spotlight indexing on macOS can result in multiple events (see [#15]). A +temporary workaround is to add your folder(s) to the *Spotlight Privacy +settings* until we have a native FSEvents implementation (see [#11]). + +[#11]: https://github.com/fsnotify/fsnotify/issues/11 +[#15]: https://github.com/fsnotify/fsnotify/issues/15 + +### Watching a file doesn't work well +Watching individual files (rather than directories) is generally not recommended +as many programs (especially editors) update files atomically: it will write to +a temporary file which is then moved to to destination, overwriting the original +(or some variant thereof). The watcher on the original file is now lost, as that +no longer exists. + +The upshot of this is that a power failure or crash won't leave a half-written +file. + +Watch the parent directory and use `Event.Name` to filter out files you're not +interested in. There is an example of this in `cmd/fsnotify/file.go`. + Platform-specific notes ----------------------- ### Linux @@ -151,11 +182,3 @@ these platforms. The sysctl variables `kern.maxfiles` and `kern.maxfilesperproc` can be used to control the maximum number of open files. - -### macOS -Spotlight indexing on macOS can result in multiple events (see [#15]). A temporary -workaround is to add your folder(s) to the *Spotlight Privacy settings* until we -have a native FSEvents implementation (see [#11]). - -[#11]: https://github.com/fsnotify/fsnotify/issues/11 -[#15]: https://github.com/fsnotify/fsnotify/issues/15 diff --git a/vendor/github.com/fsnotify/fsnotify/backend_fen.go b/vendor/github.com/fsnotify/fsnotify/backend_fen.go index 1a95ad8e7..28497f1dd 100644 --- a/vendor/github.com/fsnotify/fsnotify/backend_fen.go +++ b/vendor/github.com/fsnotify/fsnotify/backend_fen.go @@ -1,10 +1,19 @@ //go:build solaris // +build solaris +// Note: the documentation on the Watcher type and methods is generated from +// mkdoc.zsh + package fsnotify import ( "errors" + "fmt" + "os" + "path/filepath" + "sync" + + "golang.org/x/sys/unix" ) // Watcher watches a set of paths, delivering events on a channel. @@ -17,9 +26,9 @@ import ( // When a file is removed a Remove event won't be emitted until all file // descriptors are closed, and deletes will always emit a Chmod. For example: // -// fp := os.Open("file") -// os.Remove("file") // Triggers Chmod -// fp.Close() // Triggers Remove +// fp := os.Open("file") +// os.Remove("file") // Triggers Chmod +// fp.Close() // Triggers Remove // // This is the event that inotify sends, so not much can be changed about this. // @@ -33,16 +42,16 @@ import ( // // To increase them you can use sysctl or write the value to the /proc file: // -// # Default values on Linux 5.18 -// sysctl fs.inotify.max_user_watches=124983 -// sysctl fs.inotify.max_user_instances=128 +// # Default values on Linux 5.18 +// sysctl fs.inotify.max_user_watches=124983 +// sysctl fs.inotify.max_user_instances=128 // // To make the changes persist on reboot edit /etc/sysctl.conf or // /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check // your distro's documentation): // -// fs.inotify.max_user_watches=124983 -// fs.inotify.max_user_instances=128 +// fs.inotify.max_user_watches=124983 +// fs.inotify.max_user_instances=128 // // Reaching the limit will result in a "no space left on device" or "too many open // files" error. @@ -58,14 +67,20 @@ import ( // control the maximum number of open files, as well as /etc/login.conf on BSD // systems. // -// # macOS notes +// # Windows notes +// +// Paths can be added as "C:\path\to\dir", but forward slashes +// ("C:/path/to/dir") will also work. // -// Spotlight indexing on macOS can result in multiple events (see [#15]). A -// temporary workaround is to add your folder(s) to the "Spotlight Privacy -// Settings" until we have a native FSEvents implementation (see [#11]). +// When a watched directory is removed it will always send an event for the +// directory itself, but may not send events for all files in that directory. +// Sometimes it will send events for all times, sometimes it will send no +// events, and often only for some files. // -// [#11]: https://github.com/fsnotify/fsnotify/issues/11 -// [#15]: https://github.com/fsnotify/fsnotify/issues/15 +// The default ReadDirectoryChangesW() buffer size is 64K, which is the largest +// value that is guaranteed to work with SMB filesystems. If you have many +// events in quick succession this may not be enough, and you will have to use +// [WithBufferSize] to increase the value. type Watcher struct { // Events sends the filesystem change events. // @@ -92,44 +107,129 @@ type Watcher struct { // initiated by the user may show up as one or multiple // writes, depending on when the system syncs things to // disk. For example when compiling a large Go program - // you may get hundreds of Write events, so you - // probably want to wait until you've stopped receiving - // them (see the dedup example in cmd/fsnotify). + // you may get hundreds of Write events, and you may + // want to wait until you've stopped receiving them + // (see the dedup example in cmd/fsnotify). + // + // Some systems may send Write event for directories + // when the directory content changes. // // fsnotify.Chmod Attributes were changed. On Linux this is also sent // when a file is removed (or more accurately, when a // link to an inode is removed). On kqueue it's sent - // and on kqueue when a file is truncated. On Windows - // it's never sent. + // when a file is truncated. On Windows it's never + // sent. Events chan Event // Errors sends any errors. + // + // ErrEventOverflow is used to indicate there are too many events: + // + // - inotify: There are too many queued events (fs.inotify.max_queued_events sysctl) + // - windows: The buffer size is too small; WithBufferSize() can be used to increase it. + // - kqueue, fen: Not used. Errors chan error + + mu sync.Mutex + port *unix.EventPort + done chan struct{} // Channel for sending a "quit message" to the reader goroutine + dirs map[string]struct{} // Explicitly watched directories + watches map[string]struct{} // Explicitly watched non-directories } // NewWatcher creates a new Watcher. func NewWatcher() (*Watcher, error) { - return nil, errors.New("FEN based watcher not yet supported for fsnotify\n") + return NewBufferedWatcher(0) } -// Close removes all watches and closes the events channel. +// NewBufferedWatcher creates a new Watcher with a buffered Watcher.Events +// channel. +// +// The main use case for this is situations with a very large number of events +// where the kernel buffer size can't be increased (e.g. due to lack of +// permissions). An unbuffered Watcher will perform better for almost all use +// cases, and whenever possible you will be better off increasing the kernel +// buffers instead of adding a large userspace buffer. +func NewBufferedWatcher(sz uint) (*Watcher, error) { + w := &Watcher{ + Events: make(chan Event, sz), + Errors: make(chan error), + dirs: make(map[string]struct{}), + watches: make(map[string]struct{}), + done: make(chan struct{}), + } + + var err error + w.port, err = unix.NewEventPort() + if err != nil { + return nil, fmt.Errorf("fsnotify.NewWatcher: %w", err) + } + + go w.readEvents() + return w, nil +} + +// sendEvent attempts to send an event to the user, returning true if the event +// was put in the channel successfully and false if the watcher has been closed. +func (w *Watcher) sendEvent(name string, op Op) (sent bool) { + select { + case w.Events <- Event{Name: name, Op: op}: + return true + case <-w.done: + return false + } +} + +// sendError attempts to send an error to the user, returning true if the error +// was put in the channel successfully and false if the watcher has been closed. +func (w *Watcher) sendError(err error) (sent bool) { + select { + case w.Errors <- err: + return true + case <-w.done: + return false + } +} + +func (w *Watcher) isClosed() bool { + select { + case <-w.done: + return true + default: + return false + } +} + +// Close removes all watches and closes the Events channel. func (w *Watcher) Close() error { - return nil + // Take the lock used by associateFile to prevent lingering events from + // being processed after the close + w.mu.Lock() + defer w.mu.Unlock() + if w.isClosed() { + return nil + } + close(w.done) + return w.port.Close() } // Add starts monitoring the path for changes. // -// A path can only be watched once; attempting to watch it more than once will -// return an error. Paths that do not yet exist on the filesystem cannot be -// added. A watch will be automatically removed if the path is deleted. +// A path can only be watched once; watching it more than once is a no-op and will +// not return an error. Paths that do not yet exist on the filesystem cannot be +// watched. // -// A path will remain watched if it gets renamed to somewhere else on the same -// filesystem, but the monitor will get removed if the path gets deleted and -// re-created, or if it's moved to a different filesystem. +// A watch will be automatically removed if the watched path is deleted or +// renamed. The exception is the Windows backend, which doesn't remove the +// watcher on renames. // // Notifications on network filesystems (NFS, SMB, FUSE, etc.) or special // filesystems (/proc, /sys, etc.) generally don't work. // +// Returns [ErrClosed] if [Watcher.Close] was called. +// +// See [Watcher.AddWith] for a version that allows adding options. +// // # Watching directories // // All files in a directory are monitored, including new files that are created @@ -139,15 +239,63 @@ func (w *Watcher) Close() error { // # Watching files // // Watching individual files (rather than directories) is generally not -// recommended as many tools update files atomically. Instead of "just" writing -// to the file a temporary file will be written to first, and if successful the -// temporary file is moved to to destination removing the original, or some -// variant thereof. The watcher on the original file is now lost, as it no -// longer exists. -// -// Instead, watch the parent directory and use Event.Name to filter out files -// you're not interested in. There is an example of this in [cmd/fsnotify/file.go]. -func (w *Watcher) Add(name string) error { +// recommended as many programs (especially editors) update files atomically: it +// will write to a temporary file which is then moved to to destination, +// overwriting the original (or some variant thereof). The watcher on the +// original file is now lost, as that no longer exists. +// +// The upshot of this is that a power failure or crash won't leave a +// half-written file. +// +// Watch the parent directory and use Event.Name to filter out files you're not +// interested in. There is an example of this in cmd/fsnotify/file.go. +func (w *Watcher) Add(name string) error { return w.AddWith(name) } + +// AddWith is like [Watcher.Add], but allows adding options. When using Add() +// the defaults described below are used. +// +// Possible options are: +// +// - [WithBufferSize] sets the buffer size for the Windows backend; no-op on +// other platforms. The default is 64K (65536 bytes). +func (w *Watcher) AddWith(name string, opts ...addOpt) error { + if w.isClosed() { + return ErrClosed + } + if w.port.PathIsWatched(name) { + return nil + } + + _ = getOptions(opts...) + + // Currently we resolve symlinks that were explicitly requested to be + // watched. Otherwise we would use LStat here. + stat, err := os.Stat(name) + if err != nil { + return err + } + + // Associate all files in the directory. + if stat.IsDir() { + err := w.handleDirectory(name, stat, true, w.associateFile) + if err != nil { + return err + } + + w.mu.Lock() + w.dirs[name] = struct{}{} + w.mu.Unlock() + return nil + } + + err = w.associateFile(name, stat, true) + if err != nil { + return err + } + + w.mu.Lock() + w.watches[name] = struct{}{} + w.mu.Unlock() return nil } @@ -157,6 +305,336 @@ func (w *Watcher) Add(name string) error { // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) Remove(name string) error { + if w.isClosed() { + return nil + } + if !w.port.PathIsWatched(name) { + return fmt.Errorf("%w: %s", ErrNonExistentWatch, name) + } + + // The user has expressed an intent. Immediately remove this name from + // whichever watch list it might be in. If it's not in there the delete + // doesn't cause harm. + w.mu.Lock() + delete(w.watches, name) + delete(w.dirs, name) + w.mu.Unlock() + + stat, err := os.Stat(name) + if err != nil { + return err + } + + // Remove associations for every file in the directory. + if stat.IsDir() { + err := w.handleDirectory(name, stat, false, w.dissociateFile) + if err != nil { + return err + } + return nil + } + + err = w.port.DissociatePath(name) + if err != nil { + return err + } + return nil } + +// readEvents contains the main loop that runs in a goroutine watching for events. +func (w *Watcher) readEvents() { + // If this function returns, the watcher has been closed and we can close + // these channels + defer func() { + close(w.Errors) + close(w.Events) + }() + + pevents := make([]unix.PortEvent, 8) + for { + count, err := w.port.Get(pevents, 1, nil) + if err != nil && err != unix.ETIME { + // Interrupted system call (count should be 0) ignore and continue + if errors.Is(err, unix.EINTR) && count == 0 { + continue + } + // Get failed because we called w.Close() + if errors.Is(err, unix.EBADF) && w.isClosed() { + return + } + // There was an error not caused by calling w.Close() + if !w.sendError(err) { + return + } + } + + p := pevents[:count] + for _, pevent := range p { + if pevent.Source != unix.PORT_SOURCE_FILE { + // Event from unexpected source received; should never happen. + if !w.sendError(errors.New("Event from unexpected source received")) { + return + } + continue + } + + err = w.handleEvent(&pevent) + if err != nil { + if !w.sendError(err) { + return + } + } + } + } +} + +func (w *Watcher) handleDirectory(path string, stat os.FileInfo, follow bool, handler func(string, os.FileInfo, bool) error) error { + files, err := os.ReadDir(path) + if err != nil { + return err + } + + // Handle all children of the directory. + for _, entry := range files { + finfo, err := entry.Info() + if err != nil { + return err + } + err = handler(filepath.Join(path, finfo.Name()), finfo, false) + if err != nil { + return err + } + } + + // And finally handle the directory itself. + return handler(path, stat, follow) +} + +// handleEvent might need to emit more than one fsnotify event if the events +// bitmap matches more than one event type (e.g. the file was both modified and +// had the attributes changed between when the association was created and the +// when event was returned) +func (w *Watcher) handleEvent(event *unix.PortEvent) error { + var ( + events = event.Events + path = event.Path + fmode = event.Cookie.(os.FileMode) + reRegister = true + ) + + w.mu.Lock() + _, watchedDir := w.dirs[path] + _, watchedPath := w.watches[path] + w.mu.Unlock() + isWatched := watchedDir || watchedPath + + if events&unix.FILE_DELETE != 0 { + if !w.sendEvent(path, Remove) { + return nil + } + reRegister = false + } + if events&unix.FILE_RENAME_FROM != 0 { + if !w.sendEvent(path, Rename) { + return nil + } + // Don't keep watching the new file name + reRegister = false + } + if events&unix.FILE_RENAME_TO != 0 { + // We don't report a Rename event for this case, because Rename events + // are interpreted as referring to the _old_ name of the file, and in + // this case the event would refer to the new name of the file. This + // type of rename event is not supported by fsnotify. + + // inotify reports a Remove event in this case, so we simulate this + // here. + if !w.sendEvent(path, Remove) { + return nil + } + // Don't keep watching the file that was removed + reRegister = false + } + + // The file is gone, nothing left to do. + if !reRegister { + if watchedDir { + w.mu.Lock() + delete(w.dirs, path) + w.mu.Unlock() + } + if watchedPath { + w.mu.Lock() + delete(w.watches, path) + w.mu.Unlock() + } + return nil + } + + // If we didn't get a deletion the file still exists and we're going to have + // to watch it again. Let's Stat it now so that we can compare permissions + // and have what we need to continue watching the file + + stat, err := os.Lstat(path) + if err != nil { + // This is unexpected, but we should still emit an event. This happens + // most often on "rm -r" of a subdirectory inside a watched directory We + // get a modify event of something happening inside, but by the time we + // get here, the sudirectory is already gone. Clearly we were watching + // this path but now it is gone. Let's tell the user that it was + // removed. + if !w.sendEvent(path, Remove) { + return nil + } + // Suppress extra write events on removed directories; they are not + // informative and can be confusing. + return nil + } + + // resolve symlinks that were explicitly watched as we would have at Add() + // time. this helps suppress spurious Chmod events on watched symlinks + if isWatched { + stat, err = os.Stat(path) + if err != nil { + // The symlink still exists, but the target is gone. Report the + // Remove similar to above. + if !w.sendEvent(path, Remove) { + return nil + } + // Don't return the error + } + } + + if events&unix.FILE_MODIFIED != 0 { + if fmode.IsDir() { + if watchedDir { + if err := w.updateDirectory(path); err != nil { + return err + } + } else { + if !w.sendEvent(path, Write) { + return nil + } + } + } else { + if !w.sendEvent(path, Write) { + return nil + } + } + } + if events&unix.FILE_ATTRIB != 0 && stat != nil { + // Only send Chmod if perms changed + if stat.Mode().Perm() != fmode.Perm() { + if !w.sendEvent(path, Chmod) { + return nil + } + } + } + + if stat != nil { + // If we get here, it means we've hit an event above that requires us to + // continue watching the file or directory + return w.associateFile(path, stat, isWatched) + } + return nil +} + +func (w *Watcher) updateDirectory(path string) error { + // The directory was modified, so we must find unwatched entities and watch + // them. If something was removed from the directory, nothing will happen, + // as everything else should still be watched. + files, err := os.ReadDir(path) + if err != nil { + return err + } + + for _, entry := range files { + path := filepath.Join(path, entry.Name()) + if w.port.PathIsWatched(path) { + continue + } + + finfo, err := entry.Info() + if err != nil { + return err + } + err = w.associateFile(path, finfo, false) + if err != nil { + if !w.sendError(err) { + return nil + } + } + if !w.sendEvent(path, Create) { + return nil + } + } + return nil +} + +func (w *Watcher) associateFile(path string, stat os.FileInfo, follow bool) error { + if w.isClosed() { + return ErrClosed + } + // This is primarily protecting the call to AssociatePath but it is + // important and intentional that the call to PathIsWatched is also + // protected by this mutex. Without this mutex, AssociatePath has been seen + // to error out that the path is already associated. + w.mu.Lock() + defer w.mu.Unlock() + + if w.port.PathIsWatched(path) { + // Remove the old association in favor of this one If we get ENOENT, + // then while the x/sys/unix wrapper still thought that this path was + // associated, the underlying event port did not. This call will have + // cleared up that discrepancy. The most likely cause is that the event + // has fired but we haven't processed it yet. + err := w.port.DissociatePath(path) + if err != nil && err != unix.ENOENT { + return err + } + } + // FILE_NOFOLLOW means we watch symlinks themselves rather than their + // targets. + events := unix.FILE_MODIFIED | unix.FILE_ATTRIB | unix.FILE_NOFOLLOW + if follow { + // We *DO* follow symlinks for explicitly watched entries. + events = unix.FILE_MODIFIED | unix.FILE_ATTRIB + } + return w.port.AssociatePath(path, stat, + events, + stat.Mode()) +} + +func (w *Watcher) dissociateFile(path string, stat os.FileInfo, unused bool) error { + if !w.port.PathIsWatched(path) { + return nil + } + return w.port.DissociatePath(path) +} + +// WatchList returns all paths explicitly added with [Watcher.Add] (and are not +// yet removed). +// +// Returns nil if [Watcher.Close] was called. +func (w *Watcher) WatchList() []string { + if w.isClosed() { + return nil + } + + w.mu.Lock() + defer w.mu.Unlock() + + entries := make([]string, 0, len(w.watches)+len(w.dirs)) + for pathname := range w.dirs { + entries = append(entries, pathname) + } + for pathname := range w.watches { + entries = append(entries, pathname) + } + + return entries +} diff --git a/vendor/github.com/fsnotify/fsnotify/backend_inotify.go b/vendor/github.com/fsnotify/fsnotify/backend_inotify.go index 54c77fbb0..921c1c1e4 100644 --- a/vendor/github.com/fsnotify/fsnotify/backend_inotify.go +++ b/vendor/github.com/fsnotify/fsnotify/backend_inotify.go @@ -1,5 +1,8 @@ -//go:build linux -// +build linux +//go:build linux && !appengine +// +build linux,!appengine + +// Note: the documentation on the Watcher type and methods is generated from +// mkdoc.zsh package fsnotify @@ -26,9 +29,9 @@ import ( // When a file is removed a Remove event won't be emitted until all file // descriptors are closed, and deletes will always emit a Chmod. For example: // -// fp := os.Open("file") -// os.Remove("file") // Triggers Chmod -// fp.Close() // Triggers Remove +// fp := os.Open("file") +// os.Remove("file") // Triggers Chmod +// fp.Close() // Triggers Remove // // This is the event that inotify sends, so not much can be changed about this. // @@ -42,16 +45,16 @@ import ( // // To increase them you can use sysctl or write the value to the /proc file: // -// # Default values on Linux 5.18 -// sysctl fs.inotify.max_user_watches=124983 -// sysctl fs.inotify.max_user_instances=128 +// # Default values on Linux 5.18 +// sysctl fs.inotify.max_user_watches=124983 +// sysctl fs.inotify.max_user_instances=128 // // To make the changes persist on reboot edit /etc/sysctl.conf or // /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check // your distro's documentation): // -// fs.inotify.max_user_watches=124983 -// fs.inotify.max_user_instances=128 +// fs.inotify.max_user_watches=124983 +// fs.inotify.max_user_instances=128 // // Reaching the limit will result in a "no space left on device" or "too many open // files" error. @@ -67,14 +70,20 @@ import ( // control the maximum number of open files, as well as /etc/login.conf on BSD // systems. // -// # macOS notes +// # Windows notes +// +// Paths can be added as "C:\path\to\dir", but forward slashes +// ("C:/path/to/dir") will also work. // -// Spotlight indexing on macOS can result in multiple events (see [#15]). A -// temporary workaround is to add your folder(s) to the "Spotlight Privacy -// Settings" until we have a native FSEvents implementation (see [#11]). +// When a watched directory is removed it will always send an event for the +// directory itself, but may not send events for all files in that directory. +// Sometimes it will send events for all times, sometimes it will send no +// events, and often only for some files. // -// [#11]: https://github.com/fsnotify/fsnotify/issues/11 -// [#15]: https://github.com/fsnotify/fsnotify/issues/15 +// The default ReadDirectoryChangesW() buffer size is 64K, which is the largest +// value that is guaranteed to work with SMB filesystems. If you have many +// events in quick succession this may not be enough, and you will have to use +// [WithBufferSize] to increase the value. type Watcher struct { // Events sends the filesystem change events. // @@ -101,36 +110,148 @@ type Watcher struct { // initiated by the user may show up as one or multiple // writes, depending on when the system syncs things to // disk. For example when compiling a large Go program - // you may get hundreds of Write events, so you - // probably want to wait until you've stopped receiving - // them (see the dedup example in cmd/fsnotify). + // you may get hundreds of Write events, and you may + // want to wait until you've stopped receiving them + // (see the dedup example in cmd/fsnotify). + // + // Some systems may send Write event for directories + // when the directory content changes. // // fsnotify.Chmod Attributes were changed. On Linux this is also sent // when a file is removed (or more accurately, when a // link to an inode is removed). On kqueue it's sent - // and on kqueue when a file is truncated. On Windows - // it's never sent. + // when a file is truncated. On Windows it's never + // sent. Events chan Event // Errors sends any errors. + // + // ErrEventOverflow is used to indicate there are too many events: + // + // - inotify: There are too many queued events (fs.inotify.max_queued_events sysctl) + // - windows: The buffer size is too small; WithBufferSize() can be used to increase it. + // - kqueue, fen: Not used. Errors chan error // Store fd here as os.File.Read() will no longer return on close after // calling Fd(). See: https://github.com/golang/go/issues/26439 fd int - mu sync.Mutex // Map access inotifyFile *os.File - watches map[string]*watch // Map of inotify watches (key: path) - paths map[int]string // Map of watched paths (key: watch descriptor) - done chan struct{} // Channel for sending a "quit message" to the reader goroutine - doneResp chan struct{} // Channel to respond to Close + watches *watches + done chan struct{} // Channel for sending a "quit message" to the reader goroutine + closeMu sync.Mutex + doneResp chan struct{} // Channel to respond to Close +} + +type ( + watches struct { + mu sync.RWMutex + wd map[uint32]*watch // wd → watch + path map[string]uint32 // pathname → wd + } + watch struct { + wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall) + flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags) + path string // Watch path. + } +) + +func newWatches() *watches { + return &watches{ + wd: make(map[uint32]*watch), + path: make(map[string]uint32), + } +} + +func (w *watches) len() int { + w.mu.RLock() + defer w.mu.RUnlock() + return len(w.wd) +} + +func (w *watches) add(ww *watch) { + w.mu.Lock() + defer w.mu.Unlock() + w.wd[ww.wd] = ww + w.path[ww.path] = ww.wd +} + +func (w *watches) remove(wd uint32) { + w.mu.Lock() + defer w.mu.Unlock() + delete(w.path, w.wd[wd].path) + delete(w.wd, wd) +} + +func (w *watches) removePath(path string) (uint32, bool) { + w.mu.Lock() + defer w.mu.Unlock() + + wd, ok := w.path[path] + if !ok { + return 0, false + } + + delete(w.path, path) + delete(w.wd, wd) + + return wd, true +} + +func (w *watches) byPath(path string) *watch { + w.mu.RLock() + defer w.mu.RUnlock() + return w.wd[w.path[path]] +} + +func (w *watches) byWd(wd uint32) *watch { + w.mu.RLock() + defer w.mu.RUnlock() + return w.wd[wd] +} + +func (w *watches) updatePath(path string, f func(*watch) (*watch, error)) error { + w.mu.Lock() + defer w.mu.Unlock() + + var existing *watch + wd, ok := w.path[path] + if ok { + existing = w.wd[wd] + } + + upd, err := f(existing) + if err != nil { + return err + } + if upd != nil { + w.wd[upd.wd] = upd + w.path[upd.path] = upd.wd + + if upd.wd != wd { + delete(w.wd, wd) + } + } + + return nil } // NewWatcher creates a new Watcher. func NewWatcher() (*Watcher, error) { - // Create inotify fd - // Need to set the FD to nonblocking mode in order for SetDeadline methods to work - // Otherwise, blocking i/o operations won't terminate on close + return NewBufferedWatcher(0) +} + +// NewBufferedWatcher creates a new Watcher with a buffered Watcher.Events +// channel. +// +// The main use case for this is situations with a very large number of events +// where the kernel buffer size can't be increased (e.g. due to lack of +// permissions). An unbuffered Watcher will perform better for almost all use +// cases, and whenever possible you will be better off increasing the kernel +// buffers instead of adding a large userspace buffer. +func NewBufferedWatcher(sz uint) (*Watcher, error) { + // Need to set nonblocking mode for SetDeadline to work, otherwise blocking + // I/O operations won't terminate on close. fd, errno := unix.InotifyInit1(unix.IN_CLOEXEC | unix.IN_NONBLOCK) if fd == -1 { return nil, errno @@ -139,9 +260,8 @@ func NewWatcher() (*Watcher, error) { w := &Watcher{ fd: fd, inotifyFile: os.NewFile(uintptr(fd), ""), - watches: make(map[string]*watch), - paths: make(map[int]string), - Events: make(chan Event), + watches: newWatches(), + Events: make(chan Event, sz), Errors: make(chan error), done: make(chan struct{}), doneResp: make(chan struct{}), @@ -157,8 +277,8 @@ func (w *Watcher) sendEvent(e Event) bool { case w.Events <- e: return true case <-w.done: + return false } - return false } // Returns true if the error was sent, or false if watcher is closed. @@ -180,17 +300,15 @@ func (w *Watcher) isClosed() bool { } } -// Close removes all watches and closes the events channel. +// Close removes all watches and closes the Events channel. func (w *Watcher) Close() error { - w.mu.Lock() + w.closeMu.Lock() if w.isClosed() { - w.mu.Unlock() + w.closeMu.Unlock() return nil } - - // Send 'close' signal to goroutine, and set the Watcher to closed. close(w.done) - w.mu.Unlock() + w.closeMu.Unlock() // Causes any blocking reads to return with an error, provided the file // still supports deadline operations. @@ -207,17 +325,21 @@ func (w *Watcher) Close() error { // Add starts monitoring the path for changes. // -// A path can only be watched once; attempting to watch it more than once will -// return an error. Paths that do not yet exist on the filesystem cannot be -// added. A watch will be automatically removed if the path is deleted. +// A path can only be watched once; watching it more than once is a no-op and will +// not return an error. Paths that do not yet exist on the filesystem cannot be +// watched. // -// A path will remain watched if it gets renamed to somewhere else on the same -// filesystem, but the monitor will get removed if the path gets deleted and -// re-created, or if it's moved to a different filesystem. +// A watch will be automatically removed if the watched path is deleted or +// renamed. The exception is the Windows backend, which doesn't remove the +// watcher on renames. // // Notifications on network filesystems (NFS, SMB, FUSE, etc.) or special // filesystems (/proc, /sys, etc.) generally don't work. // +// Returns [ErrClosed] if [Watcher.Close] was called. +// +// See [Watcher.AddWith] for a version that allows adding options. +// // # Watching directories // // All files in a directory are monitored, including new files that are created @@ -227,44 +349,59 @@ func (w *Watcher) Close() error { // # Watching files // // Watching individual files (rather than directories) is generally not -// recommended as many tools update files atomically. Instead of "just" writing -// to the file a temporary file will be written to first, and if successful the -// temporary file is moved to to destination removing the original, or some -// variant thereof. The watcher on the original file is now lost, as it no -// longer exists. -// -// Instead, watch the parent directory and use Event.Name to filter out files -// you're not interested in. There is an example of this in [cmd/fsnotify/file.go]. -func (w *Watcher) Add(name string) error { - name = filepath.Clean(name) +// recommended as many programs (especially editors) update files atomically: it +// will write to a temporary file which is then moved to to destination, +// overwriting the original (or some variant thereof). The watcher on the +// original file is now lost, as that no longer exists. +// +// The upshot of this is that a power failure or crash won't leave a +// half-written file. +// +// Watch the parent directory and use Event.Name to filter out files you're not +// interested in. There is an example of this in cmd/fsnotify/file.go. +func (w *Watcher) Add(name string) error { return w.AddWith(name) } + +// AddWith is like [Watcher.Add], but allows adding options. When using Add() +// the defaults described below are used. +// +// Possible options are: +// +// - [WithBufferSize] sets the buffer size for the Windows backend; no-op on +// other platforms. The default is 64K (65536 bytes). +func (w *Watcher) AddWith(name string, opts ...addOpt) error { if w.isClosed() { - return errors.New("inotify instance already closed") + return ErrClosed } + name = filepath.Clean(name) + _ = getOptions(opts...) + var flags uint32 = unix.IN_MOVED_TO | unix.IN_MOVED_FROM | unix.IN_CREATE | unix.IN_ATTRIB | unix.IN_MODIFY | unix.IN_MOVE_SELF | unix.IN_DELETE | unix.IN_DELETE_SELF - w.mu.Lock() - defer w.mu.Unlock() - watchEntry := w.watches[name] - if watchEntry != nil { - flags |= watchEntry.flags | unix.IN_MASK_ADD - } - wd, errno := unix.InotifyAddWatch(w.fd, name, flags) - if wd == -1 { - return errno - } + return w.watches.updatePath(name, func(existing *watch) (*watch, error) { + if existing != nil { + flags |= existing.flags | unix.IN_MASK_ADD + } - if watchEntry == nil { - w.watches[name] = &watch{wd: uint32(wd), flags: flags} - w.paths[wd] = name - } else { - watchEntry.wd = uint32(wd) - watchEntry.flags = flags - } + wd, err := unix.InotifyAddWatch(w.fd, name, flags) + if wd == -1 { + return nil, err + } - return nil + if existing == nil { + return &watch{ + wd: uint32(wd), + path: name, + flags: flags, + }, nil + } + + existing.wd = uint32(wd) + existing.flags = flags + return existing, nil + }) } // Remove stops monitoring the path for changes. @@ -273,32 +410,22 @@ func (w *Watcher) Add(name string) error { // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) Remove(name string) error { - name = filepath.Clean(name) - - // Fetch the watch. - w.mu.Lock() - defer w.mu.Unlock() - watch, ok := w.watches[name] + if w.isClosed() { + return nil + } + return w.remove(filepath.Clean(name)) +} - // Remove it from inotify. +func (w *Watcher) remove(name string) error { + wd, ok := w.watches.removePath(name) if !ok { return fmt.Errorf("%w: %s", ErrNonExistentWatch, name) } - // We successfully removed the watch if InotifyRmWatch doesn't return an - // error, we need to clean up our internal state to ensure it matches - // inotify's kernel state. - delete(w.paths, int(watch.wd)) - delete(w.watches, name) - - // inotify_rm_watch will return EINVAL if the file has been deleted; - // the inotify will already have been removed. - // watches and pathes are deleted in ignoreLinux() implicitly and asynchronously - // by calling inotify_rm_watch() below. e.g. readEvents() goroutine receives IN_IGNORE - // so that EINVAL means that the wd is being rm_watch()ed or its file removed - // by another thread and we have not received IN_IGNORE event. - success, errno := unix.InotifyRmWatch(w.fd, watch.wd) + success, errno := unix.InotifyRmWatch(w.fd, wd) if success == -1 { // TODO: Perhaps it's not helpful to return an error here in every case; // The only two possible errors are: @@ -312,28 +439,28 @@ func (w *Watcher) Remove(name string) error { // are watching is deleted. return errno } - return nil } -// WatchList returns all paths added with [Add] (and are not yet removed). +// WatchList returns all paths explicitly added with [Watcher.Add] (and are not +// yet removed). +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) WatchList() []string { - w.mu.Lock() - defer w.mu.Unlock() + if w.isClosed() { + return nil + } - entries := make([]string, 0, len(w.watches)) - for pathname := range w.watches { + entries := make([]string, 0, w.watches.len()) + w.watches.mu.RLock() + for pathname := range w.watches.path { entries = append(entries, pathname) } + w.watches.mu.RUnlock() return entries } -type watch struct { - wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall) - flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags) -} - // readEvents reads from the inotify file descriptor, converts the // received events into Event objects and sends them via the Events channel func (w *Watcher) readEvents() { @@ -367,14 +494,11 @@ func (w *Watcher) readEvents() { if n < unix.SizeofInotifyEvent { var err error if n == 0 { - // If EOF is received. This should really never happen. - err = io.EOF + err = io.EOF // If EOF is received. This should really never happen. } else if n < 0 { - // If an error occurred while reading. - err = errno + err = errno // If an error occurred while reading. } else { - // Read was too short. - err = errors.New("notify: short read in readEvents()") + err = errors.New("notify: short read in readEvents()") // Read was too short. } if !w.sendError(err) { return @@ -403,18 +527,29 @@ func (w *Watcher) readEvents() { // doesn't append the filename to the event, but we would like to always fill the // the "Name" field with a valid filename. We retrieve the path of the watch from // the "paths" map. - w.mu.Lock() - name, ok := w.paths[int(raw.Wd)] - // IN_DELETE_SELF occurs when the file/directory being watched is removed. - // This is a sign to clean up the maps, otherwise we are no longer in sync - // with the inotify kernel state which has already deleted the watch - // automatically. - if ok && mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF { - delete(w.paths, int(raw.Wd)) - delete(w.watches, name) + watch := w.watches.byWd(uint32(raw.Wd)) + + // inotify will automatically remove the watch on deletes; just need + // to clean our state here. + if watch != nil && mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF { + w.watches.remove(watch.wd) + } + // We can't really update the state when a watched path is moved; + // only IN_MOVE_SELF is sent and not IN_MOVED_{FROM,TO}. So remove + // the watch. + if watch != nil && mask&unix.IN_MOVE_SELF == unix.IN_MOVE_SELF { + err := w.remove(watch.path) + if err != nil && !errors.Is(err, ErrNonExistentWatch) { + if !w.sendError(err) { + return + } + } } - w.mu.Unlock() + var name string + if watch != nil { + name = watch.path + } if nameLen > 0 { // Point "bytes" at the first byte of the filename bytes := (*[unix.PathMax]byte)(unsafe.Pointer(&buf[offset+unix.SizeofInotifyEvent]))[:nameLen:nameLen] diff --git a/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go b/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go index 29087469b..063a0915a 100644 --- a/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go +++ b/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go @@ -1,12 +1,14 @@ //go:build freebsd || openbsd || netbsd || dragonfly || darwin // +build freebsd openbsd netbsd dragonfly darwin +// Note: the documentation on the Watcher type and methods is generated from +// mkdoc.zsh + package fsnotify import ( "errors" "fmt" - "io/ioutil" "os" "path/filepath" "sync" @@ -24,9 +26,9 @@ import ( // When a file is removed a Remove event won't be emitted until all file // descriptors are closed, and deletes will always emit a Chmod. For example: // -// fp := os.Open("file") -// os.Remove("file") // Triggers Chmod -// fp.Close() // Triggers Remove +// fp := os.Open("file") +// os.Remove("file") // Triggers Chmod +// fp.Close() // Triggers Remove // // This is the event that inotify sends, so not much can be changed about this. // @@ -40,16 +42,16 @@ import ( // // To increase them you can use sysctl or write the value to the /proc file: // -// # Default values on Linux 5.18 -// sysctl fs.inotify.max_user_watches=124983 -// sysctl fs.inotify.max_user_instances=128 +// # Default values on Linux 5.18 +// sysctl fs.inotify.max_user_watches=124983 +// sysctl fs.inotify.max_user_instances=128 // // To make the changes persist on reboot edit /etc/sysctl.conf or // /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check // your distro's documentation): // -// fs.inotify.max_user_watches=124983 -// fs.inotify.max_user_instances=128 +// fs.inotify.max_user_watches=124983 +// fs.inotify.max_user_instances=128 // // Reaching the limit will result in a "no space left on device" or "too many open // files" error. @@ -65,14 +67,20 @@ import ( // control the maximum number of open files, as well as /etc/login.conf on BSD // systems. // -// # macOS notes +// # Windows notes +// +// Paths can be added as "C:\path\to\dir", but forward slashes +// ("C:/path/to/dir") will also work. // -// Spotlight indexing on macOS can result in multiple events (see [#15]). A -// temporary workaround is to add your folder(s) to the "Spotlight Privacy -// Settings" until we have a native FSEvents implementation (see [#11]). +// When a watched directory is removed it will always send an event for the +// directory itself, but may not send events for all files in that directory. +// Sometimes it will send events for all times, sometimes it will send no +// events, and often only for some files. // -// [#11]: https://github.com/fsnotify/fsnotify/issues/11 -// [#15]: https://github.com/fsnotify/fsnotify/issues/15 +// The default ReadDirectoryChangesW() buffer size is 64K, which is the largest +// value that is guaranteed to work with SMB filesystems. If you have many +// events in quick succession this may not be enough, and you will have to use +// [WithBufferSize] to increase the value. type Watcher struct { // Events sends the filesystem change events. // @@ -99,18 +107,27 @@ type Watcher struct { // initiated by the user may show up as one or multiple // writes, depending on when the system syncs things to // disk. For example when compiling a large Go program - // you may get hundreds of Write events, so you - // probably want to wait until you've stopped receiving - // them (see the dedup example in cmd/fsnotify). + // you may get hundreds of Write events, and you may + // want to wait until you've stopped receiving them + // (see the dedup example in cmd/fsnotify). + // + // Some systems may send Write event for directories + // when the directory content changes. // // fsnotify.Chmod Attributes were changed. On Linux this is also sent // when a file is removed (or more accurately, when a // link to an inode is removed). On kqueue it's sent - // and on kqueue when a file is truncated. On Windows - // it's never sent. + // when a file is truncated. On Windows it's never + // sent. Events chan Event // Errors sends any errors. + // + // ErrEventOverflow is used to indicate there are too many events: + // + // - inotify: There are too many queued events (fs.inotify.max_queued_events sysctl) + // - windows: The buffer size is too small; WithBufferSize() can be used to increase it. + // - kqueue, fen: Not used. Errors chan error done chan struct{} @@ -133,6 +150,18 @@ type pathInfo struct { // NewWatcher creates a new Watcher. func NewWatcher() (*Watcher, error) { + return NewBufferedWatcher(0) +} + +// NewBufferedWatcher creates a new Watcher with a buffered Watcher.Events +// channel. +// +// The main use case for this is situations with a very large number of events +// where the kernel buffer size can't be increased (e.g. due to lack of +// permissions). An unbuffered Watcher will perform better for almost all use +// cases, and whenever possible you will be better off increasing the kernel +// buffers instead of adding a large userspace buffer. +func NewBufferedWatcher(sz uint) (*Watcher, error) { kq, closepipe, err := newKqueue() if err != nil { return nil, err @@ -147,7 +176,7 @@ func NewWatcher() (*Watcher, error) { paths: make(map[int]pathInfo), fileExists: make(map[string]struct{}), userWatches: make(map[string]struct{}), - Events: make(chan Event), + Events: make(chan Event, sz), Errors: make(chan error), done: make(chan struct{}), } @@ -197,8 +226,8 @@ func (w *Watcher) sendEvent(e Event) bool { case w.Events <- e: return true case <-w.done: + return false } - return false } // Returns true if the error was sent, or false if watcher is closed. @@ -207,11 +236,11 @@ func (w *Watcher) sendError(err error) bool { case w.Errors <- err: return true case <-w.done: + return false } - return false } -// Close removes all watches and closes the events channel. +// Close removes all watches and closes the Events channel. func (w *Watcher) Close() error { w.mu.Lock() if w.isClosed { @@ -239,17 +268,21 @@ func (w *Watcher) Close() error { // Add starts monitoring the path for changes. // -// A path can only be watched once; attempting to watch it more than once will -// return an error. Paths that do not yet exist on the filesystem cannot be -// added. A watch will be automatically removed if the path is deleted. +// A path can only be watched once; watching it more than once is a no-op and will +// not return an error. Paths that do not yet exist on the filesystem cannot be +// watched. // -// A path will remain watched if it gets renamed to somewhere else on the same -// filesystem, but the monitor will get removed if the path gets deleted and -// re-created, or if it's moved to a different filesystem. +// A watch will be automatically removed if the watched path is deleted or +// renamed. The exception is the Windows backend, which doesn't remove the +// watcher on renames. // // Notifications on network filesystems (NFS, SMB, FUSE, etc.) or special // filesystems (/proc, /sys, etc.) generally don't work. // +// Returns [ErrClosed] if [Watcher.Close] was called. +// +// See [Watcher.AddWith] for a version that allows adding options. +// // # Watching directories // // All files in a directory are monitored, including new files that are created @@ -259,15 +292,28 @@ func (w *Watcher) Close() error { // # Watching files // // Watching individual files (rather than directories) is generally not -// recommended as many tools update files atomically. Instead of "just" writing -// to the file a temporary file will be written to first, and if successful the -// temporary file is moved to to destination removing the original, or some -// variant thereof. The watcher on the original file is now lost, as it no -// longer exists. -// -// Instead, watch the parent directory and use Event.Name to filter out files -// you're not interested in. There is an example of this in [cmd/fsnotify/file.go]. -func (w *Watcher) Add(name string) error { +// recommended as many programs (especially editors) update files atomically: it +// will write to a temporary file which is then moved to to destination, +// overwriting the original (or some variant thereof). The watcher on the +// original file is now lost, as that no longer exists. +// +// The upshot of this is that a power failure or crash won't leave a +// half-written file. +// +// Watch the parent directory and use Event.Name to filter out files you're not +// interested in. There is an example of this in cmd/fsnotify/file.go. +func (w *Watcher) Add(name string) error { return w.AddWith(name) } + +// AddWith is like [Watcher.Add], but allows adding options. When using Add() +// the defaults described below are used. +// +// Possible options are: +// +// - [WithBufferSize] sets the buffer size for the Windows backend; no-op on +// other platforms. The default is 64K (65536 bytes). +func (w *Watcher) AddWith(name string, opts ...addOpt) error { + _ = getOptions(opts...) + w.mu.Lock() w.userWatches[name] = struct{}{} w.mu.Unlock() @@ -281,9 +327,19 @@ func (w *Watcher) Add(name string) error { // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) Remove(name string) error { + return w.remove(name, true) +} + +func (w *Watcher) remove(name string, unwatchFiles bool) error { name = filepath.Clean(name) w.mu.Lock() + if w.isClosed { + w.mu.Unlock() + return nil + } watchfd, ok := w.watches[name] w.mu.Unlock() if !ok { @@ -315,7 +371,7 @@ func (w *Watcher) Remove(name string) error { w.mu.Unlock() // Find all watched paths that are in this directory that are not external. - if isDir { + if unwatchFiles && isDir { var pathsToRemove []string w.mu.Lock() for fd := range w.watchesByDir[name] { @@ -326,20 +382,25 @@ func (w *Watcher) Remove(name string) error { } w.mu.Unlock() for _, name := range pathsToRemove { - // Since these are internal, not much sense in propagating error - // to the user, as that will just confuse them with an error about - // a path they did not explicitly watch themselves. + // Since these are internal, not much sense in propagating error to + // the user, as that will just confuse them with an error about a + // path they did not explicitly watch themselves. w.Remove(name) } } - return nil } -// WatchList returns all paths added with [Add] (and are not yet removed). +// WatchList returns all paths explicitly added with [Watcher.Add] (and are not +// yet removed). +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) WatchList() []string { w.mu.Lock() defer w.mu.Unlock() + if w.isClosed { + return nil + } entries := make([]string, 0, len(w.userWatches)) for pathname := range w.userWatches { @@ -352,18 +413,18 @@ func (w *Watcher) WatchList() []string { // Watch all events (except NOTE_EXTEND, NOTE_LINK, NOTE_REVOKE) const noteAllEvents = unix.NOTE_DELETE | unix.NOTE_WRITE | unix.NOTE_ATTRIB | unix.NOTE_RENAME -// addWatch adds name to the watched file set. -// The flags are interpreted as described in kevent(2). -// Returns the real path to the file which was added, if any, which may be different from the one passed in the case of symlinks. +// addWatch adds name to the watched file set; the flags are interpreted as +// described in kevent(2). +// +// Returns the real path to the file which was added, with symlinks resolved. func (w *Watcher) addWatch(name string, flags uint32) (string, error) { var isDir bool - // Make ./name and name equivalent name = filepath.Clean(name) w.mu.Lock() if w.isClosed { w.mu.Unlock() - return "", errors.New("kevent instance already closed") + return "", ErrClosed } watchfd, alreadyWatching := w.watches[name] // We already have a watch, but we can still override flags. @@ -383,27 +444,30 @@ func (w *Watcher) addWatch(name string, flags uint32) (string, error) { return "", nil } - // Follow Symlinks - // - // Linux can add unresolvable symlinks to the watch list without issue, - // and Windows can't do symlinks period. To maintain consistency, we - // will act like everything is fine if the link can't be resolved. - // There will simply be no file events for broken symlinks. Hence the - // returns of nil on errors. + // Follow Symlinks. if fi.Mode()&os.ModeSymlink == os.ModeSymlink { - name, err = filepath.EvalSymlinks(name) + link, err := os.Readlink(name) if err != nil { + // Return nil because Linux can add unresolvable symlinks to the + // watch list without problems, so maintain consistency with + // that. There will be no file events for broken symlinks. + // TODO: more specific check; returns os.PathError; ENOENT? return "", nil } w.mu.Lock() - _, alreadyWatching = w.watches[name] + _, alreadyWatching = w.watches[link] w.mu.Unlock() if alreadyWatching { - return name, nil + // Add to watches so we don't get spurious Create events later + // on when we diff the directories. + w.watches[name] = 0 + w.fileExists[name] = struct{}{} + return link, nil } + name = link fi, err = os.Lstat(name) if err != nil { return "", nil @@ -411,7 +475,7 @@ func (w *Watcher) addWatch(name string, flags uint32) (string, error) { } // Retry on EINTR; open() can return EINTR in practice on macOS. - // See #354, and go issues 11180 and 39237. + // See #354, and Go issues 11180 and 39237. for { watchfd, err = unix.Open(name, openMode, 0) if err == nil { @@ -444,14 +508,13 @@ func (w *Watcher) addWatch(name string, flags uint32) (string, error) { w.watchesByDir[parentName] = watchesByDir } watchesByDir[watchfd] = struct{}{} - w.paths[watchfd] = pathInfo{name: name, isDir: isDir} w.mu.Unlock() } if isDir { - // Watch the directory if it has not been watched before, - // or if it was watched before, but perhaps only a NOTE_DELETE (watchDirectoryFiles) + // Watch the directory if it has not been watched before, or if it was + // watched before, but perhaps only a NOTE_DELETE (watchDirectoryFiles) w.mu.Lock() watchDir := (flags&unix.NOTE_WRITE) == unix.NOTE_WRITE && @@ -473,13 +536,10 @@ func (w *Watcher) addWatch(name string, flags uint32) (string, error) { // Event values that it sends down the Events channel. func (w *Watcher) readEvents() { defer func() { - err := unix.Close(w.kq) - if err != nil { - w.Errors <- err - } - unix.Close(w.closepipe[0]) close(w.Events) close(w.Errors) + _ = unix.Close(w.kq) + unix.Close(w.closepipe[0]) }() eventBuffer := make([]unix.Kevent_t, 10) @@ -513,18 +573,8 @@ func (w *Watcher) readEvents() { event := w.newEvent(path.name, mask) - if path.isDir && !event.Has(Remove) { - // Double check to make sure the directory exists. This can - // happen when we do a rm -fr on a recursively watched folders - // and we receive a modification event first but the folder has - // been deleted and later receive the delete event. - if _, err := os.Lstat(event.Name); os.IsNotExist(err) { - event.Op |= Remove - } - } - if event.Has(Rename) || event.Has(Remove) { - w.Remove(event.Name) + w.remove(event.Name, false) w.mu.Lock() delete(w.fileExists, event.Name) w.mu.Unlock() @@ -540,26 +590,30 @@ func (w *Watcher) readEvents() { } if event.Has(Remove) { - // Look for a file that may have overwritten this. - // For example, mv f1 f2 will delete f2, then create f2. + // Look for a file that may have overwritten this; for example, + // mv f1 f2 will delete f2, then create f2. if path.isDir { fileDir := filepath.Clean(event.Name) w.mu.Lock() _, found := w.watches[fileDir] w.mu.Unlock() if found { - // make sure the directory exists before we watch for changes. When we - // do a recursive watch and perform rm -fr, the parent directory might - // have gone missing, ignore the missing directory and let the - // upcoming delete event remove the watch from the parent directory. - if _, err := os.Lstat(fileDir); err == nil { - w.sendDirectoryChangeEvents(fileDir) + err := w.sendDirectoryChangeEvents(fileDir) + if err != nil { + if !w.sendError(err) { + closed = true + } } } } else { filePath := filepath.Clean(event.Name) - if fileInfo, err := os.Lstat(filePath); err == nil { - w.sendFileCreatedEventIfNew(filePath, fileInfo) + if fi, err := os.Lstat(filePath); err == nil { + err := w.sendFileCreatedEventIfNew(filePath, fi) + if err != nil { + if !w.sendError(err) { + closed = true + } + } } } } @@ -582,21 +636,31 @@ func (w *Watcher) newEvent(name string, mask uint32) Event { if mask&unix.NOTE_ATTRIB == unix.NOTE_ATTRIB { e.Op |= Chmod } + // No point sending a write and delete event at the same time: if it's gone, + // then it's gone. + if e.Op.Has(Write) && e.Op.Has(Remove) { + e.Op &^= Write + } return e } // watchDirectoryFiles to mimic inotify when adding a watch on a directory func (w *Watcher) watchDirectoryFiles(dirPath string) error { // Get all files - files, err := ioutil.ReadDir(dirPath) + files, err := os.ReadDir(dirPath) if err != nil { return err } - for _, fileInfo := range files { - path := filepath.Join(dirPath, fileInfo.Name()) + for _, f := range files { + path := filepath.Join(dirPath, f.Name()) + + fi, err := f.Info() + if err != nil { + return fmt.Errorf("%q: %w", path, err) + } - cleanPath, err := w.internalWatch(path, fileInfo) + cleanPath, err := w.internalWatch(path, fi) if err != nil { // No permission to read the file; that's not a problem: just skip. // But do add it to w.fileExists to prevent it from being picked up @@ -606,7 +670,7 @@ func (w *Watcher) watchDirectoryFiles(dirPath string) error { case errors.Is(err, unix.EACCES) || errors.Is(err, unix.EPERM): cleanPath = filepath.Clean(path) default: - return fmt.Errorf("%q: %w", filepath.Join(dirPath, fileInfo.Name()), err) + return fmt.Errorf("%q: %w", path, err) } } @@ -622,26 +686,37 @@ func (w *Watcher) watchDirectoryFiles(dirPath string) error { // // This functionality is to have the BSD watcher match the inotify, which sends // a create event for files created in a watched directory. -func (w *Watcher) sendDirectoryChangeEvents(dir string) { - // Get all files - files, err := ioutil.ReadDir(dir) +func (w *Watcher) sendDirectoryChangeEvents(dir string) error { + files, err := os.ReadDir(dir) if err != nil { - if !w.sendError(fmt.Errorf("fsnotify.sendDirectoryChangeEvents: %w", err)) { - return + // Directory no longer exists: we can ignore this safely. kqueue will + // still give us the correct events. + if errors.Is(err, os.ErrNotExist) { + return nil } + return fmt.Errorf("fsnotify.sendDirectoryChangeEvents: %w", err) } - // Search for new files - for _, fi := range files { - err := w.sendFileCreatedEventIfNew(filepath.Join(dir, fi.Name()), fi) + for _, f := range files { + fi, err := f.Info() if err != nil { - return + return fmt.Errorf("fsnotify.sendDirectoryChangeEvents: %w", err) + } + + err = w.sendFileCreatedEventIfNew(filepath.Join(dir, fi.Name()), fi) + if err != nil { + // Don't need to send an error if this file isn't readable. + if errors.Is(err, unix.EACCES) || errors.Is(err, unix.EPERM) { + return nil + } + return fmt.Errorf("fsnotify.sendDirectoryChangeEvents: %w", err) } } + return nil } // sendFileCreatedEvent sends a create event if the file isn't already being tracked. -func (w *Watcher) sendFileCreatedEventIfNew(filePath string, fileInfo os.FileInfo) (err error) { +func (w *Watcher) sendFileCreatedEventIfNew(filePath string, fi os.FileInfo) (err error) { w.mu.Lock() _, doesExist := w.fileExists[filePath] w.mu.Unlock() @@ -652,7 +727,7 @@ func (w *Watcher) sendFileCreatedEventIfNew(filePath string, fileInfo os.FileInf } // like watchDirectoryFiles (but without doing another ReadDir) - filePath, err = w.internalWatch(filePath, fileInfo) + filePath, err = w.internalWatch(filePath, fi) if err != nil { return err } @@ -664,10 +739,10 @@ func (w *Watcher) sendFileCreatedEventIfNew(filePath string, fileInfo os.FileInf return nil } -func (w *Watcher) internalWatch(name string, fileInfo os.FileInfo) (string, error) { - if fileInfo.IsDir() { - // mimic Linux providing delete events for subdirectories - // but preserve the flags used if currently watching subdirectory +func (w *Watcher) internalWatch(name string, fi os.FileInfo) (string, error) { + if fi.IsDir() { + // mimic Linux providing delete events for subdirectories, but preserve + // the flags used if currently watching subdirectory w.mu.Lock() flags := w.dirFlags[name] w.mu.Unlock() diff --git a/vendor/github.com/fsnotify/fsnotify/backend_other.go b/vendor/github.com/fsnotify/fsnotify/backend_other.go index a9bb1c3c4..d34a23c01 100644 --- a/vendor/github.com/fsnotify/fsnotify/backend_other.go +++ b/vendor/github.com/fsnotify/fsnotify/backend_other.go @@ -1,39 +1,169 @@ -//go:build !darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows -// +build !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows +//go:build appengine || (!darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows) +// +build appengine !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows + +// Note: the documentation on the Watcher type and methods is generated from +// mkdoc.zsh package fsnotify -import ( - "fmt" - "runtime" -) +import "errors" -// Watcher watches a set of files, delivering events to a channel. -type Watcher struct{} +// Watcher watches a set of paths, delivering events on a channel. +// +// A watcher should not be copied (e.g. pass it by pointer, rather than by +// value). +// +// # Linux notes +// +// When a file is removed a Remove event won't be emitted until all file +// descriptors are closed, and deletes will always emit a Chmod. For example: +// +// fp := os.Open("file") +// os.Remove("file") // Triggers Chmod +// fp.Close() // Triggers Remove +// +// This is the event that inotify sends, so not much can be changed about this. +// +// The fs.inotify.max_user_watches sysctl variable specifies the upper limit +// for the number of watches per user, and fs.inotify.max_user_instances +// specifies the maximum number of inotify instances per user. Every Watcher you +// create is an "instance", and every path you add is a "watch". +// +// These are also exposed in /proc as /proc/sys/fs/inotify/max_user_watches and +// /proc/sys/fs/inotify/max_user_instances +// +// To increase them you can use sysctl or write the value to the /proc file: +// +// # Default values on Linux 5.18 +// sysctl fs.inotify.max_user_watches=124983 +// sysctl fs.inotify.max_user_instances=128 +// +// To make the changes persist on reboot edit /etc/sysctl.conf or +// /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check +// your distro's documentation): +// +// fs.inotify.max_user_watches=124983 +// fs.inotify.max_user_instances=128 +// +// Reaching the limit will result in a "no space left on device" or "too many open +// files" error. +// +// # kqueue notes (macOS, BSD) +// +// kqueue requires opening a file descriptor for every file that's being watched; +// so if you're watching a directory with five files then that's six file +// descriptors. You will run in to your system's "max open files" limit faster on +// these platforms. +// +// The sysctl variables kern.maxfiles and kern.maxfilesperproc can be used to +// control the maximum number of open files, as well as /etc/login.conf on BSD +// systems. +// +// # Windows notes +// +// Paths can be added as "C:\path\to\dir", but forward slashes +// ("C:/path/to/dir") will also work. +// +// When a watched directory is removed it will always send an event for the +// directory itself, but may not send events for all files in that directory. +// Sometimes it will send events for all times, sometimes it will send no +// events, and often only for some files. +// +// The default ReadDirectoryChangesW() buffer size is 64K, which is the largest +// value that is guaranteed to work with SMB filesystems. If you have many +// events in quick succession this may not be enough, and you will have to use +// [WithBufferSize] to increase the value. +type Watcher struct { + // Events sends the filesystem change events. + // + // fsnotify can send the following events; a "path" here can refer to a + // file, directory, symbolic link, or special file like a FIFO. + // + // fsnotify.Create A new path was created; this may be followed by one + // or more Write events if data also gets written to a + // file. + // + // fsnotify.Remove A path was removed. + // + // fsnotify.Rename A path was renamed. A rename is always sent with the + // old path as Event.Name, and a Create event will be + // sent with the new name. Renames are only sent for + // paths that are currently watched; e.g. moving an + // unmonitored file into a monitored directory will + // show up as just a Create. Similarly, renaming a file + // to outside a monitored directory will show up as + // only a Rename. + // + // fsnotify.Write A file or named pipe was written to. A Truncate will + // also trigger a Write. A single "write action" + // initiated by the user may show up as one or multiple + // writes, depending on when the system syncs things to + // disk. For example when compiling a large Go program + // you may get hundreds of Write events, and you may + // want to wait until you've stopped receiving them + // (see the dedup example in cmd/fsnotify). + // + // Some systems may send Write event for directories + // when the directory content changes. + // + // fsnotify.Chmod Attributes were changed. On Linux this is also sent + // when a file is removed (or more accurately, when a + // link to an inode is removed). On kqueue it's sent + // when a file is truncated. On Windows it's never + // sent. + Events chan Event + + // Errors sends any errors. + // + // ErrEventOverflow is used to indicate there are too many events: + // + // - inotify: There are too many queued events (fs.inotify.max_queued_events sysctl) + // - windows: The buffer size is too small; WithBufferSize() can be used to increase it. + // - kqueue, fen: Not used. + Errors chan error +} // NewWatcher creates a new Watcher. func NewWatcher() (*Watcher, error) { - return nil, fmt.Errorf("fsnotify not supported on %s", runtime.GOOS) + return nil, errors.New("fsnotify not supported on the current platform") } -// Close removes all watches and closes the events channel. -func (w *Watcher) Close() error { - return nil -} +// NewBufferedWatcher creates a new Watcher with a buffered Watcher.Events +// channel. +// +// The main use case for this is situations with a very large number of events +// where the kernel buffer size can't be increased (e.g. due to lack of +// permissions). An unbuffered Watcher will perform better for almost all use +// cases, and whenever possible you will be better off increasing the kernel +// buffers instead of adding a large userspace buffer. +func NewBufferedWatcher(sz uint) (*Watcher, error) { return NewWatcher() } + +// Close removes all watches and closes the Events channel. +func (w *Watcher) Close() error { return nil } + +// WatchList returns all paths explicitly added with [Watcher.Add] (and are not +// yet removed). +// +// Returns nil if [Watcher.Close] was called. +func (w *Watcher) WatchList() []string { return nil } // Add starts monitoring the path for changes. // -// A path can only be watched once; attempting to watch it more than once will -// return an error. Paths that do not yet exist on the filesystem cannot be -// added. A watch will be automatically removed if the path is deleted. +// A path can only be watched once; watching it more than once is a no-op and will +// not return an error. Paths that do not yet exist on the filesystem cannot be +// watched. // -// A path will remain watched if it gets renamed to somewhere else on the same -// filesystem, but the monitor will get removed if the path gets deleted and -// re-created, or if it's moved to a different filesystem. +// A watch will be automatically removed if the watched path is deleted or +// renamed. The exception is the Windows backend, which doesn't remove the +// watcher on renames. // // Notifications on network filesystems (NFS, SMB, FUSE, etc.) or special // filesystems (/proc, /sys, etc.) generally don't work. // +// Returns [ErrClosed] if [Watcher.Close] was called. +// +// See [Watcher.AddWith] for a version that allows adding options. +// // # Watching directories // // All files in a directory are monitored, including new files that are created @@ -43,17 +173,26 @@ func (w *Watcher) Close() error { // # Watching files // // Watching individual files (rather than directories) is generally not -// recommended as many tools update files atomically. Instead of "just" writing -// to the file a temporary file will be written to first, and if successful the -// temporary file is moved to to destination removing the original, or some -// variant thereof. The watcher on the original file is now lost, as it no -// longer exists. -// -// Instead, watch the parent directory and use Event.Name to filter out files -// you're not interested in. There is an example of this in [cmd/fsnotify/file.go]. -func (w *Watcher) Add(name string) error { - return nil -} +// recommended as many programs (especially editors) update files atomically: it +// will write to a temporary file which is then moved to to destination, +// overwriting the original (or some variant thereof). The watcher on the +// original file is now lost, as that no longer exists. +// +// The upshot of this is that a power failure or crash won't leave a +// half-written file. +// +// Watch the parent directory and use Event.Name to filter out files you're not +// interested in. There is an example of this in cmd/fsnotify/file.go. +func (w *Watcher) Add(name string) error { return nil } + +// AddWith is like [Watcher.Add], but allows adding options. When using Add() +// the defaults described below are used. +// +// Possible options are: +// +// - [WithBufferSize] sets the buffer size for the Windows backend; no-op on +// other platforms. The default is 64K (65536 bytes). +func (w *Watcher) AddWith(name string, opts ...addOpt) error { return nil } // Remove stops monitoring the path for changes. // @@ -61,6 +200,6 @@ func (w *Watcher) Add(name string) error { // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. -func (w *Watcher) Remove(name string) error { - return nil -} +// +// Returns nil if [Watcher.Close] was called. +func (w *Watcher) Remove(name string) error { return nil } diff --git a/vendor/github.com/fsnotify/fsnotify/backend_windows.go b/vendor/github.com/fsnotify/fsnotify/backend_windows.go index ae392867c..9bc91e5d6 100644 --- a/vendor/github.com/fsnotify/fsnotify/backend_windows.go +++ b/vendor/github.com/fsnotify/fsnotify/backend_windows.go @@ -1,6 +1,13 @@ //go:build windows // +build windows +// Windows backend based on ReadDirectoryChangesW() +// +// https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-readdirectorychangesw +// +// Note: the documentation on the Watcher type and methods is generated from +// mkdoc.zsh + package fsnotify import ( @@ -27,9 +34,9 @@ import ( // When a file is removed a Remove event won't be emitted until all file // descriptors are closed, and deletes will always emit a Chmod. For example: // -// fp := os.Open("file") -// os.Remove("file") // Triggers Chmod -// fp.Close() // Triggers Remove +// fp := os.Open("file") +// os.Remove("file") // Triggers Chmod +// fp.Close() // Triggers Remove // // This is the event that inotify sends, so not much can be changed about this. // @@ -43,16 +50,16 @@ import ( // // To increase them you can use sysctl or write the value to the /proc file: // -// # Default values on Linux 5.18 -// sysctl fs.inotify.max_user_watches=124983 -// sysctl fs.inotify.max_user_instances=128 +// # Default values on Linux 5.18 +// sysctl fs.inotify.max_user_watches=124983 +// sysctl fs.inotify.max_user_instances=128 // // To make the changes persist on reboot edit /etc/sysctl.conf or // /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check // your distro's documentation): // -// fs.inotify.max_user_watches=124983 -// fs.inotify.max_user_instances=128 +// fs.inotify.max_user_watches=124983 +// fs.inotify.max_user_instances=128 // // Reaching the limit will result in a "no space left on device" or "too many open // files" error. @@ -68,14 +75,20 @@ import ( // control the maximum number of open files, as well as /etc/login.conf on BSD // systems. // -// # macOS notes +// # Windows notes // -// Spotlight indexing on macOS can result in multiple events (see [#15]). A -// temporary workaround is to add your folder(s) to the "Spotlight Privacy -// Settings" until we have a native FSEvents implementation (see [#11]). +// Paths can be added as "C:\path\to\dir", but forward slashes +// ("C:/path/to/dir") will also work. // -// [#11]: https://github.com/fsnotify/fsnotify/issues/11 -// [#15]: https://github.com/fsnotify/fsnotify/issues/15 +// When a watched directory is removed it will always send an event for the +// directory itself, but may not send events for all files in that directory. +// Sometimes it will send events for all times, sometimes it will send no +// events, and often only for some files. +// +// The default ReadDirectoryChangesW() buffer size is 64K, which is the largest +// value that is guaranteed to work with SMB filesystems. If you have many +// events in quick succession this may not be enough, and you will have to use +// [WithBufferSize] to increase the value. type Watcher struct { // Events sends the filesystem change events. // @@ -102,31 +115,52 @@ type Watcher struct { // initiated by the user may show up as one or multiple // writes, depending on when the system syncs things to // disk. For example when compiling a large Go program - // you may get hundreds of Write events, so you - // probably want to wait until you've stopped receiving - // them (see the dedup example in cmd/fsnotify). + // you may get hundreds of Write events, and you may + // want to wait until you've stopped receiving them + // (see the dedup example in cmd/fsnotify). + // + // Some systems may send Write event for directories + // when the directory content changes. // // fsnotify.Chmod Attributes were changed. On Linux this is also sent // when a file is removed (or more accurately, when a // link to an inode is removed). On kqueue it's sent - // and on kqueue when a file is truncated. On Windows - // it's never sent. + // when a file is truncated. On Windows it's never + // sent. Events chan Event // Errors sends any errors. + // + // ErrEventOverflow is used to indicate there are too many events: + // + // - inotify: There are too many queued events (fs.inotify.max_queued_events sysctl) + // - windows: The buffer size is too small; WithBufferSize() can be used to increase it. + // - kqueue, fen: Not used. Errors chan error port windows.Handle // Handle to completion port input chan *input // Inputs to the reader are sent on this channel quit chan chan<- error - mu sync.Mutex // Protects access to watches, isClosed - watches watchMap // Map of watches (key: i-number) - isClosed bool // Set to true when Close() is first called + mu sync.Mutex // Protects access to watches, closed + watches watchMap // Map of watches (key: i-number) + closed bool // Set to true when Close() is first called } // NewWatcher creates a new Watcher. func NewWatcher() (*Watcher, error) { + return NewBufferedWatcher(50) +} + +// NewBufferedWatcher creates a new Watcher with a buffered Watcher.Events +// channel. +// +// The main use case for this is situations with a very large number of events +// where the kernel buffer size can't be increased (e.g. due to lack of +// permissions). An unbuffered Watcher will perform better for almost all use +// cases, and whenever possible you will be better off increasing the kernel +// buffers instead of adding a large userspace buffer. +func NewBufferedWatcher(sz uint) (*Watcher, error) { port, err := windows.CreateIoCompletionPort(windows.InvalidHandle, 0, 0, 0) if err != nil { return nil, os.NewSyscallError("CreateIoCompletionPort", err) @@ -135,7 +169,7 @@ func NewWatcher() (*Watcher, error) { port: port, watches: make(watchMap), input: make(chan *input, 1), - Events: make(chan Event, 50), + Events: make(chan Event, sz), Errors: make(chan error), quit: make(chan chan<- error, 1), } @@ -143,6 +177,12 @@ func NewWatcher() (*Watcher, error) { return w, nil } +func (w *Watcher) isClosed() bool { + w.mu.Lock() + defer w.mu.Unlock() + return w.closed +} + func (w *Watcher) sendEvent(name string, mask uint64) bool { if mask == 0 { return false @@ -167,14 +207,14 @@ func (w *Watcher) sendError(err error) bool { return false } -// Close removes all watches and closes the events channel. +// Close removes all watches and closes the Events channel. func (w *Watcher) Close() error { - w.mu.Lock() - if w.isClosed { - w.mu.Unlock() + if w.isClosed() { return nil } - w.isClosed = true + + w.mu.Lock() + w.closed = true w.mu.Unlock() // Send "quit" message to the reader goroutine @@ -188,17 +228,21 @@ func (w *Watcher) Close() error { // Add starts monitoring the path for changes. // -// A path can only be watched once; attempting to watch it more than once will -// return an error. Paths that do not yet exist on the filesystem cannot be -// added. A watch will be automatically removed if the path is deleted. +// A path can only be watched once; watching it more than once is a no-op and will +// not return an error. Paths that do not yet exist on the filesystem cannot be +// watched. // -// A path will remain watched if it gets renamed to somewhere else on the same -// filesystem, but the monitor will get removed if the path gets deleted and -// re-created, or if it's moved to a different filesystem. +// A watch will be automatically removed if the watched path is deleted or +// renamed. The exception is the Windows backend, which doesn't remove the +// watcher on renames. // // Notifications on network filesystems (NFS, SMB, FUSE, etc.) or special // filesystems (/proc, /sys, etc.) generally don't work. // +// Returns [ErrClosed] if [Watcher.Close] was called. +// +// See [Watcher.AddWith] for a version that allows adding options. +// // # Watching directories // // All files in a directory are monitored, including new files that are created @@ -208,27 +252,41 @@ func (w *Watcher) Close() error { // # Watching files // // Watching individual files (rather than directories) is generally not -// recommended as many tools update files atomically. Instead of "just" writing -// to the file a temporary file will be written to first, and if successful the -// temporary file is moved to to destination removing the original, or some -// variant thereof. The watcher on the original file is now lost, as it no -// longer exists. -// -// Instead, watch the parent directory and use Event.Name to filter out files -// you're not interested in. There is an example of this in [cmd/fsnotify/file.go]. -func (w *Watcher) Add(name string) error { - w.mu.Lock() - if w.isClosed { - w.mu.Unlock() - return errors.New("watcher already closed") +// recommended as many programs (especially editors) update files atomically: it +// will write to a temporary file which is then moved to to destination, +// overwriting the original (or some variant thereof). The watcher on the +// original file is now lost, as that no longer exists. +// +// The upshot of this is that a power failure or crash won't leave a +// half-written file. +// +// Watch the parent directory and use Event.Name to filter out files you're not +// interested in. There is an example of this in cmd/fsnotify/file.go. +func (w *Watcher) Add(name string) error { return w.AddWith(name) } + +// AddWith is like [Watcher.Add], but allows adding options. When using Add() +// the defaults described below are used. +// +// Possible options are: +// +// - [WithBufferSize] sets the buffer size for the Windows backend; no-op on +// other platforms. The default is 64K (65536 bytes). +func (w *Watcher) AddWith(name string, opts ...addOpt) error { + if w.isClosed() { + return ErrClosed + } + + with := getOptions(opts...) + if with.bufsize < 4096 { + return fmt.Errorf("fsnotify.WithBufferSize: buffer size cannot be smaller than 4096 bytes") } - w.mu.Unlock() in := &input{ - op: opAddWatch, - path: filepath.Clean(name), - flags: sysFSALLEVENTS, - reply: make(chan error), + op: opAddWatch, + path: filepath.Clean(name), + flags: sysFSALLEVENTS, + reply: make(chan error), + bufsize: with.bufsize, } w.input <- in if err := w.wakeupReader(); err != nil { @@ -243,7 +301,13 @@ func (w *Watcher) Add(name string) error { // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) Remove(name string) error { + if w.isClosed() { + return nil + } + in := &input{ op: opRemoveWatch, path: filepath.Clean(name), @@ -256,8 +320,15 @@ func (w *Watcher) Remove(name string) error { return <-in.reply } -// WatchList returns all paths added with [Add] (and are not yet removed). +// WatchList returns all paths explicitly added with [Watcher.Add] (and are not +// yet removed). +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) WatchList() []string { + if w.isClosed() { + return nil + } + w.mu.Lock() defer w.mu.Unlock() @@ -279,7 +350,6 @@ func (w *Watcher) WatchList() []string { // This should all be removed at some point, and just use windows.FILE_NOTIFY_* const ( sysFSALLEVENTS = 0xfff - sysFSATTRIB = 0x4 sysFSCREATE = 0x100 sysFSDELETE = 0x200 sysFSDELETESELF = 0x400 @@ -305,9 +375,6 @@ func (w *Watcher) newEvent(name string, mask uint32) Event { if mask&sysFSMOVE == sysFSMOVE || mask&sysFSMOVESELF == sysFSMOVESELF || mask&sysFSMOVEDFROM == sysFSMOVEDFROM { e.Op |= Rename } - if mask&sysFSATTRIB == sysFSATTRIB { - e.Op |= Chmod - } return e } @@ -321,10 +388,11 @@ const ( ) type input struct { - op int - path string - flags uint32 - reply chan error + op int + path string + flags uint32 + bufsize int + reply chan error } type inode struct { @@ -334,13 +402,14 @@ type inode struct { } type watch struct { - ov windows.Overlapped - ino *inode // i-number - path string // Directory path - mask uint64 // Directory itself is being watched with these notify flags - names map[string]uint64 // Map of names being watched and their notify flags - rename string // Remembers the old name while renaming a file - buf [65536]byte // 64K buffer + ov windows.Overlapped + ino *inode // i-number + recurse bool // Recursive watch? + path string // Directory path + mask uint64 // Directory itself is being watched with these notify flags + names map[string]uint64 // Map of names being watched and their notify flags + rename string // Remembers the old name while renaming a file + buf []byte // buffer, allocated later } type ( @@ -413,7 +482,10 @@ func (m watchMap) set(ino *inode, watch *watch) { } // Must run within the I/O thread. -func (w *Watcher) addWatch(pathname string, flags uint64) error { +func (w *Watcher) addWatch(pathname string, flags uint64, bufsize int) error { + //pathname, recurse := recursivePath(pathname) + recurse := false + dir, err := w.getDir(pathname) if err != nil { return err @@ -433,9 +505,11 @@ func (w *Watcher) addWatch(pathname string, flags uint64) error { return os.NewSyscallError("CreateIoCompletionPort", err) } watchEntry = &watch{ - ino: ino, - path: dir, - names: make(map[string]uint64), + ino: ino, + path: dir, + names: make(map[string]uint64), + recurse: recurse, + buf: make([]byte, bufsize), } w.mu.Lock() w.watches.set(ino, watchEntry) @@ -465,6 +539,8 @@ func (w *Watcher) addWatch(pathname string, flags uint64) error { // Must run within the I/O thread. func (w *Watcher) remWatch(pathname string) error { + pathname, recurse := recursivePath(pathname) + dir, err := w.getDir(pathname) if err != nil { return err @@ -478,6 +554,10 @@ func (w *Watcher) remWatch(pathname string) error { watch := w.watches.get(ino) w.mu.Unlock() + if recurse && !watch.recurse { + return fmt.Errorf("can't use \\... with non-recursive watch %q", pathname) + } + err = windows.CloseHandle(ino.handle) if err != nil { w.sendError(os.NewSyscallError("CloseHandle", err)) @@ -535,8 +615,11 @@ func (w *Watcher) startRead(watch *watch) error { return nil } - rdErr := windows.ReadDirectoryChanges(watch.ino.handle, &watch.buf[0], - uint32(unsafe.Sizeof(watch.buf)), false, mask, nil, &watch.ov, 0) + // We need to pass the array, rather than the slice. + hdr := (*reflect.SliceHeader)(unsafe.Pointer(&watch.buf)) + rdErr := windows.ReadDirectoryChanges(watch.ino.handle, + (*byte)(unsafe.Pointer(hdr.Data)), uint32(hdr.Len), + watch.recurse, mask, nil, &watch.ov, 0) if rdErr != nil { err := os.NewSyscallError("ReadDirectoryChanges", rdErr) if rdErr == windows.ERROR_ACCESS_DENIED && watch.mask&provisional == 0 { @@ -563,9 +646,8 @@ func (w *Watcher) readEvents() { runtime.LockOSThread() for { + // This error is handled after the watch == nil check below. qErr := windows.GetQueuedCompletionStatus(w.port, &n, &key, &ov, windows.INFINITE) - // This error is handled after the watch == nil check below. NOTE: this - // seems odd, note sure if it's correct. watch := (*watch)(unsafe.Pointer(ov)) if watch == nil { @@ -595,7 +677,7 @@ func (w *Watcher) readEvents() { case in := <-w.input: switch in.op { case opAddWatch: - in.reply <- w.addWatch(in.path, uint64(in.flags)) + in.reply <- w.addWatch(in.path, uint64(in.flags), in.bufsize) case opRemoveWatch: in.reply <- w.remWatch(in.path) } @@ -605,6 +687,8 @@ func (w *Watcher) readEvents() { } switch qErr { + case nil: + // No error case windows.ERROR_MORE_DATA: if watch == nil { w.sendError(errors.New("ERROR_MORE_DATA has unexpectedly null lpOverlapped buffer")) @@ -626,13 +710,12 @@ func (w *Watcher) readEvents() { default: w.sendError(os.NewSyscallError("GetQueuedCompletionPort", qErr)) continue - case nil: } var offset uint32 for { if n == 0 { - w.sendError(errors.New("short read in readEvents()")) + w.sendError(ErrEventOverflow) break } @@ -703,8 +786,9 @@ func (w *Watcher) readEvents() { // Error! if offset >= n { + //lint:ignore ST1005 Windows should be capitalized w.sendError(errors.New( - "Windows system assumed buffer larger than it is, events have likely been missed.")) + "Windows system assumed buffer larger than it is, events have likely been missed")) break } } @@ -720,9 +804,6 @@ func (w *Watcher) toWindowsFlags(mask uint64) uint32 { if mask&sysFSMODIFY != 0 { m |= windows.FILE_NOTIFY_CHANGE_LAST_WRITE } - if mask&sysFSATTRIB != 0 { - m |= windows.FILE_NOTIFY_CHANGE_ATTRIBUTES - } if mask&(sysFSMOVE|sysFSCREATE|sysFSDELETE) != 0 { m |= windows.FILE_NOTIFY_CHANGE_FILE_NAME | windows.FILE_NOTIFY_CHANGE_DIR_NAME } diff --git a/vendor/github.com/fsnotify/fsnotify/fsnotify.go b/vendor/github.com/fsnotify/fsnotify/fsnotify.go index 30a5bf0f0..24c99cc49 100644 --- a/vendor/github.com/fsnotify/fsnotify/fsnotify.go +++ b/vendor/github.com/fsnotify/fsnotify/fsnotify.go @@ -1,13 +1,18 @@ -//go:build !plan9 -// +build !plan9 - // Package fsnotify provides a cross-platform interface for file system // notifications. +// +// Currently supported systems: +// +// Linux 2.6.32+ via inotify +// BSD, macOS via kqueue +// Windows via ReadDirectoryChangesW +// illumos via FEN package fsnotify import ( "errors" "fmt" + "path/filepath" "strings" ) @@ -33,34 +38,52 @@ type Op uint32 // The operations fsnotify can trigger; see the documentation on [Watcher] for a // full description, and check them with [Event.Has]. const ( + // A new pathname was created. Create Op = 1 << iota + + // The pathname was written to; this does *not* mean the write has finished, + // and a write can be followed by more writes. Write + + // The path was removed; any watches on it will be removed. Some "remove" + // operations may trigger a Rename if the file is actually moved (for + // example "remove to trash" is often a rename). Remove + + // The path was renamed to something else; any watched on it will be + // removed. Rename + + // File attributes were changed. + // + // It's generally not recommended to take action on this event, as it may + // get triggered very frequently by some software. For example, Spotlight + // indexing on macOS, anti-virus software, backup software, etc. Chmod ) -// Common errors that can be reported by a watcher +// Common errors that can be reported. var ( - ErrNonExistentWatch = errors.New("can't remove non-existent watcher") - ErrEventOverflow = errors.New("fsnotify queue overflow") + ErrNonExistentWatch = errors.New("fsnotify: can't remove non-existent watch") + ErrEventOverflow = errors.New("fsnotify: queue or buffer overflow") + ErrClosed = errors.New("fsnotify: watcher already closed") ) -func (op Op) String() string { +func (o Op) String() string { var b strings.Builder - if op.Has(Create) { + if o.Has(Create) { b.WriteString("|CREATE") } - if op.Has(Remove) { + if o.Has(Remove) { b.WriteString("|REMOVE") } - if op.Has(Write) { + if o.Has(Write) { b.WriteString("|WRITE") } - if op.Has(Rename) { + if o.Has(Rename) { b.WriteString("|RENAME") } - if op.Has(Chmod) { + if o.Has(Chmod) { b.WriteString("|CHMOD") } if b.Len() == 0 { @@ -70,7 +93,7 @@ func (op Op) String() string { } // Has reports if this operation has the given operation. -func (o Op) Has(h Op) bool { return o&h == h } +func (o Op) Has(h Op) bool { return o&h != 0 } // Has reports if this event has the given operation. func (e Event) Has(op Op) bool { return e.Op.Has(op) } @@ -79,3 +102,45 @@ func (e Event) Has(op Op) bool { return e.Op.Has(op) } func (e Event) String() string { return fmt.Sprintf("%-13s %q", e.Op.String(), e.Name) } + +type ( + addOpt func(opt *withOpts) + withOpts struct { + bufsize int + } +) + +var defaultOpts = withOpts{ + bufsize: 65536, // 64K +} + +func getOptions(opts ...addOpt) withOpts { + with := defaultOpts + for _, o := range opts { + o(&with) + } + return with +} + +// WithBufferSize sets the [ReadDirectoryChangesW] buffer size. +// +// This only has effect on Windows systems, and is a no-op for other backends. +// +// The default value is 64K (65536 bytes) which is the highest value that works +// on all filesystems and should be enough for most applications, but if you +// have a large burst of events it may not be enough. You can increase it if +// you're hitting "queue or buffer overflow" errors ([ErrEventOverflow]). +// +// [ReadDirectoryChangesW]: https://learn.microsoft.com/en-gb/windows/win32/api/winbase/nf-winbase-readdirectorychangesw +func WithBufferSize(bytes int) addOpt { + return func(opt *withOpts) { opt.bufsize = bytes } +} + +// Check if this path is recursive (ends with "/..." or "\..."), and return the +// path with the /... stripped. +func recursivePath(path string) (string, bool) { + if filepath.Base(path) == "..." { + return filepath.Dir(path), true + } + return path, false +} diff --git a/vendor/github.com/fsnotify/fsnotify/mkdoc.zsh b/vendor/github.com/fsnotify/fsnotify/mkdoc.zsh index b09ef7683..99012ae65 100644 --- a/vendor/github.com/fsnotify/fsnotify/mkdoc.zsh +++ b/vendor/github.com/fsnotify/fsnotify/mkdoc.zsh @@ -2,8 +2,8 @@ [ "${ZSH_VERSION:-}" = "" ] && echo >&2 "Only works with zsh" && exit 1 setopt err_exit no_unset pipefail extended_glob -# Simple script to update the godoc comments on all watchers. Probably took me -# more time to write this than doing it manually, but ah well 🙃 +# Simple script to update the godoc comments on all watchers so you don't need +# to update the same comment 5 times. watcher=$(<= 0, higher meaning "less important" | positive and negative, with 0 for "info" and higher meaning "more important" | +| Error log entries | always logged, don't have a verbosity level | normal log entries with level >= `LevelError` | +| Passing logger via context | `NewContext`, `FromContext` | no API | +| Adding a name to a logger | `WithName` | no API | +| Modify verbosity of log entries in a call chain | `V` | no API | +| Grouping of key/value pairs | not supported | `WithGroup`, `GroupValue` | + +The high-level slog API is explicitly meant to be one of many different APIs +that can be layered on top of a shared `slog.Handler`. logr is one such +alternative API, with [interoperability](#slog-interoperability) provided by the [`slogr`](slogr) +package. + ### Inspiration Before you consider this package, please read [this blog post by the @@ -118,6 +142,91 @@ There are implementations for the following logging libraries: - **github.com/go-kit/log**: [gokitlogr](https://github.com/tonglil/gokitlogr) (also compatible with github.com/go-kit/kit/log since v0.12.0) - **bytes.Buffer** (writing to a buffer): [bufrlogr](https://github.com/tonglil/buflogr) (useful for ensuring values were logged, like during testing) +## slog interoperability + +Interoperability goes both ways, using the `logr.Logger` API with a `slog.Handler` +and using the `slog.Logger` API with a `logr.LogSink`. [slogr](./slogr) provides `NewLogr` and +`NewSlogHandler` API calls to convert between a `logr.Logger` and a `slog.Handler`. +As usual, `slog.New` can be used to wrap such a `slog.Handler` in the high-level +slog API. `slogr` itself leaves that to the caller. + +## Using a `logr.Sink` as backend for slog + +Ideally, a logr sink implementation should support both logr and slog by +implementing both the normal logr interface(s) and `slogr.SlogSink`. Because +of a conflict in the parameters of the common `Enabled` method, it is [not +possible to implement both slog.Handler and logr.Sink in the same +type](https://github.com/golang/go/issues/59110). + +If both are supported, log calls can go from the high-level APIs to the backend +without the need to convert parameters. `NewLogr` and `NewSlogHandler` can +convert back and forth without adding additional wrappers, with one exception: +when `Logger.V` was used to adjust the verbosity for a `slog.Handler`, then +`NewSlogHandler` has to use a wrapper which adjusts the verbosity for future +log calls. + +Such an implementation should also support values that implement specific +interfaces from both packages for logging (`logr.Marshaler`, `slog.LogValuer`, +`slog.GroupValue`). logr does not convert those. + +Not supporting slog has several drawbacks: +- Recording source code locations works correctly if the handler gets called + through `slog.Logger`, but may be wrong in other cases. That's because a + `logr.Sink` does its own stack unwinding instead of using the program counter + provided by the high-level API. +- slog levels <= 0 can be mapped to logr levels by negating the level without a + loss of information. But all slog levels > 0 (e.g. `slog.LevelWarning` as + used by `slog.Logger.Warn`) must be mapped to 0 before calling the sink + because logr does not support "more important than info" levels. +- The slog group concept is supported by prefixing each key in a key/value + pair with the group names, separated by a dot. For structured output like + JSON it would be better to group the key/value pairs inside an object. +- Special slog values and interfaces don't work as expected. +- The overhead is likely to be higher. + +These drawbacks are severe enough that applications using a mixture of slog and +logr should switch to a different backend. + +## Using a `slog.Handler` as backend for logr + +Using a plain `slog.Handler` without support for logr works better than the +other direction: +- All logr verbosity levels can be mapped 1:1 to their corresponding slog level + by negating them. +- Stack unwinding is done by the `slogr.SlogSink` and the resulting program + counter is passed to the `slog.Handler`. +- Names added via `Logger.WithName` are gathered and recorded in an additional + attribute with `logger` as key and the names separated by slash as value. +- `Logger.Error` is turned into a log record with `slog.LevelError` as level + and an additional attribute with `err` as key, if an error was provided. + +The main drawback is that `logr.Marshaler` will not be supported. Types should +ideally support both `logr.Marshaler` and `slog.Valuer`. If compatibility +with logr implementations without slog support is not important, then +`slog.Valuer` is sufficient. + +## Context support for slog + +Storing a logger in a `context.Context` is not supported by +slog. `logr.NewContext` and `logr.FromContext` can be used with slog like this +to fill this gap: + + func HandlerFromContext(ctx context.Context) slog.Handler { + logger, err := logr.FromContext(ctx) + if err == nil { + return slogr.NewSlogHandler(logger) + } + return slog.Default().Handler() + } + + func ContextWithHandler(ctx context.Context, handler slog.Handler) context.Context { + return logr.NewContext(ctx, slogr.NewLogr(handler)) + } + +The downside is that storing and retrieving a `slog.Handler` needs more +allocations compared to using a `logr.Logger`. Therefore the recommendation is +to use the `logr.Logger` API in code which uses contextual logging. + ## FAQ ### Conceptual @@ -241,7 +350,9 @@ Otherwise, you can start out with `0` as "you always want to see this", Then gradually choose levels in between as you need them, working your way down from 10 (for debug and trace style logs) and up from 1 (for chattier -info-type logs.) +info-type logs). For reference, slog pre-defines -4 for debug logs +(corresponds to 4 in logr), which matches what is +[recommended for Kubernetes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use). #### How do I choose my keys? diff --git a/vendor/github.com/go-logr/logr/SECURITY.md b/vendor/github.com/go-logr/logr/SECURITY.md new file mode 100644 index 000000000..1ca756fc7 --- /dev/null +++ b/vendor/github.com/go-logr/logr/SECURITY.md @@ -0,0 +1,18 @@ +# Security Policy + +If you have discovered a security vulnerability in this project, please report it +privately. **Do not disclose it as a public issue.** This gives us time to work with you +to fix the issue before public exposure, reducing the chance that the exploit will be +used before a patch is released. + +You may submit the report in the following ways: + +- send an email to go-logr-security@googlegroups.com +- send us a [private vulnerability report](https://github.com/go-logr/logr/security/advisories/new) + +Please provide the following information in your report: + +- A description of the vulnerability and its impact +- How to reproduce the issue + +We ask that you give us 90 days to work on a fix before public exposure. diff --git a/vendor/github.com/go-logr/logr/funcr/funcr.go b/vendor/github.com/go-logr/logr/funcr/funcr.go index e52f0cd01..12e5807cc 100644 --- a/vendor/github.com/go-logr/logr/funcr/funcr.go +++ b/vendor/github.com/go-logr/logr/funcr/funcr.go @@ -116,17 +116,17 @@ type Options struct { // Equivalent hooks are offered for key-value pairs saved via // logr.Logger.WithValues or Formatter.AddValues (see RenderValuesHook) and // for user-provided pairs (see RenderArgsHook). - RenderBuiltinsHook func(kvList []interface{}) []interface{} + RenderBuiltinsHook func(kvList []any) []any // RenderValuesHook is the same as RenderBuiltinsHook, except that it is // only called for key-value pairs saved via logr.Logger.WithValues. See // RenderBuiltinsHook for more details. - RenderValuesHook func(kvList []interface{}) []interface{} + RenderValuesHook func(kvList []any) []any // RenderArgsHook is the same as RenderBuiltinsHook, except that it is only // called for key-value pairs passed directly to Info and Error. See // RenderBuiltinsHook for more details. - RenderArgsHook func(kvList []interface{}) []interface{} + RenderArgsHook func(kvList []any) []any // MaxLogDepth tells funcr how many levels of nested fields (e.g. a struct // that contains a struct, etc.) it may log. Every time it finds a struct, @@ -163,7 +163,7 @@ func (l fnlogger) WithName(name string) logr.LogSink { return &l } -func (l fnlogger) WithValues(kvList ...interface{}) logr.LogSink { +func (l fnlogger) WithValues(kvList ...any) logr.LogSink { l.Formatter.AddValues(kvList) return &l } @@ -173,12 +173,12 @@ func (l fnlogger) WithCallDepth(depth int) logr.LogSink { return &l } -func (l fnlogger) Info(level int, msg string, kvList ...interface{}) { +func (l fnlogger) Info(level int, msg string, kvList ...any) { prefix, args := l.FormatInfo(level, msg, kvList) l.write(prefix, args) } -func (l fnlogger) Error(err error, msg string, kvList ...interface{}) { +func (l fnlogger) Error(err error, msg string, kvList ...any) { prefix, args := l.FormatError(err, msg, kvList) l.write(prefix, args) } @@ -229,7 +229,7 @@ func newFormatter(opts Options, outfmt outputFormat) Formatter { type Formatter struct { outputFormat outputFormat prefix string - values []interface{} + values []any valuesStr string depth int opts *Options @@ -246,10 +246,10 @@ const ( ) // PseudoStruct is a list of key-value pairs that gets logged as a struct. -type PseudoStruct []interface{} +type PseudoStruct []any // render produces a log line, ready to use. -func (f Formatter) render(builtins, args []interface{}) string { +func (f Formatter) render(builtins, args []any) string { // Empirically bytes.Buffer is faster than strings.Builder for this. buf := bytes.NewBuffer(make([]byte, 0, 1024)) if f.outputFormat == outputJSON { @@ -292,7 +292,7 @@ func (f Formatter) render(builtins, args []interface{}) string { // This function returns a potentially modified version of kvList, which // ensures that there is a value for every key (adding a value if needed) and // that each key is a string (substituting a key if needed). -func (f Formatter) flatten(buf *bytes.Buffer, kvList []interface{}, continuing bool, escapeKeys bool) []interface{} { +func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, continuing bool, escapeKeys bool) []any { // This logic overlaps with sanitize() but saves one type-cast per key, // which can be measurable. if len(kvList)%2 != 0 { @@ -334,7 +334,7 @@ func (f Formatter) flatten(buf *bytes.Buffer, kvList []interface{}, continuing b return kvList } -func (f Formatter) pretty(value interface{}) string { +func (f Formatter) pretty(value any) string { return f.prettyWithFlags(value, 0, 0) } @@ -343,7 +343,7 @@ const ( ) // TODO: This is not fast. Most of the overhead goes here. -func (f Formatter) prettyWithFlags(value interface{}, flags uint32, depth int) string { +func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string { if depth > f.opts.MaxLogDepth { return `""` } @@ -614,7 +614,7 @@ func isEmpty(v reflect.Value) bool { return false } -func invokeMarshaler(m logr.Marshaler) (ret interface{}) { +func invokeMarshaler(m logr.Marshaler) (ret any) { defer func() { if r := recover(); r != nil { ret = fmt.Sprintf("", r) @@ -675,12 +675,12 @@ func (f Formatter) caller() Caller { const noValue = "" -func (f Formatter) nonStringKey(v interface{}) string { +func (f Formatter) nonStringKey(v any) string { return fmt.Sprintf("", f.snippet(v)) } // snippet produces a short snippet string of an arbitrary value. -func (f Formatter) snippet(v interface{}) string { +func (f Formatter) snippet(v any) string { const snipLen = 16 snip := f.pretty(v) @@ -693,7 +693,7 @@ func (f Formatter) snippet(v interface{}) string { // sanitize ensures that a list of key-value pairs has a value for every key // (adding a value if needed) and that each key is a string (substituting a key // if needed). -func (f Formatter) sanitize(kvList []interface{}) []interface{} { +func (f Formatter) sanitize(kvList []any) []any { if len(kvList)%2 != 0 { kvList = append(kvList, noValue) } @@ -727,8 +727,8 @@ func (f Formatter) GetDepth() int { // FormatInfo renders an Info log message into strings. The prefix will be // empty when no names were set (via AddNames), or when the output is // configured for JSON. -func (f Formatter) FormatInfo(level int, msg string, kvList []interface{}) (prefix, argsStr string) { - args := make([]interface{}, 0, 64) // using a constant here impacts perf +func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) { + args := make([]any, 0, 64) // using a constant here impacts perf prefix = f.prefix if f.outputFormat == outputJSON { args = append(args, "logger", prefix) @@ -745,10 +745,10 @@ func (f Formatter) FormatInfo(level int, msg string, kvList []interface{}) (pref } // FormatError renders an Error log message into strings. The prefix will be -// empty when no names were set (via AddNames), or when the output is +// empty when no names were set (via AddNames), or when the output is // configured for JSON. -func (f Formatter) FormatError(err error, msg string, kvList []interface{}) (prefix, argsStr string) { - args := make([]interface{}, 0, 64) // using a constant here impacts perf +func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) { + args := make([]any, 0, 64) // using a constant here impacts perf prefix = f.prefix if f.outputFormat == outputJSON { args = append(args, "logger", prefix) @@ -761,12 +761,12 @@ func (f Formatter) FormatError(err error, msg string, kvList []interface{}) (pre args = append(args, "caller", f.caller()) } args = append(args, "msg", msg) - var loggableErr interface{} + var loggableErr any if err != nil { loggableErr = err.Error() } args = append(args, "error", loggableErr) - return f.prefix, f.render(args, kvList) + return prefix, f.render(args, kvList) } // AddName appends the specified name. funcr uses '/' characters to separate @@ -781,7 +781,7 @@ func (f *Formatter) AddName(name string) { // AddValues adds key-value pairs to the set of saved values to be logged with // each log line. -func (f *Formatter) AddValues(kvList []interface{}) { +func (f *Formatter) AddValues(kvList []any) { // Three slice args forces a copy. n := len(f.values) f.values = append(f.values[:n:n], kvList...) diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go index e027aea3f..2a5075a18 100644 --- a/vendor/github.com/go-logr/logr/logr.go +++ b/vendor/github.com/go-logr/logr/logr.go @@ -127,9 +127,9 @@ limitations under the License. // such a value can call its methods without having to check whether the // instance is ready for use. // -// Calling methods with the null logger (Logger{}) as instance will crash -// because it has no LogSink. Therefore this null logger should never be passed -// around. For cases where passing a logger is optional, a pointer to Logger +// The zero logger (= Logger{}) is identical to Discard() and discards all log +// entries. Code that receives a Logger by value can simply call it, the methods +// will never crash. For cases where passing a logger is optional, a pointer to Logger // should be used. // // # Key Naming Conventions @@ -258,6 +258,12 @@ type Logger struct { // Enabled tests whether this Logger is enabled. For example, commandline // flags might be used to set the logging verbosity and disable some info logs. func (l Logger) Enabled() bool { + // Some implementations of LogSink look at the caller in Enabled (e.g. + // different verbosity levels per package or file), but we only pass one + // CallDepth in (via Init). This means that all calls from Logger to the + // LogSink's Enabled, Info, and Error methods must have the same number of + // frames. In other words, Logger methods can't call other Logger methods + // which call these LogSink methods unless we do it the same in all paths. return l.sink != nil && l.sink.Enabled(l.level) } @@ -267,11 +273,11 @@ func (l Logger) Enabled() bool { // line. The key/value pairs can then be used to add additional variable // information. The key/value pairs must alternate string keys and arbitrary // values. -func (l Logger) Info(msg string, keysAndValues ...interface{}) { +func (l Logger) Info(msg string, keysAndValues ...any) { if l.sink == nil { return } - if l.Enabled() { + if l.sink.Enabled(l.level) { // see comment in Enabled if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { withHelper.GetCallStackHelper()() } @@ -289,7 +295,7 @@ func (l Logger) Info(msg string, keysAndValues ...interface{}) { // while the err argument should be used to attach the actual error that // triggered this log line, if present. The err parameter is optional // and nil may be passed instead of an error instance. -func (l Logger) Error(err error, msg string, keysAndValues ...interface{}) { +func (l Logger) Error(err error, msg string, keysAndValues ...any) { if l.sink == nil { return } @@ -314,9 +320,16 @@ func (l Logger) V(level int) Logger { return l } +// GetV returns the verbosity level of the logger. If the logger's LogSink is +// nil as in the Discard logger, this will always return 0. +func (l Logger) GetV() int { + // 0 if l.sink nil because of the if check in V above. + return l.level +} + // WithValues returns a new Logger instance with additional key/value pairs. // See Info for documentation on how key/value pairs work. -func (l Logger) WithValues(keysAndValues ...interface{}) Logger { +func (l Logger) WithValues(keysAndValues ...any) Logger { if l.sink == nil { return l } @@ -467,15 +480,15 @@ type LogSink interface { // The level argument is provided for optional logging. This method will // only be called when Enabled(level) is true. See Logger.Info for more // details. - Info(level int, msg string, keysAndValues ...interface{}) + Info(level int, msg string, keysAndValues ...any) // Error logs an error, with the given message and key/value pairs as // context. See Logger.Error for more details. - Error(err error, msg string, keysAndValues ...interface{}) + Error(err error, msg string, keysAndValues ...any) // WithValues returns a new LogSink with additional key/value pairs. See // Logger.WithValues for more details. - WithValues(keysAndValues ...interface{}) LogSink + WithValues(keysAndValues ...any) LogSink // WithName returns a new LogSink with the specified name appended. See // Logger.WithName for more details. @@ -546,5 +559,5 @@ type Marshaler interface { // with exported fields // // It may return any value of any type. - MarshalLog() interface{} + MarshalLog() any } diff --git a/vendor/github.com/go-logr/logr/slogr/sloghandler.go b/vendor/github.com/go-logr/logr/slogr/sloghandler.go new file mode 100644 index 000000000..ec6725ce2 --- /dev/null +++ b/vendor/github.com/go-logr/logr/slogr/sloghandler.go @@ -0,0 +1,168 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package slogr + +import ( + "context" + "log/slog" + + "github.com/go-logr/logr" +) + +type slogHandler struct { + // May be nil, in which case all logs get discarded. + sink logr.LogSink + // Non-nil if sink is non-nil and implements SlogSink. + slogSink SlogSink + + // groupPrefix collects values from WithGroup calls. It gets added as + // prefix to value keys when handling a log record. + groupPrefix string + + // levelBias can be set when constructing the handler to influence the + // slog.Level of log records. A positive levelBias reduces the + // slog.Level value. slog has no API to influence this value after the + // handler got created, so it can only be set indirectly through + // Logger.V. + levelBias slog.Level +} + +var _ slog.Handler = &slogHandler{} + +// groupSeparator is used to concatenate WithGroup names and attribute keys. +const groupSeparator = "." + +// GetLevel is used for black box unit testing. +func (l *slogHandler) GetLevel() slog.Level { + return l.levelBias +} + +func (l *slogHandler) Enabled(ctx context.Context, level slog.Level) bool { + return l.sink != nil && (level >= slog.LevelError || l.sink.Enabled(l.levelFromSlog(level))) +} + +func (l *slogHandler) Handle(ctx context.Context, record slog.Record) error { + if l.slogSink != nil { + // Only adjust verbosity level of log entries < slog.LevelError. + if record.Level < slog.LevelError { + record.Level -= l.levelBias + } + return l.slogSink.Handle(ctx, record) + } + + // No need to check for nil sink here because Handle will only be called + // when Enabled returned true. + + kvList := make([]any, 0, 2*record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + if attr.Key != "" { + kvList = append(kvList, l.addGroupPrefix(attr.Key), attr.Value.Resolve().Any()) + } + return true + }) + if record.Level >= slog.LevelError { + l.sinkWithCallDepth().Error(nil, record.Message, kvList...) + } else { + level := l.levelFromSlog(record.Level) + l.sinkWithCallDepth().Info(level, record.Message, kvList...) + } + return nil +} + +// sinkWithCallDepth adjusts the stack unwinding so that when Error or Info +// are called by Handle, code in slog gets skipped. +// +// This offset currently (Go 1.21.0) works for calls through +// slog.New(NewSlogHandler(...)). There's no guarantee that the call +// chain won't change. Wrapping the handler will also break unwinding. It's +// still better than not adjusting at all.... +// +// This cannot be done when constructing the handler because NewLogr needs +// access to the original sink without this adjustment. A second copy would +// work, but then WithAttrs would have to be called for both of them. +func (l *slogHandler) sinkWithCallDepth() logr.LogSink { + if sink, ok := l.sink.(logr.CallDepthLogSink); ok { + return sink.WithCallDepth(2) + } + return l.sink +} + +func (l *slogHandler) WithAttrs(attrs []slog.Attr) slog.Handler { + if l.sink == nil || len(attrs) == 0 { + return l + } + + copy := *l + if l.slogSink != nil { + copy.slogSink = l.slogSink.WithAttrs(attrs) + copy.sink = copy.slogSink + } else { + kvList := make([]any, 0, 2*len(attrs)) + for _, attr := range attrs { + if attr.Key != "" { + kvList = append(kvList, l.addGroupPrefix(attr.Key), attr.Value.Resolve().Any()) + } + } + copy.sink = l.sink.WithValues(kvList...) + } + return © +} + +func (l *slogHandler) WithGroup(name string) slog.Handler { + if l.sink == nil { + return l + } + copy := *l + if l.slogSink != nil { + copy.slogSink = l.slogSink.WithGroup(name) + copy.sink = l.slogSink + } else { + copy.groupPrefix = copy.addGroupPrefix(name) + } + return © +} + +func (l *slogHandler) addGroupPrefix(name string) string { + if l.groupPrefix == "" { + return name + } + return l.groupPrefix + groupSeparator + name +} + +// levelFromSlog adjusts the level by the logger's verbosity and negates it. +// It ensures that the result is >= 0. This is necessary because the result is +// passed to a logr.LogSink and that API did not historically document whether +// levels could be negative or what that meant. +// +// Some example usage: +// logrV0 := getMyLogger() +// logrV2 := logrV0.V(2) +// slogV2 := slog.New(slogr.NewSlogHandler(logrV2)) +// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) +// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) +// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) +func (l *slogHandler) levelFromSlog(level slog.Level) int { + result := -level + result += l.levelBias // in case the original logr.Logger had a V level + if result < 0 { + result = 0 // because logr.LogSink doesn't expect negative V levels + } + return int(result) +} diff --git a/vendor/github.com/go-logr/logr/slogr/slogr.go b/vendor/github.com/go-logr/logr/slogr/slogr.go new file mode 100644 index 000000000..eb519ae23 --- /dev/null +++ b/vendor/github.com/go-logr/logr/slogr/slogr.go @@ -0,0 +1,108 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package slogr enables usage of a slog.Handler with logr.Logger as front-end +// API and of a logr.LogSink through the slog.Handler and thus slog.Logger +// APIs. +// +// See the README in the top-level [./logr] package for a discussion of +// interoperability. +package slogr + +import ( + "context" + "log/slog" + + "github.com/go-logr/logr" +) + +// NewLogr returns a logr.Logger which writes to the slog.Handler. +// +// The logr verbosity level is mapped to slog levels such that V(0) becomes +// slog.LevelInfo and V(4) becomes slog.LevelDebug. +func NewLogr(handler slog.Handler) logr.Logger { + if handler, ok := handler.(*slogHandler); ok { + if handler.sink == nil { + return logr.Discard() + } + return logr.New(handler.sink).V(int(handler.levelBias)) + } + return logr.New(&slogSink{handler: handler}) +} + +// NewSlogHandler returns a slog.Handler which writes to the same sink as the logr.Logger. +// +// The returned logger writes all records with level >= slog.LevelError as +// error log entries with LogSink.Error, regardless of the verbosity level of +// the logr.Logger: +// +// logger := +// slog.New(NewSlogHandler(logger.V(10))).Error(...) -> logSink.Error(...) +// +// The level of all other records gets reduced by the verbosity +// level of the logr.Logger and the result is negated. If it happens +// to be negative, then it gets replaced by zero because a LogSink +// is not expected to handled negative levels: +// +// slog.New(NewSlogHandler(logger)).Debug(...) -> logger.GetSink().Info(level=4, ...) +// slog.New(NewSlogHandler(logger)).Warning(...) -> logger.GetSink().Info(level=0, ...) +// slog.New(NewSlogHandler(logger)).Info(...) -> logger.GetSink().Info(level=0, ...) +// slog.New(NewSlogHandler(logger.V(4))).Info(...) -> logger.GetSink().Info(level=4, ...) +func NewSlogHandler(logger logr.Logger) slog.Handler { + if sink, ok := logger.GetSink().(*slogSink); ok && logger.GetV() == 0 { + return sink.handler + } + + handler := &slogHandler{sink: logger.GetSink(), levelBias: slog.Level(logger.GetV())} + if slogSink, ok := handler.sink.(SlogSink); ok { + handler.slogSink = slogSink + } + return handler +} + +// SlogSink is an optional interface that a LogSink can implement to support +// logging through the slog.Logger or slog.Handler APIs better. It then should +// also support special slog values like slog.Group. When used as a +// slog.Handler, the advantages are: +// +// - stack unwinding gets avoided in favor of logging the pre-recorded PC, +// as intended by slog +// - proper grouping of key/value pairs via WithGroup +// - verbosity levels > slog.LevelInfo can be recorded +// - less overhead +// +// Both APIs (logr.Logger and slog.Logger/Handler) then are supported equally +// well. Developers can pick whatever API suits them better and/or mix +// packages which use either API in the same binary with a common logging +// implementation. +// +// This interface is necessary because the type implementing the LogSink +// interface cannot also implement the slog.Handler interface due to the +// different prototype of the common Enabled method. +// +// An implementation could support both interfaces in two different types, but then +// additional interfaces would be needed to convert between those types in NewLogr +// and NewSlogHandler. +type SlogSink interface { + logr.LogSink + + Handle(ctx context.Context, record slog.Record) error + WithAttrs(attrs []slog.Attr) SlogSink + WithGroup(name string) SlogSink +} diff --git a/vendor/github.com/go-logr/logr/slogr/slogsink.go b/vendor/github.com/go-logr/logr/slogr/slogsink.go new file mode 100644 index 000000000..6fbac561d --- /dev/null +++ b/vendor/github.com/go-logr/logr/slogr/slogsink.go @@ -0,0 +1,122 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package slogr + +import ( + "context" + "log/slog" + "runtime" + "time" + + "github.com/go-logr/logr" +) + +var ( + _ logr.LogSink = &slogSink{} + _ logr.CallDepthLogSink = &slogSink{} + _ Underlier = &slogSink{} +) + +// Underlier is implemented by the LogSink returned by NewLogr. +type Underlier interface { + // GetUnderlying returns the Handler used by the LogSink. + GetUnderlying() slog.Handler +} + +const ( + // nameKey is used to log the `WithName` values as an additional attribute. + nameKey = "logger" + + // errKey is used to log the error parameter of Error as an additional attribute. + errKey = "err" +) + +type slogSink struct { + callDepth int + name string + handler slog.Handler +} + +func (l *slogSink) Init(info logr.RuntimeInfo) { + l.callDepth = info.CallDepth +} + +func (l *slogSink) GetUnderlying() slog.Handler { + return l.handler +} + +func (l *slogSink) WithCallDepth(depth int) logr.LogSink { + newLogger := *l + newLogger.callDepth += depth + return &newLogger +} + +func (l *slogSink) Enabled(level int) bool { + return l.handler.Enabled(context.Background(), slog.Level(-level)) +} + +func (l *slogSink) Info(level int, msg string, kvList ...interface{}) { + l.log(nil, msg, slog.Level(-level), kvList...) +} + +func (l *slogSink) Error(err error, msg string, kvList ...interface{}) { + l.log(err, msg, slog.LevelError, kvList...) +} + +func (l *slogSink) log(err error, msg string, level slog.Level, kvList ...interface{}) { + var pcs [1]uintptr + // skip runtime.Callers, this function, Info/Error, and all helper functions above that. + runtime.Callers(3+l.callDepth, pcs[:]) + + record := slog.NewRecord(time.Now(), level, msg, pcs[0]) + if l.name != "" { + record.AddAttrs(slog.String(nameKey, l.name)) + } + if err != nil { + record.AddAttrs(slog.Any(errKey, err)) + } + record.Add(kvList...) + l.handler.Handle(context.Background(), record) +} + +func (l slogSink) WithName(name string) logr.LogSink { + if l.name != "" { + l.name = l.name + "/" + } + l.name += name + return &l +} + +func (l slogSink) WithValues(kvList ...interface{}) logr.LogSink { + l.handler = l.handler.WithAttrs(kvListToAttrs(kvList...)) + return &l +} + +func kvListToAttrs(kvList ...interface{}) []slog.Attr { + // We don't need the record itself, only its Add method. + record := slog.NewRecord(time.Time{}, 0, "", 0) + record.Add(kvList...) + attrs := make([]slog.Attr, 0, record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + attrs = append(attrs, attr) + return true + }) + return attrs +} diff --git a/vendor/github.com/go-openapi/swag/util.go b/vendor/github.com/go-openapi/swag/util.go index f78ab684a..d971fbe34 100644 --- a/vendor/github.com/go-openapi/swag/util.go +++ b/vendor/github.com/go-openapi/swag/util.go @@ -341,12 +341,21 @@ type zeroable interface { // IsZero returns true when the value passed into the function is a zero value. // This allows for safer checking of interface values. func IsZero(data interface{}) bool { + v := reflect.ValueOf(data) + // check for nil data + switch v.Kind() { + case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + if v.IsNil() { + return true + } + } + // check for things that have an IsZero method instead if vv, ok := data.(zeroable); ok { return vv.IsZero() } + // continue with slightly more complex reflection - v := reflect.ValueOf(data) switch v.Kind() { case reflect.String: return v.Len() == 0 @@ -358,14 +367,13 @@ func IsZero(data interface{}) bool { return v.Uint() == 0 case reflect.Float32, reflect.Float64: return v.Float() == 0 - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() case reflect.Struct, reflect.Array: return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface()) case reflect.Invalid: return true + default: + return false } - return false } // AddInitialisms add additional initialisms diff --git a/vendor/github.com/golang-jwt/jwt/v5/.gitignore b/vendor/github.com/golang-jwt/jwt/v5/.gitignore new file mode 100644 index 000000000..09573e016 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +bin +.idea/ + diff --git a/vendor/github.com/jongio/azidext/go/azidext/LICENSE b/vendor/github.com/golang-jwt/jwt/v5/LICENSE similarity index 91% rename from vendor/github.com/jongio/azidext/go/azidext/LICENSE rename to vendor/github.com/golang-jwt/jwt/v5/LICENSE index 21cbc94a6..35dbc2520 100644 --- a/vendor/github.com/jongio/azidext/go/azidext/LICENSE +++ b/vendor/github.com/golang-jwt/jwt/v5/LICENSE @@ -1,7 +1,9 @@ -Copyright 2020 Jon Gallant +Copyright (c) 2012 Dave Grijalva +Copyright (c) 2021 golang-jwt maintainers 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 +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/golang-jwt/jwt/v5/MIGRATION_GUIDE.md b/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md new file mode 100644 index 000000000..6ad1c22bb --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md @@ -0,0 +1,185 @@ +# Migration Guide (v5.0.0) + +Version `v5` contains a major rework of core functionalities in the `jwt-go` +library. This includes support for several validation options as well as a +re-design of the `Claims` interface. Lastly, we reworked how errors work under +the hood, which should provide a better overall developer experience. + +Starting from [v5.0.0](https://github.com/golang-jwt/jwt/releases/tag/v5.0.0), +the import path will be: + + "github.com/golang-jwt/jwt/v5" + +For most users, changing the import path *should* suffice. However, since we +intentionally changed and cleaned some of the public API, existing programs +might need to be updated. The following sections describe significant changes +and corresponding updates for existing programs. + +## Parsing and Validation Options + +Under the hood, a new `validator` struct takes care of validating the claims. A +long awaited feature has been the option to fine-tune the validation of tokens. +This is now possible with several `ParserOption` functions that can be appended +to most `Parse` functions, such as `ParseWithClaims`. The most important options +and changes are: + * Added `WithLeeway` to support specifying the leeway that is allowed when + validating time-based claims, such as `exp` or `nbf`. + * Changed default behavior to not check the `iat` claim. Usage of this claim + is OPTIONAL according to the JWT RFC. The claim itself is also purely + informational according to the RFC, so a strict validation failure is not + recommended. If you want to check for sensible values in these claims, + please use the `WithIssuedAt` parser option. + * Added `WithAudience`, `WithSubject` and `WithIssuer` to support checking for + expected `aud`, `sub` and `iss`. + * Added `WithStrictDecoding` and `WithPaddingAllowed` options to allow + previously global settings to enable base64 strict encoding and the parsing + of base64 strings with padding. The latter is strictly speaking against the + standard, but unfortunately some of the major identity providers issue some + of these incorrect tokens. Both options are disabled by default. + +## Changes to the `Claims` interface + +### Complete Restructuring + +Previously, the claims interface was satisfied with an implementation of a +`Valid() error` function. This had several issues: + * The different claim types (struct claims, map claims, etc.) then contained + similar (but not 100 % identical) code of how this validation was done. This + lead to a lot of (almost) duplicate code and was hard to maintain + * It was not really semantically close to what a "claim" (or a set of claims) + really is; which is a list of defined key/value pairs with a certain + semantic meaning. + +Since all the validation functionality is now extracted into the validator, all +`VerifyXXX` and `Valid` functions have been removed from the `Claims` interface. +Instead, the interface now represents a list of getters to retrieve values with +a specific meaning. This allows us to completely decouple the validation logic +with the underlying storage representation of the claim, which could be a +struct, a map or even something stored in a database. + +```go +type Claims interface { + GetExpirationTime() (*NumericDate, error) + GetIssuedAt() (*NumericDate, error) + GetNotBefore() (*NumericDate, error) + GetIssuer() (string, error) + GetSubject() (string, error) + GetAudience() (ClaimStrings, error) +} +``` + +### Supported Claim Types and Removal of `StandardClaims` + +The two standard claim types supported by this library, `MapClaims` and +`RegisteredClaims` both implement the necessary functions of this interface. The +old `StandardClaims` struct, which has already been deprecated in `v4` is now +removed. + +Users using custom claims, in most cases, will not experience any changes in the +behavior as long as they embedded `RegisteredClaims`. If they created a new +claim type from scratch, they now need to implemented the proper getter +functions. + +### Migrating Application Specific Logic of the old `Valid` + +Previously, users could override the `Valid` method in a custom claim, for +example to extend the validation with application-specific claims. However, this +was always very dangerous, since once could easily disable the standard +validation and signature checking. + +In order to avoid that, while still supporting the use-case, a new +`ClaimsValidator` interface has been introduced. This interface consists of the +`Validate() error` function. If the validator sees, that a `Claims` struct +implements this interface, the errors returned to the `Validate` function will +be *appended* to the regular standard validation. It is not possible to disable +the standard validation anymore (even only by accident). + +Usage examples can be found in [example_test.go](./example_test.go), to build +claims structs like the following. + +```go +// MyCustomClaims includes all registered claims, plus Foo. +type MyCustomClaims struct { + Foo string `json:"foo"` + jwt.RegisteredClaims +} + +// Validate can be used to execute additional application-specific claims +// validation. +func (m MyCustomClaims) Validate() error { + if m.Foo != "bar" { + return errors.New("must be foobar") + } + + return nil +} +``` + +## Changes to the `Token` and `Parser` struct + +The previously global functions `DecodeSegment` and `EncodeSegment` were moved +to the `Parser` and `Token` struct respectively. This will allow us in the +future to configure the behavior of these two based on options supplied on the +parser or the token (creation). This also removes two previously global +variables and moves them to parser options `WithStrictDecoding` and +`WithPaddingAllowed`. + +In order to do that, we had to adjust the way signing methods work. Previously +they were given a base64 encoded signature in `Verify` and were expected to +return a base64 encoded version of the signature in `Sign`, both as a `string`. +However, this made it necessary to have `DecodeSegment` and `EncodeSegment` +global and was a less than perfect design because we were repeating +encoding/decoding steps for all signing methods. Now, `Sign` and `Verify` +operate on a decoded signature as a `[]byte`, which feels more natural for a +cryptographic operation anyway. Lastly, `Parse` and `SignedString` take care of +the final encoding/decoding part. + +In addition to that, we also changed the `Signature` field on `Token` from a +`string` to `[]byte` and this is also now populated with the decoded form. This +is also more consistent, because the other parts of the JWT, mainly `Header` and +`Claims` were already stored in decoded form in `Token`. Only the signature was +stored in base64 encoded form, which was redundant with the information in the +`Raw` field, which contains the complete token as base64. + +```go +type Token struct { + Raw string // Raw contains the raw token + Method SigningMethod // Method is the signing method used or to be used + Header map[string]interface{} // Header is the first segment of the token in decoded form + Claims Claims // Claims is the second segment of the token in decoded form + Signature []byte // Signature is the third segment of the token in decoded form + Valid bool // Valid specifies if the token is valid +} +``` + +Most (if not all) of these changes should not impact the normal usage of this +library. Only users directly accessing the `Signature` field as well as +developers of custom signing methods should be affected. + +# Migration Guide (v4.0.0) + +Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0), +the import path will be: + + "github.com/golang-jwt/jwt/v4" + +The `/v4` version will be backwards compatible with existing `v3.x.y` tags in +this repo, as well as `github.com/dgrijalva/jwt-go`. For most users this should +be a drop-in replacement, if you're having troubles migrating, please open an +issue. + +You can replace all occurrences of `github.com/dgrijalva/jwt-go` or +`github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v5`, either manually +or by using tools such as `sed` or `gofmt`. + +And then you'd typically run: + +``` +go get github.com/golang-jwt/jwt/v4 +go mod tidy +``` + +# Older releases (before v3.2.0) + +The original migration guide for older releases can be found at +https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md. diff --git a/vendor/github.com/golang-jwt/jwt/v5/README.md b/vendor/github.com/golang-jwt/jwt/v5/README.md new file mode 100644 index 000000000..964598a31 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/README.md @@ -0,0 +1,167 @@ +# jwt-go + +[![build](https://github.com/golang-jwt/jwt/actions/workflows/build.yml/badge.svg)](https://github.com/golang-jwt/jwt/actions/workflows/build.yml) +[![Go +Reference](https://pkg.go.dev/badge/github.com/golang-jwt/jwt/v5.svg)](https://pkg.go.dev/github.com/golang-jwt/jwt/v5) +[![Coverage Status](https://coveralls.io/repos/github/golang-jwt/jwt/badge.svg?branch=main)](https://coveralls.io/github/golang-jwt/jwt?branch=main) + +A [go](http://www.golang.org) (or 'golang' for search engine friendliness) +implementation of [JSON Web +Tokens](https://datatracker.ietf.org/doc/html/rfc7519). + +Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0) +this project adds Go module support, but maintains backwards compatibility with +older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`. See the +[`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information. Version +v5.0.0 introduces major improvements to the validation of tokens, but is not +entirely backwards compatible. + +> After the original author of the library suggested migrating the maintenance +> of `jwt-go`, a dedicated team of open source maintainers decided to clone the +> existing library into this repository. See +> [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a +> detailed discussion on this topic. + + +**SECURITY NOTICE:** Some older versions of Go have a security issue in the +crypto/elliptic. Recommendation is to upgrade to at least 1.15 See issue +[dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more +detail. + +**SECURITY NOTICE:** It's important that you [validate the `alg` presented is +what you +expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). +This library attempts to make it easy to do the right thing by requiring key +types match the expected alg, but you should take the extra step to verify it in +your usage. See the examples provided. + +### Supported Go versions + +Our support of Go versions is aligned with Go's [version release +policy](https://golang.org/doc/devel/release#policy). So we will support a major +version of Go until there are two newer major releases. We no longer support +building jwt-go with unsupported Go versions, as these contain security +vulnerabilities which will not be fixed. + +## What the heck is a JWT? + +JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web +Tokens. + +In short, it's a signed JSON object that does something useful (for example, +authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is +made of three parts, separated by `.`'s. The first two parts are JSON objects, +that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) +encoded. The last part is the signature, encoded the same way. + +The first part is called the header. It contains the necessary information for +verifying the last part, the signature. For example, which encryption method +was used for signing and what key was used. + +The part in the middle is the interesting bit. It's called the Claims and +contains the actual stuff you care about. Refer to [RFC +7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about +reserved keys and the proper way to add your own. + +## What's in the box? + +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/v5 +``` + +2. Import it in your code: + +```go +import "github.com/golang-jwt/jwt/v5" +``` + +## Usage + +A detailed usage guide, including how to sign and verify tokens can be found on +our [documentation website](https://golang-jwt.github.io/jwt/usage/create/). + +## Examples + +See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v5) +for examples of usage: + +* [Simple example of parsing and validating a + token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-Parse-Hmac) +* [Simple example of building and signing a + token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-New-Hmac) +* [Directory of + Examples](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#pkg-examples) + +## Compliance + +This library was last reviewed to comply with [RFC +7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few +notable differences: + +* In order to protect against accidental use of [Unsecured + JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using + `alg=none` will only be accepted if the constant + `jwt.UnsafeAllowNoneSignatureType` is provided as the key. + +## Project Status & Versioning + +This library is considered production ready. Feedback and feature requests are +appreciated. The API should be considered stable. There should be very few +backwards-incompatible changes outside of major version updates (and only with +good reason). + +This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull +requests will land on `main`. Periodically, versions will be tagged from +`main`. You can find all the releases on [the project releases +page](https://github.com/golang-jwt/jwt/releases). + +**BREAKING CHANGES:*** A full list of breaking changes is available in +`VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating +your code. + +## Extensions + +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. + +| 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 + +## More + +Go package documentation can be found [on +pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt/v5). Additional +documentation can be found on [our project +page](https://golang-jwt.github.io/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/v5/SECURITY.md b/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md new file mode 100644 index 000000000..b08402c34 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/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/v5/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md new file mode 100644 index 000000000..b5039e49c --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md @@ -0,0 +1,137 @@ +# `jwt-go` Version History + +The following version history is kept for historic purposes. To retrieve the current changes of each version, please refer to the change-log of the specific release versions on https://github.com/golang-jwt/jwt/releases. + +## 4.0.0 + +* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`. + +## 3.2.2 + +* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)). +* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)). +* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)). +* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)). + +## 3.2.1 + +* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code + * Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt` +* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160 + +#### 3.2.0 + +* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation +* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate +* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before. +* Deprecated `ParseFromRequestWithClaims` to simplify API in the future. + +#### 3.1.0 + +* Improvements to `jwt` command line tool +* Added `SkipClaimsValidation` option to `Parser` +* Documentation updates + +#### 3.0.0 + +* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code + * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods. + * `ParseFromRequest` has been moved to `request` subpackage and usage has changed + * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims. +* Other Additions and Changes + * Added `Claims` interface type to allow users to decode the claims into a custom type + * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into. + * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage + * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims` + * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`. + * Added several new, more specific, validation errors to error type bitmask + * Moved examples from README to executable example files + * Signing method registry is now thread safe + * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser) + +#### 2.7.0 + +This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes. + +* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying +* Error text for expired tokens includes how long it's been expired +* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM` +* Documentation updates + +#### 2.6.0 + +* Exposed inner error within ValidationError +* Fixed validation errors when using UseJSONNumber flag +* Added several unit tests + +#### 2.5.0 + +* Added support for signing method none. You shouldn't use this. The API tries to make this clear. +* Updated/fixed some documentation +* Added more helpful error message when trying to parse tokens that begin with `BEARER ` + +#### 2.4.0 + +* Added new type, Parser, to allow for configuration of various parsing parameters + * You can now specify a list of valid signing methods. Anything outside this set will be rejected. + * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON +* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go) +* Fixed some bugs with ECDSA parsing + +#### 2.3.0 + +* Added support for ECDSA signing methods +* Added support for RSA PSS signing methods (requires go v1.4) + +#### 2.2.0 + +* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic. + +#### 2.1.0 + +Backwards compatible API change that was missed in 2.0.0. + +* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte` + +#### 2.0.0 + +There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change. + +The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`. + +It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`. + +* **Compatibility Breaking Changes** + * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct` + * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct` + * `KeyFunc` now returns `interface{}` instead of `[]byte` + * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key + * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key +* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type. + * Added public package global `SigningMethodHS256` + * Added public package global `SigningMethodHS384` + * Added public package global `SigningMethodHS512` +* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type. + * Added public package global `SigningMethodRS256` + * Added public package global `SigningMethodRS384` + * Added public package global `SigningMethodRS512` +* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged. +* Refactored the RSA implementation to be easier to read +* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM` + +## 1.0.2 + +* Fixed bug in parsing public keys from certificates +* Added more tests around the parsing of keys for RS256 +* Code refactoring in RS256 implementation. No functional changes + +## 1.0.1 + +* Fixed panic if RS256 signing method was passed an invalid key + +## 1.0.0 + +* First versioned release +* API stabilized +* Supports creating, signing, parsing, and validating JWT tokens +* Supports RS256 and HS256 signing methods diff --git a/vendor/github.com/golang-jwt/jwt/v5/claims.go b/vendor/github.com/golang-jwt/jwt/v5/claims.go new file mode 100644 index 000000000..d50ff3dad --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/claims.go @@ -0,0 +1,16 @@ +package jwt + +// Claims represent any form of a JWT Claims Set according to +// https://datatracker.ietf.org/doc/html/rfc7519#section-4. In order to have a +// common basis for validation, it is required that an implementation is able to +// supply at least the claim names provided in +// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 namely `exp`, +// `iat`, `nbf`, `iss`, `sub` and `aud`. +type Claims interface { + GetExpirationTime() (*NumericDate, error) + GetIssuedAt() (*NumericDate, error) + GetNotBefore() (*NumericDate, error) + GetIssuer() (string, error) + GetSubject() (string, error) + GetAudience() (ClaimStrings, error) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/doc.go b/vendor/github.com/golang-jwt/jwt/v5/doc.go new file mode 100644 index 000000000..a86dc1a3b --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/doc.go @@ -0,0 +1,4 @@ +// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html +// +// See README.md for more info. +package jwt diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go new file mode 100644 index 000000000..4ccae2a85 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go @@ -0,0 +1,134 @@ +package jwt + +import ( + "crypto" + "crypto/ecdsa" + "crypto/rand" + "errors" + "math/big" +) + +var ( + // Sadly this is missing from crypto/ecdsa compared to crypto/rsa + ErrECDSAVerification = errors.New("crypto/ecdsa: verification error") +) + +// SigningMethodECDSA implements the ECDSA family of signing methods. +// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification +type SigningMethodECDSA struct { + Name string + Hash crypto.Hash + KeySize int + CurveBits int +} + +// Specific instances for EC256 and company +var ( + SigningMethodES256 *SigningMethodECDSA + SigningMethodES384 *SigningMethodECDSA + SigningMethodES512 *SigningMethodECDSA +) + +func init() { + // ES256 + SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256} + RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod { + return SigningMethodES256 + }) + + // ES384 + SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384} + RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod { + return SigningMethodES384 + }) + + // ES512 + SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521} + RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod { + return SigningMethodES512 + }) +} + +func (m *SigningMethodECDSA) Alg() string { + return m.Name +} + +// Verify implements token verification for the SigningMethod. +// For this verify method, key must be an ecdsa.PublicKey struct +func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key interface{}) error { + // Get the key + var ecdsaKey *ecdsa.PublicKey + switch k := key.(type) { + case *ecdsa.PublicKey: + ecdsaKey = k + default: + return ErrInvalidKeyType + } + + if len(sig) != 2*m.KeySize { + return ErrECDSAVerification + } + + r := big.NewInt(0).SetBytes(sig[:m.KeySize]) + s := big.NewInt(0).SetBytes(sig[m.KeySize:]) + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Verify the signature + if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus { + return nil + } + + return ErrECDSAVerification +} + +// Sign implements token signing for the SigningMethod. +// For this signing method, key must be an ecdsa.PrivateKey struct +func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) ([]byte, error) { + // Get the key + var ecdsaKey *ecdsa.PrivateKey + switch k := key.(type) { + case *ecdsa.PrivateKey: + ecdsaKey = k + default: + return nil, ErrInvalidKeyType + } + + // Create the hasher + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return r, s + if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil { + curveBits := ecdsaKey.Curve.Params().BitSize + + if m.CurveBits != curveBits { + return nil, ErrInvalidKey + } + + keyBytes := curveBits / 8 + if curveBits%8 > 0 { + keyBytes += 1 + } + + // We serialize the outputs (r and s) into big-endian byte arrays + // padded with zeros on the left to make sure the sizes work out. + // Output must be 2*keyBytes long. + out := make([]byte, 2*keyBytes) + r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output. + s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output. + + return out, nil + } else { + return nil, err + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go new file mode 100644 index 000000000..5700636d3 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go @@ -0,0 +1,69 @@ +package jwt + +import ( + "crypto/ecdsa" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key") + ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key") +) + +// ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure +func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + } + + var pkey *ecdsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { + return nil, ErrNotECPrivateKey + } + + return pkey, nil +} + +// ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key +func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + if cert, err := x509.ParseCertificate(block.Bytes); err == nil { + parsedKey = cert.PublicKey + } else { + return nil, err + } + } + + var pkey *ecdsa.PublicKey + var ok bool + if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { + return nil, ErrNotECPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go new file mode 100644 index 000000000..3db00e4a2 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go @@ -0,0 +1,80 @@ +package jwt + +import ( + "errors" + + "crypto" + "crypto/ed25519" + "crypto/rand" +) + +var ( + ErrEd25519Verification = errors.New("ed25519: verification error") +) + +// SigningMethodEd25519 implements the EdDSA family. +// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification +type SigningMethodEd25519 struct{} + +// Specific instance for EdDSA +var ( + SigningMethodEdDSA *SigningMethodEd25519 +) + +func init() { + SigningMethodEdDSA = &SigningMethodEd25519{} + RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod { + return SigningMethodEdDSA + }) +} + +func (m *SigningMethodEd25519) Alg() string { + return "EdDSA" +} + +// Verify implements token verification for the SigningMethod. +// For this verify method, key must be an ed25519.PublicKey +func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key interface{}) error { + var ed25519Key ed25519.PublicKey + var ok bool + + if ed25519Key, ok = key.(ed25519.PublicKey); !ok { + return ErrInvalidKeyType + } + + if len(ed25519Key) != ed25519.PublicKeySize { + return ErrInvalidKey + } + + // Verify the signature + if !ed25519.Verify(ed25519Key, []byte(signingString), sig) { + return ErrEd25519Verification + } + + return nil +} + +// Sign implements token signing for the SigningMethod. +// For this signing method, key must be an ed25519.PrivateKey +func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) ([]byte, error) { + var ed25519Key crypto.Signer + var ok bool + + if ed25519Key, ok = key.(crypto.Signer); !ok { + return nil, ErrInvalidKeyType + } + + if _, ok := ed25519Key.Public().(ed25519.PublicKey); !ok { + return nil, ErrInvalidKey + } + + // Sign the string and return the result. ed25519 performs a two-pass hash + // as part of its algorithm. Therefore, we need to pass a non-prehashed + // message into the Sign function, as indicated by crypto.Hash(0) + sig, err := ed25519Key.Sign(rand.Reader, []byte(signingString), crypto.Hash(0)) + if err != nil { + return nil, err + } + + return sig, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go new file mode 100644 index 000000000..cdb5e68e8 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go @@ -0,0 +1,64 @@ +package jwt + +import ( + "crypto" + "crypto/ed25519" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key") + ErrNotEdPublicKey = errors.New("key is not a valid Ed25519 public key") +) + +// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key +func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + + var pkey ed25519.PrivateKey + var ok bool + if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok { + return nil, ErrNotEdPrivateKey + } + + return pkey, nil +} + +// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key +func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + return nil, err + } + + var pkey ed25519.PublicKey + var ok bool + if pkey, ok = parsedKey.(ed25519.PublicKey); !ok { + return nil, ErrNotEdPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors.go b/vendor/github.com/golang-jwt/jwt/v5/errors.go new file mode 100644 index 000000000..23bb616dd --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/errors.go @@ -0,0 +1,49 @@ +package jwt + +import ( + "errors" + "strings" +) + +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") + ErrTokenRequiredClaimMissing = errors.New("token is missing required claim") + 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") + ErrTokenInvalidSubject = errors.New("token has invalid subject") + ErrTokenNotValidYet = errors.New("token is not valid yet") + ErrTokenInvalidId = errors.New("token has invalid id") + ErrTokenInvalidClaims = errors.New("token has invalid claims") + ErrInvalidType = errors.New("invalid type for claim") +) + +// joinedError is an error type that works similar to what [errors.Join] +// produces, with the exception that it has a nice error string; mainly its +// error messages are concatenated using a comma, rather than a newline. +type joinedError struct { + errs []error +} + +func (je joinedError) Error() string { + msg := []string{} + for _, err := range je.errs { + msg = append(msg, err.Error()) + } + + return strings.Join(msg, ", ") +} + +// joinErrors joins together multiple errors. Useful for scenarios where +// multiple errors next to each other occur, e.g., in claims validation. +func joinErrors(errs ...error) error { + return &joinedError{ + errs: errs, + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go b/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go new file mode 100644 index 000000000..a893d355e --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go @@ -0,0 +1,47 @@ +//go:build go1.20 +// +build go1.20 + +package jwt + +import ( + "fmt" +) + +// Unwrap implements the multiple error unwrapping for this error type, which is +// possible in Go 1.20. +func (je joinedError) Unwrap() []error { + return je.errs +} + +// newError creates a new error message with a detailed error message. The +// message will be prefixed with the contents of the supplied error type. +// Additionally, more errors, that provide more context can be supplied which +// will be appended to the message. This makes use of Go 1.20's possibility to +// include more than one %w formatting directive in [fmt.Errorf]. +// +// For example, +// +// newError("no keyfunc was provided", ErrTokenUnverifiable) +// +// will produce the error string +// +// "token is unverifiable: no keyfunc was provided" +func newError(message string, err error, more ...error) error { + var format string + var args []any + if message != "" { + format = "%w: %s" + args = []any{err, message} + } else { + format = "%w" + args = []any{err} + } + + for _, e := range more { + format += ": %w" + args = append(args, e) + } + + err = fmt.Errorf(format, args...) + return err +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors_go_other.go b/vendor/github.com/golang-jwt/jwt/v5/errors_go_other.go new file mode 100644 index 000000000..3afb04e64 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/errors_go_other.go @@ -0,0 +1,78 @@ +//go:build !go1.20 +// +build !go1.20 + +package jwt + +import ( + "errors" + "fmt" +) + +// Is implements checking for multiple errors using [errors.Is], since multiple +// error unwrapping is not possible in versions less than Go 1.20. +func (je joinedError) Is(err error) bool { + for _, e := range je.errs { + if errors.Is(e, err) { + return true + } + } + + return false +} + +// wrappedErrors is a workaround for wrapping multiple errors in environments +// where Go 1.20 is not available. It basically uses the already implemented +// functionatlity of joinedError to handle multiple errors with supplies a +// custom error message that is identical to the one we produce in Go 1.20 using +// multiple %w directives. +type wrappedErrors struct { + msg string + joinedError +} + +// Error returns the stored error string +func (we wrappedErrors) Error() string { + return we.msg +} + +// newError creates a new error message with a detailed error message. The +// message will be prefixed with the contents of the supplied error type. +// Additionally, more errors, that provide more context can be supplied which +// will be appended to the message. Since we cannot use of Go 1.20's possibility +// to include more than one %w formatting directive in [fmt.Errorf], we have to +// emulate that. +// +// For example, +// +// newError("no keyfunc was provided", ErrTokenUnverifiable) +// +// will produce the error string +// +// "token is unverifiable: no keyfunc was provided" +func newError(message string, err error, more ...error) error { + // We cannot wrap multiple errors here with %w, so we have to be a little + // bit creative. Basically, we are using %s instead of %w to produce the + // same error message and then throw the result into a custom error struct. + var format string + var args []any + if message != "" { + format = "%s: %s" + args = []any{err, message} + } else { + format = "%s" + args = []any{err} + } + errs := []error{err} + + for _, e := range more { + format += ": %s" + args = append(args, e) + errs = append(errs, e) + } + + err = &wrappedErrors{ + msg: fmt.Sprintf(format, args...), + joinedError: joinedError{errs: errs}, + } + return err +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/hmac.go b/vendor/github.com/golang-jwt/jwt/v5/hmac.go new file mode 100644 index 000000000..91b688ba9 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/hmac.go @@ -0,0 +1,104 @@ +package jwt + +import ( + "crypto" + "crypto/hmac" + "errors" +) + +// SigningMethodHMAC implements the HMAC-SHA family of signing methods. +// Expects key type of []byte for both signing and validation +type SigningMethodHMAC struct { + Name string + Hash crypto.Hash +} + +// Specific instances for HS256 and company +var ( + SigningMethodHS256 *SigningMethodHMAC + SigningMethodHS384 *SigningMethodHMAC + SigningMethodHS512 *SigningMethodHMAC + ErrSignatureInvalid = errors.New("signature is invalid") +) + +func init() { + // HS256 + SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256} + RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod { + return SigningMethodHS256 + }) + + // HS384 + SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384} + RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod { + return SigningMethodHS384 + }) + + // HS512 + SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512} + RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod { + return SigningMethodHS512 + }) +} + +func (m *SigningMethodHMAC) Alg() string { + return m.Name +} + +// Verify implements token verification for the SigningMethod. Returns nil if +// the signature is valid. Key must be []byte. +// +// Note it is not advised to provide a []byte which was converted from a 'human +// readable' string using a subset of ASCII characters. To maximize entropy, you +// should ideally be providing a []byte key which was produced from a +// cryptographically random source, e.g. crypto/rand. Additional information +// about this, and why we intentionally are not supporting string as a key can +// be found on our usage guide +// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types. +func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key interface{}) error { + // Verify the key is the right type + keyBytes, ok := key.([]byte) + if !ok { + return ErrInvalidKeyType + } + + // Can we use the specified hashing method? + if !m.Hash.Available() { + return ErrHashUnavailable + } + + // This signing method is symmetric, so we validate the signature + // by reproducing the signature from the signing string and key, then + // comparing that against the provided signature. + hasher := hmac.New(m.Hash.New, keyBytes) + hasher.Write([]byte(signingString)) + if !hmac.Equal(sig, hasher.Sum(nil)) { + return ErrSignatureInvalid + } + + // No validation errors. Signature is good. + return nil +} + +// Sign implements token signing for the SigningMethod. Key must be []byte. +// +// Note it is not advised to provide a []byte which was converted from a 'human +// readable' string using a subset of ASCII characters. To maximize entropy, you +// should ideally be providing a []byte key which was produced from a +// cryptographically random source, e.g. crypto/rand. Additional information +// about this, and why we intentionally are not supporting string as a key can +// be found on our usage guide https://golang-jwt.github.io/jwt/usage/signing_methods/. +func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) ([]byte, error) { + if keyBytes, ok := key.([]byte); ok { + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := hmac.New(m.Hash.New, keyBytes) + hasher.Write([]byte(signingString)) + + return hasher.Sum(nil), nil + } + + return nil, ErrInvalidKeyType +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/map_claims.go b/vendor/github.com/golang-jwt/jwt/v5/map_claims.go new file mode 100644 index 000000000..b2b51a1f8 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/map_claims.go @@ -0,0 +1,109 @@ +package jwt + +import ( + "encoding/json" + "fmt" +) + +// MapClaims is a claims type that uses the map[string]interface{} for JSON +// decoding. This is the default claims type if you don't supply one +type MapClaims map[string]interface{} + +// GetExpirationTime implements the Claims interface. +func (m MapClaims) GetExpirationTime() (*NumericDate, error) { + return m.parseNumericDate("exp") +} + +// GetNotBefore implements the Claims interface. +func (m MapClaims) GetNotBefore() (*NumericDate, error) { + return m.parseNumericDate("nbf") +} + +// GetIssuedAt implements the Claims interface. +func (m MapClaims) GetIssuedAt() (*NumericDate, error) { + return m.parseNumericDate("iat") +} + +// GetAudience implements the Claims interface. +func (m MapClaims) GetAudience() (ClaimStrings, error) { + return m.parseClaimsString("aud") +} + +// GetIssuer implements the Claims interface. +func (m MapClaims) GetIssuer() (string, error) { + return m.parseString("iss") +} + +// GetSubject implements the Claims interface. +func (m MapClaims) GetSubject() (string, error) { + return m.parseString("sub") +} + +// parseNumericDate tries to parse a key in the map claims type as a number +// date. This will succeed, if the underlying type is either a [float64] or a +// [json.Number]. Otherwise, nil will be returned. +func (m MapClaims) parseNumericDate(key string) (*NumericDate, error) { + v, ok := m[key] + if !ok { + return nil, nil + } + + switch exp := v.(type) { + case float64: + if exp == 0 { + return nil, nil + } + + return newNumericDateFromSeconds(exp), nil + case json.Number: + v, _ := exp.Float64() + + return newNumericDateFromSeconds(v), nil + } + + return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) +} + +// parseClaimsString tries to parse a key in the map claims type as a +// [ClaimsStrings] type, which can either be a string or an array of string. +func (m MapClaims) parseClaimsString(key string) (ClaimStrings, error) { + var cs []string + switch v := m[key].(type) { + case string: + cs = append(cs, v) + case []string: + cs = v + case []interface{}: + for _, a := range v { + vs, ok := a.(string) + if !ok { + return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) + } + cs = append(cs, vs) + } + } + + return cs, nil +} + +// parseString tries to parse a key in the map claims type as a [string] type. +// If the key does not exist, an empty string is returned. If the key has the +// wrong type, an error is returned. +func (m MapClaims) parseString(key string) (string, error) { + var ( + ok bool + raw interface{} + iss string + ) + raw, ok = m[key] + if !ok { + return "", nil + } + + iss, ok = raw.(string) + if !ok { + return "", newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) + } + + return iss, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/none.go b/vendor/github.com/golang-jwt/jwt/v5/none.go new file mode 100644 index 000000000..c93daa584 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/none.go @@ -0,0 +1,50 @@ +package jwt + +// SigningMethodNone implements the none signing method. This is required by the spec +// but you probably should never use it. +var SigningMethodNone *signingMethodNone + +const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed" + +var NoneSignatureTypeDisallowedError error + +type signingMethodNone struct{} +type unsafeNoneMagicConstant string + +func init() { + SigningMethodNone = &signingMethodNone{} + NoneSignatureTypeDisallowedError = newError("'none' signature type is not allowed", ErrTokenUnverifiable) + + RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod { + return SigningMethodNone + }) +} + +func (m *signingMethodNone) Alg() string { + return "none" +} + +// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key +func (m *signingMethodNone) Verify(signingString string, sig []byte, key interface{}) (err error) { + // Key must be UnsafeAllowNoneSignatureType to prevent accidentally + // accepting 'none' signing method + if _, ok := key.(unsafeNoneMagicConstant); !ok { + return NoneSignatureTypeDisallowedError + } + // If signing method is none, signature must be an empty string + if string(sig) != "" { + return newError("'none' signing method with non-empty signature", ErrTokenUnverifiable) + } + + // Accept 'none' signing method. + return nil +} + +// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key +func (m *signingMethodNone) Sign(signingString string, key interface{}) ([]byte, error) { + if _, ok := key.(unsafeNoneMagicConstant); ok { + return []byte{}, nil + } + + return nil, NoneSignatureTypeDisallowedError +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser.go b/vendor/github.com/golang-jwt/jwt/v5/parser.go new file mode 100644 index 000000000..f4386fbaa --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/parser.go @@ -0,0 +1,215 @@ +package jwt + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "fmt" + "strings" +) + +type Parser struct { + // If populated, only these methods will be considered valid. + validMethods []string + + // Use JSON Number format in JSON decoder. + useJSONNumber bool + + // Skip claims validation during token parsing. + skipClaimsValidation bool + + validator *validator + + decodeStrict bool + + decodePaddingAllowed bool +} + +// NewParser creates a new Parser with the specified options +func NewParser(options ...ParserOption) *Parser { + p := &Parser{ + validator: &validator{}, + } + + // Loop through our parsing options and apply them + for _, option := range options { + option(p) + } + + return p +} + +// Parse parses, validates, verifies the signature and returns the parsed token. +// keyFunc will receive the parsed token and should return the key for validating. +func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { + return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) +} + +// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims +// interface. This provides default values which can be overridden and allows a caller to use their own type, rather +// than the default MapClaims implementation of Claims. +// +// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims), +// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the +// proper memory for it before passing in the overall claims, otherwise you might run into a panic. +func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { + token, parts, err := p.ParseUnverified(tokenString, claims) + if err != nil { + return token, err + } + + // Verify signing method is in the required set + if p.validMethods != nil { + var signingMethodValid = false + var alg = token.Method.Alg() + for _, m := range p.validMethods { + if m == alg { + signingMethodValid = true + break + } + } + if !signingMethodValid { + // signing method is not in the listed set + return token, newError(fmt.Sprintf("signing method %v is invalid", alg), ErrTokenSignatureInvalid) + } + } + + // Lookup key + var key interface{} + if keyFunc == nil { + // keyFunc was not provided. short circuiting validation + return token, newError("no keyfunc was provided", ErrTokenUnverifiable) + } + if key, err = keyFunc(token); err != nil { + return token, newError("error while executing keyfunc", ErrTokenUnverifiable, err) + } + + // Decode signature + token.Signature, err = p.DecodeSegment(parts[2]) + if err != nil { + return token, newError("could not base64 decode signature", ErrTokenMalformed, err) + } + + // Perform signature validation + if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil { + return token, newError("", ErrTokenSignatureInvalid, err) + } + + // Validate Claims + if !p.skipClaimsValidation { + // Make sure we have at least a default validator + if p.validator == nil { + p.validator = newValidator() + } + + if err := p.validator.Validate(claims); err != nil { + return token, newError("", ErrTokenInvalidClaims, err) + } + } + + // No errors so far, token is valid. + token.Valid = true + + return token, nil +} + +// ParseUnverified parses the token but doesn't validate the signature. +// +// WARNING: Don't use this method unless you know what you're doing. +// +// It's only ever useful in cases where you know the signature is valid (because it has +// been checked previously in the stack) and you want to extract values from it. +func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) { + parts = strings.Split(tokenString, ".") + if len(parts) != 3 { + return nil, parts, newError("token contains an invalid number of segments", ErrTokenMalformed) + } + + token = &Token{Raw: tokenString} + + // parse Header + var headerBytes []byte + if headerBytes, err = p.DecodeSegment(parts[0]); err != nil { + if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") { + return token, parts, newError("tokenstring should not contain 'bearer '", ErrTokenMalformed) + } + return token, parts, newError("could not base64 decode header", ErrTokenMalformed, err) + } + if err = json.Unmarshal(headerBytes, &token.Header); err != nil { + return token, parts, newError("could not JSON decode header", ErrTokenMalformed, err) + } + + // parse Claims + var claimBytes []byte + token.Claims = claims + + if claimBytes, err = p.DecodeSegment(parts[1]); err != nil { + return token, parts, newError("could not base64 decode claim", ErrTokenMalformed, err) + } + dec := json.NewDecoder(bytes.NewBuffer(claimBytes)) + if p.useJSONNumber { + dec.UseNumber() + } + // JSON Decode. Special case for map type to avoid weird pointer behavior + if c, ok := token.Claims.(MapClaims); ok { + err = dec.Decode(&c) + } else { + err = dec.Decode(&claims) + } + // Handle decode error + if err != nil { + return token, parts, newError("could not JSON decode claim", ErrTokenMalformed, err) + } + + // Lookup signature method + if method, ok := token.Header["alg"].(string); ok { + if token.Method = GetSigningMethod(method); token.Method == nil { + return token, parts, newError("signing method (alg) is unavailable", ErrTokenUnverifiable) + } + } else { + return token, parts, newError("signing method (alg) is unspecified", ErrTokenUnverifiable) + } + + return token, parts, nil +} + +// DecodeSegment decodes a JWT specific base64url encoding. This function will +// take into account whether the [Parser] is configured with additional options, +// such as [WithStrictDecoding] or [WithPaddingAllowed]. +func (p *Parser) DecodeSegment(seg string) ([]byte, error) { + encoding := base64.RawURLEncoding + + if p.decodePaddingAllowed { + if l := len(seg) % 4; l > 0 { + seg += strings.Repeat("=", 4-l) + } + encoding = base64.URLEncoding + } + + if p.decodeStrict { + encoding = encoding.Strict() + } + return encoding.DecodeString(seg) +} + +// Parse parses, validates, verifies the signature and returns the parsed token. +// keyFunc will receive the parsed token and should return the cryptographic key +// for verifying the signature. The caller is strongly encouraged to set the +// WithValidMethods option to validate the 'alg' claim in the token matches the +// expected algorithm. For more details about the importance of validating the +// 'alg' claim, see +// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/ +func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { + return NewParser(options...).Parse(tokenString, keyFunc) +} + +// ParseWithClaims is a shortcut for NewParser().ParseWithClaims(). +// +// Note: If you provide a custom claim implementation that embeds one of the +// standard claims (such as RegisteredClaims), make sure that a) you either +// embed a non-pointer version of the claims or b) if you are using a pointer, +// allocate the proper memory for it before passing in the overall claims, +// otherwise you might run into a panic. +func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { + return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser_option.go b/vendor/github.com/golang-jwt/jwt/v5/parser_option.go new file mode 100644 index 000000000..1b5af970f --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/parser_option.go @@ -0,0 +1,120 @@ +package jwt + +import "time" + +// 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) + +// WithValidMethods is an option to supply algorithm methods that the parser +// will check. Only those methods will be considered valid. It is heavily +// encouraged to use this option in order to prevent attacks such as +// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/. +func WithValidMethods(methods []string) ParserOption { + return func(p *Parser) { + p.validMethods = methods + } +} + +// WithJSONNumber is an option to configure the underlying JSON parser with +// UseNumber. +func WithJSONNumber() ParserOption { + return func(p *Parser) { + p.useJSONNumber = true + } +} + +// WithoutClaimsValidation is an option to disable claims validation. This +// option should only be used if you exactly know what you are doing. +func WithoutClaimsValidation() ParserOption { + return func(p *Parser) { + p.skipClaimsValidation = true + } +} + +// WithLeeway returns the ParserOption for specifying the leeway window. +func WithLeeway(leeway time.Duration) ParserOption { + return func(p *Parser) { + p.validator.leeway = leeway + } +} + +// WithTimeFunc returns the ParserOption for specifying the time func. The +// primary use-case for this is testing. If you are looking for a way to account +// for clock-skew, WithLeeway should be used instead. +func WithTimeFunc(f func() time.Time) ParserOption { + return func(p *Parser) { + p.validator.timeFunc = f + } +} + +// WithIssuedAt returns the ParserOption to enable verification +// of issued-at. +func WithIssuedAt() ParserOption { + return func(p *Parser) { + p.validator.verifyIat = true + } +} + +// WithAudience configures the validator to require the specified audience in +// the `aud` claim. Validation will fail if the audience is not listed in the +// token or the `aud` claim is missing. +// +// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if an audience is expected. +func WithAudience(aud string) ParserOption { + return func(p *Parser) { + p.validator.expectedAud = aud + } +} + +// WithIssuer configures the validator to require the specified issuer in the +// `iss` claim. Validation will fail if a different issuer is specified in the +// token or the `iss` claim is missing. +// +// NOTE: While the `iss` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if an issuer is expected. +func WithIssuer(iss string) ParserOption { + return func(p *Parser) { + p.validator.expectedIss = iss + } +} + +// WithSubject configures the validator to require the specified subject in the +// `sub` claim. Validation will fail if a different subject is specified in the +// token or the `sub` claim is missing. +// +// NOTE: While the `sub` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if a subject is expected. +func WithSubject(sub string) ParserOption { + return func(p *Parser) { + p.validator.expectedSub = sub + } +} + +// WithPaddingAllowed will enable the codec used for decoding JWTs to allow +// padding. 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. +func WithPaddingAllowed() ParserOption { + return func(p *Parser) { + p.decodePaddingAllowed = true + } +} + +// WithStrictDecoding will switch the codec used for decoding JWTs into strict +// mode. In this mode, the decoder requires that trailing padding bits are zero, +// as described in RFC 4648 section 3.5. +func WithStrictDecoding() ParserOption { + return func(p *Parser) { + p.decodeStrict = true + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go b/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go new file mode 100644 index 000000000..77951a531 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go @@ -0,0 +1,63 @@ +package jwt + +// RegisteredClaims are a structured version of the JWT Claims Set, +// restricted to Registered Claim Names, as referenced at +// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 +// +// This type can be used on its own, but then additional private and +// public claims embedded in the JWT will not be parsed. The typical use-case +// therefore is to embedded this in a user-defined claim type. +// +// See examples for how to use this with your own claim types. +type RegisteredClaims struct { + // the `iss` (Issuer) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1 + Issuer string `json:"iss,omitempty"` + + // the `sub` (Subject) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2 + Subject string `json:"sub,omitempty"` + + // the `aud` (Audience) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3 + Audience ClaimStrings `json:"aud,omitempty"` + + // the `exp` (Expiration Time) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4 + ExpiresAt *NumericDate `json:"exp,omitempty"` + + // the `nbf` (Not Before) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5 + NotBefore *NumericDate `json:"nbf,omitempty"` + + // the `iat` (Issued At) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6 + IssuedAt *NumericDate `json:"iat,omitempty"` + + // the `jti` (JWT ID) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7 + ID string `json:"jti,omitempty"` +} + +// GetExpirationTime implements the Claims interface. +func (c RegisteredClaims) GetExpirationTime() (*NumericDate, error) { + return c.ExpiresAt, nil +} + +// GetNotBefore implements the Claims interface. +func (c RegisteredClaims) GetNotBefore() (*NumericDate, error) { + return c.NotBefore, nil +} + +// GetIssuedAt implements the Claims interface. +func (c RegisteredClaims) GetIssuedAt() (*NumericDate, error) { + return c.IssuedAt, nil +} + +// GetAudience implements the Claims interface. +func (c RegisteredClaims) GetAudience() (ClaimStrings, error) { + return c.Audience, nil +} + +// GetIssuer implements the Claims interface. +func (c RegisteredClaims) GetIssuer() (string, error) { + return c.Issuer, nil +} + +// GetSubject implements the Claims interface. +func (c RegisteredClaims) GetSubject() (string, error) { + return c.Subject, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa.go b/vendor/github.com/golang-jwt/jwt/v5/rsa.go new file mode 100644 index 000000000..daff09431 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/rsa.go @@ -0,0 +1,93 @@ +package jwt + +import ( + "crypto" + "crypto/rand" + "crypto/rsa" +) + +// SigningMethodRSA implements the RSA family of signing methods. +// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation +type SigningMethodRSA struct { + Name string + Hash crypto.Hash +} + +// Specific instances for RS256 and company +var ( + SigningMethodRS256 *SigningMethodRSA + SigningMethodRS384 *SigningMethodRSA + SigningMethodRS512 *SigningMethodRSA +) + +func init() { + // RS256 + SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256} + RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod { + return SigningMethodRS256 + }) + + // RS384 + SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384} + RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod { + return SigningMethodRS384 + }) + + // RS512 + SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512} + RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod { + return SigningMethodRS512 + }) +} + +func (m *SigningMethodRSA) Alg() string { + return m.Name +} + +// Verify implements token verification for the SigningMethod +// For this signing method, must be an *rsa.PublicKey structure. +func (m *SigningMethodRSA) Verify(signingString string, sig []byte, key interface{}) error { + var rsaKey *rsa.PublicKey + var ok bool + + if rsaKey, ok = key.(*rsa.PublicKey); !ok { + return ErrInvalidKeyType + } + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Verify the signature + return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig) +} + +// Sign implements token signing for the SigningMethod +// For this signing method, must be an *rsa.PrivateKey structure. +func (m *SigningMethodRSA) Sign(signingString string, key interface{}) ([]byte, error) { + var rsaKey *rsa.PrivateKey + var ok bool + + // Validate type of key + if rsaKey, ok = key.(*rsa.PrivateKey); !ok { + return nil, ErrInvalidKey + } + + // Create the hasher + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return the encoded bytes + if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil { + return sigBytes, nil + } else { + return nil, err + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go new file mode 100644 index 000000000..9599f0a46 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go @@ -0,0 +1,135 @@ +//go:build go1.4 +// +build go1.4 + +package jwt + +import ( + "crypto" + "crypto/rand" + "crypto/rsa" +) + +// SigningMethodRSAPSS implements the RSAPSS family of signing methods signing methods +type SigningMethodRSAPSS struct { + *SigningMethodRSA + Options *rsa.PSSOptions + // VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS. + // Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow + // https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously. + // See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details. + VerifyOptions *rsa.PSSOptions +} + +// Specific instances for RS/PS and company. +var ( + SigningMethodPS256 *SigningMethodRSAPSS + SigningMethodPS384 *SigningMethodRSAPSS + SigningMethodPS512 *SigningMethodRSAPSS +) + +func init() { + // PS256 + SigningMethodPS256 = &SigningMethodRSAPSS{ + SigningMethodRSA: &SigningMethodRSA{ + Name: "PS256", + Hash: crypto.SHA256, + }, + Options: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }, + VerifyOptions: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + }, + } + RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod { + return SigningMethodPS256 + }) + + // PS384 + SigningMethodPS384 = &SigningMethodRSAPSS{ + SigningMethodRSA: &SigningMethodRSA{ + Name: "PS384", + Hash: crypto.SHA384, + }, + Options: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }, + VerifyOptions: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + }, + } + RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod { + return SigningMethodPS384 + }) + + // PS512 + SigningMethodPS512 = &SigningMethodRSAPSS{ + SigningMethodRSA: &SigningMethodRSA{ + Name: "PS512", + Hash: crypto.SHA512, + }, + Options: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }, + VerifyOptions: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + }, + } + RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod { + return SigningMethodPS512 + }) +} + +// Verify implements token verification for the SigningMethod. +// For this verify method, key must be an rsa.PublicKey struct +func (m *SigningMethodRSAPSS) Verify(signingString string, sig []byte, key interface{}) error { + var rsaKey *rsa.PublicKey + switch k := key.(type) { + case *rsa.PublicKey: + rsaKey = k + default: + return ErrInvalidKey + } + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + opts := m.Options + if m.VerifyOptions != nil { + opts = m.VerifyOptions + } + + return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts) +} + +// Sign implements token signing for the SigningMethod. +// For this signing method, key must be an rsa.PrivateKey struct +func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) ([]byte, error) { + var rsaKey *rsa.PrivateKey + + switch k := key.(type) { + case *rsa.PrivateKey: + rsaKey = k + default: + return nil, ErrInvalidKeyType + } + + // Create the hasher + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return the encoded bytes + if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil { + return sigBytes, nil + } else { + return nil, err + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go new file mode 100644 index 000000000..b3aeebbe1 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go @@ -0,0 +1,107 @@ +package jwt + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") + ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key") + ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key") +) + +// ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key +func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + var parsedKey interface{} + if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + } + + var pkey *rsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { + return nil, ErrNotRSAPrivateKey + } + + return pkey, nil +} + +// ParseRSAPrivateKeyFromPEMWithPassword parses a PEM encoded PKCS1 or PKCS8 private key protected with password +// +// Deprecated: This function is deprecated and should not be used anymore. It uses the deprecated x509.DecryptPEMBlock +// function, which was deprecated since RFC 1423 is regarded insecure by design. Unfortunately, there is no alternative +// in the Go standard library for now. See https://github.com/golang/go/issues/8860. +func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + var parsedKey interface{} + + var blockDecrypted []byte + if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil { + return nil, err + } + + if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil { + return nil, err + } + } + + var pkey *rsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { + return nil, ErrNotRSAPrivateKey + } + + return pkey, nil +} + +// ParseRSAPublicKeyFromPEM parses a certificate or a PEM encoded PKCS1 or PKIX public key +func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + if cert, err := x509.ParseCertificate(block.Bytes); err == nil { + parsedKey = cert.PublicKey + } else { + if parsedKey, err = x509.ParsePKCS1PublicKey(block.Bytes); err != nil { + return nil, err + } + } + } + + var pkey *rsa.PublicKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { + return nil, ErrNotRSAPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go b/vendor/github.com/golang-jwt/jwt/v5/signing_method.go new file mode 100644 index 000000000..0d73631c1 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/signing_method.go @@ -0,0 +1,49 @@ +package jwt + +import ( + "sync" +) + +var signingMethods = map[string]func() SigningMethod{} +var signingMethodLock = new(sync.RWMutex) + +// SigningMethod can be used add new methods for signing or verifying tokens. It +// takes a decoded signature as an input in the Verify function and produces a +// signature in Sign. The signature is then usually base64 encoded as part of a +// JWT. +type SigningMethod interface { + Verify(signingString string, sig []byte, key interface{}) error // Returns nil if signature is valid + Sign(signingString string, key interface{}) ([]byte, error) // Returns signature or error + Alg() string // returns the alg identifier for this method (example: 'HS256') +} + +// RegisterSigningMethod registers the "alg" name and a factory function for signing method. +// This is typically done during init() in the method's implementation +func RegisterSigningMethod(alg string, f func() SigningMethod) { + signingMethodLock.Lock() + defer signingMethodLock.Unlock() + + signingMethods[alg] = f +} + +// GetSigningMethod retrieves a signing method from an "alg" string +func GetSigningMethod(alg string) (method SigningMethod) { + signingMethodLock.RLock() + defer signingMethodLock.RUnlock() + + if methodF, ok := signingMethods[alg]; ok { + method = methodF() + } + return +} + +// GetAlgorithms returns a list of registered "alg" names +func GetAlgorithms() (algs []string) { + signingMethodLock.RLock() + defer signingMethodLock.RUnlock() + + for alg := range signingMethods { + algs = append(algs, alg) + } + return +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf b/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf new file mode 100644 index 000000000..53745d51d --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf @@ -0,0 +1 @@ +checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1023"] diff --git a/vendor/github.com/golang-jwt/jwt/v5/token.go b/vendor/github.com/golang-jwt/jwt/v5/token.go new file mode 100644 index 000000000..c8ad7c783 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/token.go @@ -0,0 +1,86 @@ +package jwt + +import ( + "encoding/base64" + "encoding/json" +) + +// Keyfunc will be used by the Parse methods as a callback function to supply +// the key for verification. The function receives the parsed, but unverified +// Token. This allows you to use properties in the Header of the token (such as +// `kid`) to identify which key to use. +type Keyfunc func(*Token) (interface{}, error) + +// Token represents a JWT Token. Different fields will be used depending on +// whether you're creating or parsing/verifying a token. +type Token struct { + Raw string // Raw contains the raw token. Populated when you [Parse] a token + Method SigningMethod // Method is the signing method used or to be used + Header map[string]interface{} // Header is the first segment of the token in decoded form + Claims Claims // Claims is the second segment of the token in decoded form + Signature []byte // Signature is the third segment of the token in decoded form. Populated when you Parse a token + Valid bool // Valid specifies if the token is valid. Populated when you Parse/Verify a token +} + +// New creates a new [Token] with the specified signing method and an empty map +// of claims. Additional options can be specified, but are currently unused. +func New(method SigningMethod, opts ...TokenOption) *Token { + return NewWithClaims(method, MapClaims{}, opts...) +} + +// NewWithClaims creates a new [Token] with the specified signing method and +// claims. Additional options can be specified, but are currently unused. +func NewWithClaims(method SigningMethod, claims Claims, opts ...TokenOption) *Token { + return &Token{ + Header: map[string]interface{}{ + "typ": "JWT", + "alg": method.Alg(), + }, + Claims: claims, + Method: method, + } +} + +// SignedString creates and returns a complete, signed JWT. The token is signed +// using the SigningMethod specified in the token. Please refer to +// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types +// for an overview of the different signing methods and their respective key +// types. +func (t *Token) SignedString(key interface{}) (string, error) { + sstr, err := t.SigningString() + if err != nil { + return "", err + } + + sig, err := t.Method.Sign(sstr, key) + if err != nil { + return "", err + } + + return sstr + "." + t.EncodeSegment(sig), nil +} + +// SigningString generates the signing string. This is the most expensive part +// of the whole deal. Unless you need this for something special, just go +// straight for the SignedString. +func (t *Token) SigningString() (string, error) { + h, err := json.Marshal(t.Header) + if err != nil { + return "", err + } + + c, err := json.Marshal(t.Claims) + if err != nil { + return "", err + } + + return t.EncodeSegment(h) + "." + t.EncodeSegment(c), nil +} + +// EncodeSegment encodes a JWT specific base64url encoding with padding +// stripped. In the future, this function might take into account a +// [TokenOption]. Therefore, this function exists as a method of [Token], rather +// than a global function. +func (*Token) EncodeSegment(seg []byte) string { + return base64.RawURLEncoding.EncodeToString(seg) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/token_option.go b/vendor/github.com/golang-jwt/jwt/v5/token_option.go new file mode 100644 index 000000000..b4ae3badf --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/token_option.go @@ -0,0 +1,5 @@ +package jwt + +// TokenOption is a reserved type, which provides some forward compatibility, +// if we ever want to introduce token creation-related options. +type TokenOption func(*Token) diff --git a/vendor/github.com/golang-jwt/jwt/v5/types.go b/vendor/github.com/golang-jwt/jwt/v5/types.go new file mode 100644 index 000000000..b82b38867 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/types.go @@ -0,0 +1,150 @@ +package jwt + +import ( + "encoding/json" + "fmt" + "math" + "reflect" + "strconv" + "time" +) + +// TimePrecision sets the precision of times and dates within this library. This +// has an influence on the precision of times when comparing expiry or other +// related time fields. Furthermore, it is also the precision of times when +// serializing. +// +// For backwards compatibility the default precision is set to seconds, so that +// no fractional timestamps are generated. +var TimePrecision = time.Second + +// MarshalSingleStringAsArray modifies the behavior of the ClaimStrings type, +// especially its MarshalJSON function. +// +// If it is set to true (the default), it will always serialize the type as an +// array of strings, even if it just contains one element, defaulting to the +// behavior of the underlying []string. If it is set to false, it will serialize +// to a single string, if it contains one element. Otherwise, it will serialize +// to an array of strings. +var MarshalSingleStringAsArray = true + +// NumericDate represents a JSON numeric date value, as referenced at +// https://datatracker.ietf.org/doc/html/rfc7519#section-2. +type NumericDate struct { + time.Time +} + +// NewNumericDate constructs a new *NumericDate from a standard library time.Time struct. +// It will truncate the timestamp according to the precision specified in TimePrecision. +func NewNumericDate(t time.Time) *NumericDate { + return &NumericDate{t.Truncate(TimePrecision)} +} + +// newNumericDateFromSeconds creates a new *NumericDate out of a float64 representing a +// UNIX epoch with the float fraction representing non-integer seconds. +func newNumericDateFromSeconds(f float64) *NumericDate { + round, frac := math.Modf(f) + return NewNumericDate(time.Unix(int64(round), int64(frac*1e9))) +} + +// 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) { + 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 returns 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 +// deserializes a [NumericDate] from a JSON representation, i.e. a +// [json.Number]. This number represents an UNIX epoch with either integer or +// non-integer seconds. +func (date *NumericDate) UnmarshalJSON(b []byte) (err error) { + var ( + number json.Number + f float64 + ) + + if err = json.Unmarshal(b, &number); err != nil { + return fmt.Errorf("could not parse NumericData: %w", err) + } + + if f, err = number.Float64(); err != nil { + return fmt.Errorf("could not convert json number value to float: %w", err) + } + + n := newNumericDateFromSeconds(f) + *date = *n + + return nil +} + +// ClaimStrings is basically just a slice of strings, but it can be either +// serialized from a string array or just a string. This type is necessary, +// since the "aud" claim can either be a single string or an array. +type ClaimStrings []string + +func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) { + var value interface{} + + if err = json.Unmarshal(data, &value); err != nil { + return err + } + + var aud []string + + switch v := value.(type) { + case string: + aud = append(aud, v) + case []string: + aud = ClaimStrings(v) + case []interface{}: + for _, vv := range v { + vs, ok := vv.(string) + if !ok { + return &json.UnsupportedTypeError{Type: reflect.TypeOf(vv)} + } + aud = append(aud, vs) + } + case nil: + return nil + default: + return &json.UnsupportedTypeError{Type: reflect.TypeOf(v)} + } + + *s = aud + + return +} + +func (s ClaimStrings) MarshalJSON() (b []byte, err error) { + // This handles a special case in the JWT RFC. If the string array, e.g. + // used by the "aud" field, only contains one element, it MAY be serialized + // as a single string. This may or may not be desired based on the ecosystem + // of other JWT library used, so we make it configurable by the variable + // MarshalSingleStringAsArray. + if len(s) == 1 && !MarshalSingleStringAsArray { + return json.Marshal(s[0]) + } + + return json.Marshal([]string(s)) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/validator.go b/vendor/github.com/golang-jwt/jwt/v5/validator.go new file mode 100644 index 000000000..385043893 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/validator.go @@ -0,0 +1,301 @@ +package jwt + +import ( + "crypto/subtle" + "fmt" + "time" +) + +// ClaimsValidator is an interface that can be implemented by custom claims who +// wish to execute any additional claims validation based on +// application-specific logic. The Validate function is then executed in +// addition to the regular claims validation and any error returned is appended +// to the final validation result. +// +// type MyCustomClaims struct { +// Foo string `json:"foo"` +// jwt.RegisteredClaims +// } +// +// func (m MyCustomClaims) Validate() error { +// if m.Foo != "bar" { +// return errors.New("must be foobar") +// } +// return nil +// } +type ClaimsValidator interface { + Claims + Validate() error +} + +// validator is the core of the new Validation API. It is automatically used by +// a [Parser] during parsing and can be modified with various parser options. +// +// Note: This struct is intentionally not exported (yet) as we want to +// internally finalize its API. In the future, we might make it publicly +// available. +type validator struct { + // leeway is an optional leeway that can be provided to account for clock skew. + leeway time.Duration + + // timeFunc is used to supply the current time that is needed for + // validation. If unspecified, this defaults to time.Now. + timeFunc func() time.Time + + // verifyIat specifies whether the iat (Issued At) claim will be verified. + // According to https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6 this + // only specifies the age of the token, but no validation check is + // necessary. However, if wanted, it can be checked if the iat is + // unrealistic, i.e., in the future. + verifyIat bool + + // expectedAud contains the audience this token expects. Supplying an empty + // string will disable aud checking. + expectedAud string + + // expectedIss contains the issuer this token expects. Supplying an empty + // string will disable iss checking. + expectedIss string + + // expectedSub contains the subject this token expects. Supplying an empty + // string will disable sub checking. + expectedSub string +} + +// newValidator can be used to create a stand-alone validator with the supplied +// options. This validator can then be used to validate already parsed claims. +func newValidator(opts ...ParserOption) *validator { + p := NewParser(opts...) + return p.validator +} + +// Validate validates the given claims. It will also perform any custom +// validation if claims implements the [ClaimsValidator] interface. +func (v *validator) Validate(claims Claims) error { + var ( + now time.Time + errs []error = make([]error, 0, 6) + err error + ) + + // Check, if we have a time func + if v.timeFunc != nil { + now = v.timeFunc() + } else { + now = time.Now() + } + + // We always need to check the expiration time, but usage of the claim + // itself is OPTIONAL. + if err = v.verifyExpiresAt(claims, now, false); err != nil { + errs = append(errs, err) + } + + // We always need to check not-before, but usage of the claim itself is + // OPTIONAL. + if err = v.verifyNotBefore(claims, now, false); err != nil { + errs = append(errs, err) + } + + // Check issued-at if the option is enabled + if v.verifyIat { + if err = v.verifyIssuedAt(claims, now, false); err != nil { + errs = append(errs, err) + } + } + + // If we have an expected audience, we also require the audience claim + if v.expectedAud != "" { + if err = v.verifyAudience(claims, v.expectedAud, true); err != nil { + errs = append(errs, err) + } + } + + // If we have an expected issuer, we also require the issuer claim + if v.expectedIss != "" { + if err = v.verifyIssuer(claims, v.expectedIss, true); err != nil { + errs = append(errs, err) + } + } + + // If we have an expected subject, we also require the subject claim + if v.expectedSub != "" { + if err = v.verifySubject(claims, v.expectedSub, true); err != nil { + errs = append(errs, err) + } + } + + // Finally, we want to give the claim itself some possibility to do some + // additional custom validation based on a custom Validate function. + cvt, ok := claims.(ClaimsValidator) + if ok { + if err := cvt.Validate(); err != nil { + errs = append(errs, err) + } + } + + if len(errs) == 0 { + return nil + } + + return joinErrors(errs...) +} + +// verifyExpiresAt compares the exp claim in claims against cmp. This function +// will succeed if cmp < exp. Additional leeway is taken into account. +// +// If exp is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *validator) verifyExpiresAt(claims Claims, cmp time.Time, required bool) error { + exp, err := claims.GetExpirationTime() + if err != nil { + return err + } + + if exp == nil { + return errorIfRequired(required, "exp") + } + + return errorIfFalse(cmp.Before((exp.Time).Add(+v.leeway)), ErrTokenExpired) +} + +// verifyIssuedAt compares the iat claim in claims against cmp. This function +// will succeed if cmp >= iat. Additional leeway is taken into account. +// +// If iat is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *validator) verifyIssuedAt(claims Claims, cmp time.Time, required bool) error { + iat, err := claims.GetIssuedAt() + if err != nil { + return err + } + + if iat == nil { + return errorIfRequired(required, "iat") + } + + return errorIfFalse(!cmp.Before(iat.Add(-v.leeway)), ErrTokenUsedBeforeIssued) +} + +// verifyNotBefore compares the nbf claim in claims against cmp. This function +// will return true if cmp >= nbf. Additional leeway is taken into account. +// +// If nbf is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *validator) verifyNotBefore(claims Claims, cmp time.Time, required bool) error { + nbf, err := claims.GetNotBefore() + if err != nil { + return err + } + + if nbf == nil { + return errorIfRequired(required, "nbf") + } + + return errorIfFalse(!cmp.Before(nbf.Add(-v.leeway)), ErrTokenNotValidYet) +} + +// verifyAudience compares the aud claim against cmp. +// +// If aud is not set or an empty list, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *validator) verifyAudience(claims Claims, cmp string, required bool) error { + aud, err := claims.GetAudience() + if err != nil { + return err + } + + if len(aud) == 0 { + return errorIfRequired(required, "aud") + } + + // use a var here to keep constant time compare when looping over a number of claims + result := false + + var stringClaims string + for _, a := range aud { + if subtle.ConstantTimeCompare([]byte(a), []byte(cmp)) != 0 { + result = true + } + stringClaims = stringClaims + a + } + + // case where "" is sent in one or many aud claims + if stringClaims == "" { + return errorIfRequired(required, "aud") + } + + return errorIfFalse(result, ErrTokenInvalidAudience) +} + +// verifyIssuer compares the iss claim in claims against cmp. +// +// If iss is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *validator) verifyIssuer(claims Claims, cmp string, required bool) error { + iss, err := claims.GetIssuer() + if err != nil { + return err + } + + if iss == "" { + return errorIfRequired(required, "iss") + } + + return errorIfFalse(iss == cmp, ErrTokenInvalidIssuer) +} + +// verifySubject compares the sub claim against cmp. +// +// If sub is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *validator) verifySubject(claims Claims, cmp string, required bool) error { + sub, err := claims.GetSubject() + if err != nil { + return err + } + + if sub == "" { + return errorIfRequired(required, "sub") + } + + return errorIfFalse(sub == cmp, ErrTokenInvalidSubject) +} + +// errorIfFalse returns the error specified in err, if the value is true. +// Otherwise, nil is returned. +func errorIfFalse(value bool, err error) error { + if value { + return nil + } else { + return err + } +} + +// errorIfRequired returns an ErrTokenRequiredClaimMissing error if required is +// true. Otherwise, nil is returned. +func errorIfRequired(required bool, claim string) error { + if required { + return newError(fmt.Sprintf("%s claim is required", claim), ErrTokenRequiredClaimMissing) + } else { + return nil + } +} diff --git a/vendor/github.com/google/go-cmp/cmp/compare.go b/vendor/github.com/google/go-cmp/cmp/compare.go index 087320da7..0f5b8a48c 100644 --- a/vendor/github.com/google/go-cmp/cmp/compare.go +++ b/vendor/github.com/google/go-cmp/cmp/compare.go @@ -5,7 +5,7 @@ // Package cmp determines equality of values. // // This package is intended to be a more powerful and safer alternative to -// reflect.DeepEqual for comparing whether two values are semantically equal. +// [reflect.DeepEqual] for comparing whether two values are semantically equal. // It is intended to only be used in tests, as performance is not a goal and // it may panic if it cannot compare the values. Its propensity towards // panicking means that its unsuitable for production environments where a @@ -18,16 +18,17 @@ // For example, an equality function may report floats as equal so long as // they are within some tolerance of each other. // -// - Types with an Equal method may use that method to determine equality. -// This allows package authors to determine the equality operation -// for the types that they define. +// - Types with an Equal method (e.g., [time.Time.Equal]) may use that method +// to determine equality. This allows package authors to determine +// the equality operation for the types that they define. // // - If no custom equality functions are used and no Equal method is defined, // equality is determined by recursively comparing the primitive kinds on -// both values, much like reflect.DeepEqual. Unlike reflect.DeepEqual, +// both values, much like [reflect.DeepEqual]. Unlike [reflect.DeepEqual], // unexported fields are not compared by default; they result in panics -// unless suppressed by using an Ignore option (see cmpopts.IgnoreUnexported) -// or explicitly compared using the Exporter option. +// unless suppressed by using an [Ignore] option +// (see [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported]) +// or explicitly compared using the [Exporter] option. package cmp import ( @@ -45,14 +46,14 @@ import ( // Equal reports whether x and y are equal by recursively applying the // following rules in the given order to x and y and all of their sub-values: // -// - Let S be the set of all Ignore, Transformer, and Comparer options that +// - Let S be the set of all [Ignore], [Transformer], and [Comparer] options that // remain after applying all path filters, value filters, and type filters. -// If at least one Ignore exists in S, then the comparison is ignored. -// If the number of Transformer and Comparer options in S is non-zero, +// If at least one [Ignore] exists in S, then the comparison is ignored. +// If the number of [Transformer] and [Comparer] options in S is non-zero, // then Equal panics because it is ambiguous which option to use. -// If S contains a single Transformer, then use that to transform +// If S contains a single [Transformer], then use that to transform // the current values and recursively call Equal on the output values. -// If S contains a single Comparer, then use that to compare the current values. +// If S contains a single [Comparer], then use that to compare the current values. // Otherwise, evaluation proceeds to the next rule. // // - If the values have an Equal method of the form "(T) Equal(T) bool" or @@ -66,21 +67,22 @@ import ( // Functions are only equal if they are both nil, otherwise they are unequal. // // Structs are equal if recursively calling Equal on all fields report equal. -// If a struct contains unexported fields, Equal panics unless an Ignore option -// (e.g., cmpopts.IgnoreUnexported) ignores that field or the Exporter option -// explicitly permits comparing the unexported field. +// If a struct contains unexported fields, Equal panics unless an [Ignore] option +// (e.g., [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported]) ignores that field +// or the [Exporter] option explicitly permits comparing the unexported field. // // Slices are equal if they are both nil or both non-nil, where recursively // calling Equal on all non-ignored slice or array elements report equal. // Empty non-nil slices and nil slices are not equal; to equate empty slices, -// consider using cmpopts.EquateEmpty. +// consider using [github.com/google/go-cmp/cmp/cmpopts.EquateEmpty]. // // Maps are equal if they are both nil or both non-nil, where recursively // calling Equal on all non-ignored map entries report equal. // Map keys are equal according to the == operator. -// To use custom comparisons for map keys, consider using cmpopts.SortMaps. +// To use custom comparisons for map keys, consider using +// [github.com/google/go-cmp/cmp/cmpopts.SortMaps]. // Empty non-nil maps and nil maps are not equal; to equate empty maps, -// consider using cmpopts.EquateEmpty. +// consider using [github.com/google/go-cmp/cmp/cmpopts.EquateEmpty]. // // Pointers and interfaces are equal if they are both nil or both non-nil, // where they have the same underlying concrete type and recursively diff --git a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go b/vendor/github.com/google/go-cmp/cmp/export.go similarity index 94% rename from vendor/github.com/google/go-cmp/cmp/export_unsafe.go rename to vendor/github.com/google/go-cmp/cmp/export.go index e2c0f74e8..29f82fe6b 100644 --- a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go +++ b/vendor/github.com/google/go-cmp/cmp/export.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego -// +build !purego - package cmp import ( @@ -12,8 +9,6 @@ import ( "unsafe" ) -const supportExporters = true - // retrieveUnexportedField uses unsafe to forcibly retrieve any field from // a struct such that the value has read-write permissions. // diff --git a/vendor/github.com/google/go-cmp/cmp/export_panic.go b/vendor/github.com/google/go-cmp/cmp/export_panic.go deleted file mode 100644 index ae851fe53..000000000 --- a/vendor/github.com/google/go-cmp/cmp/export_panic.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego -// +build purego - -package cmp - -import "reflect" - -const supportExporters = false - -func retrieveUnexportedField(reflect.Value, reflect.StructField, bool) reflect.Value { - panic("no support for forcibly accessing unexported fields") -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go similarity index 95% rename from vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go rename to vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go index 16e6860af..e5dfff69a 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego -// +build !purego - package value import ( diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go deleted file mode 100644 index 1a71bfcbd..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego -// +build purego - -package value - -import "reflect" - -// Pointer is an opaque typed pointer and is guaranteed to be comparable. -type Pointer struct { - p uintptr - t reflect.Type -} - -// PointerOf returns a Pointer from v, which must be a -// reflect.Ptr, reflect.Slice, or reflect.Map. -func PointerOf(v reflect.Value) Pointer { - // NOTE: Storing a pointer as an uintptr is technically incorrect as it - // assumes that the GC implementation does not use a moving collector. - return Pointer{v.Pointer(), v.Type()} -} - -// IsNil reports whether the pointer is nil. -func (p Pointer) IsNil() bool { - return p.p == 0 -} - -// Uintptr returns the pointer as a uintptr. -func (p Pointer) Uintptr() uintptr { - return p.p -} diff --git a/vendor/github.com/google/go-cmp/cmp/options.go b/vendor/github.com/google/go-cmp/cmp/options.go index 1f9ca9c48..754496f3b 100644 --- a/vendor/github.com/google/go-cmp/cmp/options.go +++ b/vendor/github.com/google/go-cmp/cmp/options.go @@ -13,15 +13,15 @@ import ( "github.com/google/go-cmp/cmp/internal/function" ) -// Option configures for specific behavior of Equal and Diff. In particular, -// the fundamental Option functions (Ignore, Transformer, and Comparer), +// Option configures for specific behavior of [Equal] and [Diff]. In particular, +// the fundamental Option functions ([Ignore], [Transformer], and [Comparer]), // configure how equality is determined. // -// The fundamental options may be composed with filters (FilterPath and -// FilterValues) to control the scope over which they are applied. +// The fundamental options may be composed with filters ([FilterPath] and +// [FilterValues]) to control the scope over which they are applied. // -// The cmp/cmpopts package provides helper functions for creating options that -// may be used with Equal and Diff. +// The [github.com/google/go-cmp/cmp/cmpopts] package provides helper functions +// for creating options that may be used with [Equal] and [Diff]. type Option interface { // filter applies all filters and returns the option that remains. // Each option may only read s.curPath and call s.callTTBFunc. @@ -56,9 +56,9 @@ type core struct{} func (core) isCore() {} -// Options is a list of Option values that also satisfies the Option interface. +// Options is a list of [Option] values that also satisfies the [Option] interface. // Helper comparison packages may return an Options value when packing multiple -// Option values into a single Option. When this package processes an Options, +// [Option] values into a single [Option]. When this package processes an Options, // it will be implicitly expanded into a flat list. // // Applying a filter on an Options is equivalent to applying that same filter @@ -105,16 +105,16 @@ func (opts Options) String() string { return fmt.Sprintf("Options{%s}", strings.Join(ss, ", ")) } -// FilterPath returns a new Option where opt is only evaluated if filter f -// returns true for the current Path in the value tree. +// FilterPath returns a new [Option] where opt is only evaluated if filter f +// returns true for the current [Path] in the value tree. // // This filter is called even if a slice element or map entry is missing and // provides an opportunity to ignore such cases. The filter function must be // symmetric such that the filter result is identical regardless of whether the // missing value is from x or y. // -// The option passed in may be an Ignore, Transformer, Comparer, Options, or -// a previously filtered Option. +// The option passed in may be an [Ignore], [Transformer], [Comparer], [Options], or +// a previously filtered [Option]. func FilterPath(f func(Path) bool, opt Option) Option { if f == nil { panic("invalid path filter function") @@ -142,7 +142,7 @@ func (f pathFilter) String() string { return fmt.Sprintf("FilterPath(%s, %v)", function.NameOf(reflect.ValueOf(f.fnc)), f.opt) } -// FilterValues returns a new Option where opt is only evaluated if filter f, +// FilterValues returns a new [Option] where opt is only evaluated if filter f, // which is a function of the form "func(T, T) bool", returns true for the // current pair of values being compared. If either value is invalid or // the type of the values is not assignable to T, then this filter implicitly @@ -154,8 +154,8 @@ func (f pathFilter) String() string { // If T is an interface, it is possible that f is called with two values with // different concrete types that both implement T. // -// The option passed in may be an Ignore, Transformer, Comparer, Options, or -// a previously filtered Option. +// The option passed in may be an [Ignore], [Transformer], [Comparer], [Options], or +// a previously filtered [Option]. func FilterValues(f interface{}, opt Option) Option { v := reflect.ValueOf(f) if !function.IsType(v.Type(), function.ValueFilter) || v.IsNil() { @@ -192,9 +192,9 @@ func (f valuesFilter) String() string { return fmt.Sprintf("FilterValues(%s, %v)", function.NameOf(f.fnc), f.opt) } -// Ignore is an Option that causes all comparisons to be ignored. -// This value is intended to be combined with FilterPath or FilterValues. -// It is an error to pass an unfiltered Ignore option to Equal. +// Ignore is an [Option] that causes all comparisons to be ignored. +// This value is intended to be combined with [FilterPath] or [FilterValues]. +// It is an error to pass an unfiltered Ignore option to [Equal]. func Ignore() Option { return ignore{} } type ignore struct{ core } @@ -234,6 +234,8 @@ func (validator) apply(s *state, vx, vy reflect.Value) { name = fmt.Sprintf("%q.%v", t.PkgPath(), t.Name()) // e.g., "path/to/package".MyType if _, ok := reflect.New(t).Interface().(error); ok { help = "consider using cmpopts.EquateErrors to compare error values" + } else if t.Comparable() { + help = "consider using cmpopts.EquateComparable to compare comparable Go types" } } else { // Unnamed type with unexported fields. Derive PkgPath from field. @@ -254,7 +256,7 @@ const identRx = `[_\p{L}][_\p{L}\p{N}]*` var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`) -// Transformer returns an Option that applies a transformation function that +// Transformer returns an [Option] that applies a transformation function that // converts values of a certain type into that of another. // // The transformer f must be a function "func(T) R" that converts values of @@ -265,13 +267,14 @@ var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`) // same transform to the output of itself (e.g., in the case where the // input and output types are the same), an implicit filter is added such that // a transformer is applicable only if that exact transformer is not already -// in the tail of the Path since the last non-Transform step. +// in the tail of the [Path] since the last non-[Transform] step. // For situations where the implicit filter is still insufficient, -// consider using cmpopts.AcyclicTransformer, which adds a filter -// to prevent the transformer from being recursively applied upon itself. +// consider using [github.com/google/go-cmp/cmp/cmpopts.AcyclicTransformer], +// which adds a filter to prevent the transformer from +// being recursively applied upon itself. // -// The name is a user provided label that is used as the Transform.Name in the -// transformation PathStep (and eventually shown in the Diff output). +// The name is a user provided label that is used as the [Transform.Name] in the +// transformation [PathStep] (and eventually shown in the [Diff] output). // The name must be a valid identifier or qualified identifier in Go syntax. // If empty, an arbitrary name is used. func Transformer(name string, f interface{}) Option { @@ -329,7 +332,7 @@ func (tr transformer) String() string { return fmt.Sprintf("Transformer(%s, %s)", tr.name, function.NameOf(tr.fnc)) } -// Comparer returns an Option that determines whether two values are equal +// Comparer returns an [Option] that determines whether two values are equal // to each other. // // The comparer f must be a function "func(T, T) bool" and is implicitly @@ -377,35 +380,32 @@ func (cm comparer) String() string { return fmt.Sprintf("Comparer(%s)", function.NameOf(cm.fnc)) } -// Exporter returns an Option that specifies whether Equal is allowed to +// Exporter returns an [Option] that specifies whether [Equal] is allowed to // introspect into the unexported fields of certain struct types. // // Users of this option must understand that comparing on unexported fields // from external packages is not safe since changes in the internal -// implementation of some external package may cause the result of Equal +// implementation of some external package may cause the result of [Equal] // to unexpectedly change. However, it may be valid to use this option on types // defined in an internal package where the semantic meaning of an unexported // field is in the control of the user. // -// In many cases, a custom Comparer should be used instead that defines +// In many cases, a custom [Comparer] should be used instead that defines // equality as a function of the public API of a type rather than the underlying // unexported implementation. // -// For example, the reflect.Type documentation defines equality to be determined +// For example, the [reflect.Type] documentation defines equality to be determined // by the == operator on the interface (essentially performing a shallow pointer -// comparison) and most attempts to compare *regexp.Regexp types are interested +// comparison) and most attempts to compare *[regexp.Regexp] types are interested // in only checking that the regular expression strings are equal. -// Both of these are accomplished using Comparers: +// Both of these are accomplished using [Comparer] options: // // Comparer(func(x, y reflect.Type) bool { return x == y }) // Comparer(func(x, y *regexp.Regexp) bool { return x.String() == y.String() }) // -// In other cases, the cmpopts.IgnoreUnexported option can be used to ignore -// all unexported fields on specified struct types. +// In other cases, the [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported] +// option can be used to ignore all unexported fields on specified struct types. func Exporter(f func(reflect.Type) bool) Option { - if !supportExporters { - panic("Exporter is not supported on purego builds") - } return exporter(f) } @@ -415,10 +415,10 @@ func (exporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableO panic("not implemented") } -// AllowUnexported returns an Options that allows Equal to forcibly introspect +// AllowUnexported returns an [Option] that allows [Equal] to forcibly introspect // unexported fields of the specified struct types. // -// See Exporter for the proper use of this option. +// See [Exporter] for the proper use of this option. func AllowUnexported(types ...interface{}) Option { m := make(map[reflect.Type]bool) for _, typ := range types { @@ -432,7 +432,7 @@ func AllowUnexported(types ...interface{}) Option { } // Result represents the comparison result for a single node and -// is provided by cmp when calling Report (see Reporter). +// is provided by cmp when calling Report (see [Reporter]). type Result struct { _ [0]func() // Make Result incomparable flags resultFlags @@ -445,7 +445,7 @@ func (r Result) Equal() bool { } // ByIgnore reports whether the node is equal because it was ignored. -// This never reports true if Equal reports false. +// This never reports true if [Result.Equal] reports false. func (r Result) ByIgnore() bool { return r.flags&reportByIgnore != 0 } @@ -455,7 +455,7 @@ func (r Result) ByMethod() bool { return r.flags&reportByMethod != 0 } -// ByFunc reports whether a Comparer function determined equality. +// ByFunc reports whether a [Comparer] function determined equality. func (r Result) ByFunc() bool { return r.flags&reportByFunc != 0 } @@ -478,7 +478,7 @@ const ( reportByCycle ) -// Reporter is an Option that can be passed to Equal. When Equal traverses +// Reporter is an [Option] that can be passed to [Equal]. When [Equal] traverses // the value trees, it calls PushStep as it descends into each node in the // tree and PopStep as it ascend out of the node. The leaves of the tree are // either compared (determined to be equal or not equal) or ignored and reported diff --git a/vendor/github.com/google/go-cmp/cmp/path.go b/vendor/github.com/google/go-cmp/cmp/path.go index a0a588502..c3c145642 100644 --- a/vendor/github.com/google/go-cmp/cmp/path.go +++ b/vendor/github.com/google/go-cmp/cmp/path.go @@ -14,9 +14,9 @@ import ( "github.com/google/go-cmp/cmp/internal/value" ) -// Path is a list of PathSteps describing the sequence of operations to get +// Path is a list of [PathStep] describing the sequence of operations to get // from some root type to the current position in the value tree. -// The first Path element is always an operation-less PathStep that exists +// The first Path element is always an operation-less [PathStep] that exists // simply to identify the initial type. // // When traversing structs with embedded structs, the embedded struct will @@ -29,8 +29,13 @@ type Path []PathStep // a value's tree structure. Users of this package never need to implement // these types as values of this type will be returned by this package. // -// Implementations of this interface are -// StructField, SliceIndex, MapIndex, Indirect, TypeAssertion, and Transform. +// Implementations of this interface: +// - [StructField] +// - [SliceIndex] +// - [MapIndex] +// - [Indirect] +// - [TypeAssertion] +// - [Transform] type PathStep interface { String() string @@ -70,8 +75,9 @@ func (pa *Path) pop() { *pa = (*pa)[:len(*pa)-1] } -// Last returns the last PathStep in the Path. -// If the path is empty, this returns a non-nil PathStep that reports a nil Type. +// Last returns the last [PathStep] in the Path. +// If the path is empty, this returns a non-nil [PathStep] +// that reports a nil [PathStep.Type]. func (pa Path) Last() PathStep { return pa.Index(-1) } @@ -79,7 +85,8 @@ func (pa Path) Last() PathStep { // Index returns the ith step in the Path and supports negative indexing. // A negative index starts counting from the tail of the Path such that -1 // refers to the last step, -2 refers to the second-to-last step, and so on. -// If index is invalid, this returns a non-nil PathStep that reports a nil Type. +// If index is invalid, this returns a non-nil [PathStep] +// that reports a nil [PathStep.Type]. func (pa Path) Index(i int) PathStep { if i < 0 { i = len(pa) + i @@ -168,7 +175,8 @@ func (ps pathStep) String() string { return fmt.Sprintf("{%s}", s) } -// StructField represents a struct field access on a field called Name. +// StructField is a [PathStep] that represents a struct field access +// on a field called [StructField.Name]. type StructField struct{ *structField } type structField struct { pathStep @@ -204,10 +212,11 @@ func (sf StructField) String() string { return fmt.Sprintf(".%s", sf.name) } func (sf StructField) Name() string { return sf.name } // Index is the index of the field in the parent struct type. -// See reflect.Type.Field. +// See [reflect.Type.Field]. func (sf StructField) Index() int { return sf.idx } -// SliceIndex is an index operation on a slice or array at some index Key. +// SliceIndex is a [PathStep] that represents an index operation on +// a slice or array at some index [SliceIndex.Key]. type SliceIndex struct{ *sliceIndex } type sliceIndex struct { pathStep @@ -247,12 +256,12 @@ func (si SliceIndex) Key() int { // all of the indexes to be shifted. If an index is -1, then that // indicates that the element does not exist in the associated slice. // -// Key is guaranteed to return -1 if and only if the indexes returned -// by SplitKeys are not the same. SplitKeys will never return -1 for +// [SliceIndex.Key] is guaranteed to return -1 if and only if the indexes +// returned by SplitKeys are not the same. SplitKeys will never return -1 for // both indexes. func (si SliceIndex) SplitKeys() (ix, iy int) { return si.xkey, si.ykey } -// MapIndex is an index operation on a map at some index Key. +// MapIndex is a [PathStep] that represents an index operation on a map at some index Key. type MapIndex struct{ *mapIndex } type mapIndex struct { pathStep @@ -266,7 +275,7 @@ func (mi MapIndex) String() string { return fmt.Sprintf("[%#v]", // Key is the value of the map key. func (mi MapIndex) Key() reflect.Value { return mi.key } -// Indirect represents pointer indirection on the parent type. +// Indirect is a [PathStep] that represents pointer indirection on the parent type. type Indirect struct{ *indirect } type indirect struct { pathStep @@ -276,7 +285,7 @@ func (in Indirect) Type() reflect.Type { return in.typ } func (in Indirect) Values() (vx, vy reflect.Value) { return in.vx, in.vy } func (in Indirect) String() string { return "*" } -// TypeAssertion represents a type assertion on an interface. +// TypeAssertion is a [PathStep] that represents a type assertion on an interface. type TypeAssertion struct{ *typeAssertion } type typeAssertion struct { pathStep @@ -286,7 +295,8 @@ func (ta TypeAssertion) Type() reflect.Type { return ta.typ } func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy } func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", value.TypeString(ta.typ, false)) } -// Transform is a transformation from the parent type to the current type. +// Transform is a [PathStep] that represents a transformation +// from the parent type to the current type. type Transform struct{ *transform } type transform struct { pathStep @@ -297,13 +307,13 @@ func (tf Transform) Type() reflect.Type { return tf.typ } func (tf Transform) Values() (vx, vy reflect.Value) { return tf.vx, tf.vy } func (tf Transform) String() string { return fmt.Sprintf("%s()", tf.trans.name) } -// Name is the name of the Transformer. +// Name is the name of the [Transformer]. func (tf Transform) Name() string { return tf.trans.name } // Func is the function pointer to the transformer function. func (tf Transform) Func() reflect.Value { return tf.trans.fnc } -// Option returns the originally constructed Transformer option. +// Option returns the originally constructed [Transformer] option. // The == operator can be used to detect the exact option used. func (tf Transform) Option() Option { return tf.trans } diff --git a/vendor/github.com/google/go-cmp/cmp/report_reflect.go b/vendor/github.com/google/go-cmp/cmp/report_reflect.go index 2ab41fad3..e39f42284 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_reflect.go +++ b/vendor/github.com/google/go-cmp/cmp/report_reflect.go @@ -199,7 +199,7 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind, break } sf := t.Field(i) - if supportExporters && !isExported(sf.Name) { + if !isExported(sf.Name) { vv = retrieveUnexportedField(v, sf, true) } s := opts.WithTypeMode(autoType).FormatValue(vv, t.Kind(), ptrs) diff --git a/vendor/github.com/google/pprof/profile/encode.go b/vendor/github.com/google/pprof/profile/encode.go index ab7f03ae2..182c926b9 100644 --- a/vendor/github.com/google/pprof/profile/encode.go +++ b/vendor/github.com/google/pprof/profile/encode.go @@ -17,6 +17,7 @@ package profile import ( "errors" "sort" + "strings" ) func (p *Profile) decoder() []decoder { @@ -183,12 +184,13 @@ var profileDecoder = []decoder{ // repeated Location location = 4 func(b *buffer, m message) error { x := new(Location) - x.Line = make([]Line, 0, 8) // Pre-allocate Line buffer + x.Line = b.tmpLines[:0] // Use shared space temporarily pp := m.(*Profile) pp.Location = append(pp.Location, x) err := decodeMessage(b, x) - var tmp []Line - x.Line = append(tmp, x.Line...) // Shrink to allocated size + b.tmpLines = x.Line[:0] + // Copy to shrink size and detach from shared space. + x.Line = append([]Line(nil), x.Line...) return err }, // repeated Function function = 5 @@ -252,6 +254,14 @@ func (p *Profile) postDecode() error { } else { mappings[m.ID] = m } + + // If this a main linux kernel mapping with a relocation symbol suffix + // ("[kernel.kallsyms]_text"), extract said suffix. + // It is fairly hacky to handle at this level, but the alternatives appear even worse. + const prefix = "[kernel.kallsyms]" + if strings.HasPrefix(m.File, prefix) { + m.KernelRelocationSymbol = m.File[len(prefix):] + } } functions := make(map[uint64]*Function, len(p.Function)) @@ -298,41 +308,52 @@ func (p *Profile) postDecode() error { st.Unit, err = getString(p.stringTable, &st.unitX, err) } + // Pre-allocate space for all locations. + numLocations := 0 + for _, s := range p.Sample { + numLocations += len(s.locationIDX) + } + locBuffer := make([]*Location, numLocations) + for _, s := range p.Sample { - labels := make(map[string][]string, len(s.labelX)) - numLabels := make(map[string][]int64, len(s.labelX)) - numUnits := make(map[string][]string, len(s.labelX)) - for _, l := range s.labelX { - var key, value string - key, err = getString(p.stringTable, &l.keyX, err) - if l.strX != 0 { - value, err = getString(p.stringTable, &l.strX, err) - labels[key] = append(labels[key], value) - } else if l.numX != 0 || l.unitX != 0 { - numValues := numLabels[key] - units := numUnits[key] - if l.unitX != 0 { - var unit string - unit, err = getString(p.stringTable, &l.unitX, err) - units = padStringArray(units, len(numValues)) - numUnits[key] = append(units, unit) + if len(s.labelX) > 0 { + labels := make(map[string][]string, len(s.labelX)) + numLabels := make(map[string][]int64, len(s.labelX)) + numUnits := make(map[string][]string, len(s.labelX)) + for _, l := range s.labelX { + var key, value string + key, err = getString(p.stringTable, &l.keyX, err) + if l.strX != 0 { + value, err = getString(p.stringTable, &l.strX, err) + labels[key] = append(labels[key], value) + } else if l.numX != 0 || l.unitX != 0 { + numValues := numLabels[key] + units := numUnits[key] + if l.unitX != 0 { + var unit string + unit, err = getString(p.stringTable, &l.unitX, err) + units = padStringArray(units, len(numValues)) + numUnits[key] = append(units, unit) + } + numLabels[key] = append(numLabels[key], l.numX) } - numLabels[key] = append(numLabels[key], l.numX) } - } - if len(labels) > 0 { - s.Label = labels - } - if len(numLabels) > 0 { - s.NumLabel = numLabels - for key, units := range numUnits { - if len(units) > 0 { - numUnits[key] = padStringArray(units, len(numLabels[key])) + if len(labels) > 0 { + s.Label = labels + } + if len(numLabels) > 0 { + s.NumLabel = numLabels + for key, units := range numUnits { + if len(units) > 0 { + numUnits[key] = padStringArray(units, len(numLabels[key])) + } } + s.NumUnit = numUnits } - s.NumUnit = numUnits } - s.Location = make([]*Location, len(s.locationIDX)) + + s.Location = locBuffer[:len(s.locationIDX)] + locBuffer = locBuffer[len(s.locationIDX):] for i, lid := range s.locationIDX { if lid < uint64(len(locationIds)) { s.Location[i] = locationIds[lid] diff --git a/vendor/github.com/google/pprof/profile/filter.go b/vendor/github.com/google/pprof/profile/filter.go index ea8e66c68..c794b9390 100644 --- a/vendor/github.com/google/pprof/profile/filter.go +++ b/vendor/github.com/google/pprof/profile/filter.go @@ -22,6 +22,10 @@ import "regexp" // samples where at least one frame matches focus but none match ignore. // Returns true is the corresponding regexp matched at least one sample. func (p *Profile) FilterSamplesByName(focus, ignore, hide, show *regexp.Regexp) (fm, im, hm, hnm bool) { + if focus == nil && ignore == nil && hide == nil && show == nil { + fm = true // Missing focus implies a match + return + } focusOrIgnore := make(map[uint64]bool) hidden := make(map[uint64]bool) for _, l := range p.Location { diff --git a/vendor/github.com/google/pprof/profile/legacy_profile.go b/vendor/github.com/google/pprof/profile/legacy_profile.go index 0c8f3bb5b..8d07fd6c2 100644 --- a/vendor/github.com/google/pprof/profile/legacy_profile.go +++ b/vendor/github.com/google/pprof/profile/legacy_profile.go @@ -295,11 +295,12 @@ func get64b(b []byte) (uint64, []byte) { // // The general format for profilez samples is a sequence of words in // binary format. The first words are a header with the following data: -// 1st word -- 0 -// 2nd word -- 3 -// 3rd word -- 0 if a c++ application, 1 if a java application. -// 4th word -- Sampling period (in microseconds). -// 5th word -- Padding. +// +// 1st word -- 0 +// 2nd word -- 3 +// 3rd word -- 0 if a c++ application, 1 if a java application. +// 4th word -- Sampling period (in microseconds). +// 5th word -- Padding. func parseCPU(b []byte) (*Profile, error) { var parse func([]byte) (uint64, []byte) var n1, n2, n3, n4, n5 uint64 @@ -403,15 +404,18 @@ func cleanupDuplicateLocations(p *Profile) { // // profilez samples are a repeated sequence of stack frames of the // form: -// 1st word -- The number of times this stack was encountered. -// 2nd word -- The size of the stack (StackSize). -// 3rd word -- The first address on the stack. -// ... -// StackSize + 2 -- The last address on the stack +// +// 1st word -- The number of times this stack was encountered. +// 2nd word -- The size of the stack (StackSize). +// 3rd word -- The first address on the stack. +// ... +// StackSize + 2 -- The last address on the stack +// // The last stack trace is of the form: -// 1st word -- 0 -// 2nd word -- 1 -// 3rd word -- 0 +// +// 1st word -- 0 +// 2nd word -- 1 +// 3rd word -- 0 // // Addresses from stack traces may point to the next instruction after // each call. Optionally adjust by -1 to land somewhere on the actual @@ -861,7 +865,6 @@ func parseThread(b []byte) (*Profile, error) { // Recognize each thread and populate profile samples. for !isMemoryMapSentinel(line) { if strings.HasPrefix(line, "---- no stack trace for") { - line = "" break } if t := threadStartRE.FindStringSubmatch(line); len(t) != 4 { diff --git a/vendor/github.com/google/pprof/profile/merge.go b/vendor/github.com/google/pprof/profile/merge.go index 9978e7330..4b66282cb 100644 --- a/vendor/github.com/google/pprof/profile/merge.go +++ b/vendor/github.com/google/pprof/profile/merge.go @@ -15,6 +15,7 @@ package profile import ( + "encoding/binary" "fmt" "sort" "strconv" @@ -58,7 +59,7 @@ func Merge(srcs []*Profile) (*Profile, error) { for _, src := range srcs { // Clear the profile-specific hash tables - pm.locationsByID = make(map[uint64]*Location, len(src.Location)) + pm.locationsByID = makeLocationIDMap(len(src.Location)) pm.functionsByID = make(map[uint64]*Function, len(src.Function)) pm.mappingsByID = make(map[uint64]mapInfo, len(src.Mapping)) @@ -136,7 +137,7 @@ type profileMerger struct { p *Profile // Memoization tables within a profile. - locationsByID map[uint64]*Location + locationsByID locationIDMap functionsByID map[uint64]*Function mappingsByID map[uint64]mapInfo @@ -153,6 +154,16 @@ type mapInfo struct { } func (pm *profileMerger) mapSample(src *Sample) *Sample { + // Check memoization table + k := pm.sampleKey(src) + if ss, ok := pm.samples[k]; ok { + for i, v := range src.Value { + ss.Value[i] += v + } + return ss + } + + // Make new sample. s := &Sample{ Location: make([]*Location, len(src.Location)), Value: make([]int64, len(src.Value)), @@ -177,52 +188,98 @@ func (pm *profileMerger) mapSample(src *Sample) *Sample { s.NumLabel[k] = vv s.NumUnit[k] = uu } - // Check memoization table. Must be done on the remapped location to - // account for the remapped mapping. Add current values to the - // existing sample. - k := s.key() - if ss, ok := pm.samples[k]; ok { - for i, v := range src.Value { - ss.Value[i] += v - } - return ss - } copy(s.Value, src.Value) pm.samples[k] = s pm.p.Sample = append(pm.p.Sample, s) return s } -// key generates sampleKey to be used as a key for maps. -func (sample *Sample) key() sampleKey { - ids := make([]string, len(sample.Location)) - for i, l := range sample.Location { - ids[i] = strconv.FormatUint(l.ID, 16) +func (pm *profileMerger) sampleKey(sample *Sample) sampleKey { + // Accumulate contents into a string. + var buf strings.Builder + buf.Grow(64) // Heuristic to avoid extra allocs + + // encode a number + putNumber := func(v uint64) { + var num [binary.MaxVarintLen64]byte + n := binary.PutUvarint(num[:], v) + buf.Write(num[:n]) + } + + // encode a string prefixed with its length. + putDelimitedString := func(s string) { + putNumber(uint64(len(s))) + buf.WriteString(s) + } + + for _, l := range sample.Location { + // Get the location in the merged profile, which may have a different ID. + if loc := pm.mapLocation(l); loc != nil { + putNumber(loc.ID) + } } + putNumber(0) // Delimiter - labels := make([]string, 0, len(sample.Label)) - for k, v := range sample.Label { - labels = append(labels, fmt.Sprintf("%q%q", k, v)) + for _, l := range sortedKeys1(sample.Label) { + putDelimitedString(l) + values := sample.Label[l] + putNumber(uint64(len(values))) + for _, v := range values { + putDelimitedString(v) + } } - sort.Strings(labels) - numlabels := make([]string, 0, len(sample.NumLabel)) - for k, v := range sample.NumLabel { - numlabels = append(numlabels, fmt.Sprintf("%q%x%x", k, v, sample.NumUnit[k])) + for _, l := range sortedKeys2(sample.NumLabel) { + putDelimitedString(l) + values := sample.NumLabel[l] + putNumber(uint64(len(values))) + for _, v := range values { + putNumber(uint64(v)) + } + units := sample.NumUnit[l] + putNumber(uint64(len(units))) + for _, v := range units { + putDelimitedString(v) + } } - sort.Strings(numlabels) - return sampleKey{ - strings.Join(ids, "|"), - strings.Join(labels, ""), - strings.Join(numlabels, ""), + return sampleKey(buf.String()) +} + +type sampleKey string + +// sortedKeys1 returns the sorted keys found in a string->[]string map. +// +// Note: this is currently non-generic since github pprof runs golint, +// which does not support generics. When that issue is fixed, it can +// be merged with sortedKeys2 and made into a generic function. +func sortedKeys1(m map[string][]string) []string { + if len(m) == 0 { + return nil } + keys := make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + sort.Strings(keys) + return keys } -type sampleKey struct { - locations string - labels string - numlabels string +// sortedKeys2 returns the sorted keys found in a string->[]int64 map. +// +// Note: this is currently non-generic since github pprof runs golint, +// which does not support generics. When that issue is fixed, it can +// be merged with sortedKeys1 and made into a generic function. +func sortedKeys2(m map[string][]int64) []string { + if len(m) == 0 { + return nil + } + keys := make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + sort.Strings(keys) + return keys } func (pm *profileMerger) mapLocation(src *Location) *Location { @@ -230,7 +287,7 @@ func (pm *profileMerger) mapLocation(src *Location) *Location { return nil } - if l, ok := pm.locationsByID[src.ID]; ok { + if l := pm.locationsByID.get(src.ID); l != nil { return l } @@ -249,10 +306,10 @@ func (pm *profileMerger) mapLocation(src *Location) *Location { // account for the remapped mapping ID. k := l.key() if ll, ok := pm.locations[k]; ok { - pm.locationsByID[src.ID] = ll + pm.locationsByID.set(src.ID, ll) return ll } - pm.locationsByID[src.ID] = l + pm.locationsByID.set(src.ID, l) pm.locations[k] = l pm.p.Location = append(pm.p.Location, l) return l @@ -303,16 +360,17 @@ func (pm *profileMerger) mapMapping(src *Mapping) mapInfo { return mi } m := &Mapping{ - ID: uint64(len(pm.p.Mapping) + 1), - Start: src.Start, - Limit: src.Limit, - Offset: src.Offset, - File: src.File, - BuildID: src.BuildID, - HasFunctions: src.HasFunctions, - HasFilenames: src.HasFilenames, - HasLineNumbers: src.HasLineNumbers, - HasInlineFrames: src.HasInlineFrames, + ID: uint64(len(pm.p.Mapping) + 1), + Start: src.Start, + Limit: src.Limit, + Offset: src.Offset, + File: src.File, + KernelRelocationSymbol: src.KernelRelocationSymbol, + BuildID: src.BuildID, + HasFunctions: src.HasFunctions, + HasFilenames: src.HasFilenames, + HasLineNumbers: src.HasLineNumbers, + HasInlineFrames: src.HasInlineFrames, } pm.p.Mapping = append(pm.p.Mapping, m) @@ -479,3 +537,131 @@ func (p *Profile) compatible(pb *Profile) error { func equalValueType(st1, st2 *ValueType) bool { return st1.Type == st2.Type && st1.Unit == st2.Unit } + +// locationIDMap is like a map[uint64]*Location, but provides efficiency for +// ids that are densely numbered, which is often the case. +type locationIDMap struct { + dense []*Location // indexed by id for id < len(dense) + sparse map[uint64]*Location // indexed by id for id >= len(dense) +} + +func makeLocationIDMap(n int) locationIDMap { + return locationIDMap{ + dense: make([]*Location, n), + sparse: map[uint64]*Location{}, + } +} + +func (lm locationIDMap) get(id uint64) *Location { + if id < uint64(len(lm.dense)) { + return lm.dense[int(id)] + } + return lm.sparse[id] +} + +func (lm locationIDMap) set(id uint64, loc *Location) { + if id < uint64(len(lm.dense)) { + lm.dense[id] = loc + return + } + lm.sparse[id] = loc +} + +// CompatibilizeSampleTypes makes profiles compatible to be compared/merged. It +// keeps sample types that appear in all profiles only and drops/reorders the +// sample types as necessary. +// +// In the case of sample types order is not the same for given profiles the +// order is derived from the first profile. +// +// Profiles are modified in-place. +// +// It returns an error if the sample type's intersection is empty. +func CompatibilizeSampleTypes(ps []*Profile) error { + sTypes := commonSampleTypes(ps) + if len(sTypes) == 0 { + return fmt.Errorf("profiles have empty common sample type list") + } + for _, p := range ps { + if err := compatibilizeSampleTypes(p, sTypes); err != nil { + return err + } + } + return nil +} + +// commonSampleTypes returns sample types that appear in all profiles in the +// order how they ordered in the first profile. +func commonSampleTypes(ps []*Profile) []string { + if len(ps) == 0 { + return nil + } + sTypes := map[string]int{} + for _, p := range ps { + for _, st := range p.SampleType { + sTypes[st.Type]++ + } + } + var res []string + for _, st := range ps[0].SampleType { + if sTypes[st.Type] == len(ps) { + res = append(res, st.Type) + } + } + return res +} + +// compatibilizeSampleTypes drops sample types that are not present in sTypes +// list and reorder them if needed. +// +// It sets DefaultSampleType to sType[0] if it is not in sType list. +// +// It assumes that all sample types from the sTypes list are present in the +// given profile otherwise it returns an error. +func compatibilizeSampleTypes(p *Profile, sTypes []string) error { + if len(sTypes) == 0 { + return fmt.Errorf("sample type list is empty") + } + defaultSampleType := sTypes[0] + reMap, needToModify := make([]int, len(sTypes)), false + for i, st := range sTypes { + if st == p.DefaultSampleType { + defaultSampleType = p.DefaultSampleType + } + idx := searchValueType(p.SampleType, st) + if idx < 0 { + return fmt.Errorf("%q sample type is not found in profile", st) + } + reMap[i] = idx + if idx != i { + needToModify = true + } + } + if !needToModify && len(sTypes) == len(p.SampleType) { + return nil + } + p.DefaultSampleType = defaultSampleType + oldSampleTypes := p.SampleType + p.SampleType = make([]*ValueType, len(sTypes)) + for i, idx := range reMap { + p.SampleType[i] = oldSampleTypes[idx] + } + values := make([]int64, len(sTypes)) + for _, s := range p.Sample { + for i, idx := range reMap { + values[i] = s.Value[idx] + } + s.Value = s.Value[:len(values)] + copy(s.Value, values) + } + return nil +} + +func searchValueType(vts []*ValueType, s string) int { + for i, vt := range vts { + if vt.Type == s { + return i + } + } + return -1 +} diff --git a/vendor/github.com/google/pprof/profile/profile.go b/vendor/github.com/google/pprof/profile/profile.go index 2590c8ddb..60ef7e926 100644 --- a/vendor/github.com/google/pprof/profile/profile.go +++ b/vendor/github.com/google/pprof/profile/profile.go @@ -21,7 +21,6 @@ import ( "compress/gzip" "fmt" "io" - "io/ioutil" "math" "path/filepath" "regexp" @@ -73,9 +72,23 @@ type ValueType struct { type Sample struct { Location []*Location Value []int64 - Label map[string][]string + // Label is a per-label-key map to values for string labels. + // + // In general, having multiple values for the given label key is strongly + // discouraged - see docs for the sample label field in profile.proto. The + // main reason this unlikely state is tracked here is to make the + // decoding->encoding roundtrip not lossy. But we expect that the value + // slices present in this map are always of length 1. + Label map[string][]string + // NumLabel is a per-label-key map to values for numeric labels. See a note + // above on handling multiple values for a label. NumLabel map[string][]int64 - NumUnit map[string][]string + // NumUnit is a per-label-key map to the unit names of corresponding numeric + // label values. The unit info may be missing even if the label is in + // NumLabel, see the docs in profile.proto for details. When the value is + // slice is present and not nil, its length must be equal to the length of + // the corresponding value slice in NumLabel. + NumUnit map[string][]string locationIDX []uint64 labelX []label @@ -106,6 +119,15 @@ type Mapping struct { fileX int64 buildIDX int64 + + // Name of the kernel relocation symbol ("_text" or "_stext"), extracted from File. + // For linux kernel mappings generated by some tools, correct symbolization depends + // on knowing which of the two possible relocation symbols was used for `Start`. + // This is given to us as a suffix in `File` (e.g. "[kernel.kallsyms]_stext"). + // + // Note, this public field is not persisted in the proto. For the purposes of + // copying / merging / hashing profiles, it is considered subsumed by `File`. + KernelRelocationSymbol string } // Location corresponds to Profile.Location @@ -144,7 +166,7 @@ type Function struct { // may be a gzip-compressed encoded protobuf or one of many legacy // profile formats which may be unsupported in the future. func Parse(r io.Reader) (*Profile, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } @@ -159,7 +181,7 @@ func ParseData(data []byte) (*Profile, error) { if len(data) >= 2 && data[0] == 0x1f && data[1] == 0x8b { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err == nil { - data, err = ioutil.ReadAll(gz) + data, err = io.ReadAll(gz) } if err != nil { return nil, fmt.Errorf("decompressing profile: %v", err) @@ -707,6 +729,35 @@ func (s *Sample) HasLabel(key, value string) bool { return false } +// SetNumLabel sets the specified key to the specified value for all samples in the +// profile. "unit" is a slice that describes the units that each corresponding member +// of "values" is measured in (e.g. bytes or seconds). If there is no relevant +// unit for a given value, that member of "unit" should be the empty string. +// "unit" must either have the same length as "value", or be nil. +func (p *Profile) SetNumLabel(key string, value []int64, unit []string) { + for _, sample := range p.Sample { + if sample.NumLabel == nil { + sample.NumLabel = map[string][]int64{key: value} + } else { + sample.NumLabel[key] = value + } + if sample.NumUnit == nil { + sample.NumUnit = map[string][]string{key: unit} + } else { + sample.NumUnit[key] = unit + } + } +} + +// RemoveNumLabel removes all numerical labels associated with the specified key for all +// samples in the profile. +func (p *Profile) RemoveNumLabel(key string) { + for _, sample := range p.Sample { + delete(sample.NumLabel, key) + delete(sample.NumUnit, key) + } +} + // DiffBaseSample returns true if a sample belongs to the diff base and false // otherwise. func (s *Sample) DiffBaseSample() bool { diff --git a/vendor/github.com/google/pprof/profile/proto.go b/vendor/github.com/google/pprof/profile/proto.go index 539ad3ab3..a15696ba1 100644 --- a/vendor/github.com/google/pprof/profile/proto.go +++ b/vendor/github.com/google/pprof/profile/proto.go @@ -39,11 +39,12 @@ import ( ) type buffer struct { - field int // field tag - typ int // proto wire type code for field - u64 uint64 - data []byte - tmp [16]byte + field int // field tag + typ int // proto wire type code for field + u64 uint64 + data []byte + tmp [16]byte + tmpLines []Line // temporary storage used while decoding "repeated Line". } type decoder func(*buffer, message) error @@ -286,7 +287,6 @@ func decodeInt64s(b *buffer, x *[]int64) error { if b.typ == 2 { // Packed encoding data := b.data - tmp := make([]int64, 0, len(data)) // Maximally sized for len(data) > 0 { var u uint64 var err error @@ -294,9 +294,8 @@ func decodeInt64s(b *buffer, x *[]int64) error { if u, data, err = decodeVarint(data); err != nil { return err } - tmp = append(tmp, int64(u)) + *x = append(*x, int64(u)) } - *x = append(*x, tmp...) return nil } var i int64 @@ -319,7 +318,6 @@ func decodeUint64s(b *buffer, x *[]uint64) error { if b.typ == 2 { data := b.data // Packed encoding - tmp := make([]uint64, 0, len(data)) // Maximally sized for len(data) > 0 { var u uint64 var err error @@ -327,9 +325,8 @@ func decodeUint64s(b *buffer, x *[]uint64) error { if u, data, err = decodeVarint(data); err != nil { return err } - tmp = append(tmp, u) + *x = append(*x, u) } - *x = append(*x, tmp...) return nil } var u uint64 diff --git a/vendor/github.com/google/pprof/profile/prune.go b/vendor/github.com/google/pprof/profile/prune.go index 02d21a818..b2f9fd546 100644 --- a/vendor/github.com/google/pprof/profile/prune.go +++ b/vendor/github.com/google/pprof/profile/prune.go @@ -62,15 +62,31 @@ func (p *Profile) Prune(dropRx, keepRx *regexp.Regexp) { prune := make(map[uint64]bool) pruneBeneath := make(map[uint64]bool) + // simplifyFunc can be expensive, so cache results. + // Note that the same function name can be encountered many times due + // different lines and addresses in the same function. + pruneCache := map[string]bool{} // Map from function to whether or not to prune + pruneFromHere := func(s string) bool { + if r, ok := pruneCache[s]; ok { + return r + } + funcName := simplifyFunc(s) + if dropRx.MatchString(funcName) { + if keepRx == nil || !keepRx.MatchString(funcName) { + pruneCache[s] = true + return true + } + } + pruneCache[s] = false + return false + } + for _, loc := range p.Location { var i int for i = len(loc.Line) - 1; i >= 0; i-- { if fn := loc.Line[i].Function; fn != nil && fn.Name != "" { - funcName := simplifyFunc(fn.Name) - if dropRx.MatchString(funcName) { - if keepRx == nil || !keepRx.MatchString(funcName) { - break - } + if pruneFromHere(fn.Name) { + break } } } diff --git a/vendor/github.com/google/uuid/.travis.yml b/vendor/github.com/google/uuid/.travis.yml deleted file mode 100644 index d8156a60b..000000000 --- a/vendor/github.com/google/uuid/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go - -go: - - 1.4.3 - - 1.5.3 - - tip - -script: - - go test -v ./... diff --git a/vendor/github.com/google/uuid/CHANGELOG.md b/vendor/github.com/google/uuid/CHANGELOG.md new file mode 100644 index 000000000..7ed347d3a --- /dev/null +++ b/vendor/github.com/google/uuid/CHANGELOG.md @@ -0,0 +1,21 @@ +# Changelog + +## [1.4.0](https://github.com/google/uuid/compare/v1.3.1...v1.4.0) (2023-10-26) + + +### Features + +* UUIDs slice type with Strings() convenience method ([#133](https://github.com/google/uuid/issues/133)) ([cd5fbbd](https://github.com/google/uuid/commit/cd5fbbdd02f3e3467ac18940e07e062be1f864b4)) + +### Fixes + +* Clarify that Parse's job is to parse but not necessarily validate strings. (Documents current behavior) + +## [1.3.1](https://github.com/google/uuid/compare/v1.3.0...v1.3.1) (2023-08-18) + + +### Bug Fixes + +* Use .EqualFold() to parse urn prefixed UUIDs ([#118](https://github.com/google/uuid/issues/118)) ([574e687](https://github.com/google/uuid/commit/574e6874943741fb99d41764c705173ada5293f0)) + +## Changelog diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md index 04fdf09f1..a502fdc51 100644 --- a/vendor/github.com/google/uuid/CONTRIBUTING.md +++ b/vendor/github.com/google/uuid/CONTRIBUTING.md @@ -2,6 +2,22 @@ We definitely welcome patches and contribution to this project! +### Tips + +Commits must be formatted according to the [Conventional Commits Specification](https://www.conventionalcommits.org). + +Always try to include a test case! If it is not possible or not necessary, +please explain why in the pull request description. + +### Releasing + +Commits that would precipitate a SemVer change, as described in the Conventional +Commits Specification, will trigger [`release-please`](https://github.com/google-github-actions/release-please-action) +to create a release candidate pull request. Once submitted, `release-please` +will create a release. + +For tips on how to work with `release-please`, see its documentation. + ### Legal requirements In order to protect both you and ourselves, you will need to sign the diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md index f765a46f9..3e9a61889 100644 --- a/vendor/github.com/google/uuid/README.md +++ b/vendor/github.com/google/uuid/README.md @@ -1,6 +1,6 @@ -# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) +# uuid The uuid package generates and inspects UUIDs based on -[RFC 4122](http://tools.ietf.org/html/rfc4122) +[RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122) and DCE 1.1: Authentication and Security Services. This package is based on the github.com/pborman/uuid package (previously named @@ -9,10 +9,12 @@ a UUID is a 16 byte array rather than a byte slice. One loss due to this change is the ability to represent an invalid UUID (vs a NIL UUID). ###### Install -`go get github.com/google/uuid` +```sh +go get github.com/google/uuid +``` ###### Documentation -[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) +[![Go Reference](https://pkg.go.dev/badge/github.com/google/uuid.svg)](https://pkg.go.dev/github.com/google/uuid) Full `go doc` style documentation for the package can be viewed online without installing this package by using the GoDoc site here: diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go index 24b78edc9..b2a0bc871 100644 --- a/vendor/github.com/google/uuid/node_js.go +++ b/vendor/github.com/google/uuid/node_js.go @@ -7,6 +7,6 @@ package uuid // getHardwareInterface returns nil values for the JS version of the code. -// This remvoves the "net" dependency, because it is not used in the browser. +// This removes the "net" dependency, because it is not used in the browser. // Using the "net" library inflates the size of the transpiled JS code by 673k bytes. func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go index a57207aeb..dc75f7d99 100644 --- a/vendor/github.com/google/uuid/uuid.go +++ b/vendor/github.com/google/uuid/uuid.go @@ -56,11 +56,15 @@ func IsInvalidLengthError(err error) bool { return ok } -// Parse decodes s into a UUID or returns an error. Both the standard UUID -// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the -// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex -// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. +// Parse decodes s into a UUID or returns an error if it cannot be parsed. Both +// the standard UUID forms defined in RFC 4122 +// (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) are decoded. In addition, +// Parse accepts non-standard strings such as the raw hex encoding +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx and 38 byte "Microsoft style" encodings, +// e.g. {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. Only the middle 36 bytes are +// examined in the latter case. Parse should not be used to validate strings as +// it parses non-standard encodings as indicated above. func Parse(s string) (UUID, error) { var uuid UUID switch len(s) { @@ -69,7 +73,7 @@ func Parse(s string) (UUID, error) { // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx case 36 + 9: - if strings.ToLower(s[:9]) != "urn:uuid:" { + if !strings.EqualFold(s[:9], "urn:uuid:") { return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) } s = s[9:] @@ -101,7 +105,8 @@ func Parse(s string) (UUID, error) { 9, 11, 14, 16, 19, 21, - 24, 26, 28, 30, 32, 34} { + 24, 26, 28, 30, 32, 34, + } { v, ok := xtob(s[x], s[x+1]) if !ok { return uuid, errors.New("invalid UUID format") @@ -117,7 +122,7 @@ func ParseBytes(b []byte) (UUID, error) { switch len(b) { case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { + if !bytes.EqualFold(b[:9], []byte("urn:uuid:")) { return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) } b = b[9:] @@ -145,7 +150,8 @@ func ParseBytes(b []byte) (UUID, error) { 9, 11, 14, 16, 19, 21, - 24, 26, 28, 30, 32, 34} { + 24, 26, 28, 30, 32, 34, + } { v, ok := xtob(b[x], b[x+1]) if !ok { return uuid, errors.New("invalid UUID format") @@ -292,3 +298,15 @@ func DisableRandPool() { poolMu.Lock() poolPos = randPoolSize } + +// UUIDs is a slice of UUID types. +type UUIDs []UUID + +// Strings returns a string slice containing the string form of each UUID in uuids. +func (uuids UUIDs) Strings() []string { + var uuidStrs = make([]string, len(uuids)) + for i, uuid := range uuids { + uuidStrs[i] = uuid.String() + } + return uuidStrs +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go index 138f7c12f..c056bd305 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go @@ -1,10 +1,10 @@ +//go:build gofuzz // +build gofuzz package httprule func Fuzz(data []byte) int { - _, err := Parse(string(data)) - if err != nil { + if _, err := Parse(string(data)); err != nil { return 0 } return 0 diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go index 5edd784e6..65ffcf5cf 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go @@ -1,6 +1,7 @@ package httprule import ( + "errors" "fmt" "strings" ) @@ -164,9 +165,9 @@ func (p *parser) segment() (segment, error) { v, err := p.variable() if err != nil { - return nil, fmt.Errorf("segment neither wildcards, literal or variable: %v", err) + return nil, fmt.Errorf("segment neither wildcards, literal or variable: %w", err) } - return v, err + return v, nil } func (p *parser) literal() (segment, error) { @@ -191,7 +192,7 @@ func (p *parser) variable() (segment, error) { if _, err := p.accept("="); err == nil { segs, err = p.segments() if err != nil { - return nil, fmt.Errorf("invalid segment in variable %q: %v", path, err) + return nil, fmt.Errorf("invalid segment in variable %q: %w", path, err) } } else { segs = []segment{wildcard{}} @@ -213,12 +214,12 @@ func (p *parser) fieldPath() (string, error) { } components := []string{c} for { - if _, err = p.accept("."); err != nil { + if _, err := p.accept("."); err != nil { return strings.Join(components, "."), nil } c, err := p.accept(typeIdent) if err != nil { - return "", fmt.Errorf("invalid field path component: %v", err) + return "", fmt.Errorf("invalid field path component: %w", err) } components = append(components, c) } @@ -237,10 +238,8 @@ const ( typeEOF = termType("$") ) -const ( - // eof is the terminal symbol which always appears at the end of token sequence. - eof = "\u0000" -) +// eof is the terminal symbol which always appears at the end of token sequence. +const eof = "\u0000" // accept tries to accept a token in "p". // This function consumes a token and returns it if it matches to the specified "term". @@ -275,11 +274,12 @@ func (p *parser) accept(term termType) (string, error) { // expectPChars determines if "t" consists of only pchars defined in RFC3986. // // https://www.ietf.org/rfc/rfc3986.txt, P.49 -// pchar = unreserved / pct-encoded / sub-delims / ":" / "@" -// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" -// sub-delims = "!" / "$" / "&" / "'" / "(" / ")" -// / "*" / "+" / "," / ";" / "=" -// pct-encoded = "%" HEXDIG HEXDIG +// +// pchar = unreserved / pct-encoded / sub-delims / ":" / "@" +// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" +// sub-delims = "!" / "$" / "&" / "'" / "(" / ")" +// / "*" / "+" / "," / ";" / "=" +// pct-encoded = "%" HEXDIG HEXDIG func expectPChars(t string) error { const ( init = iota @@ -333,7 +333,7 @@ func expectPChars(t string) error { // expectIdent determines if "ident" is a valid identifier in .proto schema ([[:alpha:]_][[:alphanum:]_]*). func expectIdent(ident string) error { if ident == "" { - return fmt.Errorf("empty identifier") + return errors.New("empty identifier") } for pos, r := range ident { switch { diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel index 95f867a52..a8789f170 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel @@ -27,9 +27,9 @@ go_library( "//internal/httprule", "//utilities", "@go_googleapis//google/api:httpbody_go_proto", - "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//grpclog", + "@org_golang_google_grpc//health/grpc_health_v1", "@org_golang_google_grpc//metadata", "@org_golang_google_grpc//status", "@org_golang_google_protobuf//encoding/protojson", @@ -37,6 +37,8 @@ go_library( "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//reflect/protoregistry", "@org_golang_google_protobuf//types/known/durationpb", + "@org_golang_google_protobuf//types/known/fieldmaskpb", + "@org_golang_google_protobuf//types/known/structpb", "@org_golang_google_protobuf//types/known/timestamppb", "@org_golang_google_protobuf//types/known/wrapperspb", ], @@ -56,8 +58,10 @@ go_test( "marshal_jsonpb_test.go", "marshal_proto_test.go", "marshaler_registry_test.go", + "mux_internal_test.go", "mux_test.go", "pattern_test.go", + "query_fuzz_test.go", "query_test.go", ], embed = [":runtime"], @@ -69,8 +73,9 @@ go_test( "@go_googleapis//google/api:httpbody_go_proto", "@go_googleapis//google/rpc:errdetails_go_proto", "@go_googleapis//google/rpc:status_go_proto", - "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", + "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//health/grpc_health_v1", "@org_golang_google_grpc//metadata", "@org_golang_google_grpc//status", "@org_golang_google_protobuf//encoding/protojson", @@ -78,6 +83,7 @@ go_test( "@org_golang_google_protobuf//testing/protocmp", "@org_golang_google_protobuf//types/known/durationpb", "@org_golang_google_protobuf//types/known/emptypb", + "@org_golang_google_protobuf//types/known/fieldmaskpb", "@org_golang_google_protobuf//types/known/structpb", "@org_golang_google_protobuf//types/known/timestamppb", "@org_golang_google_protobuf//types/known/wrapperspb", diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go index fb57b9366..31553e784 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go @@ -13,6 +13,7 @@ import ( "time" "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -35,11 +36,15 @@ const metadataHeaderBinarySuffix = "-Bin" const xForwardedFor = "X-Forwarded-For" const xForwardedHost = "X-Forwarded-Host" -var ( - // DefaultContextTimeout is used for gRPC call context.WithTimeout whenever a Grpc-Timeout inbound - // header isn't present. If the value is 0 the sent `context` will not have a timeout. - DefaultContextTimeout = 0 * time.Second -) +// DefaultContextTimeout is used for gRPC call context.WithTimeout whenever a Grpc-Timeout inbound +// header isn't present. If the value is 0 the sent `context` will not have a timeout. +var DefaultContextTimeout = 0 * time.Second + +// malformedHTTPHeaders lists the headers that the gRPC server may reject outright as malformed. +// See https://github.com/grpc/grpc-go/pull/4803#issuecomment-986093310 for more context. +var malformedHTTPHeaders = map[string]struct{}{ + "connection": {}, +} type ( rpcMethodKey struct{} @@ -95,12 +100,43 @@ func AnnotateIncomingContext(ctx context.Context, mux *ServeMux, req *http.Reque return metadata.NewIncomingContext(ctx, md), nil } +func isValidGRPCMetadataKey(key string) bool { + // Must be a valid gRPC "Header-Name" as defined here: + // https://github.com/grpc/grpc/blob/4b05dc88b724214d0c725c8e7442cbc7a61b1374/doc/PROTOCOL-HTTP2.md + // This means 0-9 a-z _ - . + // Only lowercase letters are valid in the wire protocol, but the client library will normalize + // uppercase ASCII to lowercase, so uppercase ASCII is also acceptable. + bytes := []byte(key) // gRPC validates strings on the byte level, not Unicode. + for _, ch := range bytes { + validLowercaseLetter := ch >= 'a' && ch <= 'z' + validUppercaseLetter := ch >= 'A' && ch <= 'Z' + validDigit := ch >= '0' && ch <= '9' + validOther := ch == '.' || ch == '-' || ch == '_' + if !validLowercaseLetter && !validUppercaseLetter && !validDigit && !validOther { + return false + } + } + return true +} + +func isValidGRPCMetadataTextValue(textValue string) bool { + // Must be a valid gRPC "ASCII-Value" as defined here: + // https://github.com/grpc/grpc/blob/4b05dc88b724214d0c725c8e7442cbc7a61b1374/doc/PROTOCOL-HTTP2.md + // This means printable ASCII (including/plus spaces); 0x20 to 0x7E inclusive. + bytes := []byte(textValue) // gRPC validates strings on the byte level, not Unicode. + for _, ch := range bytes { + if ch < 0x20 || ch > 0x7E { + return false + } + } + return true +} + func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcMethodName string, options ...AnnotateContextOption) (context.Context, metadata.MD, error) { ctx = withRPCMethod(ctx, rpcMethodName) for _, o := range options { ctx = o(ctx) } - var pairs []string timeout := DefaultContextTimeout if tm := req.Header.Get(metadataGrpcTimeout); tm != "" { var err error @@ -109,7 +145,7 @@ func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcM return nil, nil, status.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm) } } - + var pairs []string for key, vals := range req.Header { key = textproto.CanonicalMIMEHeaderKey(key) for _, val := range vals { @@ -118,6 +154,10 @@ func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcM pairs = append(pairs, "authorization", val) } if h, ok := mux.incomingHeaderMatcher(key); ok { + if !isValidGRPCMetadataKey(h) { + grpclog.Errorf("HTTP header name %q is not valid as gRPC metadata key; skipping", h) + continue + } // Handles "-bin" metadata in grpc, since grpc will do another base64 // encode before sending to server, we need to decode it first. if strings.HasSuffix(key, metadataHeaderBinarySuffix) { @@ -127,6 +167,9 @@ func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcM } val = string(b) + } else if !isValidGRPCMetadataTextValue(val) { + grpclog.Errorf("Value of HTTP header %q contains non-ASCII value (not valid as gRPC metadata): skipping", h) + continue } pairs = append(pairs, h, val) } @@ -172,11 +215,17 @@ type serverMetadataKey struct{} // NewServerMetadataContext creates a new context with ServerMetadata func NewServerMetadataContext(ctx context.Context, md ServerMetadata) context.Context { + if ctx == nil { + ctx = context.Background() + } return context.WithValue(ctx, serverMetadataKey{}, md) } // ServerMetadataFromContext returns the ServerMetadata in ctx func ServerMetadataFromContext(ctx context.Context) (md ServerMetadata, ok bool) { + if ctx == nil { + return md, false + } md, ok = ctx.Value(serverMetadataKey{}).(ServerMetadata) return } @@ -269,8 +318,8 @@ func timeoutUnitToDuration(u uint8) (d time.Duration, ok bool) { case 'n': return time.Nanosecond, true default: + return } - return } // isPermanentHTTPHeader checks whether hdr belongs to the list of @@ -308,6 +357,13 @@ func isPermanentHTTPHeader(hdr string) bool { return false } +// isMalformedHTTPHeader checks whether header belongs to the list of +// "malformed headers" and would be rejected by the gRPC server. +func isMalformedHTTPHeader(header string) bool { + _, isMalformed := malformedHTTPHeaders[strings.ToLower(header)] + return isMalformed +} + // RPCMethod returns the method string for the server context. The returned // string is in the format of "/package.service/method". func RPCMethod(ctx context.Context) (string, bool) { diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/convert.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/convert.go index e6bc4e6ce..d7b15fcfb 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/convert.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/convert.go @@ -37,7 +37,7 @@ func BoolSlice(val, sep string) ([]bool, error) { for i, v := range s { value, err := Bool(v) if err != nil { - return values, err + return nil, err } values[i] = value } @@ -57,7 +57,7 @@ func Float64Slice(val, sep string) ([]float64, error) { for i, v := range s { value, err := Float64(v) if err != nil { - return values, err + return nil, err } values[i] = value } @@ -81,7 +81,7 @@ func Float32Slice(val, sep string) ([]float32, error) { for i, v := range s { value, err := Float32(v) if err != nil { - return values, err + return nil, err } values[i] = value } @@ -101,7 +101,7 @@ func Int64Slice(val, sep string) ([]int64, error) { for i, v := range s { value, err := Int64(v) if err != nil { - return values, err + return nil, err } values[i] = value } @@ -125,7 +125,7 @@ func Int32Slice(val, sep string) ([]int32, error) { for i, v := range s { value, err := Int32(v) if err != nil { - return values, err + return nil, err } values[i] = value } @@ -145,7 +145,7 @@ func Uint64Slice(val, sep string) ([]uint64, error) { for i, v := range s { value, err := Uint64(v) if err != nil { - return values, err + return nil, err } values[i] = value } @@ -169,7 +169,7 @@ func Uint32Slice(val, sep string) ([]uint32, error) { for i, v := range s { value, err := Uint32(v) if err != nil { - return values, err + return nil, err } values[i] = value } @@ -197,7 +197,7 @@ func BytesSlice(val, sep string) ([][]byte, error) { for i, v := range s { value, err := Bytes(v) if err != nil { - return values, err + return nil, err } values[i] = value } @@ -209,8 +209,7 @@ func Timestamp(val string) (*timestamppb.Timestamp, error) { var r timestamppb.Timestamp val = strconv.Quote(strings.Trim(val, `"`)) unmarshaler := &protojson.UnmarshalOptions{} - err := unmarshaler.Unmarshal([]byte(val), &r) - if err != nil { + if err := unmarshaler.Unmarshal([]byte(val), &r); err != nil { return nil, err } return &r, nil @@ -221,8 +220,7 @@ func Duration(val string) (*durationpb.Duration, error) { var r durationpb.Duration val = strconv.Quote(strings.Trim(val, `"`)) unmarshaler := &protojson.UnmarshalOptions{} - err := unmarshaler.Unmarshal([]byte(val), &r) - if err != nil { + if err := unmarshaler.Unmarshal([]byte(val), &r); err != nil { return nil, err } return &r, nil @@ -257,66 +255,64 @@ func EnumSlice(val, sep string, enumValMap map[string]int32) ([]int32, error) { for i, v := range s { value, err := Enum(v, enumValMap) if err != nil { - return values, err + return nil, err } values[i] = value } return values, nil } -/* - Support fot google.protobuf.wrappers on top of primitive types -*/ +// Support for google.protobuf.wrappers on top of primitive types // StringValue well-known type support as wrapper around string type func StringValue(val string) (*wrapperspb.StringValue, error) { - return &wrapperspb.StringValue{Value: val}, nil + return wrapperspb.String(val), nil } // FloatValue well-known type support as wrapper around float32 type func FloatValue(val string) (*wrapperspb.FloatValue, error) { parsedVal, err := Float32(val) - return &wrapperspb.FloatValue{Value: parsedVal}, err + return wrapperspb.Float(parsedVal), err } // DoubleValue well-known type support as wrapper around float64 type func DoubleValue(val string) (*wrapperspb.DoubleValue, error) { parsedVal, err := Float64(val) - return &wrapperspb.DoubleValue{Value: parsedVal}, err + return wrapperspb.Double(parsedVal), err } // BoolValue well-known type support as wrapper around bool type func BoolValue(val string) (*wrapperspb.BoolValue, error) { parsedVal, err := Bool(val) - return &wrapperspb.BoolValue{Value: parsedVal}, err + return wrapperspb.Bool(parsedVal), err } // Int32Value well-known type support as wrapper around int32 type func Int32Value(val string) (*wrapperspb.Int32Value, error) { parsedVal, err := Int32(val) - return &wrapperspb.Int32Value{Value: parsedVal}, err + return wrapperspb.Int32(parsedVal), err } // UInt32Value well-known type support as wrapper around uint32 type func UInt32Value(val string) (*wrapperspb.UInt32Value, error) { parsedVal, err := Uint32(val) - return &wrapperspb.UInt32Value{Value: parsedVal}, err + return wrapperspb.UInt32(parsedVal), err } // Int64Value well-known type support as wrapper around int64 type func Int64Value(val string) (*wrapperspb.Int64Value, error) { parsedVal, err := Int64(val) - return &wrapperspb.Int64Value{Value: parsedVal}, err + return wrapperspb.Int64(parsedVal), err } // UInt64Value well-known type support as wrapper around uint64 type func UInt64Value(val string) (*wrapperspb.UInt64Value, error) { parsedVal, err := Uint64(val) - return &wrapperspb.UInt64Value{Value: parsedVal}, err + return wrapperspb.UInt64(parsedVal), err } // BytesValue well-known type support as wrapper around bytes[] type func BytesValue(val string) (*wrapperspb.BytesValue, error) { parsedVal, err := Bytes(val) - return &wrapperspb.BytesValue{Value: parsedVal}, err + return wrapperspb.Bytes(parsedVal), err } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go index d9e0013c4..d2bcbb7d2 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go @@ -38,7 +38,7 @@ func HTTPStatusFromCode(code codes.Code) int { case codes.OK: return http.StatusOK case codes.Canceled: - return http.StatusRequestTimeout + return 499 case codes.Unknown: return http.StatusInternalServerError case codes.InvalidArgument: @@ -70,10 +70,10 @@ func HTTPStatusFromCode(code codes.Code) int { return http.StatusServiceUnavailable case codes.DataLoss: return http.StatusInternalServerError + default: + grpclog.Infof("Unknown gRPC error code: %v", code) + return http.StatusInternalServerError } - - grpclog.Infof("Unknown gRPC error code: %v", code) - return http.StatusInternalServerError } // HTTPError uses the mux-configured error handler. @@ -162,10 +162,11 @@ func DefaultStreamErrorHandler(_ context.Context, err error) *status.Status { // DefaultRoutingErrorHandler is our default handler for routing errors. // By default http error codes mapped on the following error codes: -// NotFound -> grpc.NotFound -// StatusBadRequest -> grpc.InvalidArgument -// MethodNotAllowed -> grpc.Unimplemented -// Other -> grpc.Internal, method is not expecting to be called for anything else +// +// NotFound -> grpc.NotFound +// StatusBadRequest -> grpc.InvalidArgument +// MethodNotAllowed -> grpc.Unimplemented +// Other -> grpc.Internal, method is not expecting to be called for anything else func DefaultRoutingErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, r *http.Request, httpStatus int) { sterr := status.Error(codes.Internal, "Unexpected routing error") switch httpStatus { diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go index 0138ed2f7..a03dd166b 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go @@ -2,13 +2,14 @@ package runtime import ( "encoding/json" + "errors" "fmt" "io" "sort" - "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" + field_mask "google.golang.org/protobuf/types/known/fieldmaskpb" ) func getFieldByName(fields protoreflect.FieldDescriptors, name string) protoreflect.FieldDescriptor { @@ -44,7 +45,7 @@ func FieldMaskFromRequestBody(r io.Reader, msg proto.Message) (*field_mask.Field // if the item is an object, then enqueue all of its children for k, v := range m { if item.msg == nil { - return nil, fmt.Errorf("JSON structure did not match request type") + return nil, errors.New("JSON structure did not match request type") } fd := getFieldByName(item.msg.Descriptor().Fields(), k) @@ -53,7 +54,7 @@ func FieldMaskFromRequestBody(r io.Reader, msg proto.Message) (*field_mask.Field } if isDynamicProtoMessage(fd.Message()) { - for _, p := range buildPathsBlindly(k, v) { + for _, p := range buildPathsBlindly(string(fd.FullName().Name()), v) { newPath := p if item.path != "" { newPath = item.path + "." + newPath @@ -63,7 +64,7 @@ func FieldMaskFromRequestBody(r io.Reader, msg proto.Message) (*field_mask.Field continue } - if isProtobufAnyMessage(fd.Message()) { + if isProtobufAnyMessage(fd.Message()) && !fd.IsList() { _, hasTypeField := v.(map[string]interface{})["@type"] if hasTypeField { queue = append(queue, fieldMaskPathItem{path: k}) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go index d1e21df48..945f3a5eb 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go @@ -52,11 +52,11 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal return } if err != nil { - handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) + handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err, delimiter) return } if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { - handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) + handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err, delimiter) return } @@ -82,15 +82,15 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal if err != nil { grpclog.Infof("Failed to marshal response chunk: %v", err) - handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) + handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err, delimiter) return } - if _, err = w.Write(buf); err != nil { + if _, err := w.Write(buf); err != nil { grpclog.Infof("Failed to send response chunk: %v", err) return } wroteHeader = true - if _, err = w.Write(delimiter); err != nil { + if _, err := w.Write(delimiter); err != nil { grpclog.Infof("Failed to send delimiter chunk: %v", err) return } @@ -200,20 +200,24 @@ func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, re return nil } -func handleForwardResponseStreamError(ctx context.Context, wroteHeader bool, marshaler Marshaler, w http.ResponseWriter, req *http.Request, mux *ServeMux, err error) { +func handleForwardResponseStreamError(ctx context.Context, wroteHeader bool, marshaler Marshaler, w http.ResponseWriter, req *http.Request, mux *ServeMux, err error, delimiter []byte) { st := mux.streamErrorHandler(ctx, err) msg := errorChunk(st) if !wroteHeader { w.Header().Set("Content-Type", marshaler.ContentType(msg)) w.WriteHeader(HTTPStatusFromCode(st.Code())) } - buf, merr := marshaler.Marshal(msg) - if merr != nil { - grpclog.Infof("Failed to marshal an error: %v", merr) + buf, err := marshaler.Marshal(msg) + if err != nil { + grpclog.Infof("Failed to marshal an error: %v", err) + return + } + if _, err := w.Write(buf); err != nil { + grpclog.Infof("Failed to notify error to client: %v", err) return } - if _, werr := w.Write(buf); werr != nil { - grpclog.Infof("Failed to notify error to client: %v", werr) + if _, err := w.Write(delimiter); err != nil { + grpclog.Infof("Failed to send delimiter chunk: %v", err) return } } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go index 7387c8e39..51b8247da 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go @@ -92,23 +92,20 @@ func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { if rv.Type().Elem().Implements(protoMessageType) { var buf bytes.Buffer - err := buf.WriteByte('[') - if err != nil { + if err := buf.WriteByte('['); err != nil { return nil, err } for i := 0; i < rv.Len(); i++ { if i != 0 { - err = buf.WriteByte(',') - if err != nil { + if err := buf.WriteByte(','); err != nil { return nil, err } } - if err = j.marshalTo(&buf, rv.Index(i).Interface().(proto.Message)); err != nil { + if err := j.marshalTo(&buf, rv.Index(i).Interface().(proto.Message)); err != nil { return nil, err } } - err = buf.WriteByte(']') - if err != nil { + if err := buf.WriteByte(']'); err != nil { return nil, err } @@ -117,17 +114,16 @@ func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { if rv.Type().Elem().Implements(typeProtoEnum) { var buf bytes.Buffer - err := buf.WriteByte('[') - if err != nil { + if err := buf.WriteByte('['); err != nil { return nil, err } for i := 0; i < rv.Len(); i++ { if i != 0 { - err = buf.WriteByte(',') - if err != nil { + if err := buf.WriteByte(','); err != nil { return nil, err } } + var err error if j.UseEnumNumbers { _, err = buf.WriteString(strconv.FormatInt(rv.Index(i).Int(), 10)) } else { @@ -137,8 +133,7 @@ func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { return nil, err } } - err = buf.WriteByte(']') - if err != nil { + if err := buf.WriteByte(']'); err != nil { return nil, err } @@ -219,8 +214,7 @@ func decodeJSONPb(d *json.Decoder, unmarshaler protojson.UnmarshalOptions, v int // Decode into bytes for marshalling var b json.RawMessage - err := d.Decode(&b) - if err != nil { + if err := d.Decode(&b); err != nil { return err } @@ -239,8 +233,7 @@ func decodeNonProtoField(d *json.Decoder, unmarshaler protojson.UnmarshalOptions if rv.Type().ConvertibleTo(typeProtoMessage) { // Decode into bytes for marshalling var b json.RawMessage - err := d.Decode(&b) - if err != nil { + if err := d.Decode(&b); err != nil { return err } @@ -280,6 +273,17 @@ func decodeNonProtoField(d *json.Decoder, unmarshaler protojson.UnmarshalOptions return nil } if rv.Kind() == reflect.Slice { + if rv.Type().Elem().Kind() == reflect.Uint8 { + var sl []byte + if err := d.Decode(&sl); err != nil { + return err + } + if sl != nil { + rv.SetBytes(sl) + } + return nil + } + var sl []json.RawMessage if err := d.Decode(&sl); err != nil { return err diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_proto.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_proto.go index 007f8f1a2..398c780dc 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_proto.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_proto.go @@ -1,10 +1,8 @@ package runtime import ( - "io" - "errors" - "io/ioutil" + "io" "google.golang.org/protobuf/proto" ) @@ -38,7 +36,7 @@ func (*ProtoMarshaller) Unmarshal(data []byte, value interface{}) error { // NewDecoder returns a Decoder which reads proto stream from "reader". func (marshaller *ProtoMarshaller) NewDecoder(reader io.Reader) Decoder { return DecoderFunc(func(value interface{}) error { - buffer, err := ioutil.ReadAll(reader) + buffer, err := io.ReadAll(reader) if err != nil { return err } @@ -53,8 +51,7 @@ func (marshaller *ProtoMarshaller) NewEncoder(writer io.Writer) Encoder { if err != nil { return err } - _, err = writer.Write(buffer) - if err != nil { + if _, err := writer.Write(buffer); err != nil { return err } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go index 46a4aabaf..f451cb441 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go @@ -6,10 +6,13 @@ import ( "fmt" "net/http" "net/textproto" + "regexp" "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" @@ -23,15 +26,15 @@ const ( // path string before doing any routing. UnescapingModeLegacy UnescapingMode = iota - // EscapingTypeExceptReserved unescapes all path parameters except RFC 6570 + // UnescapingModeAllExceptReserved unescapes all path parameters except RFC 6570 // reserved characters. UnescapingModeAllExceptReserved - // EscapingTypeExceptSlash unescapes URL path parameters except path - // seperators, which will be left as "%2F". + // UnescapingModeAllExceptSlash unescapes URL path parameters except path + // separators, which will be left as "%2F". UnescapingModeAllExceptSlash - // URL path parameters will be fully decoded. + // UnescapingModeAllCharacters unescapes all URL path parameters. UnescapingModeAllCharacters // UnescapingModeDefault is the default escaping type. @@ -40,6 +43,8 @@ const ( UnescapingModeDefault = UnescapingModeLegacy ) +var encodedPathSplitter = regexp.MustCompile("(/|%2F)") + // A HandlerFunc handles a specific pair of path pattern and HTTP method. type HandlerFunc func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) @@ -75,7 +80,7 @@ func WithForwardResponseOption(forwardResponseOption func(context.Context, http. } } -// WithEscapingType sets the escaping type. See the definitions of UnescapingMode +// WithUnescapingMode sets the escaping type. See the definitions of UnescapingMode // for more information. func WithUnescapingMode(mode UnescapingMode) ServeMuxOption { return func(serveMux *ServeMux) { @@ -96,13 +101,14 @@ func SetQueryParameterParser(queryParameterParser QueryParameterParser) ServeMux type HeaderMatcherFunc func(string) (string, bool) // DefaultHeaderMatcher is used to pass http request headers to/from gRPC context. This adds permanent HTTP header -// keys (as specified by the IANA) to gRPC context with grpcgateway- prefix. HTTP headers that start with -// 'Grpc-Metadata-' are mapped to gRPC metadata after removing prefix 'Grpc-Metadata-'. +// keys (as specified by the IANA, e.g: Accept, Cookie, Host) to the gRPC metadata with the grpcgateway- prefix. If you want to know which headers are considered permanent, you can view the isPermanentHTTPHeader function. +// HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata after removing the prefix 'Grpc-Metadata-'. +// Other headers are not added to the gRPC metadata. func DefaultHeaderMatcher(key string) (string, bool) { - key = textproto.CanonicalMIMEHeaderKey(key) - if isPermanentHTTPHeader(key) { + switch key = textproto.CanonicalMIMEHeaderKey(key); { + case isPermanentHTTPHeader(key): return MetadataPrefix + key, true - } else if strings.HasPrefix(key, MetadataHeaderPrefix) { + case strings.HasPrefix(key, MetadataHeaderPrefix): return key[len(MetadataHeaderPrefix):], true } return "", false @@ -113,11 +119,30 @@ func DefaultHeaderMatcher(key string) (string, bool) { // This matcher will be called with each header in http.Request. If matcher returns true, that header will be // passed to gRPC context. To transform the header before passing to gRPC context, matcher should return modified header. func WithIncomingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { + for _, header := range fn.matchedMalformedHeaders() { + grpclog.Warningf("The configured forwarding filter would allow %q to be sent to the gRPC server, which will likely cause errors. See https://github.com/grpc/grpc-go/pull/4803#issuecomment-986093310 for more information.", header) + } + return func(mux *ServeMux) { mux.incomingHeaderMatcher = fn } } +// matchedMalformedHeaders returns the malformed headers that would be forwarded to gRPC server. +func (fn HeaderMatcherFunc) matchedMalformedHeaders() []string { + if fn == nil { + return nil + } + headers := make([]string, 0) + for header := range malformedHTTPHeaders { + out, accept := fn(header) + if accept && isMalformedHTTPHeader(out) { + headers = append(headers, out) + } + } + return headers +} + // WithOutgoingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for outgoing response from gateway. // // This matcher will be called with each header in response header metadata. If matcher returns true, that header will be @@ -179,6 +204,56 @@ func WithDisablePathLengthFallback() ServeMuxOption { } } +// WithHealthEndpointAt returns a ServeMuxOption that will add an endpoint to the created ServeMux at the path specified by endpointPath. +// When called the handler will forward the request to the upstream grpc service health check (defined in the +// gRPC Health Checking Protocol). +// +// See here https://grpc-ecosystem.github.io/grpc-gateway/docs/operations/health_check/ for more information on how +// to setup the protocol in the grpc server. +// +// If you define a service as query parameter, this will also be forwarded as service in the HealthCheckRequest. +func WithHealthEndpointAt(healthCheckClient grpc_health_v1.HealthClient, endpointPath string) ServeMuxOption { + return func(s *ServeMux) { + // error can be ignored since pattern is definitely valid + _ = s.HandlePath( + http.MethodGet, endpointPath, func(w http.ResponseWriter, r *http.Request, _ map[string]string, + ) { + _, outboundMarshaler := MarshalerForRequest(s, r) + + resp, err := healthCheckClient.Check(r.Context(), &grpc_health_v1.HealthCheckRequest{ + Service: r.URL.Query().Get("service"), + }) + if err != nil { + s.errorHandler(r.Context(), s, outboundMarshaler, w, r, err) + return + } + + w.Header().Set("Content-Type", "application/json") + + if resp.GetStatus() != grpc_health_v1.HealthCheckResponse_SERVING { + switch resp.GetStatus() { + case grpc_health_v1.HealthCheckResponse_NOT_SERVING, grpc_health_v1.HealthCheckResponse_UNKNOWN: + err = status.Error(codes.Unavailable, resp.String()) + case grpc_health_v1.HealthCheckResponse_SERVICE_UNKNOWN: + err = status.Error(codes.NotFound, resp.String()) + } + + s.errorHandler(r.Context(), s, outboundMarshaler, w, r, err) + return + } + + _ = outboundMarshaler.NewEncoder(w).Encode(resp) + }) + } +} + +// WithHealthzEndpoint returns a ServeMuxOption that will add a /healthz endpoint to the created ServeMux. +// +// See WithHealthEndpointAt for the general implementation. +func WithHealthzEndpoint(healthCheckClient grpc_health_v1.HealthClient) ServeMuxOption { + return WithHealthEndpointAt(healthCheckClient, "/healthz") +} + // NewServeMux returns a new ServeMux whose internal mapping is empty. func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ @@ -229,7 +304,7 @@ func (s *ServeMux) HandlePath(meth string, pathPattern string, h HandlerFunc) er return nil } -// ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.Path. +// ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.URL.Path. func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -245,8 +320,6 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { path = r.URL.RawPath } - components := strings.Split(path[1:], "/") - if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && s.isPathLengthFallback(r) { r.Method = strings.ToUpper(override) if err := r.ParseForm(); err != nil { @@ -257,8 +330,18 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } - // Verb out here is to memoize for the fallback case below - var verb string + var pathComponents []string + // since in UnescapeModeLegacy, the URL will already have been fully unescaped, if we also split on "%2F" + // in this escaping mode we would be double unescaping but in UnescapingModeAllCharacters, we still do as the + // path is the RawPath (i.e. unescaped). That does mean that the behavior of this function will change its default + // behavior when the UnescapingModeDefault gets changed from UnescapingModeLegacy to UnescapingModeAllExceptReserved + if s.unescapingMode == UnescapingModeAllCharacters { + pathComponents = encodedPathSplitter.Split(path[1:], -1) + } else { + pathComponents = strings.Split(path[1:], "/") + } + + lastPathComponent := pathComponents[len(pathComponents)-1] for _, h := range s.handlers[r.Method] { // If the pattern has a verb, explicitly look for a suffix in the last @@ -269,23 +352,28 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { // parser because we know what verb we're looking for, however, there // are still some cases that the parser itself cannot disambiguate. See // the comment there if interested. + + var verb string patVerb := h.pat.Verb() - l := len(components) - lastComponent := components[l-1] - var idx int = -1 - if patVerb != "" && strings.HasSuffix(lastComponent, ":"+patVerb) { - idx = len(lastComponent) - len(patVerb) - 1 + + idx := -1 + if patVerb != "" && strings.HasSuffix(lastPathComponent, ":"+patVerb) { + idx = len(lastPathComponent) - len(patVerb) - 1 } if idx == 0 { _, outboundMarshaler := MarshalerForRequest(s, r) s.routingErrorHandler(ctx, s, outboundMarshaler, w, r, http.StatusNotFound) return } + + comps := make([]string, len(pathComponents)) + copy(comps, pathComponents) + if idx > 0 { - components[l-1], verb = lastComponent[:idx], lastComponent[idx+1:] + comps[len(comps)-1], verb = lastPathComponent[:idx], lastPathComponent[idx+1:] } - pathParams, err := h.pat.MatchAndEscape(components, verb, s.unescapingMode) + pathParams, err := h.pat.MatchAndEscape(comps, verb, s.unescapingMode) if err != nil { var mse MalformedSequenceError if ok := errors.As(err, &mse); ok { @@ -301,14 +389,33 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - // lookup other methods to handle fallback from GET to POST and - // to determine if it is NotImplemented or NotFound. + // if no handler has found for the request, lookup for other methods + // to handle POST -> GET fallback if the request is subject to path + // length fallback. + // Note we are not eagerly checking the request here as we want to return the + // right HTTP status code, and we need to process the fallback candidates in + // order to do that. for m, handlers := range s.handlers { if m == r.Method { continue } for _, h := range handlers { - pathParams, err := h.pat.MatchAndEscape(components, verb, s.unescapingMode) + var verb string + patVerb := h.pat.Verb() + + idx := -1 + if patVerb != "" && strings.HasSuffix(lastPathComponent, ":"+patVerb) { + idx = len(lastPathComponent) - len(patVerb) - 1 + } + + comps := make([]string, len(pathComponents)) + copy(comps, pathComponents) + + if idx > 0 { + comps[len(comps)-1], verb = lastPathComponent[:idx], lastPathComponent[idx+1:] + } + + pathParams, err := h.pat.MatchAndEscape(comps, verb, s.unescapingMode) if err != nil { var mse MalformedSequenceError if ok := errors.As(err, &mse); ok { @@ -320,8 +427,11 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { } continue } + // X-HTTP-Method-Override is optional. Always allow fallback to POST. - if s.isPathLengthFallback(r) { + // Also, only consider POST -> GET fallbacks, and avoid falling back to + // potentially dangerous operations like DELETE. + if s.isPathLengthFallback(r) && m == http.MethodGet { if err := r.ParseForm(); err != nil { _, outboundMarshaler := MarshalerForRequest(s, r) sterr := status.Error(codes.InvalidArgument, err.Error()) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go index df7cb8142..8f90d15a5 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go @@ -15,8 +15,6 @@ var ( ErrNotMatch = errors.New("not match to the path pattern") // ErrInvalidPattern indicates that the given definition of Pattern is not valid. ErrInvalidPattern = errors.New("invalid pattern") - // ErrMalformedSequence indicates that an escape sequence was malformed. - ErrMalformedSequence = errors.New("malformed escape sequence") ) type MalformedSequenceError string diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go index fb0c84ef0..d01933c4f 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go @@ -1,7 +1,6 @@ package runtime import ( - "encoding/base64" "errors" "fmt" "net/url" @@ -11,19 +10,21 @@ import ( "time" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/grpc/grpclog" + "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/types/known/durationpb" + field_mask "google.golang.org/protobuf/types/known/fieldmaskpb" + "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" ) var valuesKeyRegexp = regexp.MustCompile(`^(.*)\[(.*)\]$`) -var currentQueryParser QueryParameterParser = &defaultQueryParser{} +var currentQueryParser QueryParameterParser = &DefaultQueryParser{} // QueryParameterParser defines interface for all query parameter parsers type QueryParameterParser interface { @@ -36,14 +37,17 @@ func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utili return currentQueryParser.Parse(msg, values, filter) } -type defaultQueryParser struct{} +// DefaultQueryParser is a QueryParameterParser which implements the default +// query parameters parsing behavior. +// +// See https://github.com/grpc-ecosystem/grpc-gateway/issues/2632 for more context. +type DefaultQueryParser struct{} // Parse populates "values" into "msg". // A value is ignored if its key starts with one of the elements in "filter". -func (*defaultQueryParser) Parse(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { +func (*DefaultQueryParser) Parse(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { for key, values := range values { - match := valuesKeyRegexp.FindStringSubmatch(key) - if len(match) == 3 { + if match := valuesKeyRegexp.FindStringSubmatch(key); len(match) == 3 { key = match[1] values = append([]string{match[2]}, values...) } @@ -175,10 +179,10 @@ func parseField(fieldDescriptor protoreflect.FieldDescriptor, value string) (pro return protoreflect.ValueOfBool(v), nil case protoreflect.EnumKind: enum, err := protoregistry.GlobalTypes.FindEnumByName(fieldDescriptor.Enum().FullName()) - switch { - case errors.Is(err, protoregistry.NotFound): - return protoreflect.Value{}, fmt.Errorf("enum %q is not registered", fieldDescriptor.Enum().FullName()) - case err != nil: + if err != nil { + if errors.Is(err, protoregistry.NotFound) { + return protoreflect.Value{}, fmt.Errorf("enum %q is not registered", fieldDescriptor.Enum().FullName()) + } return protoreflect.Value{}, fmt.Errorf("failed to look up enum: %w", err) } // Look for enum by name @@ -189,8 +193,7 @@ func parseField(fieldDescriptor protoreflect.FieldDescriptor, value string) (pro return protoreflect.Value{}, fmt.Errorf("%q is not a valid value", value) } // Look for enum by number - v = enum.Descriptor().Values().ByNumber(protoreflect.EnumNumber(i)) - if v == nil { + if v = enum.Descriptor().Values().ByNumber(protoreflect.EnumNumber(i)); v == nil { return protoreflect.Value{}, fmt.Errorf("%q is not a valid value", value) } } @@ -234,7 +237,7 @@ func parseField(fieldDescriptor protoreflect.FieldDescriptor, value string) (pro case protoreflect.StringKind: return protoreflect.ValueOfString(value), nil case protoreflect.BytesKind: - v, err := base64.URLEncoding.DecodeString(value) + v, err := Bytes(value) if err != nil { return protoreflect.Value{}, err } @@ -250,18 +253,12 @@ func parseMessage(msgDescriptor protoreflect.MessageDescriptor, value string) (p var msg proto.Message switch msgDescriptor.FullName() { case "google.protobuf.Timestamp": - if value == "null" { - break - } t, err := time.Parse(time.RFC3339Nano, value) if err != nil { return protoreflect.Value{}, err } msg = timestamppb.New(t) case "google.protobuf.Duration": - if value == "null" { - break - } d, err := time.ParseDuration(value) if err != nil { return protoreflect.Value{}, err @@ -272,55 +269,67 @@ func parseMessage(msgDescriptor protoreflect.MessageDescriptor, value string) (p if err != nil { return protoreflect.Value{}, err } - msg = &wrapperspb.DoubleValue{Value: v} + msg = wrapperspb.Double(v) case "google.protobuf.FloatValue": v, err := strconv.ParseFloat(value, 32) if err != nil { return protoreflect.Value{}, err } - msg = &wrapperspb.FloatValue{Value: float32(v)} + msg = wrapperspb.Float(float32(v)) case "google.protobuf.Int64Value": v, err := strconv.ParseInt(value, 10, 64) if err != nil { return protoreflect.Value{}, err } - msg = &wrapperspb.Int64Value{Value: v} + msg = wrapperspb.Int64(v) case "google.protobuf.Int32Value": v, err := strconv.ParseInt(value, 10, 32) if err != nil { return protoreflect.Value{}, err } - msg = &wrapperspb.Int32Value{Value: int32(v)} + msg = wrapperspb.Int32(int32(v)) case "google.protobuf.UInt64Value": v, err := strconv.ParseUint(value, 10, 64) if err != nil { return protoreflect.Value{}, err } - msg = &wrapperspb.UInt64Value{Value: v} + msg = wrapperspb.UInt64(v) case "google.protobuf.UInt32Value": v, err := strconv.ParseUint(value, 10, 32) if err != nil { return protoreflect.Value{}, err } - msg = &wrapperspb.UInt32Value{Value: uint32(v)} + msg = wrapperspb.UInt32(uint32(v)) case "google.protobuf.BoolValue": v, err := strconv.ParseBool(value) if err != nil { return protoreflect.Value{}, err } - msg = &wrapperspb.BoolValue{Value: v} + msg = wrapperspb.Bool(v) case "google.protobuf.StringValue": - msg = &wrapperspb.StringValue{Value: value} + msg = wrapperspb.String(value) case "google.protobuf.BytesValue": - v, err := base64.URLEncoding.DecodeString(value) + v, err := Bytes(value) if err != nil { return protoreflect.Value{}, err } - msg = &wrapperspb.BytesValue{Value: v} + msg = wrapperspb.Bytes(v) case "google.protobuf.FieldMask": fm := &field_mask.FieldMask{} fm.Paths = append(fm.Paths, strings.Split(value, ",")...) msg = fm + case "google.protobuf.Value": + var v structpb.Value + if err := protojson.Unmarshal([]byte(value), &v); err != nil { + return protoreflect.Value{}, err + } + msg = &v + case "google.protobuf.Struct": + var v structpb.Struct + if err := protojson.Unmarshal([]byte(value), &v); err != nil { + return protoreflect.Value{}, err + } + msg = &v default: return protoreflect.Value{}, fmt.Errorf("unsupported message type: %q", string(msgDescriptor.FullName())) } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel index 5d8d12bc4..b89409465 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel @@ -8,6 +8,7 @@ go_library( "doc.go", "pattern.go", "readerfactory.go", + "string_array_flag.go", "trie.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/utilities", @@ -16,7 +17,10 @@ go_library( go_test( name = "utilities_test", size = "small", - srcs = ["trie_test.go"], + srcs = [ + "string_array_flag_test.go", + "trie_test.go", + ], deps = [":utilities"], ) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/readerfactory.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/readerfactory.go index 6dd385466..01d26edae 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/readerfactory.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/readerfactory.go @@ -3,13 +3,12 @@ package utilities import ( "bytes" "io" - "io/ioutil" ) // IOReaderFactory takes in an io.Reader and returns a function that will allow you to create a new reader that begins // at the start of the stream func IOReaderFactory(r io.Reader) (func() io.Reader, error) { - b, err := ioutil.ReadAll(r) + b, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/string_array_flag.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/string_array_flag.go new file mode 100644 index 000000000..d224ab776 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/string_array_flag.go @@ -0,0 +1,33 @@ +package utilities + +import ( + "flag" + "strings" +) + +// flagInterface is an cut down interface to `flag` +type flagInterface interface { + Var(value flag.Value, name string, usage string) +} + +// StringArrayFlag defines a flag with the specified name and usage string. +// The return value is the address of a `StringArrayFlags` variable that stores the repeated values of the flag. +func StringArrayFlag(f flagInterface, name string, usage string) *StringArrayFlags { + value := &StringArrayFlags{} + f.Var(value, name, usage) + return value +} + +// StringArrayFlags is a wrapper of `[]string` to provider an interface for `flag.Var` +type StringArrayFlags []string + +// String returns a string representation of `StringArrayFlags` +func (i *StringArrayFlags) String() string { + return strings.Join(*i, ",") +} + +// Set appends a value to `StringArrayFlags` +func (i *StringArrayFlags) Set(value string) error { + *i = append(*i, value) + return nil +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/trie.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/trie.go index af3b703d5..dd99b0ed2 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/trie.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/trie.go @@ -40,7 +40,7 @@ func NewDoubleArray(seqs [][]string) *DoubleArray { func registerTokens(da *DoubleArray, seqs [][]string) [][]int { var result [][]int for _, seq := range seqs { - var encoded []int + encoded := make([]int, 0, len(seq)) for _, token := range seq { if _, ok := da.Encoding[token]; !ok { da.Encoding[token] = len(da.Encoding) diff --git a/vendor/github.com/jongio/azidext/go/azidext/azure_identity_credential_adapter.go b/vendor/github.com/jongio/azidext/go/azidext/azure_identity_credential_adapter.go deleted file mode 100644 index 69531f60d..000000000 --- a/vendor/github.com/jongio/azidext/go/azidext/azure_identity_credential_adapter.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package azidext - -import ( - "errors" - "net/http" - - "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/azidentity" - "github.com/Azure/go-autorest/autorest" -) - -// NewTokenCredentialAdapter is used to adapt an azcore.TokenCredential to an autorest.Authorizer -func NewTokenCredentialAdapter(credential azcore.TokenCredential, scopes []string) autorest.Authorizer { - tkPolicy := runtime.NewBearerTokenPolicy(credential, scopes, nil) - return &policyAdapter{ - pl: runtime.NewPipeline("azidext", "v0.4.0", runtime.PipelineOptions{ - PerRetry: []policy.Policy{tkPolicy, nullPolicy{}}, - }, nil), - } -} - -type policyAdapter struct { - pl runtime.Pipeline -} - -// WithAuthorization implements the autorest.Authorizer interface for type policyAdapter. -func (ca *policyAdapter) WithAuthorization() autorest.PrepareDecorator { - return func(p autorest.Preparer) autorest.Preparer { - return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err != nil { - return r, err - } - // create a dummy request - req, err := runtime.NewRequest(r.Context(), r.Method, r.URL.String()) - if err != nil { - return r, err - } - resp, err := ca.pl.Do(req) - // if the authentication failed due to invalid/missing credentials - // return a wrapped error so the retry policy won't kick in. - type nonRetriable interface { - NonRetriable() - } - var nre nonRetriable - if errors.As(err, &nre) { - return r, &tokenRefreshError{ - inner: err, - } - } - // some other error - if err != nil { - return r, err - } - // copy the authorization header to the real request - const authHeader = "Authorization" - r.Header.Set(authHeader, resp.Request.Header.Get(authHeader)) - return r, err - }) - } -} - -// DefaultManagementScope is the default credential scope for Azure Resource Management. -const DefaultManagementScope = "https://management.azure.com//.default" - -// DefaultAzureCredentialOptions contains credential and authentication policy options. -type DefaultAzureCredentialOptions struct { - // DefaultCredential contains configuration options passed to azidentity.NewDefaultAzureCredential(). - // Set this to nil to accept the underlying default behavior. - DefaultCredential *azidentity.DefaultAzureCredentialOptions - - // Scopes contains the list of permission scopes required for the token. - // Setting this to nil will use the DefaultManagementScope when acquiring a token. - Scopes []string -} - -// NewDefaultAzureCredentialAdapter adapts azcore.NewDefaultAzureCredential to an autorest.Authorizer. -func NewDefaultAzureCredentialAdapter(options *DefaultAzureCredentialOptions) (autorest.Authorizer, error) { - if options == nil { - options = &DefaultAzureCredentialOptions{ - Scopes: []string{DefaultManagementScope}, - } - } - cred, err := azidentity.NewDefaultAzureCredential(options.DefaultCredential) - if err != nil { - return nil, err - } - return NewTokenCredentialAdapter(cred, options.Scopes), nil -} - -// dummy policy to terminate the pipeline -type nullPolicy struct{} - -func (nullPolicy) Do(req *policy.Request) (*http.Response, error) { - return &http.Response{Request: req.Raw(), StatusCode: http.StatusOK}, nil -} - -// error type returned to prevent the retry policy from retrying the request -type tokenRefreshError struct { - inner error -} - -func (t *tokenRefreshError) Error() string { - return t.inner.Error() -} - -func (t *tokenRefreshError) Response() *http.Response { - return nil -} - -func (t *tokenRefreshError) Unwrap() error { - return t.inner -} diff --git a/vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/protosanitizer.go b/vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/protosanitizer.go index af64a7b27..cad31f17f 100644 --- a/vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/protosanitizer.go +++ b/vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/protosanitizer.go @@ -26,7 +26,6 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" - protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" protobufdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" ) @@ -56,7 +55,7 @@ func StripSecretsCSI03(msg interface{}) fmt.Stringer { type stripSecrets struct { msg interface{} - isSecretField func(field *protobuf.FieldDescriptorProto) bool + isSecretField func(field *protobufdescriptor.FieldDescriptorProto) bool } func (s *stripSecrets) String() string { @@ -110,7 +109,7 @@ func (s *stripSecrets) strip(parsed interface{}, msg interface{}) { if _, ok := parsedFields[field.GetName()]; ok { parsedFields[field.GetName()] = "***stripped***" } - } else if field.GetType() == protobuf.FieldDescriptorProto_TYPE_MESSAGE { + } else if field.GetType() == protobufdescriptor.FieldDescriptorProto_TYPE_MESSAGE { // When we get here, // the type name is something like ".csi.v1.CapacityRange" (leading dot!) // and looking up "csi.v1.CapacityRange" @@ -150,7 +149,7 @@ func (s *stripSecrets) strip(parsed interface{}, msg interface{}) { // isCSI1Secret uses the csi.E_CsiSecret extension from CSI 1.0 to // determine whether a field contains secrets. -func isCSI1Secret(field *protobuf.FieldDescriptorProto) bool { +func isCSI1Secret(field *protobufdescriptor.FieldDescriptorProto) bool { ex, err := proto.GetExtension(field.Options, e_CsiSecret) return err == nil && ex != nil && *ex.(*bool) } @@ -172,6 +171,6 @@ var e_CsiSecret = &proto.ExtensionDesc{ // isCSI03Secret relies on the naming convention in CSI <= 0.3 // to determine whether a field contains secrets. -func isCSI03Secret(field *protobuf.FieldDescriptorProto) bool { +func isCSI03Secret(field *protobufdescriptor.FieldDescriptorProto) bool { return strings.HasSuffix(field.GetName(), "_secrets") } diff --git a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md index fea67526e..ec91408f9 100644 --- a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md @@ -1,3 +1,21 @@ +## 2.13.2 + +### Fixes +- Fix file handler leak (#1309) [e2e81c8] +- Avoid allocations with `(*regexp.Regexp).MatchString` (#1302) [3b2a2a7] + +## 2.13.1 + +### Fixes +- # 1296 fix(precompiled test guite): exec bit check omitted on Windows (#1301) [26eea01] + +### Maintenance +- Bump github.com/go-logr/logr from 1.2.4 to 1.3.0 (#1291) [7161a9d] +- Bump golang.org/x/sys from 0.13.0 to 0.14.0 (#1295) [7fc7b10] +- Bump golang.org/x/tools from 0.12.0 to 0.14.0 (#1282) [74bbd65] +- Bump github.com/onsi/gomega from 1.27.10 to 1.29.0 (#1290) [9373633] +- Bump golang.org/x/net in /integration/_fixtures/version_mismatch_fixture (#1286) [6e3cf65] + ## 2.13.0 ### Features diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/test_suite.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/test_suite.go index 64dcb1b78..df99875be 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/test_suite.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/test_suite.go @@ -7,6 +7,7 @@ import ( "path" "path/filepath" "regexp" + "runtime" "strings" "github.com/onsi/ginkgo/v2/types" @@ -192,7 +193,7 @@ func precompiledTestSuite(path string) (TestSuite, error) { return TestSuite{}, errors.New("this is not a .test binary") } - if filepath.Ext(path) == ".test" && info.Mode()&0111 == 0 { + if filepath.Ext(path) == ".test" && runtime.GOOS != "windows" && info.Mode()&0111 == 0 { return TestSuite{}, errors.New("this is not executable") } @@ -225,7 +226,7 @@ func suitesInDir(dir string, recurse bool) TestSuites { files, _ := os.ReadDir(dir) re := regexp.MustCompile(`^[^._].*_test\.go$`) for _, file := range files { - if !file.IsDir() && re.Match([]byte(file.Name())) { + if !file.IsDir() && re.MatchString(file.Name()) { suite := TestSuite{ Path: relPath(dir), PackageName: packageNameForSuite(dir), @@ -240,7 +241,7 @@ func suitesInDir(dir string, recurse bool) TestSuites { if recurse { re = regexp.MustCompile(`^[._]`) for _, file := range files { - if file.IsDir() && !re.Match([]byte(file.Name())) { + if file.IsDir() && !re.MatchString(file.Name()) { suites = append(suites, suitesInDir(dir+"/"+file.Name(), recurse)...) } } @@ -271,7 +272,7 @@ func filesHaveGinkgoSuite(dir string, files []os.DirEntry) bool { reGinkgo := regexp.MustCompile(`package ginkgo|\/ginkgo"|\/ginkgo\/v2"|\/ginkgo\/v2/dsl/`) for _, file := range files { - if !file.IsDir() && reTestFile.Match([]byte(file.Name())) { + if !file.IsDir() && reTestFile.MatchString(file.Name()) { contents, _ := os.ReadFile(dir + "/" + file.Name()) if reGinkgo.Match(contents) { return true diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/dependencies.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/dependencies.go index f5ddff30f..a34d94354 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/dependencies.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/dependencies.go @@ -78,7 +78,7 @@ func (d Dependencies) resolveAndAdd(deps []string, depth int) { if err != nil { continue } - if !pkg.Goroot && (!ginkgoAndGomegaFilter.Match([]byte(pkg.Dir)) || ginkgoIntegrationTestFilter.Match([]byte(pkg.Dir))) { + if !pkg.Goroot && (!ginkgoAndGomegaFilter.MatchString(pkg.Dir) || ginkgoIntegrationTestFilter.MatchString(pkg.Dir)) { d.addDepIfNotPresent(pkg.Dir, depth) } } diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go index e9f7ec0cb..17d052bdc 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go @@ -79,7 +79,7 @@ func (p *PackageHash) computeHashes() (codeHash string, codeModifiedTime time.Ti continue } - if goTestRegExp.Match([]byte(info.Name())) { + if goTestRegExp.MatchString(info.Name()) { testHash += p.hashForFileInfo(info) if info.ModTime().After(testModifiedTime) { testModifiedTime = info.ModTime() @@ -87,7 +87,7 @@ func (p *PackageHash) computeHashes() (codeHash string, codeModifiedTime time.Ti continue } - if p.watchRegExp.Match([]byte(info.Name())) { + if p.watchRegExp.MatchString(info.Name()) { codeHash += p.hashForFileInfo(info) if info.ModTime().After(codeModifiedTime) { codeModifiedTime = info.ModTime() diff --git a/vendor/github.com/onsi/ginkgo/v2/reporters/json_report.go b/vendor/github.com/onsi/ginkgo/v2/reporters/json_report.go index be506f9b4..5d3e8db99 100644 --- a/vendor/github.com/onsi/ginkgo/v2/reporters/json_report.go +++ b/vendor/github.com/onsi/ginkgo/v2/reporters/json_report.go @@ -18,6 +18,7 @@ func GenerateJSONReport(report types.Report, destination string) error { if err != nil { return err } + defer f.Close() enc := json.NewEncoder(f) enc.SetIndent("", " ") err = enc.Encode([]types.Report{ @@ -26,7 +27,7 @@ func GenerateJSONReport(report types.Report, destination string) error { if err != nil { return err } - return f.Close() + return nil } // MergeJSONReports produces a single JSON-formatted report at the passed in destination by merging the JSON-formatted reports provided in sources @@ -57,11 +58,12 @@ func MergeAndCleanupJSONReports(sources []string, destination string) ([]string, if err != nil { return messages, err } + defer f.Close() enc := json.NewEncoder(f) enc.SetIndent("", " ") err = enc.Encode(allReports) if err != nil { return messages, err } - return messages, f.Close() + return messages, nil } diff --git a/vendor/github.com/onsi/ginkgo/v2/types/code_location.go b/vendor/github.com/onsi/ginkgo/v2/types/code_location.go index 9cd576817..57e87517e 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/code_location.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/code_location.go @@ -149,7 +149,7 @@ func PruneStack(fullStackTrace string, skip int) string { re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) for i := 0; i < len(stack)/2; i++ { // We filter out based on the source code file name. - if !re.Match([]byte(stack[i*2+1])) { + if !re.MatchString(stack[i*2+1]) { prunedStack = append(prunedStack, stack[i*2]) prunedStack = append(prunedStack, stack[i*2+1]) } diff --git a/vendor/github.com/onsi/ginkgo/v2/types/version.go b/vendor/github.com/onsi/ginkgo/v2/types/version.go index a37f30828..a4a1524b4 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/version.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/version.go @@ -1,3 +1,3 @@ package types -const VERSION = "2.13.0" +const VERSION = "2.13.2" diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index 1526497b9..fe72a7b18 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,3 +1,41 @@ +## 1.30.0 + +### Features +- BeTrueBecause and BeFalseBecause allow for better failure messages [4da4c7f] + +### Maintenance +- Bump actions/checkout from 3 to 4 (#694) [6ca6e97] +- doc: fix type on gleak go doc [f1b8343] + +## 1.29.0 + +### Features +- MatchError can now take an optional func(error) bool + description [2b39142] + +## 1.28.1 + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.12.0 to 2.13.0 [635d196] +- Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 [14f8859] +- Bump golang.org/x/net from 0.14.0 to 0.17.0 [d8a6508] +- #703 doc(matchers): HaveEach() doc comment updated [2705bdb] +- Minor typos (#699) [375648c] + +## 1.28.0 + +### Features +- Add VerifyHost handler to ghttp (#698) [0b03b36] + +### Fixes +- Read Body for Newer Responses in HaveHTTPBodyMatcher (#686) [18d6673] + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.11.0 to 2.12.0 (#693) [55a33f3] +- Typo in matchers.go (#691) [de68e8f] +- Bump commonmarker from 0.23.9 to 0.23.10 in /docs (#690) [ab17f5e] +- chore: update test matrix for Go 1.21 (#689) [5069017] +- Bump golang.org/x/net from 0.12.0 to 0.14.0 (#688) [babe25f] + ## 1.27.10 ### Fixes diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index 1fd1803ac..c271a366a 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -22,7 +22,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.27.10" +const GOMEGA_VERSION = "1.30.0" const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler. If you're using Ginkgo then you probably forgot to put your assertion in an It(). @@ -242,7 +242,7 @@ func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Asse Eventually enables making assertions on asynchronous behavior. Eventually checks that an assertion *eventually* passes. Eventually blocks when called and attempts an assertion periodically until it passes or a timeout occurs. Both the timeout and polling interval are configurable as optional arguments. -The first optional argument is the timeout (which defaults to 1s), the second is the polling interval (which defaults to 10ms). Both intervals can be specified as time.Duration, parsable duration strings or floats/integers (in which case they are interpreted as seconds). In addition an optional context.Context can be passed in - Eventually will keep trying until either the timeout epxires or the context is cancelled, whichever comes first. +The first optional argument is the timeout (which defaults to 1s), the second is the polling interval (which defaults to 10ms). Both intervals can be specified as time.Duration, parsable duration strings or floats/integers (in which case they are interpreted as seconds). In addition an optional context.Context can be passed in - Eventually will keep trying until either the timeout expires or the context is cancelled, whichever comes first. Eventually works with any Gomega compatible matcher and supports making assertions against three categories of actual value: @@ -313,13 +313,13 @@ It is important to note that the function passed into Eventually is invoked *syn }).Should(BeNumerically(">=", 17)) }, SpecTimeout(time.Second)) -you an also use Eventually().WithContext(ctx) to pass in the context. Passed-in contexts play nicely with paseed-in arguments as long as the context appears first. You can rewrite the above example as: +you an also use Eventually().WithContext(ctx) to pass in the context. Passed-in contexts play nicely with passed-in arguments as long as the context appears first. You can rewrite the above example as: It("fetches the correct count", func(ctx SpecContext) { Eventually(client.FetchCount).WithContext(ctx).WithArguments("/users").Should(BeNumerically(">=", 17)) }, SpecTimeout(time.Second)) -Either way the context passd to Eventually is also passed to the underlying funciton. Now, when Ginkgo cancels the context both the FetchCount client and Gomega will be informed and can exit. +Either way the context passd to Eventually is also passed to the underlying function. Now, when Ginkgo cancels the context both the FetchCount client and Gomega will be informed and can exit. **Category 3: Making assertions _in_ the function passed into Eventually** @@ -349,7 +349,7 @@ For example: will rerun the function until all assertions pass. -You can also pass additional arugments to functions that take a Gomega. The only rule is that the Gomega argument must be first. If you also want to pass the context attached to Eventually you must ensure that is the second argument. For example: +You can also pass additional arguments to functions that take a Gomega. The only rule is that the Gomega argument must be first. If you also want to pass the context attached to Eventually you must ensure that is the second argument. For example: Eventually(func(g Gomega, ctx context.Context, path string, expected ...string){ tok, err := client.GetToken(ctx) diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go index bdaf62b56..43f994374 100644 --- a/vendor/github.com/onsi/gomega/matchers.go +++ b/vendor/github.com/onsi/gomega/matchers.go @@ -1,6 +1,7 @@ package gomega import ( + "fmt" "time" "github.com/google/go-cmp/cmp" @@ -52,15 +53,31 @@ func BeNil() types.GomegaMatcher { } // BeTrue succeeds if actual is true +// +// In general, it's better to use `BeTrueBecause(reason)` to provide a more useful error message if a true check fails. func BeTrue() types.GomegaMatcher { return &matchers.BeTrueMatcher{} } // BeFalse succeeds if actual is false +// +// In general, it's better to use `BeFalseBecause(reason)` to provide a more useful error message if a false check fails. func BeFalse() types.GomegaMatcher { return &matchers.BeFalseMatcher{} } +// BeTrueBecause succeeds if actual is true and displays the provided reason if it is false +// fmt.Sprintf is used to render the reason +func BeTrueBecause(format string, args ...any) types.GomegaMatcher { + return &matchers.BeTrueMatcher{Reason: fmt.Sprintf(format, args...)} +} + +// BeFalseBecause succeeds if actual is false and displays the provided reason if it is true. +// fmt.Sprintf is used to render the reason +func BeFalseBecause(format string, args ...any) types.GomegaMatcher { + return &matchers.BeFalseMatcher{Reason: fmt.Sprintf(format, args...)} +} + // HaveOccurred succeeds if actual is a non-nil error // The typical Go error checking pattern looks like: // @@ -88,19 +105,44 @@ func Succeed() types.GomegaMatcher { } // MatchError succeeds if actual is a non-nil error that matches the passed in -// string, error, or matcher. +// string, error, function, or matcher. // // These are valid use-cases: // -// Expect(err).Should(MatchError("an error")) //asserts that err.Error() == "an error" -// Expect(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual) -// Expect(err).Should(MatchError(ContainSubstring("sprocket not found"))) // asserts that edrr.Error() contains substring "sprocket not found" +// When passed a string: +// +// Expect(err).To(MatchError("an error")) +// +// asserts that err.Error() == "an error" +// +// When passed an error: +// +// Expect(err).To(MatchError(SomeError)) +// +// First checks if errors.Is(err, SomeError). +// If that fails then it checks if reflect.DeepEqual(err, SomeError) repeatedly for err and any errors wrapped by err +// +// When passed a matcher: +// +// Expect(err).To(MatchError(ContainSubstring("sprocket not found"))) +// +// the matcher is passed err.Error(). In this case it asserts that err.Error() contains substring "sprocket not found" +// +// When passed a func(err) bool and a description: +// +// Expect(err).To(MatchError(os.IsNotExist, "IsNotExist")) +// +// the function is passed err and matches if the return value is true. The description is required to allow Gomega +// to print a useful error message. // // It is an error for err to be nil or an object that does not implement the // Error interface -func MatchError(expected interface{}) types.GomegaMatcher { +// +// The optional second argument is a description of the error function, if used. This is required when passing a function but is ignored in all other cases. +func MatchError(expected interface{}, functionErrorDescription ...any) types.GomegaMatcher { return &matchers.MatchErrorMatcher{ - Expected: expected, + Expected: expected, + FuncErrDescription: functionErrorDescription, } } @@ -381,7 +423,7 @@ func ContainElements(elements ...interface{}) types.GomegaMatcher { } // HaveEach succeeds if actual solely contains elements that match the passed in element. -// Please note that if actual is empty, HaveEach always will succeed. +// Please note that if actual is empty, HaveEach always will fail. // By default HaveEach() uses Equal() to perform the match, however a // matcher can be passed in instead: // diff --git a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go index e326c0157..8ee2b1c51 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go @@ -9,6 +9,7 @@ import ( ) type BeFalseMatcher struct { + Reason string } func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { @@ -20,9 +21,17 @@ func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err erro } func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be false") + if matcher.Reason == "" { + return format.Message(actual, "to be false") + } else { + return matcher.Reason + } } func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be false") + if matcher.Reason == "" { + return format.Message(actual, "not to be false") + } else { + return fmt.Sprintf(`Expected not false but got false\nNegation of "%s" failed`, matcher.Reason) + } } diff --git a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go index 60bc1e3fa..3576aac88 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go @@ -9,6 +9,7 @@ import ( ) type BeTrueMatcher struct { + Reason string } func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { @@ -20,9 +21,17 @@ func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error } func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be true") + if matcher.Reason == "" { + return format.Message(actual, "to be true") + } else { + return matcher.Reason + } } func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be true") + if matcher.Reason == "" { + return format.Message(actual, "not to be true") + } else { + return fmt.Sprintf(`Expected not true but got true\nNegation of "%s" failed`, matcher.Reason) + } } diff --git a/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go index 6a3dcdc35..d14d9e5fc 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go @@ -11,8 +11,9 @@ import ( ) type HaveHTTPBodyMatcher struct { - Expected interface{} - cachedBody []byte + Expected interface{} + cachedResponse interface{} + cachedBody []byte } func (matcher *HaveHTTPBodyMatcher) Match(actual interface{}) (bool, error) { @@ -73,7 +74,7 @@ func (matcher *HaveHTTPBodyMatcher) NegatedFailureMessage(actual interface{}) (m // the Reader is closed and it is not readable again in FailureMessage() // or NegatedFailureMessage() func (matcher *HaveHTTPBodyMatcher) body(actual interface{}) ([]byte, error) { - if matcher.cachedBody != nil { + if matcher.cachedResponse == actual && matcher.cachedBody != nil { return matcher.cachedBody, nil } @@ -91,8 +92,10 @@ func (matcher *HaveHTTPBodyMatcher) body(actual interface{}) ([]byte, error) { switch a := actual.(type) { case *http.Response: + matcher.cachedResponse = a return body(a) case *httptest.ResponseRecorder: + matcher.cachedResponse = a return body(a.Result()) default: return nil, fmt.Errorf("HaveHTTPBody matcher expects *http.Response or *httptest.ResponseRecorder. Got:\n%s", format.Object(actual, 1)) diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go index 827475ea5..c539dd389 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go @@ -9,10 +9,14 @@ import ( ) type MatchErrorMatcher struct { - Expected interface{} + Expected any + FuncErrDescription []any + isFunc bool } -func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *MatchErrorMatcher) Match(actual any) (success bool, err error) { + matcher.isFunc = false + if isNil(actual) { return false, fmt.Errorf("Expected an error, got nil") } @@ -42,6 +46,17 @@ func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err e return actualErr.Error() == expected, nil } + v := reflect.ValueOf(expected) + t := v.Type() + errorInterface := reflect.TypeOf((*error)(nil)).Elem() + if t.Kind() == reflect.Func && t.NumIn() == 1 && t.In(0).Implements(errorInterface) && t.NumOut() == 1 && t.Out(0).Kind() == reflect.Bool { + if len(matcher.FuncErrDescription) == 0 { + return false, fmt.Errorf("MatchError requires an additional description when passed a function") + } + matcher.isFunc = true + return v.Call([]reflect.Value{reflect.ValueOf(actualErr)})[0].Bool(), nil + } + var subMatcher omegaMatcher var hasSubMatcher bool if expected != nil { @@ -57,9 +72,15 @@ func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err e } func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) { + if matcher.isFunc { + return format.Message(actual, fmt.Sprintf("to match error function %s", matcher.FuncErrDescription[0])) + } return format.Message(actual, "to match error", matcher.Expected) } func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) { + if matcher.isFunc { + return format.Message(actual, fmt.Sprintf("not to match error function %s", matcher.FuncErrDescription[0])) + } return format.Message(actual, "not to match error", matcher.Expected) } diff --git a/vendor/github.com/spf13/cobra/.golangci.yml b/vendor/github.com/spf13/cobra/.golangci.yml index 2578d94b5..a618ec24d 100644 --- a/vendor/github.com/spf13/cobra/.golangci.yml +++ b/vendor/github.com/spf13/cobra/.golangci.yml @@ -19,7 +19,7 @@ linters: disable-all: true enable: #- bodyclose - - deadcode + # - deadcode ! deprecated since v1.49.0; replaced by 'unused' #- depguard #- dogsled #- dupl @@ -51,12 +51,12 @@ linters: #- rowserrcheck #- scopelint #- staticcheck - - structcheck + #- structcheck ! deprecated since v1.49.0; replaced by 'unused' #- stylecheck #- typecheck - unconvert #- unparam - #- unused - - varcheck + - unused + # - varcheck ! deprecated since v1.49.0; replaced by 'unused' #- whitespace fast: false diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md index 592c0b8ab..6444f4b7f 100644 --- a/vendor/github.com/spf13/cobra/README.md +++ b/vendor/github.com/spf13/cobra/README.md @@ -4,7 +4,7 @@ Cobra is a library for creating powerful modern CLI applications. Cobra is used in many Go projects such as [Kubernetes](https://kubernetes.io/), [Hugo](https://gohugo.io), and [GitHub CLI](https://github.com/cli/cli) to -name a few. [This list](./projects_using_cobra.md) contains a more extensive list of projects using Cobra. +name a few. [This list](site/content/projects_using_cobra.md) contains a more extensive list of projects using Cobra. [![](https://img.shields.io/github/actions/workflow/status/spf13/cobra/test.yml?branch=main&longCache=true&label=Test&logo=github%20actions&logoColor=fff)](https://github.com/spf13/cobra/actions?query=workflow%3ATest) [![Go Reference](https://pkg.go.dev/badge/github.com/spf13/cobra.svg)](https://pkg.go.dev/github.com/spf13/cobra) @@ -80,7 +80,7 @@ which maintains the same interface while adding POSIX compliance. # Installing Using Cobra is easy. First, use `go get` to install the latest version -of the library. +of the library. ``` go get -u github.com/spf13/cobra@latest @@ -105,8 +105,8 @@ go install github.com/spf13/cobra-cli@latest For complete details on using the Cobra-CLI generator, please read [The Cobra Generator README](https://github.com/spf13/cobra-cli/blob/main/README.md) -For complete details on using the Cobra library, please read the [The Cobra User Guide](user_guide.md). +For complete details on using the Cobra library, please read the [The Cobra User Guide](site/content/user_guide.md). # License -Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/spf13/cobra/blob/master/LICENSE.txt) +Cobra is released under the Apache 2.0 license. See [LICENSE.txt](LICENSE.txt) diff --git a/vendor/github.com/spf13/cobra/active_help.go b/vendor/github.com/spf13/cobra/active_help.go index 2d0239437..5f965e057 100644 --- a/vendor/github.com/spf13/cobra/active_help.go +++ b/vendor/github.com/spf13/cobra/active_help.go @@ -17,6 +17,7 @@ package cobra import ( "fmt" "os" + "regexp" "strings" ) @@ -29,6 +30,8 @@ const ( activeHelpGlobalDisable = "0" ) +var activeHelpEnvVarPrefixSubstRegexp = regexp.MustCompile(`[^A-Z0-9_]`) + // AppendActiveHelp adds the specified string to the specified array to be used as ActiveHelp. // Such strings will be processed by the completion script and will be shown as ActiveHelp // to the user. @@ -42,7 +45,7 @@ func AppendActiveHelp(compArray []string, activeHelpStr string) []string { // GetActiveHelpConfig returns the value of the ActiveHelp environment variable // _ACTIVE_HELP where is the name of the root command in upper -// case, with all - replaced by _. +// case, with all non-ASCII-alphanumeric characters replaced by `_`. // It will always return "0" if the global environment variable COBRA_ACTIVE_HELP // is set to "0". func GetActiveHelpConfig(cmd *Command) string { @@ -55,9 +58,10 @@ func GetActiveHelpConfig(cmd *Command) string { // activeHelpEnvVar returns the name of the program-specific ActiveHelp environment // variable. It has the format _ACTIVE_HELP where is the name of the -// root command in upper case, with all - replaced by _. +// root command in upper case, with all non-ASCII-alphanumeric characters replaced by `_`. func activeHelpEnvVar(name string) string { // This format should not be changed: users will be using it explicitly. activeHelpEnvVar := strings.ToUpper(fmt.Sprintf("%s%s", name, activeHelpEnvVarSuffix)) - return strings.ReplaceAll(activeHelpEnvVar, "-", "_") + activeHelpEnvVar = activeHelpEnvVarPrefixSubstRegexp.ReplaceAllString(activeHelpEnvVar, "_") + return activeHelpEnvVar } diff --git a/vendor/github.com/spf13/cobra/active_help.md b/vendor/github.com/spf13/cobra/active_help.md deleted file mode 100644 index 5e7f59af3..000000000 --- a/vendor/github.com/spf13/cobra/active_help.md +++ /dev/null @@ -1,157 +0,0 @@ -# Active Help - -Active Help is a framework provided by Cobra which allows a program to define messages (hints, warnings, etc) that will be printed during program usage. It aims to make it easier for your users to learn how to use your program. If configured by the program, Active Help is printed when the user triggers shell completion. - -For example, -``` -bash-5.1$ helm repo add [tab] -You must choose a name for the repo you are adding. - -bash-5.1$ bin/helm package [tab] -Please specify the path to the chart to package - -bash-5.1$ bin/helm package [tab][tab] -bin/ internal/ scripts/ pkg/ testdata/ -``` - -**Hint**: A good place to use Active Help messages is when the normal completion system does not provide any suggestions. In such cases, Active Help nicely supplements the normal shell completions to guide the user in knowing what is expected by the program. -## Supported shells - -Active Help is currently only supported for the following shells: -- Bash (using [bash completion V2](shell_completions.md#bash-completion-v2) only). Note that bash 4.4 or higher is required for the prompt to appear when an Active Help message is printed. -- Zsh - -## Adding Active Help messages - -As Active Help uses the shell completion system, the implementation of Active Help messages is done by enhancing custom dynamic completions. If you are not familiar with dynamic completions, please refer to [Shell Completions](shell_completions.md). - -Adding Active Help is done through the use of the `cobra.AppendActiveHelp(...)` function, where the program repeatedly adds Active Help messages to the list of completions. Keep reading for details. - -### Active Help for nouns - -Adding Active Help when completing a noun is done within the `ValidArgsFunction(...)` of a command. Please notice the use of `cobra.AppendActiveHelp(...)` in the following example: - -```go -cmd := &cobra.Command{ - Use: "add [NAME] [URL]", - Short: "add a chart repository", - Args: require.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - return addRepo(args) - }, - ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - var comps []string - if len(args) == 0 { - comps = cobra.AppendActiveHelp(comps, "You must choose a name for the repo you are adding") - } else if len(args) == 1 { - comps = cobra.AppendActiveHelp(comps, "You must specify the URL for the repo you are adding") - } else { - comps = cobra.AppendActiveHelp(comps, "This command does not take any more arguments") - } - return comps, cobra.ShellCompDirectiveNoFileComp - }, -} -``` -The example above defines the completions (none, in this specific example) as well as the Active Help messages for the `helm repo add` command. It yields the following behavior: -``` -bash-5.1$ helm repo add [tab] -You must choose a name for the repo you are adding - -bash-5.1$ helm repo add grafana [tab] -You must specify the URL for the repo you are adding - -bash-5.1$ helm repo add grafana https://grafana.github.io/helm-charts [tab] -This command does not take any more arguments -``` -**Hint**: As can be seen in the above example, a good place to use Active Help messages is when the normal completion system does not provide any suggestions. In such cases, Active Help nicely supplements the normal shell completions. - -### Active Help for flags - -Providing Active Help for flags is done in the same fashion as for nouns, but using the completion function registered for the flag. For example: -```go -_ = cmd.RegisterFlagCompletionFunc("version", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - if len(args) != 2 { - return cobra.AppendActiveHelp(nil, "You must first specify the chart to install before the --version flag can be completed"), cobra.ShellCompDirectiveNoFileComp - } - return compVersionFlag(args[1], toComplete) - }) -``` -The example above prints an Active Help message when not enough information was given by the user to complete the `--version` flag. -``` -bash-5.1$ bin/helm install myrelease --version 2.0.[tab] -You must first specify the chart to install before the --version flag can be completed - -bash-5.1$ bin/helm install myrelease bitnami/solr --version 2.0.[tab][tab] -2.0.1 2.0.2 2.0.3 -``` - -## User control of Active Help - -You may want to allow your users to disable Active Help or choose between different levels of Active Help. It is entirely up to the program to define the type of configurability of Active Help that it wants to offer, if any. -Allowing to configure Active Help is entirely optional; you can use Active Help in your program without doing anything about Active Help configuration. - -The way to configure Active Help is to use the program's Active Help environment -variable. That variable is named `_ACTIVE_HELP` where `` is the name of your -program in uppercase with any `-` replaced by an `_`. The variable should be set by the user to whatever -Active Help configuration values are supported by the program. - -For example, say `helm` has chosen to support three levels for Active Help: `on`, `off`, `local`. Then a user -would set the desired behavior to `local` by doing `export HELM_ACTIVE_HELP=local` in their shell. - -For simplicity, when in `cmd.ValidArgsFunction(...)` or a flag's completion function, the program should read the -Active Help configuration using the `cobra.GetActiveHelpConfig(cmd)` function and select what Active Help messages -should or should not be added (instead of reading the environment variable directly). - -For example: -```go -ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - activeHelpLevel := cobra.GetActiveHelpConfig(cmd) - - var comps []string - if len(args) == 0 { - if activeHelpLevel != "off" { - comps = cobra.AppendActiveHelp(comps, "You must choose a name for the repo you are adding") - } - } else if len(args) == 1 { - if activeHelpLevel != "off" { - comps = cobra.AppendActiveHelp(comps, "You must specify the URL for the repo you are adding") - } - } else { - if activeHelpLevel == "local" { - comps = cobra.AppendActiveHelp(comps, "This command does not take any more arguments") - } - } - return comps, cobra.ShellCompDirectiveNoFileComp -}, -``` -**Note 1**: If the `_ACTIVE_HELP` environment variable is set to the string "0", Cobra will automatically disable all Active Help output (even if some output was specified by the program using the `cobra.AppendActiveHelp(...)` function). Using "0" can simplify your code in situations where you want to blindly disable Active Help without having to call `cobra.GetActiveHelpConfig(cmd)` explicitly. - -**Note 2**: If a user wants to disable Active Help for every single program based on Cobra, she can set the environment variable `COBRA_ACTIVE_HELP` to "0". In this case `cobra.GetActiveHelpConfig(cmd)` will return "0" no matter what the variable `_ACTIVE_HELP` is set to. - -**Note 3**: If the user does not set `_ACTIVE_HELP` or `COBRA_ACTIVE_HELP` (which will be a common case), the default value for the Active Help configuration returned by `cobra.GetActiveHelpConfig(cmd)` will be the empty string. -## Active Help with Cobra's default completion command - -Cobra provides a default `completion` command for programs that wish to use it. -When using the default `completion` command, Active Help is configurable in the same -fashion as described above using environment variables. You may wish to document this in more -details for your users. - -## Debugging Active Help - -Debugging your Active Help code is done in the same way as debugging your dynamic completion code, which is with Cobra's hidden `__complete` command. Please refer to [debugging shell completion](shell_completions.md#debugging) for details. - -When debugging with the `__complete` command, if you want to specify different Active Help configurations, you should use the active help environment variable. That variable is named `_ACTIVE_HELP` where any `-` is replaced by an `_`. For example, we can test deactivating some Active Help as shown below: -``` -$ HELM_ACTIVE_HELP=1 bin/helm __complete install wordpress bitnami/h -bitnami/haproxy -bitnami/harbor -_activeHelp_ WARNING: cannot re-use a name that is still in use -:0 -Completion ended with directive: ShellCompDirectiveDefault - -$ HELM_ACTIVE_HELP=0 bin/helm __complete install wordpress bitnami/h -bitnami/haproxy -bitnami/harbor -:0 -Completion ended with directive: ShellCompDirectiveDefault -``` diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go index 10c78847d..8a5315184 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.go +++ b/vendor/github.com/spf13/cobra/bash_completions.go @@ -85,7 +85,7 @@ __%[1]s_handle_go_custom_completion() local out requestComp lastParam lastChar comp directive args # Prepare the command to request completions for the program. - # Calling ${words[0]} instead of directly %[1]s allows to handle aliases + # Calling ${words[0]} instead of directly %[1]s allows handling aliases args=("${words[@]:1}") # Disable ActiveHelp which is not supported for bash completion v1 requestComp="%[8]s=0 ${words[0]} %[2]s ${args[*]}" diff --git a/vendor/github.com/spf13/cobra/bash_completions.md b/vendor/github.com/spf13/cobra/bash_completions.md deleted file mode 100644 index 52919b2fa..000000000 --- a/vendor/github.com/spf13/cobra/bash_completions.md +++ /dev/null @@ -1,93 +0,0 @@ -# Generating Bash Completions For Your cobra.Command - -Please refer to [Shell Completions](shell_completions.md) for details. - -## Bash legacy dynamic completions - -For backward compatibility, Cobra still supports its legacy dynamic completion solution (described below). Unlike the `ValidArgsFunction` solution, the legacy solution will only work for Bash shell-completion and not for other shells. This legacy solution can be used along-side `ValidArgsFunction` and `RegisterFlagCompletionFunc()`, as long as both solutions are not used for the same command. This provides a path to gradually migrate from the legacy solution to the new solution. - -**Note**: Cobra's default `completion` command uses bash completion V2. If you are currently using Cobra's legacy dynamic completion solution, you should not use the default `completion` command but continue using your own. - -The legacy solution allows you to inject bash functions into the bash completion script. Those bash functions are responsible for providing the completion choices for your own completions. - -Some code that works in kubernetes: - -```bash -const ( - bash_completion_func = `__kubectl_parse_get() -{ - local kubectl_output out - if kubectl_output=$(kubectl get --no-headers "$1" 2>/dev/null); then - out=($(echo "${kubectl_output}" | awk '{print $1}')) - COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) ) - fi -} - -__kubectl_get_resource() -{ - if [[ ${#nouns[@]} -eq 0 ]]; then - return 1 - fi - __kubectl_parse_get ${nouns[${#nouns[@]} -1]} - if [[ $? -eq 0 ]]; then - return 0 - fi -} - -__kubectl_custom_func() { - case ${last_command} in - kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop) - __kubectl_get_resource - return - ;; - *) - ;; - esac -} -`) -``` - -And then I set that in my command definition: - -```go -cmds := &cobra.Command{ - Use: "kubectl", - Short: "kubectl controls the Kubernetes cluster manager", - Long: `kubectl controls the Kubernetes cluster manager. - -Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`, - Run: runHelp, - BashCompletionFunction: bash_completion_func, -} -``` - -The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__kubectl_custom_func()` (`___custom_func()`) to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__kubectl_customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__kubectl_custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! - -Similarly, for flags: - -```go - annotation := make(map[string][]string) - annotation[cobra.BashCompCustom] = []string{"__kubectl_get_namespaces"} - - flag := &pflag.Flag{ - Name: "namespace", - Usage: usage, - Annotations: annotation, - } - cmd.Flags().AddFlag(flag) -``` - -In addition add the `__kubectl_get_namespaces` implementation in the `BashCompletionFunction` -value, e.g.: - -```bash -__kubectl_get_namespaces() -{ - local template - template="{{ range .items }}{{ .metadata.name }} {{ end }}" - local kubectl_out - if kubectl_out=$(kubectl get -o template --template="${template}" namespace 2>/dev/null); then - COMPREPLY=( $( compgen -W "${kubectl_out}[*]" -- "$cur" ) ) - fi -} -``` diff --git a/vendor/github.com/spf13/cobra/bash_completionsV2.go b/vendor/github.com/spf13/cobra/bash_completionsV2.go index 19b09560c..1cce5c329 100644 --- a/vendor/github.com/spf13/cobra/bash_completionsV2.go +++ b/vendor/github.com/spf13/cobra/bash_completionsV2.go @@ -57,7 +57,7 @@ __%[1]s_get_completion_results() { local requestComp lastParam lastChar args # Prepare the command to request completions for the program. - # Calling ${words[0]} instead of directly %[1]s allows to handle aliases + # Calling ${words[0]} instead of directly %[1]s allows handling aliases args=("${words[@]:1}") requestComp="${words[0]} %[2]s ${args[*]}" diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go index b07b44a0c..a6b160ce5 100644 --- a/vendor/github.com/spf13/cobra/cobra.go +++ b/vendor/github.com/spf13/cobra/cobra.go @@ -43,12 +43,13 @@ var initializers []func() var finalizers []func() const ( - defaultPrefixMatching = false - defaultCommandSorting = true - defaultCaseInsensitive = false + defaultPrefixMatching = false + defaultCommandSorting = true + defaultCaseInsensitive = false + defaultTraverseRunHooks = false ) -// EnablePrefixMatching allows to set automatic prefix matching. Automatic prefix matching can be a dangerous thing +// EnablePrefixMatching allows setting automatic prefix matching. Automatic prefix matching can be a dangerous thing // to automatically enable in CLI tools. // Set this to true to enable it. var EnablePrefixMatching = defaultPrefixMatching @@ -60,6 +61,10 @@ var EnableCommandSorting = defaultCommandSorting // EnableCaseInsensitive allows case-insensitive commands names. (case sensitive by default) var EnableCaseInsensitive = defaultCaseInsensitive +// EnableTraverseRunHooks executes persistent pre-run and post-run hooks from all parents. +// By default this is disabled, which means only the first run hook to be found is executed. +var EnableTraverseRunHooks = defaultTraverseRunHooks + // MousetrapHelpText enables an information splash screen on Windows // if the CLI is started from explorer.exe. // To disable the mousetrap, just set this variable to blank string (""). diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go index 01f7c6f1c..2fbe6c131 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -30,7 +30,10 @@ import ( flag "github.com/spf13/pflag" ) -const FlagSetByCobraAnnotation = "cobra_annotation_flag_set_by_cobra" +const ( + FlagSetByCobraAnnotation = "cobra_annotation_flag_set_by_cobra" + CommandDisplayNameAnnotation = "cobra_annotation_command_display_name" +) // FParseErrWhitelist configures Flag parse errors to be ignored type FParseErrWhitelist flag.ParseErrorsWhitelist @@ -99,7 +102,7 @@ type Command struct { Deprecated string // Annotations are key/value pairs that can be used by applications to identify or - // group commands. + // group commands or set special options. Annotations map[string]string // Version defines the version for this command. If this value is non-empty and the command does not @@ -115,6 +118,8 @@ type Command struct { // * PostRun() // * PersistentPostRun() // All functions get the same args, the arguments after the command name. + // The *PreRun and *PostRun functions will only be executed if the Run function of the current + // command has been declared. // // PersistentPreRun: children of this command will inherit and execute. PersistentPreRun func(cmd *Command, args []string) @@ -181,6 +186,9 @@ type Command struct { // versionTemplate is the version template defined by user. versionTemplate string + // errPrefix is the error message prefix defined by user. + errPrefix string + // inReader is a reader defined by the user that replaces stdin inReader io.Reader // outWriter is a writer defined by the user that replaces stdout @@ -346,6 +354,11 @@ func (c *Command) SetVersionTemplate(s string) { c.versionTemplate = s } +// SetErrPrefix sets error message prefix to be used. Application can use it to set custom prefix. +func (c *Command) SetErrPrefix(s string) { + c.errPrefix = s +} + // SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands. // The user should not have a cyclic dependency on commands. func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string) flag.NormalizedName) { @@ -595,6 +608,18 @@ func (c *Command) VersionTemplate() string { ` } +// ErrPrefix return error message prefix for the command +func (c *Command) ErrPrefix() string { + if c.errPrefix != "" { + return c.errPrefix + } + + if c.HasParent() { + return c.parent.ErrPrefix() + } + return "Error:" +} + func hasNoOptDefVal(name string, fs *flag.FlagSet) bool { flag := fs.Lookup(name) if flag == nil { @@ -752,7 +777,9 @@ func (c *Command) findNext(next string) *Command { } if len(matches) == 1 { - return matches[0] + // Temporarily disable gosec G602, which produces a false positive. + // See https://github.com/securego/gosec/issues/1005. + return matches[0] // #nosec G602 } return nil @@ -910,15 +937,31 @@ func (c *Command) execute(a []string) (err error) { return err } + parents := make([]*Command, 0, 5) for p := c; p != nil; p = p.Parent() { + if EnableTraverseRunHooks { + // When EnableTraverseRunHooks is set: + // - Execute all persistent pre-runs from the root parent till this command. + // - Execute all persistent post-runs from this command till the root parent. + parents = append([]*Command{p}, parents...) + } else { + // Otherwise, execute only the first found persistent hook. + parents = append(parents, p) + } + } + for _, p := range parents { if p.PersistentPreRunE != nil { if err := p.PersistentPreRunE(c, argWoFlags); err != nil { return err } - break + if !EnableTraverseRunHooks { + break + } } else if p.PersistentPreRun != nil { p.PersistentPreRun(c, argWoFlags) - break + if !EnableTraverseRunHooks { + break + } } } if c.PreRunE != nil { @@ -955,10 +998,14 @@ func (c *Command) execute(a []string) (err error) { if err := p.PersistentPostRunE(c, argWoFlags); err != nil { return err } - break + if !EnableTraverseRunHooks { + break + } } else if p.PersistentPostRun != nil { p.PersistentPostRun(c, argWoFlags) - break + if !EnableTraverseRunHooks { + break + } } } @@ -1048,7 +1095,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) { c = cmd } if !c.SilenceErrors { - c.PrintErrln("Error:", err.Error()) + c.PrintErrln(c.ErrPrefix(), err.Error()) c.PrintErrf("Run '%v --help' for usage.\n", c.CommandPath()) } return c, err @@ -1077,7 +1124,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) { // If root command has SilenceErrors flagged, // all subcommands should respect it if !cmd.SilenceErrors && !c.SilenceErrors { - c.PrintErrln("Error:", err.Error()) + c.PrintErrln(cmd.ErrPrefix(), err.Error()) } // If root command has SilenceUsage flagged, @@ -1380,6 +1427,9 @@ func (c *Command) CommandPath() string { if c.HasParent() { return c.Parent().CommandPath() + " " + c.Name() } + if displayName, ok := c.Annotations[CommandDisplayNameAnnotation]; ok { + return displayName + } return c.Name() } @@ -1402,6 +1452,7 @@ func (c *Command) UseLine() string { // DebugFlags used to determine which flags have been assigned to which commands // and which persist. +// nolint:goconst func (c *Command) DebugFlags() { c.Println("DebugFlags called on", c.Name()) var debugflags func(*Command) diff --git a/vendor/github.com/spf13/cobra/completions.go b/vendor/github.com/spf13/cobra/completions.go index ee38c4d0b..b60f6b200 100644 --- a/vendor/github.com/spf13/cobra/completions.go +++ b/vendor/github.com/spf13/cobra/completions.go @@ -145,6 +145,20 @@ func (c *Command) RegisterFlagCompletionFunc(flagName string, f func(cmd *Comman return nil } +// GetFlagCompletionFunc returns the completion function for the given flag of the command, if available. +func (c *Command) GetFlagCompletionFunc(flagName string) (func(*Command, []string, string) ([]string, ShellCompDirective), bool) { + flag := c.Flag(flagName) + if flag == nil { + return nil, false + } + + flagCompletionMutex.RLock() + defer flagCompletionMutex.RUnlock() + + completionFunc, exists := flagCompletionFunctions[flag] + return completionFunc, exists +} + // Returns a string listing the different directive enabled in the specified parameter func (d ShellCompDirective) string() string { var directives []string @@ -283,9 +297,13 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi // These flags are normally added when `execute()` is called on `finalCmd`, // however, when doing completion, we don't call `finalCmd.execute()`. - // Let's add the --help and --version flag ourselves. - finalCmd.InitDefaultHelpFlag() - finalCmd.InitDefaultVersionFlag() + // Let's add the --help and --version flag ourselves but only if the finalCmd + // has not disabled flag parsing; if flag parsing is disabled, it is up to the + // finalCmd itself to handle the completion of *all* flags. + if !finalCmd.DisableFlagParsing { + finalCmd.InitDefaultHelpFlag() + finalCmd.InitDefaultVersionFlag() + } // Check if we are doing flag value completion before parsing the flags. // This is important because if we are completing a flag value, we need to also @@ -389,6 +407,11 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi finalCmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) { doCompleteFlags(flag) }) + // Try to complete non-inherited flags even if DisableFlagParsing==true. + // This allows programs to tell Cobra about flags for completion even + // if the actual parsing of flags is not done by Cobra. + // For instance, Helm uses this to provide flag name completion for + // some of its plugins. finalCmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) { doCompleteFlags(flag) }) diff --git a/vendor/github.com/spf13/cobra/fish_completions.go b/vendor/github.com/spf13/cobra/fish_completions.go index 12ca0d2b1..12d61b691 100644 --- a/vendor/github.com/spf13/cobra/fish_completions.go +++ b/vendor/github.com/spf13/cobra/fish_completions.go @@ -113,7 +113,7 @@ function __%[1]s_clear_perform_completion_once_result __%[1]s_debug "" __%[1]s_debug "========= clearing previously set __%[1]s_perform_completion_once_result variable ==========" set --erase __%[1]s_perform_completion_once_result - __%[1]s_debug "Succesfully erased the variable __%[1]s_perform_completion_once_result" + __%[1]s_debug "Successfully erased the variable __%[1]s_perform_completion_once_result" end function __%[1]s_requires_order_preservation diff --git a/vendor/github.com/spf13/cobra/fish_completions.md b/vendor/github.com/spf13/cobra/fish_completions.md deleted file mode 100644 index 19b2ed129..000000000 --- a/vendor/github.com/spf13/cobra/fish_completions.md +++ /dev/null @@ -1,4 +0,0 @@ -## Generating Fish Completions For Your cobra.Command - -Please refer to [Shell Completions](shell_completions.md) for details. - diff --git a/vendor/github.com/spf13/cobra/flag_groups.go b/vendor/github.com/spf13/cobra/flag_groups.go index b35fde155..0671ec5f2 100644 --- a/vendor/github.com/spf13/cobra/flag_groups.go +++ b/vendor/github.com/spf13/cobra/flag_groups.go @@ -24,6 +24,7 @@ import ( const ( requiredAsGroup = "cobra_annotation_required_if_others_set" + oneRequired = "cobra_annotation_one_required" mutuallyExclusive = "cobra_annotation_mutually_exclusive" ) @@ -43,6 +44,22 @@ func (c *Command) MarkFlagsRequiredTogether(flagNames ...string) { } } +// MarkFlagsOneRequired marks the given flags with annotations so that Cobra errors +// if the command is invoked without at least one flag from the given set of flags. +func (c *Command) MarkFlagsOneRequired(flagNames ...string) { + c.mergePersistentFlags() + for _, v := range flagNames { + f := c.Flags().Lookup(v) + if f == nil { + panic(fmt.Sprintf("Failed to find flag %q and mark it as being in a one-required flag group", v)) + } + if err := c.Flags().SetAnnotation(v, oneRequired, append(f.Annotations[oneRequired], strings.Join(flagNames, " "))); err != nil { + // Only errs if the flag isn't found. + panic(err) + } + } +} + // MarkFlagsMutuallyExclusive marks the given flags with annotations so that Cobra errors // if the command is invoked with more than one flag from the given set of flags. func (c *Command) MarkFlagsMutuallyExclusive(flagNames ...string) { @@ -59,7 +76,7 @@ func (c *Command) MarkFlagsMutuallyExclusive(flagNames ...string) { } } -// ValidateFlagGroups validates the mutuallyExclusive/requiredAsGroup logic and returns the +// ValidateFlagGroups validates the mutuallyExclusive/oneRequired/requiredAsGroup logic and returns the // first error encountered. func (c *Command) ValidateFlagGroups() error { if c.DisableFlagParsing { @@ -71,15 +88,20 @@ func (c *Command) ValidateFlagGroups() error { // groupStatus format is the list of flags as a unique ID, // then a map of each flag name and whether it is set or not. groupStatus := map[string]map[string]bool{} + oneRequiredGroupStatus := map[string]map[string]bool{} mutuallyExclusiveGroupStatus := map[string]map[string]bool{} flags.VisitAll(func(pflag *flag.Flag) { processFlagForGroupAnnotation(flags, pflag, requiredAsGroup, groupStatus) + processFlagForGroupAnnotation(flags, pflag, oneRequired, oneRequiredGroupStatus) processFlagForGroupAnnotation(flags, pflag, mutuallyExclusive, mutuallyExclusiveGroupStatus) }) if err := validateRequiredFlagGroups(groupStatus); err != nil { return err } + if err := validateOneRequiredFlagGroups(oneRequiredGroupStatus); err != nil { + return err + } if err := validateExclusiveFlagGroups(mutuallyExclusiveGroupStatus); err != nil { return err } @@ -142,6 +164,27 @@ func validateRequiredFlagGroups(data map[string]map[string]bool) error { return nil } +func validateOneRequiredFlagGroups(data map[string]map[string]bool) error { + keys := sortedKeys(data) + for _, flagList := range keys { + flagnameAndStatus := data[flagList] + var set []string + for flagname, isSet := range flagnameAndStatus { + if isSet { + set = append(set, flagname) + } + } + if len(set) >= 1 { + continue + } + + // Sort values, so they can be tested/scripted against consistently. + sort.Strings(set) + return fmt.Errorf("at least one of the flags in the group [%v] is required", flagList) + } + return nil +} + func validateExclusiveFlagGroups(data map[string]map[string]bool) error { keys := sortedKeys(data) for _, flagList := range keys { @@ -176,6 +219,7 @@ func sortedKeys(m map[string]map[string]bool) []string { // enforceFlagGroupsForCompletion will do the following: // - when a flag in a group is present, other flags in the group will be marked required +// - when none of the flags in a one-required group are present, all flags in the group will be marked required // - when a flag in a mutually exclusive group is present, other flags in the group will be marked as hidden // This allows the standard completion logic to behave appropriately for flag groups func (c *Command) enforceFlagGroupsForCompletion() { @@ -185,9 +229,11 @@ func (c *Command) enforceFlagGroupsForCompletion() { flags := c.Flags() groupStatus := map[string]map[string]bool{} + oneRequiredGroupStatus := map[string]map[string]bool{} mutuallyExclusiveGroupStatus := map[string]map[string]bool{} c.Flags().VisitAll(func(pflag *flag.Flag) { processFlagForGroupAnnotation(flags, pflag, requiredAsGroup, groupStatus) + processFlagForGroupAnnotation(flags, pflag, oneRequired, oneRequiredGroupStatus) processFlagForGroupAnnotation(flags, pflag, mutuallyExclusive, mutuallyExclusiveGroupStatus) }) @@ -204,6 +250,26 @@ func (c *Command) enforceFlagGroupsForCompletion() { } } + // If none of the flags of a one-required group are present, we make all the flags + // of that group required so that the shell completion suggests them automatically + for flagList, flagnameAndStatus := range oneRequiredGroupStatus { + set := 0 + + for _, isSet := range flagnameAndStatus { + if isSet { + set++ + } + } + + // None of the flags of the group are set, mark all flags in the group + // as required + if set == 0 { + for _, fName := range strings.Split(flagList, " ") { + _ = c.MarkFlagRequired(fName) + } + } + } + // If a flag that is mutually exclusive to others is present, we hide the other // flags of that group so the shell completion does not suggest them for flagList, flagnameAndStatus := range mutuallyExclusiveGroupStatus { diff --git a/vendor/github.com/spf13/cobra/powershell_completions.go b/vendor/github.com/spf13/cobra/powershell_completions.go index 177d2755f..551951939 100644 --- a/vendor/github.com/spf13/cobra/powershell_completions.go +++ b/vendor/github.com/spf13/cobra/powershell_completions.go @@ -47,7 +47,7 @@ filter __%[1]s_escapeStringWithSpecialChars { `+" $_ -replace '\\s|#|@|\\$|;|,|''|\\{|\\}|\\(|\\)|\"|`|\\||<|>|&','`$&'"+` } -[scriptblock]$__%[2]sCompleterBlock = { +[scriptblock]${__%[2]sCompleterBlock} = { param( $WordToComplete, $CommandAst, @@ -122,7 +122,7 @@ filter __%[1]s_escapeStringWithSpecialChars { __%[1]s_debug "Calling $RequestComp" # First disable ActiveHelp which is not supported for Powershell - $env:%[10]s=0 + ${env:%[10]s}=0 #call the command store the output in $out and redirect stderr and stdout to null # $Out is an array contains each line per element @@ -279,7 +279,7 @@ filter __%[1]s_escapeStringWithSpecialChars { } } -Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock $__%[2]sCompleterBlock +Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock ${__%[2]sCompleterBlock} `, name, nameForVar, compCmd, ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder, activeHelpEnvVar(name))) diff --git a/vendor/github.com/spf13/cobra/powershell_completions.md b/vendor/github.com/spf13/cobra/powershell_completions.md deleted file mode 100644 index c449f1e5c..000000000 --- a/vendor/github.com/spf13/cobra/powershell_completions.md +++ /dev/null @@ -1,3 +0,0 @@ -# Generating PowerShell Completions For Your Own cobra.Command - -Please refer to [Shell Completions](shell_completions.md#powershell-completions) for details. diff --git a/vendor/github.com/spf13/cobra/projects_using_cobra.md b/vendor/github.com/spf13/cobra/projects_using_cobra.md deleted file mode 100644 index 8a291eb20..000000000 --- a/vendor/github.com/spf13/cobra/projects_using_cobra.md +++ /dev/null @@ -1,64 +0,0 @@ -## Projects using Cobra - -- [Allero](https://github.com/allero-io/allero) -- [Arewefastyet](https://benchmark.vitess.io) -- [Arduino CLI](https://github.com/arduino/arduino-cli) -- [Bleve](https://blevesearch.com/) -- [Cilium](https://cilium.io/) -- [CloudQuery](https://github.com/cloudquery/cloudquery) -- [CockroachDB](https://www.cockroachlabs.com/) -- [Constellation](https://github.com/edgelesssys/constellation) -- [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) -- [Datree](https://github.com/datreeio/datree) -- [Delve](https://github.com/derekparker/delve) -- [Docker (distribution)](https://github.com/docker/distribution) -- [Etcd](https://etcd.io/) -- [Gardener](https://github.com/gardener/gardenctl) -- [Giant Swarm's gsctl](https://github.com/giantswarm/gsctl) -- [Git Bump](https://github.com/erdaltsksn/git-bump) -- [GitHub CLI](https://github.com/cli/cli) -- [GitHub Labeler](https://github.com/erdaltsksn/gh-label) -- [Golangci-lint](https://golangci-lint.run) -- [GopherJS](https://github.com/gopherjs/gopherjs) -- [GoReleaser](https://goreleaser.com) -- [Helm](https://helm.sh) -- [Hugo](https://gohugo.io) -- [Infracost](https://github.com/infracost/infracost) -- [Istio](https://istio.io) -- [Kool](https://github.com/kool-dev/kool) -- [Kubernetes](https://kubernetes.io/) -- [Kubescape](https://github.com/kubescape/kubescape) -- [KubeVirt](https://github.com/kubevirt/kubevirt) -- [Linkerd](https://linkerd.io/) -- [Mattermost-server](https://github.com/mattermost/mattermost-server) -- [Mercure](https://mercure.rocks/) -- [Meroxa CLI](https://github.com/meroxa/cli) -- [Metal Stack CLI](https://github.com/metal-stack/metalctl) -- [Moby (former Docker)](https://github.com/moby/moby) -- [Moldy](https://github.com/Moldy-Community/moldy) -- [Multi-gitter](https://github.com/lindell/multi-gitter) -- [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack) -- [nFPM](https://nfpm.goreleaser.com) -- [Okteto](https://github.com/okteto/okteto) -- [OpenShift](https://www.openshift.com/) -- [Ory Hydra](https://github.com/ory/hydra) -- [Ory Kratos](https://github.com/ory/kratos) -- [Pixie](https://github.com/pixie-io/pixie) -- [Polygon Edge](https://github.com/0xPolygon/polygon-edge) -- [Pouch](https://github.com/alibaba/pouch) -- [ProjectAtomic (enterprise)](https://www.projectatomic.io/) -- [Prototool](https://github.com/uber/prototool) -- [Pulumi](https://www.pulumi.com) -- [QRcp](https://github.com/claudiodangelis/qrcp) -- [Random](https://github.com/erdaltsksn/random) -- [Rclone](https://rclone.org/) -- [Scaleway CLI](https://github.com/scaleway/scaleway-cli) -- [Sia](https://github.com/SiaFoundation/siad) -- [Skaffold](https://skaffold.dev/) -- [Tendermint](https://github.com/tendermint/tendermint) -- [Twitch CLI](https://github.com/twitchdev/twitch-cli) -- [UpCloud CLI (`upctl`)](https://github.com/UpCloudLtd/upcloud-cli) -- [Vitess](https://vitess.io) -- VMware's [Tanzu Community Edition](https://github.com/vmware-tanzu/community-edition) & [Tanzu Framework](https://github.com/vmware-tanzu/tanzu-framework) -- [Werf](https://werf.io/) -- [ZITADEL](https://github.com/zitadel/zitadel) diff --git a/vendor/github.com/spf13/cobra/shell_completions.md b/vendor/github.com/spf13/cobra/shell_completions.md deleted file mode 100644 index 065c0621d..000000000 --- a/vendor/github.com/spf13/cobra/shell_completions.md +++ /dev/null @@ -1,576 +0,0 @@ -# Generating shell completions - -Cobra can generate shell completions for multiple shells. -The currently supported shells are: -- Bash -- Zsh -- fish -- PowerShell - -Cobra will automatically provide your program with a fully functional `completion` command, -similarly to how it provides the `help` command. - -## Creating your own completion command - -If you do not wish to use the default `completion` command, you can choose to -provide your own, which will take precedence over the default one. (This also provides -backwards-compatibility with programs that already have their own `completion` command.) - -If you are using the `cobra-cli` generator, -which can be found at [spf13/cobra-cli](https://github.com/spf13/cobra-cli), -you can create a completion command by running - -```bash -cobra-cli add completion -``` -and then modifying the generated `cmd/completion.go` file to look something like this -(writing the shell script to stdout allows the most flexible use): - -```go -var completionCmd = &cobra.Command{ - Use: "completion [bash|zsh|fish|powershell]", - Short: "Generate completion script", - Long: fmt.Sprintf(`To load completions: - -Bash: - - $ source <(%[1]s completion bash) - - # To load completions for each session, execute once: - # Linux: - $ %[1]s completion bash > /etc/bash_completion.d/%[1]s - # macOS: - $ %[1]s completion bash > $(brew --prefix)/etc/bash_completion.d/%[1]s - -Zsh: - - # If shell completion is not already enabled in your environment, - # you will need to enable it. You can execute the following once: - - $ echo "autoload -U compinit; compinit" >> ~/.zshrc - - # To load completions for each session, execute once: - $ %[1]s completion zsh > "${fpath[1]}/_%[1]s" - - # You will need to start a new shell for this setup to take effect. - -fish: - - $ %[1]s completion fish | source - - # To load completions for each session, execute once: - $ %[1]s completion fish > ~/.config/fish/completions/%[1]s.fish - -PowerShell: - - PS> %[1]s completion powershell | Out-String | Invoke-Expression - - # To load completions for every new session, run: - PS> %[1]s completion powershell > %[1]s.ps1 - # and source this file from your PowerShell profile. -`,cmd.Root().Name()), - DisableFlagsInUseLine: true, - ValidArgs: []string{"bash", "zsh", "fish", "powershell"}, - Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), - Run: func(cmd *cobra.Command, args []string) { - switch args[0] { - case "bash": - cmd.Root().GenBashCompletion(os.Stdout) - case "zsh": - cmd.Root().GenZshCompletion(os.Stdout) - case "fish": - cmd.Root().GenFishCompletion(os.Stdout, true) - case "powershell": - cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout) - } - }, -} -``` - -**Note:** The cobra generator may include messages printed to stdout, for example, if the config file is loaded; this will break the auto-completion script so must be removed. - -## Adapting the default completion command - -Cobra provides a few options for the default `completion` command. To configure such options you must set -the `CompletionOptions` field on the *root* command. - -To tell Cobra *not* to provide the default `completion` command: -``` -rootCmd.CompletionOptions.DisableDefaultCmd = true -``` - -To tell Cobra to mark the default `completion` command as *hidden*: -``` -rootCmd.CompletionOptions.HiddenDefaultCmd = true -``` - -To tell Cobra *not* to provide the user with the `--no-descriptions` flag to the completion sub-commands: -``` -rootCmd.CompletionOptions.DisableNoDescFlag = true -``` - -To tell Cobra to completely disable descriptions for completions: -``` -rootCmd.CompletionOptions.DisableDescriptions = true -``` - -# Customizing completions - -The generated completion scripts will automatically handle completing commands and flags. However, you can make your completions much more powerful by providing information to complete your program's nouns and flag values. - -## Completion of nouns - -### Static completion of nouns - -Cobra allows you to provide a pre-defined list of completion choices for your nouns using the `ValidArgs` field. -For example, if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. -Some simplified code from `kubectl get` looks like: - -```go -validArgs = []string{ "pod", "node", "service", "replicationcontroller" } - -cmd := &cobra.Command{ - Use: "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)", - Short: "Display one or many resources", - Long: get_long, - Example: get_example, - Run: func(cmd *cobra.Command, args []string) { - cobra.CheckErr(RunGet(f, out, cmd, args)) - }, - ValidArgs: validArgs, -} -``` - -Notice we put the `ValidArgs` field on the `get` sub-command. Doing so will give results like: - -```bash -$ kubectl get [tab][tab] -node pod replicationcontroller service -``` - -#### Aliases for nouns - -If your nouns have aliases, you can define them alongside `ValidArgs` using `ArgAliases`: - -```go -argAliases = []string { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" } - -cmd := &cobra.Command{ - ... - ValidArgs: validArgs, - ArgAliases: argAliases -} -``` - -The aliases are shown to the user on tab completion only if no completions were found within sub-commands or `ValidArgs`. - -### Dynamic completion of nouns - -In some cases it is not possible to provide a list of completions in advance. Instead, the list of completions must be determined at execution-time. In a similar fashion as for static completions, you can use the `ValidArgsFunction` field to provide a Go function that Cobra will execute when it needs the list of completion choices for the nouns of a command. Note that either `ValidArgs` or `ValidArgsFunction` can be used for a single cobra command, but not both. -Simplified code from `helm status` looks like: - -```go -cmd := &cobra.Command{ - Use: "status RELEASE_NAME", - Short: "Display the status of the named release", - Long: status_long, - RunE: func(cmd *cobra.Command, args []string) { - RunGet(args[0]) - }, - ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoFileComp - } - return getReleasesFromCluster(toComplete), cobra.ShellCompDirectiveNoFileComp - }, -} -``` -Where `getReleasesFromCluster()` is a Go function that obtains the list of current Helm releases running on the Kubernetes cluster. -Notice we put the `ValidArgsFunction` on the `status` sub-command. Let's assume the Helm releases on the cluster are: `harbor`, `notary`, `rook` and `thanos` then this dynamic completion will give results like: - -```bash -$ helm status [tab][tab] -harbor notary rook thanos -``` -You may have noticed the use of `cobra.ShellCompDirective`. These directives are bit fields allowing to control some shell completion behaviors for your particular completion. You can combine them with the bit-or operator such as `cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp` -```go -// Indicates that the shell will perform its default behavior after completions -// have been provided (this implies none of the other directives). -ShellCompDirectiveDefault - -// Indicates an error occurred and completions should be ignored. -ShellCompDirectiveError - -// Indicates that the shell should not add a space after the completion, -// even if there is a single completion provided. -ShellCompDirectiveNoSpace - -// Indicates that the shell should not provide file completion even when -// no completion is provided. -ShellCompDirectiveNoFileComp - -// Indicates that the returned completions should be used as file extension filters. -// For example, to complete only files of the form *.json or *.yaml: -// return []string{"yaml", "json"}, ShellCompDirectiveFilterFileExt -// For flags, using MarkFlagFilename() and MarkPersistentFlagFilename() -// is a shortcut to using this directive explicitly. -// -ShellCompDirectiveFilterFileExt - -// Indicates that only directory names should be provided in file completion. -// For example: -// return nil, ShellCompDirectiveFilterDirs -// For flags, using MarkFlagDirname() is a shortcut to using this directive explicitly. -// -// To request directory names within another directory, the returned completions -// should specify a single directory name within which to search. For example, -// to complete directories within "themes/": -// return []string{"themes"}, ShellCompDirectiveFilterDirs -// -ShellCompDirectiveFilterDirs - -// ShellCompDirectiveKeepOrder indicates that the shell should preserve the order -// in which the completions are provided -ShellCompDirectiveKeepOrder -``` - -***Note***: When using the `ValidArgsFunction`, Cobra will call your registered function after having parsed all flags and arguments provided in the command-line. You therefore don't need to do this parsing yourself. For example, when a user calls `helm status --namespace my-rook-ns [tab][tab]`, Cobra will call your registered `ValidArgsFunction` after having parsed the `--namespace` flag, as it would have done when calling the `RunE` function. - -#### Debugging - -Cobra achieves dynamic completion through the use of a hidden command called by the completion script. To debug your Go completion code, you can call this hidden command directly: -```bash -$ helm __complete status har -harbor -:4 -Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr -``` -***Important:*** If the noun to complete is empty (when the user has not yet typed any letters of that noun), you must pass an empty parameter to the `__complete` command: -```bash -$ helm __complete status "" -harbor -notary -rook -thanos -:4 -Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr -``` -Calling the `__complete` command directly allows you to run the Go debugger to troubleshoot your code. You can also add printouts to your code; Cobra provides the following functions to use for printouts in Go completion code: -```go -// Prints to the completion script debug file (if BASH_COMP_DEBUG_FILE -// is set to a file path) and optionally prints to stderr. -cobra.CompDebug(msg string, printToStdErr bool) { -cobra.CompDebugln(msg string, printToStdErr bool) - -// Prints to the completion script debug file (if BASH_COMP_DEBUG_FILE -// is set to a file path) and to stderr. -cobra.CompError(msg string) -cobra.CompErrorln(msg string) -``` -***Important:*** You should **not** leave traces that print directly to stdout in your completion code as they will be interpreted as completion choices by the completion script. Instead, use the cobra-provided debugging traces functions mentioned above. - -## Completions for flags - -### Mark flags as required - -Most of the time completions will only show sub-commands. But if a flag is required to make a sub-command work, you probably want it to show up when the user types [tab][tab]. You can mark a flag as 'Required' like so: - -```go -cmd.MarkFlagRequired("pod") -cmd.MarkFlagRequired("container") -``` - -and you'll get something like - -```bash -$ kubectl exec [tab][tab] --c --container= -p --pod= -``` - -### Specify dynamic flag completion - -As for nouns, Cobra provides a way of defining dynamic completion of flags. To provide a Go function that Cobra will execute when it needs the list of completion choices for a flag, you must register the function using the `command.RegisterFlagCompletionFunc()` function. - -```go -flagName := "output" -cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"json", "table", "yaml"}, cobra.ShellCompDirectiveDefault -}) -``` -Notice that calling `RegisterFlagCompletionFunc()` is done through the `command` with which the flag is associated. In our example this dynamic completion will give results like so: - -```bash -$ helm status --output [tab][tab] -json table yaml -``` - -#### Debugging - -You can also easily debug your Go completion code for flags: -```bash -$ helm __complete status --output "" -json -table -yaml -:4 -Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr -``` -***Important:*** You should **not** leave traces that print to stdout in your completion code as they will be interpreted as completion choices by the completion script. Instead, use the cobra-provided debugging traces functions mentioned further above. - -### Specify valid filename extensions for flags that take a filename - -To limit completions of flag values to file names with certain extensions you can either use the different `MarkFlagFilename()` functions or a combination of `RegisterFlagCompletionFunc()` and `ShellCompDirectiveFilterFileExt`, like so: -```go -flagName := "output" -cmd.MarkFlagFilename(flagName, "yaml", "json") -``` -or -```go -flagName := "output" -cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"yaml", "json"}, ShellCompDirectiveFilterFileExt}) -``` - -### Limit flag completions to directory names - -To limit completions of flag values to directory names you can either use the `MarkFlagDirname()` functions or a combination of `RegisterFlagCompletionFunc()` and `ShellCompDirectiveFilterDirs`, like so: -```go -flagName := "output" -cmd.MarkFlagDirname(flagName) -``` -or -```go -flagName := "output" -cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return nil, cobra.ShellCompDirectiveFilterDirs -}) -``` -To limit completions of flag values to directory names *within another directory* you can use a combination of `RegisterFlagCompletionFunc()` and `ShellCompDirectiveFilterDirs` like so: -```go -flagName := "output" -cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"themes"}, cobra.ShellCompDirectiveFilterDirs -}) -``` -### Descriptions for completions - -Cobra provides support for completion descriptions. Such descriptions are supported for each shell -(however, for bash, it is only available in the [completion V2 version](#bash-completion-v2)). -For commands and flags, Cobra will provide the descriptions automatically, based on usage information. -For example, using zsh: -``` -$ helm s[tab] -search -- search for a keyword in charts -show -- show information of a chart -status -- displays the status of the named release -``` -while using fish: -``` -$ helm s[tab] -search (search for a keyword in charts) show (show information of a chart) status (displays the status of the named release) -``` - -Cobra allows you to add descriptions to your own completions. Simply add the description text after each completion, following a `\t` separator. This technique applies to completions returned by `ValidArgs`, `ValidArgsFunction` and `RegisterFlagCompletionFunc()`. For example: -```go -ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"harbor\tAn image registry", "thanos\tLong-term metrics"}, cobra.ShellCompDirectiveNoFileComp -}} -``` -or -```go -ValidArgs: []string{"bash\tCompletions for bash", "zsh\tCompletions for zsh"} -``` - -If you don't want to show descriptions in the completions, you can add `--no-descriptions` to the default `completion` command to disable them, like: - -```bash -$ source <(helm completion bash) -$ helm completion [tab][tab] -bash (generate autocompletion script for bash) powershell (generate autocompletion script for powershell) -fish (generate autocompletion script for fish) zsh (generate autocompletion script for zsh) - -$ source <(helm completion bash --no-descriptions) -$ helm completion [tab][tab] -bash fish powershell zsh -``` -## Bash completions - -### Dependencies - -The bash completion script generated by Cobra requires the `bash_completion` package. You should update the help text of your completion command to show how to install the `bash_completion` package ([Kubectl docs](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion)) - -### Aliases - -You can also configure `bash` aliases for your program and they will also support completions. - -```bash -alias aliasname=origcommand -complete -o default -F __start_origcommand aliasname - -# and now when you run `aliasname` completion will make -# suggestions as it did for `origcommand`. - -$ aliasname -completion firstcommand secondcommand -``` -### Bash legacy dynamic completions - -For backward compatibility, Cobra still supports its bash legacy dynamic completion solution. -Please refer to [Bash Completions](bash_completions.md) for details. - -### Bash completion V2 - -Cobra provides two versions for bash completion. The original bash completion (which started it all!) can be used by calling -`GenBashCompletion()` or `GenBashCompletionFile()`. - -A new V2 bash completion version is also available. This version can be used by calling `GenBashCompletionV2()` or -`GenBashCompletionFileV2()`. The V2 version does **not** support the legacy dynamic completion -(see [Bash Completions](bash_completions.md)) but instead works only with the Go dynamic completion -solution described in this document. -Unless your program already uses the legacy dynamic completion solution, it is recommended that you use the bash -completion V2 solution which provides the following extra features: -- Supports completion descriptions (like the other shells) -- Small completion script of less than 300 lines (v1 generates scripts of thousands of lines; `kubectl` for example has a bash v1 completion script of over 13K lines) -- Streamlined user experience thanks to a completion behavior aligned with the other shells - -`Bash` completion V2 supports descriptions for completions. When calling `GenBashCompletionV2()` or `GenBashCompletionFileV2()` -you must provide these functions with a parameter indicating if the completions should be annotated with a description; Cobra -will provide the description automatically based on usage information. You can choose to make this option configurable by -your users. - -``` -# With descriptions -$ helm s[tab][tab] -search (search for a keyword in charts) status (display the status of the named release) -show (show information of a chart) - -# Without descriptions -$ helm s[tab][tab] -search show status -``` -**Note**: Cobra's default `completion` command uses bash completion V2. If for some reason you need to use bash completion V1, you will need to implement your own `completion` command. -## Zsh completions - -Cobra supports native zsh completion generated from the root `cobra.Command`. -The generated completion script should be put somewhere in your `$fpath` and be named -`_`. You will need to start a new shell for the completions to become available. - -Zsh supports descriptions for completions. Cobra will provide the description automatically, -based on usage information. Cobra provides a way to completely disable such descriptions by -using `GenZshCompletionNoDesc()` or `GenZshCompletionFileNoDesc()`. You can choose to make -this a configurable option to your users. -``` -# With descriptions -$ helm s[tab] -search -- search for a keyword in charts -show -- show information of a chart -status -- displays the status of the named release - -# Without descriptions -$ helm s[tab] -search show status -``` -*Note*: Because of backward-compatibility requirements, we were forced to have a different API to disable completion descriptions between `zsh` and `fish`. - -### Limitations - -* Custom completions implemented in Bash scripting (legacy) are not supported and will be ignored for `zsh` (including the use of the `BashCompCustom` flag annotation). - * You should instead use `ValidArgsFunction` and `RegisterFlagCompletionFunc()` which are portable to the different shells (`bash`, `zsh`, `fish`, `powershell`). -* The function `MarkFlagCustom()` is not supported and will be ignored for `zsh`. - * You should instead use `RegisterFlagCompletionFunc()`. - -### Zsh completions standardization - -Cobra 1.1 standardized its zsh completion support to align it with its other shell completions. Although the API was kept backward-compatible, some small changes in behavior were introduced. -Please refer to [Zsh Completions](zsh_completions.md) for details. - -## fish completions - -Cobra supports native fish completions generated from the root `cobra.Command`. You can use the `command.GenFishCompletion()` or `command.GenFishCompletionFile()` functions. You must provide these functions with a parameter indicating if the completions should be annotated with a description; Cobra will provide the description automatically based on usage information. You can choose to make this option configurable by your users. -``` -# With descriptions -$ helm s[tab] -search (search for a keyword in charts) show (show information of a chart) status (displays the status of the named release) - -# Without descriptions -$ helm s[tab] -search show status -``` -*Note*: Because of backward-compatibility requirements, we were forced to have a different API to disable completion descriptions between `zsh` and `fish`. - -### Limitations - -* Custom completions implemented in bash scripting (legacy) are not supported and will be ignored for `fish` (including the use of the `BashCompCustom` flag annotation). - * You should instead use `ValidArgsFunction` and `RegisterFlagCompletionFunc()` which are portable to the different shells (`bash`, `zsh`, `fish`, `powershell`). -* The function `MarkFlagCustom()` is not supported and will be ignored for `fish`. - * You should instead use `RegisterFlagCompletionFunc()`. -* The following flag completion annotations are not supported and will be ignored for `fish`: - * `BashCompFilenameExt` (filtering by file extension) - * `BashCompSubdirsInDir` (filtering by directory) -* The functions corresponding to the above annotations are consequently not supported and will be ignored for `fish`: - * `MarkFlagFilename()` and `MarkPersistentFlagFilename()` (filtering by file extension) - * `MarkFlagDirname()` and `MarkPersistentFlagDirname()` (filtering by directory) -* Similarly, the following completion directives are not supported and will be ignored for `fish`: - * `ShellCompDirectiveFilterFileExt` (filtering by file extension) - * `ShellCompDirectiveFilterDirs` (filtering by directory) - -## PowerShell completions - -Cobra supports native PowerShell completions generated from the root `cobra.Command`. You can use the `command.GenPowerShellCompletion()` or `command.GenPowerShellCompletionFile()` functions. To include descriptions use `command.GenPowerShellCompletionWithDesc()` and `command.GenPowerShellCompletionFileWithDesc()`. Cobra will provide the description automatically based on usage information. You can choose to make this option configurable by your users. - -The script is designed to support all three PowerShell completion modes: - -* TabCompleteNext (default windows style - on each key press the next option is displayed) -* Complete (works like bash) -* MenuComplete (works like zsh) - -You set the mode with `Set-PSReadLineKeyHandler -Key Tab -Function `. Descriptions are only displayed when using the `Complete` or `MenuComplete` mode. - -Users need PowerShell version 5.0 or above, which comes with Windows 10 and can be downloaded separately for Windows 7 or 8.1. They can then write the completions to a file and source this file from their PowerShell profile, which is referenced by the `$Profile` environment variable. See `Get-Help about_Profiles` for more info about PowerShell profiles. - -``` -# With descriptions and Mode 'Complete' -$ helm s[tab] -search (search for a keyword in charts) show (show information of a chart) status (displays the status of the named release) - -# With descriptions and Mode 'MenuComplete' The description of the current selected value will be displayed below the suggestions. -$ helm s[tab] -search show status - -search for a keyword in charts - -# Without descriptions -$ helm s[tab] -search show status -``` -### Aliases - -You can also configure `powershell` aliases for your program and they will also support completions. - -``` -$ sal aliasname origcommand -$ Register-ArgumentCompleter -CommandName 'aliasname' -ScriptBlock $__origcommandCompleterBlock - -# and now when you run `aliasname` completion will make -# suggestions as it did for `origcommand`. - -$ aliasname -completion firstcommand secondcommand -``` -The name of the completer block variable is of the form `$__CompleterBlock` where every `-` and `:` in the program name have been replaced with `_`, to respect powershell naming syntax. - -### Limitations - -* Custom completions implemented in bash scripting (legacy) are not supported and will be ignored for `powershell` (including the use of the `BashCompCustom` flag annotation). - * You should instead use `ValidArgsFunction` and `RegisterFlagCompletionFunc()` which are portable to the different shells (`bash`, `zsh`, `fish`, `powershell`). -* The function `MarkFlagCustom()` is not supported and will be ignored for `powershell`. - * You should instead use `RegisterFlagCompletionFunc()`. -* The following flag completion annotations are not supported and will be ignored for `powershell`: - * `BashCompFilenameExt` (filtering by file extension) - * `BashCompSubdirsInDir` (filtering by directory) -* The functions corresponding to the above annotations are consequently not supported and will be ignored for `powershell`: - * `MarkFlagFilename()` and `MarkPersistentFlagFilename()` (filtering by file extension) - * `MarkFlagDirname()` and `MarkPersistentFlagDirname()` (filtering by directory) -* Similarly, the following completion directives are not supported and will be ignored for `powershell`: - * `ShellCompDirectiveFilterFileExt` (filtering by file extension) - * `ShellCompDirectiveFilterDirs` (filtering by directory) diff --git a/vendor/github.com/spf13/cobra/user_guide.md b/vendor/github.com/spf13/cobra/user_guide.md deleted file mode 100644 index 85201d840..000000000 --- a/vendor/github.com/spf13/cobra/user_guide.md +++ /dev/null @@ -1,726 +0,0 @@ -# User Guide - -While you are welcome to provide your own organization, typically a Cobra-based -application will follow the following organizational structure: - -``` - ▾ appName/ - ▾ cmd/ - add.go - your.go - commands.go - here.go - main.go -``` - -In a Cobra app, typically the main.go file is very bare. It serves one purpose: initializing Cobra. - -```go -package main - -import ( - "{pathToYourApp}/cmd" -) - -func main() { - cmd.Execute() -} -``` - -## Using the Cobra Generator - -Cobra-CLI is its own program that will create your application and add any -commands you want. It's the easiest way to incorporate Cobra into your application. - -For complete details on using the Cobra generator, please refer to [The Cobra-CLI Generator README](https://github.com/spf13/cobra-cli/blob/main/README.md) - -## Using the Cobra Library - -To manually implement Cobra you need to create a bare main.go file and a rootCmd file. -You will optionally provide additional commands as you see fit. - -### Create rootCmd - -Cobra doesn't require any special constructors. Simply create your commands. - -Ideally you place this in app/cmd/root.go: - -```go -var rootCmd = &cobra.Command{ - Use: "hugo", - Short: "Hugo is a very fast static site generator", - Long: `A Fast and Flexible Static Site Generator built with - love by spf13 and friends in Go. - Complete documentation is available at https://gohugo.io/documentation/`, - Run: func(cmd *cobra.Command, args []string) { - // Do Stuff Here - }, -} - -func Execute() { - if err := rootCmd.Execute(); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } -} -``` - -You will additionally define flags and handle configuration in your init() function. - -For example cmd/root.go: - -```go -package cmd - -import ( - "fmt" - "os" - - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -var ( - // Used for flags. - cfgFile string - userLicense string - - rootCmd = &cobra.Command{ - Use: "cobra-cli", - Short: "A generator for Cobra based Applications", - Long: `Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - } -) - -// Execute executes the root command. -func Execute() error { - return rootCmd.Execute() -} - -func init() { - cobra.OnInitialize(initConfig) - - rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") - rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "author name for copyright attribution") - rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "name of license for the project") - rootCmd.PersistentFlags().Bool("viper", true, "use Viper for configuration") - viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")) - viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper")) - viper.SetDefault("author", "NAME HERE ") - viper.SetDefault("license", "apache") - - rootCmd.AddCommand(addCmd) - rootCmd.AddCommand(initCmd) -} - -func initConfig() { - if cfgFile != "" { - // Use config file from the flag. - viper.SetConfigFile(cfgFile) - } else { - // Find home directory. - home, err := os.UserHomeDir() - cobra.CheckErr(err) - - // Search config in home directory with name ".cobra" (without extension). - viper.AddConfigPath(home) - viper.SetConfigType("yaml") - viper.SetConfigName(".cobra") - } - - viper.AutomaticEnv() - - if err := viper.ReadInConfig(); err == nil { - fmt.Println("Using config file:", viper.ConfigFileUsed()) - } -} -``` - -### Create your main.go - -With the root command you need to have your main function execute it. -Execute should be run on the root for clarity, though it can be called on any command. - -In a Cobra app, typically the main.go file is very bare. It serves one purpose: to initialize Cobra. - -```go -package main - -import ( - "{pathToYourApp}/cmd" -) - -func main() { - cmd.Execute() -} -``` - -### Create additional commands - -Additional commands can be defined and typically are each given their own file -inside of the cmd/ directory. - -If you wanted to create a version command you would create cmd/version.go and -populate it with the following: - -```go -package cmd - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -func init() { - rootCmd.AddCommand(versionCmd) -} - -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Print the version number of Hugo", - Long: `All software has versions. This is Hugo's`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Hugo Static Site Generator v0.9 -- HEAD") - }, -} -``` - -### Organizing subcommands - -A command may have subcommands which in turn may have other subcommands. This is achieved by using -`AddCommand`. In some cases, especially in larger applications, each subcommand may be defined in -its own go package. - -The suggested approach is for the parent command to use `AddCommand` to add its most immediate -subcommands. For example, consider the following directory structure: - -```text -├── cmd -│   ├── root.go -│   └── sub1 -│   ├── sub1.go -│   └── sub2 -│   ├── leafA.go -│   ├── leafB.go -│   └── sub2.go -└── main.go -``` - -In this case: - -* The `init` function of `root.go` adds the command defined in `sub1.go` to the root command. -* The `init` function of `sub1.go` adds the command defined in `sub2.go` to the sub1 command. -* The `init` function of `sub2.go` adds the commands defined in `leafA.go` and `leafB.go` to the - sub2 command. - -This approach ensures the subcommands are always included at compile time while avoiding cyclic -references. - -### Returning and handling errors - -If you wish to return an error to the caller of a command, `RunE` can be used. - -```go -package cmd - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -func init() { - rootCmd.AddCommand(tryCmd) -} - -var tryCmd = &cobra.Command{ - Use: "try", - Short: "Try and possibly fail at something", - RunE: func(cmd *cobra.Command, args []string) error { - if err := someFunc(); err != nil { - return err - } - return nil - }, -} -``` - -The error can then be caught at the execute function call. - -## Working with Flags - -Flags provide modifiers to control how the action command operates. - -### Assign flags to a command - -Since the flags are defined and used in different locations, we need to -define a variable outside with the correct scope to assign the flag to -work with. - -```go -var Verbose bool -var Source string -``` - -There are two different approaches to assign a flag. - -### Persistent Flags - -A flag can be 'persistent', meaning that this flag will be available to the -command it's assigned to as well as every command under that command. For -global flags, assign a flag as a persistent flag on the root. - -```go -rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output") -``` - -### Local Flags - -A flag can also be assigned locally, which will only apply to that specific command. - -```go -localCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from") -``` - -### Local Flag on Parent Commands - -By default, Cobra only parses local flags on the target command, and any local flags on -parent commands are ignored. By enabling `Command.TraverseChildren`, Cobra will -parse local flags on each command before executing the target command. - -```go -command := cobra.Command{ - Use: "print [OPTIONS] [COMMANDS]", - TraverseChildren: true, -} -``` - -### Bind Flags with Config - -You can also bind your flags with [viper](https://github.com/spf13/viper): -```go -var author string - -func init() { - rootCmd.PersistentFlags().StringVar(&author, "author", "YOUR NAME", "Author name for copyright attribution") - viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")) -} -``` - -In this example, the persistent flag `author` is bound with `viper`. -**Note**: the variable `author` will not be set to the value from config, -when the `--author` flag is provided by user. - -More in [viper documentation](https://github.com/spf13/viper#working-with-flags). - -### Required flags - -Flags are optional by default. If instead you wish your command to report an error -when a flag has not been set, mark it as required: -```go -rootCmd.Flags().StringVarP(&Region, "region", "r", "", "AWS region (required)") -rootCmd.MarkFlagRequired("region") -``` - -Or, for persistent flags: -```go -rootCmd.PersistentFlags().StringVarP(&Region, "region", "r", "", "AWS region (required)") -rootCmd.MarkPersistentFlagRequired("region") -``` - -### Flag Groups - -If you have different flags that must be provided together (e.g. if they provide the `--username` flag they MUST provide the `--password` flag as well) then -Cobra can enforce that requirement: -```go -rootCmd.Flags().StringVarP(&u, "username", "u", "", "Username (required if password is set)") -rootCmd.Flags().StringVarP(&pw, "password", "p", "", "Password (required if username is set)") -rootCmd.MarkFlagsRequiredTogether("username", "password") -``` - -You can also prevent different flags from being provided together if they represent mutually -exclusive options such as specifying an output format as either `--json` or `--yaml` but never both: -```go -rootCmd.Flags().BoolVar(&ofJson, "json", false, "Output in JSON") -rootCmd.Flags().BoolVar(&ofYaml, "yaml", false, "Output in YAML") -rootCmd.MarkFlagsMutuallyExclusive("json", "yaml") -``` - -In both of these cases: - - both local and persistent flags can be used - - **NOTE:** the group is only enforced on commands where every flag is defined - - a flag may appear in multiple groups - - a group may contain any number of flags - -## Positional and Custom Arguments - -Validation of positional arguments can be specified using the `Args` field of `Command`. -The following validators are built in: - -- Number of arguments: - - `NoArgs` - report an error if there are any positional args. - - `ArbitraryArgs` - accept any number of args. - - `MinimumNArgs(int)` - report an error if less than N positional args are provided. - - `MaximumNArgs(int)` - report an error if more than N positional args are provided. - - `ExactArgs(int)` - report an error if there are not exactly N positional args. - - `RangeArgs(min, max)` - report an error if the number of args is not between `min` and `max`. -- Content of the arguments: - - `OnlyValidArgs` - report an error if there are any positional args not specified in the `ValidArgs` field of `Command`, which can optionally be set to a list of valid values for positional args. - -If `Args` is undefined or `nil`, it defaults to `ArbitraryArgs`. - -Moreover, `MatchAll(pargs ...PositionalArgs)` enables combining existing checks with arbitrary other checks. -For instance, if you want to report an error if there are not exactly N positional args OR if there are any positional -args that are not in the `ValidArgs` field of `Command`, you can call `MatchAll` on `ExactArgs` and `OnlyValidArgs`, as -shown below: - -```go -var cmd = &cobra.Command{ - Short: "hello", - Args: cobra.MatchAll(cobra.ExactArgs(2), cobra.OnlyValidArgs), - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Hello, World!") - }, -} -``` - -It is possible to set any custom validator that satisfies `func(cmd *cobra.Command, args []string) error`. -For example: - -```go -var cmd = &cobra.Command{ - Short: "hello", - Args: func(cmd *cobra.Command, args []string) error { - // Optionally run one of the validators provided by cobra - if err := cobra.MinimumNArgs(1)(cmd, args); err != nil { - return err - } - // Run the custom validation logic - if myapp.IsValidColor(args[0]) { - return nil - } - return fmt.Errorf("invalid color specified: %s", args[0]) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Hello, World!") - }, -} -``` - -## Example - -In the example below, we have defined three commands. Two are at the top level -and one (cmdTimes) is a child of one of the top commands. In this case the root -is not executable, meaning that a subcommand is required. This is accomplished -by not providing a 'Run' for the 'rootCmd'. - -We have only defined one flag for a single command. - -More documentation about flags is available at https://github.com/spf13/pflag - -```go -package main - -import ( - "fmt" - "strings" - - "github.com/spf13/cobra" -) - -func main() { - var echoTimes int - - var cmdPrint = &cobra.Command{ - Use: "print [string to print]", - Short: "Print anything to the screen", - Long: `print is for printing anything back to the screen. -For many years people have printed back to the screen.`, - Args: cobra.MinimumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Print: " + strings.Join(args, " ")) - }, - } - - var cmdEcho = &cobra.Command{ - Use: "echo [string to echo]", - Short: "Echo anything to the screen", - Long: `echo is for echoing anything back. -Echo works a lot like print, except it has a child command.`, - Args: cobra.MinimumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Echo: " + strings.Join(args, " ")) - }, - } - - var cmdTimes = &cobra.Command{ - Use: "times [string to echo]", - Short: "Echo anything to the screen more times", - Long: `echo things multiple times back to the user by providing -a count and a string.`, - Args: cobra.MinimumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { - for i := 0; i < echoTimes; i++ { - fmt.Println("Echo: " + strings.Join(args, " ")) - } - }, - } - - cmdTimes.Flags().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input") - - var rootCmd = &cobra.Command{Use: "app"} - rootCmd.AddCommand(cmdPrint, cmdEcho) - cmdEcho.AddCommand(cmdTimes) - rootCmd.Execute() -} -``` - -For a more complete example of a larger application, please checkout [Hugo](https://gohugo.io/). - -## Help Command - -Cobra automatically adds a help command to your application when you have subcommands. -This will be called when a user runs 'app help'. Additionally, help will also -support all other commands as input. Say, for instance, you have a command called -'create' without any additional configuration; Cobra will work when 'app help -create' is called. Every command will automatically have the '--help' flag added. - -### Example - -The following output is automatically generated by Cobra. Nothing beyond the -command and flag definitions are needed. - - $ cobra-cli help - - Cobra is a CLI library for Go that empowers applications. - This application is a tool to generate the needed files - to quickly create a Cobra application. - - Usage: - cobra-cli [command] - - Available Commands: - add Add a command to a Cobra Application - completion Generate the autocompletion script for the specified shell - help Help about any command - init Initialize a Cobra Application - - Flags: - -a, --author string author name for copyright attribution (default "YOUR NAME") - --config string config file (default is $HOME/.cobra.yaml) - -h, --help help for cobra-cli - -l, --license string name of license for the project - --viper use Viper for configuration - - Use "cobra-cli [command] --help" for more information about a command. - - -Help is just a command like any other. There is no special logic or behavior -around it. In fact, you can provide your own if you want. - -### Grouping commands in help - -Cobra supports grouping of available commands in the help output. To group commands, each group must be explicitly -defined using `AddGroup()` on the parent command. Then a subcommand can be added to a group using the `GroupID` element -of that subcommand. The groups will appear in the help output in the same order as they are defined using different -calls to `AddGroup()`. If you use the generated `help` or `completion` commands, you can set their group ids using -`SetHelpCommandGroupId()` and `SetCompletionCommandGroupId()` on the root command, respectively. - -### Defining your own help - -You can provide your own Help command or your own template for the default command to use -with the following functions: - -```go -cmd.SetHelpCommand(cmd *Command) -cmd.SetHelpFunc(f func(*Command, []string)) -cmd.SetHelpTemplate(s string) -``` - -The latter two will also apply to any children commands. - -## Usage Message - -When the user provides an invalid flag or invalid command, Cobra responds by -showing the user the 'usage'. - -### Example -You may recognize this from the help above. That's because the default help -embeds the usage as part of its output. - - $ cobra-cli --invalid - Error: unknown flag: --invalid - Usage: - cobra-cli [command] - - Available Commands: - add Add a command to a Cobra Application - completion Generate the autocompletion script for the specified shell - help Help about any command - init Initialize a Cobra Application - - Flags: - -a, --author string author name for copyright attribution (default "YOUR NAME") - --config string config file (default is $HOME/.cobra.yaml) - -h, --help help for cobra-cli - -l, --license string name of license for the project - --viper use Viper for configuration - - Use "cobra [command] --help" for more information about a command. - -### Defining your own usage -You can provide your own usage function or template for Cobra to use. -Like help, the function and template are overridable through public methods: - -```go -cmd.SetUsageFunc(f func(*Command) error) -cmd.SetUsageTemplate(s string) -``` - -## Version Flag - -Cobra adds a top-level '--version' flag if the Version field is set on the root command. -Running an application with the '--version' flag will print the version to stdout using -the version template. The template can be customized using the -`cmd.SetVersionTemplate(s string)` function. - -## PreRun and PostRun Hooks - -It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherited by children if they do not declare their own. These functions are run in the following order: - -- `PersistentPreRun` -- `PreRun` -- `Run` -- `PostRun` -- `PersistentPostRun` - -An example of two commands which use all of these features is below. When the subcommand is executed, it will run the root command's `PersistentPreRun` but not the root command's `PersistentPostRun`: - -```go -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -func main() { - - var rootCmd = &cobra.Command{ - Use: "root [sub]", - Short: "My root command", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PersistentPreRun with args: %v\n", args) - }, - PreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PreRun with args: %v\n", args) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd Run with args: %v\n", args) - }, - PostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PostRun with args: %v\n", args) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PersistentPostRun with args: %v\n", args) - }, - } - - var subCmd = &cobra.Command{ - Use: "sub [no options!]", - Short: "My subcommand", - PreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PreRun with args: %v\n", args) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd Run with args: %v\n", args) - }, - PostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PostRun with args: %v\n", args) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PersistentPostRun with args: %v\n", args) - }, - } - - rootCmd.AddCommand(subCmd) - - rootCmd.SetArgs([]string{""}) - rootCmd.Execute() - fmt.Println() - rootCmd.SetArgs([]string{"sub", "arg1", "arg2"}) - rootCmd.Execute() -} -``` - -Output: -``` -Inside rootCmd PersistentPreRun with args: [] -Inside rootCmd PreRun with args: [] -Inside rootCmd Run with args: [] -Inside rootCmd PostRun with args: [] -Inside rootCmd PersistentPostRun with args: [] - -Inside rootCmd PersistentPreRun with args: [arg1 arg2] -Inside subCmd PreRun with args: [arg1 arg2] -Inside subCmd Run with args: [arg1 arg2] -Inside subCmd PostRun with args: [arg1 arg2] -Inside subCmd PersistentPostRun with args: [arg1 arg2] -``` - -## Suggestions when "unknown command" happens - -Cobra will print automatic suggestions when "unknown command" errors happen. This allows Cobra to behave similarly to the `git` command when a typo happens. For example: - -``` -$ hugo srever -Error: unknown command "srever" for "hugo" - -Did you mean this? - server - -Run 'hugo --help' for usage. -``` - -Suggestions are automatically generated based on existing subcommands and use an implementation of [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance). Every registered command that matches a minimum distance of 2 (ignoring case) will be displayed as a suggestion. - -If you need to disable suggestions or tweak the string distance in your command, use: - -```go -command.DisableSuggestions = true -``` - -or - -```go -command.SuggestionsMinimumDistance = 1 -``` - -You can also explicitly set names for which a given command will be suggested using the `SuggestFor` attribute. This allows suggestions for strings that are not close in terms of string distance, but make sense in your set of commands but for which -you don't want aliases. Example: - -``` -$ kubectl remove -Error: unknown command "remove" for "kubectl" - -Did you mean this? - delete - -Run 'kubectl help' for usage. -``` - -## Generating documentation for your command - -Cobra can generate documentation based on subcommands, flags, etc. Read more about it in the [docs generation documentation](doc/README.md). - -## Generating shell completions - -Cobra can generate a shell-completion file for the following shells: bash, zsh, fish, PowerShell. If you add more information to your commands, these completions can be amazingly powerful and flexible. Read more about it in [Shell Completions](shell_completions.md). - -## Providing Active Help - -Cobra makes use of the shell-completion system to define a framework allowing you to provide Active Help to your users. Active Help are messages (hints, warnings, etc) printed as the program is being used. Read more about it in [Active Help](active_help.md). diff --git a/vendor/github.com/spf13/cobra/zsh_completions.md b/vendor/github.com/spf13/cobra/zsh_completions.md deleted file mode 100644 index 7cff61787..000000000 --- a/vendor/github.com/spf13/cobra/zsh_completions.md +++ /dev/null @@ -1,48 +0,0 @@ -## Generating Zsh Completion For Your cobra.Command - -Please refer to [Shell Completions](shell_completions.md) for details. - -## Zsh completions standardization - -Cobra 1.1 standardized its zsh completion support to align it with its other shell completions. Although the API was kept backwards-compatible, some small changes in behavior were introduced. - -### Deprecation summary - -See further below for more details on these deprecations. - -* `cmd.MarkZshCompPositionalArgumentFile(pos, []string{})` is no longer needed. It is therefore **deprecated** and silently ignored. -* `cmd.MarkZshCompPositionalArgumentFile(pos, glob[])` is **deprecated** and silently ignored. - * Instead use `ValidArgsFunction` with `ShellCompDirectiveFilterFileExt`. -* `cmd.MarkZshCompPositionalArgumentWords()` is **deprecated** and silently ignored. - * Instead use `ValidArgsFunction`. - -### Behavioral changes - -**Noun completion** -|Old behavior|New behavior| -|---|---| -|No file completion by default (opposite of bash)|File completion by default; use `ValidArgsFunction` with `ShellCompDirectiveNoFileComp` to turn off file completion on a per-argument basis| -|Completion of flag names without the `-` prefix having been typed|Flag names are only completed if the user has typed the first `-`| -`cmd.MarkZshCompPositionalArgumentFile(pos, []string{})` used to turn on file completion on a per-argument position basis|File completion for all arguments by default; `cmd.MarkZshCompPositionalArgumentFile()` is **deprecated** and silently ignored| -|`cmd.MarkZshCompPositionalArgumentFile(pos, glob[])` used to turn on file completion **with glob filtering** on a per-argument position basis (zsh-specific)|`cmd.MarkZshCompPositionalArgumentFile()` is **deprecated** and silently ignored; use `ValidArgsFunction` with `ShellCompDirectiveFilterFileExt` for file **extension** filtering (not full glob filtering)| -|`cmd.MarkZshCompPositionalArgumentWords(pos, words[])` used to provide completion choices on a per-argument position basis (zsh-specific)|`cmd.MarkZshCompPositionalArgumentWords()` is **deprecated** and silently ignored; use `ValidArgsFunction` to achieve the same behavior| - -**Flag-value completion** - -|Old behavior|New behavior| -|---|---| -|No file completion by default (opposite of bash)|File completion by default; use `RegisterFlagCompletionFunc()` with `ShellCompDirectiveNoFileComp` to turn off file completion| -|`cmd.MarkFlagFilename(flag, []string{})` and similar used to turn on file completion|File completion by default; `cmd.MarkFlagFilename(flag, []string{})` no longer needed in this context and silently ignored| -|`cmd.MarkFlagFilename(flag, glob[])` used to turn on file completion **with glob filtering** (syntax of `[]string{"*.yaml", "*.yml"}` incompatible with bash)|Will continue to work, however, support for bash syntax is added and should be used instead so as to work for all shells (`[]string{"yaml", "yml"}`)| -|`cmd.MarkFlagDirname(flag)` only completes directories (zsh-specific)|Has been added for all shells| -|Completion of a flag name does not repeat, unless flag is of type `*Array` or `*Slice` (not supported by bash)|Retained for `zsh` and added to `fish`| -|Completion of a flag name does not provide the `=` form (unlike bash)|Retained for `zsh` and added to `fish`| - -**Improvements** - -* Custom completion support (`ValidArgsFunction` and `RegisterFlagCompletionFunc()`) -* File completion by default if no other completions found -* Handling of required flags -* File extension filtering no longer mutually exclusive with bash usage -* Completion of directory names *within* another directory -* Support for `=` form of flags diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go new file mode 100644 index 000000000..67f8d7339 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go @@ -0,0 +1,229 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + +import ( + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/propagation" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + "go.opentelemetry.io/otel/trace" +) + +const ( + // ScopeName is the instrumentation scope name. + ScopeName = "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + // GRPCStatusCodeKey is convention for numeric status code of a gRPC request. + GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +// Filter is a predicate used to determine whether a given request in +// interceptor info should be traced. A Filter must return true if +// the request should be traced. +type Filter func(*InterceptorInfo) bool + +// config is a group of options for this instrumentation. +type config struct { + Filter Filter + Propagators propagation.TextMapPropagator + TracerProvider trace.TracerProvider + MeterProvider metric.MeterProvider + SpanStartOptions []trace.SpanStartOption + + ReceivedEvent bool + SentEvent bool + + tracer trace.Tracer + meter metric.Meter + + rpcDuration metric.Float64Histogram + rpcRequestSize metric.Int64Histogram + rpcResponseSize metric.Int64Histogram + rpcRequestsPerRPC metric.Int64Histogram + rpcResponsesPerRPC metric.Int64Histogram +} + +// Option applies an option value for a config. +type Option interface { + apply(*config) +} + +// newConfig returns a config configured with all the passed Options. +func newConfig(opts []Option, role string) *config { + c := &config{ + Propagators: otel.GetTextMapPropagator(), + TracerProvider: otel.GetTracerProvider(), + MeterProvider: otel.GetMeterProvider(), + } + for _, o := range opts { + o.apply(c) + } + + c.tracer = c.TracerProvider.Tracer( + ScopeName, + trace.WithInstrumentationVersion(SemVersion()), + ) + + c.meter = c.MeterProvider.Meter( + ScopeName, + metric.WithInstrumentationVersion(Version()), + metric.WithSchemaURL(semconv.SchemaURL), + ) + + var err error + c.rpcDuration, err = c.meter.Float64Histogram("rpc."+role+".duration", + metric.WithDescription("Measures the duration of inbound RPC."), + metric.WithUnit("ms")) + if err != nil { + otel.Handle(err) + } + + c.rpcRequestSize, err = c.meter.Int64Histogram("rpc."+role+".request.size", + metric.WithDescription("Measures size of RPC request messages (uncompressed)."), + metric.WithUnit("By")) + if err != nil { + otel.Handle(err) + } + + c.rpcResponseSize, err = c.meter.Int64Histogram("rpc."+role+".response.size", + metric.WithDescription("Measures size of RPC response messages (uncompressed)."), + metric.WithUnit("By")) + if err != nil { + otel.Handle(err) + } + + c.rpcRequestsPerRPC, err = c.meter.Int64Histogram("rpc."+role+".requests_per_rpc", + metric.WithDescription("Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs."), + metric.WithUnit("{count}")) + if err != nil { + otel.Handle(err) + } + + c.rpcResponsesPerRPC, err = c.meter.Int64Histogram("rpc."+role+".responses_per_rpc", + metric.WithDescription("Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs."), + metric.WithUnit("{count}")) + if err != nil { + otel.Handle(err) + } + + return c +} + +type propagatorsOption struct{ p propagation.TextMapPropagator } + +func (o propagatorsOption) apply(c *config) { + if o.p != nil { + c.Propagators = o.p + } +} + +// WithPropagators returns an Option to use the Propagators when extracting +// and injecting trace context from requests. +func WithPropagators(p propagation.TextMapPropagator) Option { + return propagatorsOption{p: p} +} + +type tracerProviderOption struct{ tp trace.TracerProvider } + +func (o tracerProviderOption) apply(c *config) { + if o.tp != nil { + c.TracerProvider = o.tp + } +} + +// WithInterceptorFilter returns an Option to use the request filter. +// +// Deprecated: Use stats handlers instead. +func WithInterceptorFilter(f Filter) Option { + return interceptorFilterOption{f: f} +} + +type interceptorFilterOption struct { + f Filter +} + +func (o interceptorFilterOption) apply(c *config) { + if o.f != nil { + c.Filter = o.f + } +} + +// WithTracerProvider returns an Option to use the TracerProvider when +// creating a Tracer. +func WithTracerProvider(tp trace.TracerProvider) Option { + return tracerProviderOption{tp: tp} +} + +type meterProviderOption struct{ mp metric.MeterProvider } + +func (o meterProviderOption) apply(c *config) { + if o.mp != nil { + c.MeterProvider = o.mp + } +} + +// WithMeterProvider returns an Option to use the MeterProvider when +// creating a Meter. If this option is not provide the global MeterProvider will be used. +func WithMeterProvider(mp metric.MeterProvider) Option { + return meterProviderOption{mp: mp} +} + +// Event type that can be recorded, see WithMessageEvents. +type Event int + +// Different types of events that can be recorded, see WithMessageEvents. +const ( + ReceivedEvents Event = iota + SentEvents +) + +type messageEventsProviderOption struct { + events []Event +} + +func (m messageEventsProviderOption) apply(c *config) { + for _, e := range m.events { + switch e { + case ReceivedEvents: + c.ReceivedEvent = true + case SentEvents: + c.SentEvent = true + } + } +} + +// WithMessageEvents configures the Handler to record the specified events +// (span.AddEvent) on spans. By default only summary attributes are added at the +// end of the request. +// +// Valid events are: +// - ReceivedEvents: Record the number of bytes read after every gRPC read operation. +// - SentEvents: Record the number of bytes written after every gRPC write operation. +func WithMessageEvents(events ...Event) Option { + return messageEventsProviderOption{events: events} +} + +type spanStartOption struct{ opts []trace.SpanStartOption } + +func (o spanStartOption) apply(c *config) { + c.SpanStartOptions = append(c.SpanStartOptions, o.opts...) +} + +// WithSpanOptions configures an additional set of +// trace.SpanOptions, which are applied to each new span. +func WithSpanOptions(opts ...trace.SpanStartOption) Option { + return spanStartOption{opts} +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/doc.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/doc.go new file mode 100644 index 000000000..958dcd87a --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/doc.go @@ -0,0 +1,22 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package otelgrpc is the instrumentation library for [google.golang.org/grpc]. + +Use [NewClientHandler] with [grpc.WithStatsHandler] to instrument a gRPC client. + +Use [NewServerHandler] with [grpc.StatsHandler] to instrument a gRPC server. +*/ +package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go deleted file mode 100644 index f512cf6e3..000000000 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - -import ( - "context" - - "google.golang.org/grpc/metadata" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/baggage" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/trace" -) - -const ( - // instrumentationName is the name of this instrumentation package. - instrumentationName = "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - // GRPCStatusCodeKey is convention for numeric status code of a gRPC request. - GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") -) - -// Filter is a predicate used to determine whether a given request in -// interceptor info should be traced. A Filter must return true if -// the request should be traced. -type Filter func(*InterceptorInfo) bool - -// config is a group of options for this instrumentation. -type config struct { - Filter Filter - Propagators propagation.TextMapPropagator - TracerProvider trace.TracerProvider -} - -// Option applies an option value for a config. -type Option interface { - apply(*config) -} - -// newConfig returns a config configured with all the passed Options. -func newConfig(opts []Option) *config { - c := &config{ - Propagators: otel.GetTextMapPropagator(), - TracerProvider: otel.GetTracerProvider(), - } - for _, o := range opts { - o.apply(c) - } - return c -} - -type propagatorsOption struct{ p propagation.TextMapPropagator } - -func (o propagatorsOption) apply(c *config) { - if o.p != nil { - c.Propagators = o.p - } -} - -// WithPropagators returns an Option to use the Propagators when extracting -// and injecting trace context from requests. -func WithPropagators(p propagation.TextMapPropagator) Option { - return propagatorsOption{p: p} -} - -type tracerProviderOption struct{ tp trace.TracerProvider } - -func (o tracerProviderOption) apply(c *config) { - if o.tp != nil { - c.TracerProvider = o.tp - } -} - -// WithInterceptorFilter returns an Option to use the request filter. -func WithInterceptorFilter(f Filter) Option { - return interceptorFilterOption{f: f} -} - -type interceptorFilterOption struct { - f Filter -} - -func (o interceptorFilterOption) apply(c *config) { - if o.f != nil { - c.Filter = o.f - } -} - -// WithTracerProvider returns an Option to use the TracerProvider when -// creating a Tracer. -func WithTracerProvider(tp trace.TracerProvider) Option { - return tracerProviderOption{tp: tp} -} - -type metadataSupplier struct { - metadata *metadata.MD -} - -// assert that metadataSupplier implements the TextMapCarrier interface. -var _ propagation.TextMapCarrier = &metadataSupplier{} - -func (s *metadataSupplier) Get(key string) string { - values := s.metadata.Get(key) - if len(values) == 0 { - return "" - } - return values[0] -} - -func (s *metadataSupplier) Set(key string, value string) { - s.metadata.Set(key, value) -} - -func (s *metadataSupplier) Keys() []string { - out := make([]string, 0, len(*s.metadata)) - for key := range *s.metadata { - out = append(out, key) - } - return out -} - -// Inject injects correlation context and span context into the gRPC -// metadata object. This function is meant to be used on outgoing -// requests. -func Inject(ctx context.Context, md *metadata.MD, opts ...Option) { - c := newConfig(opts) - inject(ctx, md, c.Propagators) -} - -func inject(ctx context.Context, md *metadata.MD, propagators propagation.TextMapPropagator) { - propagators.Inject(ctx, &metadataSupplier{ - metadata: md, - }) -} - -// Extract returns the correlation context and span context that -// another service encoded in the gRPC metadata object with Inject. -// This function is meant to be used on incoming requests. -func Extract(ctx context.Context, md *metadata.MD, opts ...Option) (baggage.Baggage, trace.SpanContext) { - c := newConfig(opts) - return extract(ctx, md, c.Propagators) -} - -func extract(ctx context.Context, md *metadata.MD, propagators propagation.TextMapPropagator) (baggage.Baggage, trace.SpanContext) { - ctx = propagators.Extract(ctx, &metadataSupplier{ - metadata: md, - }) - - return baggage.FromContext(ctx), trace.SpanContextFromContext(ctx) -} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go index 26343dfc1..fa015e9ac 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go @@ -20,41 +20,37 @@ import ( "context" "io" "net" - - "github.com/golang/protobuf/proto" // nolint:staticcheck + "strconv" + "time" "google.golang.org/grpc" grpc_codes "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/codes" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + "go.opentelemetry.io/otel/metric" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) type messageType attribute.KeyValue // Event adds an event of the messageType to the span associated with the -// passed context with id and size (if message is a proto message). -func (m messageType) Event(ctx context.Context, id int, message interface{}) { +// passed context with a message id. +func (m messageType) Event(ctx context.Context, id int, _ interface{}) { span := trace.SpanFromContext(ctx) - if p, ok := message.(proto.Message); ok { - span.AddEvent("message", trace.WithAttributes( - attribute.KeyValue(m), - RPCMessageIDKey.Int(id), - RPCMessageUncompressedSizeKey.Int(proto.Size(p)), - )) - } else { - span.AddEvent("message", trace.WithAttributes( - attribute.KeyValue(m), - RPCMessageIDKey.Int(id), - )) + if !span.IsRecording() { + return } + span.AddEvent("message", trace.WithAttributes( + attribute.KeyValue(m), + RPCMessageIDKey.Int(id), + )) } var ( @@ -64,8 +60,15 @@ var ( // UnaryClientInterceptor returns a grpc.UnaryClientInterceptor suitable // for use in a grpc.Dial call. +// +// Deprecated: Use [NewClientHandler] instead. func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor { - cfg := newConfig(opts) + cfg := newConfig(opts, "client") + tracer := cfg.TracerProvider.Tracer( + ScopeName, + trace.WithInstrumentationVersion(Version()), + ) + return func( ctx context.Context, method string, @@ -82,32 +85,33 @@ func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor { return invoker(ctx, method, req, reply, cc, callOpts...) } - requestMetadata, _ := metadata.FromOutgoingContext(ctx) - metadataCopy := requestMetadata.Copy() + name, attr, _ := telemetryAttributes(method, cc.Target()) - tracer := cfg.TracerProvider.Tracer( - instrumentationName, - trace.WithInstrumentationVersion(SemVersion()), + startOpts := append([]trace.SpanStartOption{ + trace.WithSpanKind(trace.SpanKindClient), + trace.WithAttributes(attr...), + }, + cfg.SpanStartOptions..., ) - name, attr := spanInfo(method, cc.Target()) - var span trace.Span - ctx, span = tracer.Start( + ctx, span := tracer.Start( ctx, name, - trace.WithSpanKind(trace.SpanKindClient), - trace.WithAttributes(attr...), + startOpts..., ) defer span.End() - inject(ctx, &metadataCopy, cfg.Propagators) - ctx = metadata.NewOutgoingContext(ctx, metadataCopy) + ctx = inject(ctx, cfg.Propagators) - messageSent.Event(ctx, 1, req) + if cfg.SentEvent { + messageSent.Event(ctx, 1, req) + } err := invoker(ctx, method, req, reply, cc, callOpts...) - messageReceived.Event(ctx, 1, reply) + if cfg.ReceivedEvent { + messageReceived.Event(ctx, 1, reply) + } if err != nil { s, _ := status.FromError(err) @@ -143,6 +147,9 @@ type clientStream struct { eventsDone chan struct{} finished chan error + receivedEvent bool + sentEvent bool + receivedMessageID int sentMessageID int } @@ -160,7 +167,10 @@ func (w *clientStream) RecvMsg(m interface{}) error { w.sendStreamEvent(errorEvent, err) } else { w.receivedMessageID++ - messageReceived.Event(w.Context(), w.receivedMessageID, m) + + if w.receivedEvent { + messageReceived.Event(w.Context(), w.receivedMessageID, m) + } } return err @@ -170,7 +180,10 @@ func (w *clientStream) SendMsg(m interface{}) error { err := w.ClientStream.SendMsg(m) w.sentMessageID++ - messageSent.Event(w.Context(), w.sentMessageID, m) + + if w.sentEvent { + messageSent.Event(w.Context(), w.sentMessageID, m) + } if err != nil { w.sendStreamEvent(errorEvent, err) @@ -181,7 +194,6 @@ func (w *clientStream) SendMsg(m interface{}) error { func (w *clientStream) Header() (metadata.MD, error) { md, err := w.ClientStream.Header() - if err != nil { w.sendStreamEvent(errorEvent, err) } @@ -191,7 +203,6 @@ func (w *clientStream) Header() (metadata.MD, error) { func (w *clientStream) CloseSend() error { err := w.ClientStream.CloseSend() - if err != nil { w.sendStreamEvent(errorEvent, err) } @@ -199,7 +210,7 @@ func (w *clientStream) CloseSend() error { return err } -func wrapClientStream(ctx context.Context, s grpc.ClientStream, desc *grpc.StreamDesc) *clientStream { +func wrapClientStream(ctx context.Context, s grpc.ClientStream, desc *grpc.StreamDesc, cfg *config) *clientStream { events := make(chan streamEvent) eventsDone := make(chan struct{}) finished := make(chan error) @@ -226,11 +237,13 @@ func wrapClientStream(ctx context.Context, s grpc.ClientStream, desc *grpc.Strea }() return &clientStream{ - ClientStream: s, - desc: desc, - events: events, - eventsDone: eventsDone, - finished: finished, + ClientStream: s, + desc: desc, + events: events, + eventsDone: eventsDone, + finished: finished, + receivedEvent: cfg.ReceivedEvent, + sentEvent: cfg.SentEvent, } } @@ -243,8 +256,15 @@ func (w *clientStream) sendStreamEvent(eventType streamEventType, err error) { // StreamClientInterceptor returns a grpc.StreamClientInterceptor suitable // for use in a grpc.Dial call. +// +// Deprecated: Use [NewClientHandler] instead. func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor { - cfg := newConfig(opts) + cfg := newConfig(opts, "client") + tracer := cfg.TracerProvider.Tracer( + ScopeName, + trace.WithInstrumentationVersion(Version()), + ) + return func( ctx context.Context, desc *grpc.StreamDesc, @@ -261,25 +281,22 @@ func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor { return streamer(ctx, desc, cc, method, callOpts...) } - requestMetadata, _ := metadata.FromOutgoingContext(ctx) - metadataCopy := requestMetadata.Copy() + name, attr, _ := telemetryAttributes(method, cc.Target()) - tracer := cfg.TracerProvider.Tracer( - instrumentationName, - trace.WithInstrumentationVersion(SemVersion()), + startOpts := append([]trace.SpanStartOption{ + trace.WithSpanKind(trace.SpanKindClient), + trace.WithAttributes(attr...), + }, + cfg.SpanStartOptions..., ) - name, attr := spanInfo(method, cc.Target()) - var span trace.Span - ctx, span = tracer.Start( + ctx, span := tracer.Start( ctx, name, - trace.WithSpanKind(trace.SpanKindClient), - trace.WithAttributes(attr...), + startOpts..., ) - inject(ctx, &metadataCopy, cfg.Propagators) - ctx = metadata.NewOutgoingContext(ctx, metadataCopy) + ctx = inject(ctx, cfg.Propagators) s, err := streamer(ctx, desc, cc, method, callOpts...) if err != nil { @@ -289,7 +306,7 @@ func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor { span.End() return s, err } - stream := wrapClientStream(ctx, s, desc) + stream := wrapClientStream(ctx, s, desc, cfg) go func() { err := <-stream.finished @@ -311,8 +328,15 @@ func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor { // UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable // for use in a grpc.NewServer call. +// +// Deprecated: Use [NewServerHandler] instead. func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { - cfg := newConfig(opts) + cfg := newConfig(opts, "server") + tracer := cfg.TracerProvider.Tracer( + ScopeName, + trace.WithInstrumentationVersion(Version()), + ) + return func( ctx context.Context, req interface{}, @@ -327,38 +351,49 @@ func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { return handler(ctx, req) } - requestMetadata, _ := metadata.FromIncomingContext(ctx) - metadataCopy := requestMetadata.Copy() - - bags, spanCtx := Extract(ctx, &metadataCopy, opts...) - ctx = baggage.ContextWithBaggage(ctx, bags) + ctx = extract(ctx, cfg.Propagators) + name, attr, metricAttrs := telemetryAttributes(info.FullMethod, peerFromCtx(ctx)) - tracer := cfg.TracerProvider.Tracer( - instrumentationName, - trace.WithInstrumentationVersion(SemVersion()), + startOpts := append([]trace.SpanStartOption{ + trace.WithSpanKind(trace.SpanKindServer), + trace.WithAttributes(attr...), + }, + cfg.SpanStartOptions..., ) - name, attr := spanInfo(info.FullMethod, peerFromCtx(ctx)) ctx, span := tracer.Start( - trace.ContextWithRemoteSpanContext(ctx, spanCtx), + trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)), name, - trace.WithSpanKind(trace.SpanKindServer), - trace.WithAttributes(attr...), + startOpts..., ) defer span.End() - messageReceived.Event(ctx, 1, req) + if cfg.ReceivedEvent { + messageReceived.Event(ctx, 1, req) + } + + before := time.Now() resp, err := handler(ctx, req) + + s, _ := status.FromError(err) if err != nil { - s, _ := status.FromError(err) - span.SetStatus(codes.Error, s.Message()) - span.SetAttributes(statusCodeAttr(s.Code())) - messageSent.Event(ctx, 1, s.Proto()) + statusCode, msg := serverStatus(s) + span.SetStatus(statusCode, msg) + if cfg.SentEvent { + messageSent.Event(ctx, 1, s.Proto()) + } } else { - span.SetAttributes(statusCodeAttr(grpc_codes.OK)) - messageSent.Event(ctx, 1, resp) + if cfg.SentEvent { + messageSent.Event(ctx, 1, resp) + } } + grpcStatusCodeAttr := statusCodeAttr(s.Code()) + span.SetAttributes(grpcStatusCodeAttr) + + elapsedTime := time.Since(before).Milliseconds() + metricAttrs = append(metricAttrs, grpcStatusCodeAttr) + cfg.rpcDuration.Record(ctx, float64(elapsedTime), metric.WithAttributes(metricAttrs...)) return resp, err } @@ -372,6 +407,9 @@ type serverStream struct { receivedMessageID int sentMessageID int + + receivedEvent bool + sentEvent bool } func (w *serverStream) Context() context.Context { @@ -383,7 +421,9 @@ func (w *serverStream) RecvMsg(m interface{}) error { if err == nil { w.receivedMessageID++ - messageReceived.Event(w.Context(), w.receivedMessageID, m) + if w.receivedEvent { + messageReceived.Event(w.Context(), w.receivedMessageID, m) + } } return err @@ -393,22 +433,33 @@ func (w *serverStream) SendMsg(m interface{}) error { err := w.ServerStream.SendMsg(m) w.sentMessageID++ - messageSent.Event(w.Context(), w.sentMessageID, m) + if w.sentEvent { + messageSent.Event(w.Context(), w.sentMessageID, m) + } return err } -func wrapServerStream(ctx context.Context, ss grpc.ServerStream) *serverStream { +func wrapServerStream(ctx context.Context, ss grpc.ServerStream, cfg *config) *serverStream { return &serverStream{ - ServerStream: ss, - ctx: ctx, + ServerStream: ss, + ctx: ctx, + receivedEvent: cfg.ReceivedEvent, + sentEvent: cfg.SentEvent, } } // StreamServerInterceptor returns a grpc.StreamServerInterceptor suitable // for use in a grpc.NewServer call. +// +// Deprecated: Use [NewServerHandler] instead. func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { - cfg := newConfig(opts) + cfg := newConfig(opts, "server") + tracer := cfg.TracerProvider.Tracer( + ScopeName, + trace.WithInstrumentationVersion(Version()), + ) + return func( srv interface{}, ss grpc.ServerStream, @@ -421,34 +472,31 @@ func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { Type: StreamServer, } if cfg.Filter != nil && !cfg.Filter(i) { - return handler(srv, wrapServerStream(ctx, ss)) + return handler(srv, wrapServerStream(ctx, ss, cfg)) } - requestMetadata, _ := metadata.FromIncomingContext(ctx) - metadataCopy := requestMetadata.Copy() - - bags, spanCtx := Extract(ctx, &metadataCopy, opts...) - ctx = baggage.ContextWithBaggage(ctx, bags) + ctx = extract(ctx, cfg.Propagators) + name, attr, _ := telemetryAttributes(info.FullMethod, peerFromCtx(ctx)) - tracer := cfg.TracerProvider.Tracer( - instrumentationName, - trace.WithInstrumentationVersion(SemVersion()), + startOpts := append([]trace.SpanStartOption{ + trace.WithSpanKind(trace.SpanKindServer), + trace.WithAttributes(attr...), + }, + cfg.SpanStartOptions..., ) - name, attr := spanInfo(info.FullMethod, peerFromCtx(ctx)) ctx, span := tracer.Start( - trace.ContextWithRemoteSpanContext(ctx, spanCtx), + trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)), name, - trace.WithSpanKind(trace.SpanKindServer), - trace.WithAttributes(attr...), + startOpts..., ) defer span.End() - err := handler(srv, wrapServerStream(ctx, ss)) - + err := handler(srv, wrapServerStream(ctx, ss, cfg)) if err != nil { s, _ := status.FromError(err) - span.SetStatus(codes.Error, s.Message()) + statusCode, msg := serverStatus(s) + span.SetStatus(statusCode, msg) span.SetAttributes(statusCodeAttr(s.Code())) } else { span.SetAttributes(statusCodeAttr(grpc_codes.OK)) @@ -458,31 +506,49 @@ func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { } } -// spanInfo returns a span name and all appropriate attributes from the gRPC -// method and peer address. -func spanInfo(fullMethod, peerAddress string) (string, []attribute.KeyValue) { - attrs := []attribute.KeyValue{RPCSystemGRPC} - name, mAttrs := internal.ParseFullMethod(fullMethod) - attrs = append(attrs, mAttrs...) - attrs = append(attrs, peerAttr(peerAddress)...) - return name, attrs +// telemetryAttributes returns a span name and span and metric attributes from +// the gRPC method and peer address. +func telemetryAttributes(fullMethod, peerAddress string) (string, []attribute.KeyValue, []attribute.KeyValue) { + name, methodAttrs := internal.ParseFullMethod(fullMethod) + peerAttrs := peerAttr(peerAddress) + + attrs := make([]attribute.KeyValue, 0, 1+len(methodAttrs)+len(peerAttrs)) + attrs = append(attrs, RPCSystemGRPC) + attrs = append(attrs, methodAttrs...) + metricAttrs := attrs[:1+len(methodAttrs)] + attrs = append(attrs, peerAttrs...) + return name, attrs, metricAttrs } // peerAttr returns attributes about the peer address. func peerAttr(addr string) []attribute.KeyValue { - host, port, err := net.SplitHostPort(addr) + host, p, err := net.SplitHostPort(addr) if err != nil { - return []attribute.KeyValue(nil) + return nil } if host == "" { host = "127.0.0.1" } + port, err := strconv.Atoi(p) + if err != nil { + return nil + } - return []attribute.KeyValue{ - semconv.NetPeerIPKey.String(host), - semconv.NetPeerPortKey.String(port), + var attr []attribute.KeyValue + if ip := net.ParseIP(host); ip != nil { + attr = []attribute.KeyValue{ + semconv.NetSockPeerAddr(host), + semconv.NetSockPeerPort(port), + } + } else { + attr = []attribute.KeyValue{ + semconv.NetPeerName(host), + semconv.NetPeerPort(port), + } } + + return attr } // peerFromCtx returns a peer address from a context, if one exists. @@ -498,3 +564,26 @@ func peerFromCtx(ctx context.Context) string { func statusCodeAttr(c grpc_codes.Code) attribute.KeyValue { return GRPCStatusCodeKey.Int64(int64(c)) } + +// serverStatus returns a span status code and message for a given gRPC +// status code. It maps specific gRPC status codes to a corresponding span +// status code and message. This function is intended for use on the server +// side of a gRPC connection. +// +// If the gRPC status code is Unknown, DeadlineExceeded, Unimplemented, +// Internal, Unavailable, or DataLoss, it returns a span status code of Error +// and the message from the gRPC status. Otherwise, it returns a span status +// code of Unset and an empty message. +func serverStatus(grpcStatus *status.Status) (codes.Code, string) { + switch grpcStatus.Code() { + case grpc_codes.Unknown, + grpc_codes.DeadlineExceeded, + grpc_codes.Unimplemented, + grpc_codes.Internal, + grpc_codes.Unavailable, + grpc_codes.DataLoss: + return codes.Error, grpcStatus.Message() + default: + return codes.Unset, "" + } +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go index bc214d363..cf32a9e97 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go @@ -18,26 +18,34 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) // ParseFullMethod returns a span name following the OpenTelemetry semantic // conventions as well as all applicable span attribute.KeyValue attributes based // on a gRPC's FullMethod. +// +// Parsing is consistent with grpc-go implementation: +// https://github.com/grpc/grpc-go/blob/v1.57.0/internal/grpcutil/method.go#L26-L39 func ParseFullMethod(fullMethod string) (string, []attribute.KeyValue) { - name := strings.TrimLeft(fullMethod, "/") - parts := strings.SplitN(name, "/", 2) - if len(parts) != 2 { + if !strings.HasPrefix(fullMethod, "/") { + // Invalid format, does not follow `/package.service/method`. + return fullMethod, nil + } + name := fullMethod[1:] + pos := strings.LastIndex(name, "/") + if pos < 0 { // Invalid format, does not follow `/package.service/method`. - return name, []attribute.KeyValue(nil) + return name, nil } + service, method := name[:pos], name[pos+1:] var attrs []attribute.KeyValue - if service := parts[0]; service != "" { - attrs = append(attrs, semconv.RPCServiceKey.String(service)) + if service != "" { + attrs = append(attrs, semconv.RPCService(service)) } - if method := parts[1]; method != "" { - attrs = append(attrs, semconv.RPCMethodKey.String(method)) + if method != "" { + attrs = append(attrs, semconv.RPCMethod(method)) } return name, attrs } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier.go new file mode 100644 index 000000000..f585fb6ae --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier.go @@ -0,0 +1,98 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + +import ( + "context" + + "google.golang.org/grpc/metadata" + + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" +) + +type metadataSupplier struct { + metadata *metadata.MD +} + +// assert that metadataSupplier implements the TextMapCarrier interface. +var _ propagation.TextMapCarrier = &metadataSupplier{} + +func (s *metadataSupplier) Get(key string) string { + values := s.metadata.Get(key) + if len(values) == 0 { + return "" + } + return values[0] +} + +func (s *metadataSupplier) Set(key string, value string) { + s.metadata.Set(key, value) +} + +func (s *metadataSupplier) Keys() []string { + out := make([]string, 0, len(*s.metadata)) + for key := range *s.metadata { + out = append(out, key) + } + return out +} + +// Inject injects correlation context and span context into the gRPC +// metadata object. This function is meant to be used on outgoing +// requests. +// Deprecated: Unnecessary public func. +func Inject(ctx context.Context, md *metadata.MD, opts ...Option) { + c := newConfig(opts, "") + c.Propagators.Inject(ctx, &metadataSupplier{ + metadata: md, + }) +} + +func inject(ctx context.Context, propagators propagation.TextMapPropagator) context.Context { + md, ok := metadata.FromOutgoingContext(ctx) + if !ok { + md = metadata.MD{} + } + propagators.Inject(ctx, &metadataSupplier{ + metadata: &md, + }) + return metadata.NewOutgoingContext(ctx, md) +} + +// Extract returns the correlation context and span context that +// another service encoded in the gRPC metadata object with Inject. +// This function is meant to be used on incoming requests. +// Deprecated: Unnecessary public func. +func Extract(ctx context.Context, md *metadata.MD, opts ...Option) (baggage.Baggage, trace.SpanContext) { + c := newConfig(opts, "") + ctx = c.Propagators.Extract(ctx, &metadataSupplier{ + metadata: md, + }) + + return baggage.FromContext(ctx), trace.SpanContextFromContext(ctx) +} + +func extract(ctx context.Context, propagators propagation.TextMapPropagator) context.Context { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + md = metadata.MD{} + } + + return propagators.Extract(ctx, &metadataSupplier{ + metadata: &md, + }) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/semconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/semconv.go index 611c7f301..b65fab308 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/semconv.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/semconv.go @@ -16,7 +16,7 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.g import ( "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) // Semantic conventions for attribute keys for gRPC. @@ -41,7 +41,7 @@ const ( // Semantic conventions for common RPC attributes. var ( // Semantic convention for gRPC as the remoting system. - RPCSystemGRPC = semconv.RPCSystemKey.String("grpc") + RPCSystemGRPC = semconv.RPCSystemGRPC // Semantic convention for a message named message. RPCNameMessage = RPCNameKey.String("message") diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go new file mode 100644 index 000000000..0211e55e0 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go @@ -0,0 +1,235 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + +import ( + "context" + "sync/atomic" + "time" + + grpc_codes "google.golang.org/grpc/codes" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/status" + + "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + "go.opentelemetry.io/otel/trace" +) + +type gRPCContextKey struct{} + +type gRPCContext struct { + messagesReceived int64 + messagesSent int64 + metricAttrs []attribute.KeyValue +} + +type serverHandler struct { + *config +} + +// NewServerHandler creates a stats.Handler for gRPC server. +func NewServerHandler(opts ...Option) stats.Handler { + h := &serverHandler{ + config: newConfig(opts, "server"), + } + + return h +} + +// TagConn can attach some information to the given context. +func (h *serverHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context { + span := trace.SpanFromContext(ctx) + attrs := peerAttr(peerFromCtx(ctx)) + span.SetAttributes(attrs...) + return ctx +} + +// HandleConn processes the Conn stats. +func (h *serverHandler) HandleConn(ctx context.Context, info stats.ConnStats) { +} + +// TagRPC can attach some information to the given context. +func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { + ctx = extract(ctx, h.config.Propagators) + + name, attrs := internal.ParseFullMethod(info.FullMethodName) + attrs = append(attrs, RPCSystemGRPC) + ctx, _ = h.tracer.Start( + trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)), + name, + trace.WithSpanKind(trace.SpanKindServer), + trace.WithAttributes(attrs...), + ) + + gctx := gRPCContext{ + metricAttrs: attrs, + } + return context.WithValue(ctx, gRPCContextKey{}, &gctx) +} + +// HandleRPC processes the RPC stats. +func (h *serverHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { + h.handleRPC(ctx, rs) +} + +type clientHandler struct { + *config +} + +// NewClientHandler creates a stats.Handler for gRPC client. +func NewClientHandler(opts ...Option) stats.Handler { + h := &clientHandler{ + config: newConfig(opts, "client"), + } + + return h +} + +// TagRPC can attach some information to the given context. +func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { + name, attrs := internal.ParseFullMethod(info.FullMethodName) + attrs = append(attrs, RPCSystemGRPC) + ctx, _ = h.tracer.Start( + ctx, + name, + trace.WithSpanKind(trace.SpanKindClient), + trace.WithAttributes(attrs...), + ) + + gctx := gRPCContext{ + metricAttrs: attrs, + } + + return inject(context.WithValue(ctx, gRPCContextKey{}, &gctx), h.config.Propagators) +} + +// HandleRPC processes the RPC stats. +func (h *clientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { + h.handleRPC(ctx, rs) +} + +// TagConn can attach some information to the given context. +func (h *clientHandler) TagConn(ctx context.Context, cti *stats.ConnTagInfo) context.Context { + span := trace.SpanFromContext(ctx) + attrs := peerAttr(cti.RemoteAddr.String()) + span.SetAttributes(attrs...) + return ctx +} + +// HandleConn processes the Conn stats. +func (h *clientHandler) HandleConn(context.Context, stats.ConnStats) { + // no-op +} + +func (c *config) handleRPC(ctx context.Context, rs stats.RPCStats) { + span := trace.SpanFromContext(ctx) + gctx, _ := ctx.Value(gRPCContextKey{}).(*gRPCContext) + var messageId int64 + metricAttrs := make([]attribute.KeyValue, 0, len(gctx.metricAttrs)+1) + metricAttrs = append(metricAttrs, gctx.metricAttrs...) + wctx := withoutCancel(ctx) + + switch rs := rs.(type) { + case *stats.Begin: + case *stats.InPayload: + if gctx != nil { + messageId = atomic.AddInt64(&gctx.messagesReceived, 1) + c.rpcRequestSize.Record(wctx, int64(rs.Length), metric.WithAttributes(metricAttrs...)) + } + + if c.ReceivedEvent { + span.AddEvent("message", + trace.WithAttributes( + semconv.MessageTypeReceived, + semconv.MessageIDKey.Int64(messageId), + semconv.MessageCompressedSizeKey.Int(rs.CompressedLength), + semconv.MessageUncompressedSizeKey.Int(rs.Length), + ), + ) + } + case *stats.OutPayload: + if gctx != nil { + messageId = atomic.AddInt64(&gctx.messagesSent, 1) + c.rpcResponseSize.Record(wctx, int64(rs.Length), metric.WithAttributes(metricAttrs...)) + } + + if c.SentEvent { + span.AddEvent("message", + trace.WithAttributes( + semconv.MessageTypeSent, + semconv.MessageIDKey.Int64(messageId), + semconv.MessageCompressedSizeKey.Int(rs.CompressedLength), + semconv.MessageUncompressedSizeKey.Int(rs.Length), + ), + ) + } + case *stats.OutTrailer: + case *stats.End: + var rpcStatusAttr attribute.KeyValue + + if rs.Error != nil { + s, _ := status.FromError(rs.Error) + span.SetStatus(codes.Error, s.Message()) + rpcStatusAttr = semconv.RPCGRPCStatusCodeKey.Int(int(s.Code())) + } else { + rpcStatusAttr = semconv.RPCGRPCStatusCodeKey.Int(int(grpc_codes.OK)) + } + span.SetAttributes(rpcStatusAttr) + span.End() + + metricAttrs = append(metricAttrs, rpcStatusAttr) + c.rpcDuration.Record(wctx, float64(rs.EndTime.Sub(rs.BeginTime)), metric.WithAttributes(metricAttrs...)) + c.rpcRequestsPerRPC.Record(wctx, gctx.messagesReceived, metric.WithAttributes(metricAttrs...)) + c.rpcResponsesPerRPC.Record(wctx, gctx.messagesSent, metric.WithAttributes(metricAttrs...)) + + default: + return + } +} + +func withoutCancel(parent context.Context) context.Context { + if parent == nil { + panic("cannot create context from nil parent") + } + return withoutCancelCtx{parent} +} + +type withoutCancelCtx struct { + c context.Context +} + +func (withoutCancelCtx) Deadline() (deadline time.Time, ok bool) { + return +} + +func (withoutCancelCtx) Done() <-chan struct{} { + return nil +} + +func (withoutCancelCtx) Err() error { + return nil +} + +func (w withoutCancelCtx) Value(key any) any { + return w.c.Value(key) +} + +func (w withoutCancelCtx) String() string { + return "withoutCancel" +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go index bf6b2aa1c..5c13a7cea 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go @@ -16,11 +16,13 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.g // Version is the current release version of the gRPC instrumentation. func Version() string { - return "0.35.0" + return "0.46.0" // This string is updated by the pre_release.sh script during release } // SemVersion is the semantic version to be supplied to tracer/meter creation. +// +// Deprecated: Use [Version] instead. func SemVersion() string { - return "semver:" + Version() + return Version() } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go index 728be09d0..9509014e8 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go @@ -34,7 +34,7 @@ const ( RequestCount = "http.server.request_count" // Incoming request count total RequestContentLength = "http.server.request_content_length" // Incoming request bytes total ResponseContentLength = "http.server.response_content_length" // Incoming response bytes total - ServerLatency = "http.server.duration" // Incoming end to end duration, microseconds + ServerLatency = "http.server.duration" // Incoming end to end duration, milliseconds ) // Filter is a predicate used to determine whether a given http.request should @@ -42,5 +42,5 @@ const ( type Filter func(*http.Request) bool func newTracer(tp trace.TracerProvider) trace.Tracer { - return tp.Tracer(instrumentationName, trace.WithInstrumentationVersion(SemVersion())) + return tp.Tracer(ScopeName, trace.WithInstrumentationVersion(Version())) } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go index d0337f3a5..a1b5b5e5a 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go @@ -21,18 +21,17 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) -const ( - instrumentationName = "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" -) +// ScopeName is the instrumentation scope name. +const ScopeName = "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" // config represents the configuration options available for the http.Handler // and http.Transport types. type config struct { + ServerName string Tracer trace.Tracer Meter metric.Meter Propagators propagation.TextMapPropagator @@ -64,7 +63,7 @@ func (o optionFunc) apply(c *config) { func newConfig(opts ...Option) *config { c := &config{ Propagators: otel.GetTextMapPropagator(), - MeterProvider: global.MeterProvider(), + MeterProvider: otel.GetMeterProvider(), } for _, opt := range opts { opt.apply(c) @@ -76,8 +75,8 @@ func newConfig(opts ...Option) *config { } c.Meter = c.MeterProvider.Meter( - instrumentationName, - metric.WithInstrumentationVersion(SemVersion()), + ScopeName, + metric.WithInstrumentationVersion(Version()), ) return c @@ -198,3 +197,11 @@ func WithClientTrace(f func(context.Context) *httptrace.ClientTrace) Option { c.ClientTrace = f }) } + +// WithServerName returns an Option that sets the name of the (virtual) server +// handling requests. +func WithServerName(server string) Option { + return optionFunc(func(c *config) { + c.ServerName = server + }) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go index 5b7d9daaf..9a8260059 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go @@ -21,25 +21,19 @@ import ( "github.com/felixge/httpsnoop" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/propagation" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) -var _ http.Handler = &Handler{} - -// Handler is http middleware that corresponds to the http.Handler interface and -// is designed to wrap a http.Mux (or equivalent), while individual routes on -// the mux are wrapped with WithRouteTag. A Handler will add various attributes -// to the span using the attribute.Keys defined in this package. -type Handler struct { +// middleware is an http middleware which wraps the next handler in a span. +type middleware struct { operation string - handler http.Handler + server string tracer trace.Tracer meter metric.Meter @@ -49,8 +43,8 @@ type Handler struct { writeEvent bool filters []Filter spanNameFormatter func(string, *http.Request) string - counters map[string]syncint64.Counter - valueRecorders map[string]syncfloat64.Histogram + counters map[string]metric.Int64Counter + valueRecorders map[string]metric.Float64Histogram publicEndpoint bool publicEndpointFn func(*http.Request) bool } @@ -59,11 +53,17 @@ func defaultHandlerFormatter(operation string, _ *http.Request) string { return operation } -// NewHandler wraps the passed handler, functioning like middleware, in a span -// named after the operation and with any provided Options. +// NewHandler wraps the passed handler in a span named after the operation and +// enriches it with metrics. func NewHandler(handler http.Handler, operation string, opts ...Option) http.Handler { - h := Handler{ - handler: handler, + return NewMiddleware(operation, opts...)(handler) +} + +// NewMiddleware returns a tracing and metrics instrumentation middleware. +// The handler returned by the middleware wraps a handler +// in a span named after the operation and enriches it with metrics. +func NewMiddleware(operation string, opts ...Option) func(http.Handler) http.Handler { + h := middleware{ operation: operation, } @@ -76,10 +76,14 @@ func NewHandler(handler http.Handler, operation string, opts ...Option) http.Han h.configure(c) h.createMeasures() - return &h + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + h.serveHTTP(w, r, next) + }) + } } -func (h *Handler) configure(c *config) { +func (h *middleware) configure(c *config) { h.tracer = c.Tracer h.meter = c.Meter h.propagators = c.Propagators @@ -90,6 +94,7 @@ func (h *Handler) configure(c *config) { h.spanNameFormatter = c.SpanNameFormatter h.publicEndpoint = c.PublicEndpoint h.publicEndpointFn = c.PublicEndpointFn + h.server = c.ServerName } func handleErr(err error) { @@ -98,17 +103,29 @@ func handleErr(err error) { } } -func (h *Handler) createMeasures() { - h.counters = make(map[string]syncint64.Counter) - h.valueRecorders = make(map[string]syncfloat64.Histogram) +func (h *middleware) createMeasures() { + h.counters = make(map[string]metric.Int64Counter) + h.valueRecorders = make(map[string]metric.Float64Histogram) - requestBytesCounter, err := h.meter.SyncInt64().Counter(RequestContentLength) + requestBytesCounter, err := h.meter.Int64Counter( + RequestContentLength, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP request content length (uncompressed)"), + ) handleErr(err) - responseBytesCounter, err := h.meter.SyncInt64().Counter(ResponseContentLength) + responseBytesCounter, err := h.meter.Int64Counter( + ResponseContentLength, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP response content length (uncompressed)"), + ) handleErr(err) - serverLatencyMeasure, err := h.meter.SyncFloat64().Histogram(ServerLatency) + serverLatencyMeasure, err := h.meter.Float64Histogram( + ServerLatency, + metric.WithUnit("ms"), + metric.WithDescription("Measures the duration of HTTP request handling"), + ) handleErr(err) h.counters[RequestContentLength] = requestBytesCounter @@ -116,19 +133,27 @@ func (h *Handler) createMeasures() { h.valueRecorders[ServerLatency] = serverLatencyMeasure } -// ServeHTTP serves HTTP requests (http.Handler). -func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { +// serveHTTP sets up tracing and calls the given next http.Handler with the span +// context injected into the request context. +func (h *middleware) serveHTTP(w http.ResponseWriter, r *http.Request, next http.Handler) { requestStartTime := time.Now() for _, f := range h.filters { if !f(r) { // Simply pass through to the handler if a filter rejects the request - h.handler.ServeHTTP(w, r) + next.ServeHTTP(w, r) return } } ctx := h.propagators.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) - opts := h.spanStartOptions + opts := []trace.SpanStartOption{ + trace.WithAttributes(semconvutil.HTTPServerRequest(h.server, r)...), + } + if h.server != "" { + hostAttr := semconv.NetHostName(h.server) + opts = append(opts, trace.WithAttributes(hostAttr)) + } + opts = append(opts, h.spanStartOptions...) if h.publicEndpoint || (h.publicEndpointFn != nil && h.publicEndpointFn(r.WithContext(ctx))) { opts = append(opts, trace.WithNewRoot()) // Linking incoming span context if any for public endpoint. @@ -137,12 +162,6 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } - opts = append([]trace.SpanStartOption{ - trace.WithAttributes(semconv.NetAttributesFromHTTPRequest("tcp", r)...), - trace.WithAttributes(semconv.EndUserAttributesFromHTTPRequest(r)...), - trace.WithAttributes(semconv.HTTPServerAttributesFromHTTPRequest(h.operation, "", r)...), - }, opts...) // start with the configured options - tracer := h.tracer if tracer == nil { @@ -180,7 +199,13 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } - rww := &respWriterWrapper{ResponseWriter: w, record: writeRecordFunc, ctx: ctx, props: h.propagators} + rww := &respWriterWrapper{ + ResponseWriter: w, + record: writeRecordFunc, + ctx: ctx, + props: h.propagators, + statusCode: http.StatusOK, // default status code in case the Handler doesn't write anything + } // Wrap w to use our ResponseWriter methods while also exposing // other interfaces that w may implement (http.CloseNotifier, @@ -201,19 +226,23 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { labeler := &Labeler{} ctx = injectLabeler(ctx, labeler) - h.handler.ServeHTTP(w, r.WithContext(ctx)) + next.ServeHTTP(w, r.WithContext(ctx)) setAfterServeAttributes(span, bw.read, rww.written, rww.statusCode, bw.err, rww.err) // Add metrics - attributes := append(labeler.Get(), semconv.HTTPServerMetricAttributesFromHTTPRequest(h.operation, r)...) - h.counters[RequestContentLength].Add(ctx, bw.read, attributes...) - h.counters[ResponseContentLength].Add(ctx, rww.written, attributes...) + attributes := append(labeler.Get(), semconvutil.HTTPServerRequestMetrics(h.server, r)...) + if rww.statusCode > 0 { + attributes = append(attributes, semconv.HTTPStatusCode(rww.statusCode)) + } + o := metric.WithAttributes(attributes...) + h.counters[RequestContentLength].Add(ctx, bw.read, o) + h.counters[ResponseContentLength].Add(ctx, rww.written, o) // Use floating point division here for higher precision (instead of Millisecond method). elapsedTime := float64(time.Since(requestStartTime)) / float64(time.Millisecond) - h.valueRecorders[ServerLatency].Record(ctx, elapsedTime, attributes...) + h.valueRecorders[ServerLatency].Record(ctx, elapsedTime, o) } func setAfterServeAttributes(span trace.Span, read, wrote int64, statusCode int, rerr, werr error) { @@ -231,21 +260,28 @@ func setAfterServeAttributes(span trace.Span, read, wrote int64, statusCode int, attributes = append(attributes, WroteBytesKey.Int64(wrote)) } if statusCode > 0 { - attributes = append(attributes, semconv.HTTPAttributesFromHTTPStatusCode(statusCode)...) - span.SetStatus(semconv.SpanStatusFromHTTPStatusCodeAndSpanKind(statusCode, trace.SpanKindServer)) + attributes = append(attributes, semconv.HTTPStatusCode(statusCode)) } + span.SetStatus(semconvutil.HTTPServerStatus(statusCode)) + if werr != nil && werr != io.EOF { attributes = append(attributes, WriteErrorKey.String(werr.Error())) } span.SetAttributes(attributes...) } -// WithRouteTag annotates a span with the provided route name using the -// RouteKey Tag. +// WithRouteTag annotates spans and metrics with the provided route name +// with HTTP route attribute. func WithRouteTag(route string, h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + attr := semconv.HTTPRouteKey.String(route) + span := trace.SpanFromContext(r.Context()) - span.SetAttributes(semconv.HTTPRouteKey.String(route)) + span.SetAttributes(attr) + + labeler, _ := LabelerFromContext(r.Context()) + labeler.Add(attr) + h.ServeHTTP(w, r) }) } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go new file mode 100644 index 000000000..edf4ce3d3 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" + +// Generate semconvutil package: +//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/httpconv_test.go.tmpl "--data={}" --out=httpconv_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/httpconv.go.tmpl "--data={}" --out=httpconv.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/netconv_test.go.tmpl "--data={}" --out=netconv_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/netconv.go.tmpl "--data={}" --out=netconv.go diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go new file mode 100644 index 000000000..d3dede9eb --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go @@ -0,0 +1,552 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/semconvutil/httpconv.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" + +import ( + "fmt" + "net/http" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" +) + +// HTTPClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(HTTPClientResponse(resp), ClientRequest(resp.Request)...) +func HTTPClientResponse(resp *http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// HTTPClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func HTTPClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// HTTPClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func HTTPClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// HTTPServerRequest returns trace attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func HTTPServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) +} + +// HTTPServerRequestMetrics returns metric attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port". +func HTTPServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequestMetrics(server, req) +} + +// HTTPServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func HTTPServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// HTTPRequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func HTTPRequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// HTTPResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func HTTPResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} + +// httpConv are the HTTP semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type httpConv struct { + NetConv *netConv + + EnduserIDKey attribute.Key + HTTPClientIPKey attribute.Key + HTTPFlavorKey attribute.Key + HTTPMethodKey attribute.Key + HTTPRequestContentLengthKey attribute.Key + HTTPResponseContentLengthKey attribute.Key + HTTPRouteKey attribute.Key + HTTPSchemeHTTP attribute.KeyValue + HTTPSchemeHTTPS attribute.KeyValue + HTTPStatusCodeKey attribute.Key + HTTPTargetKey attribute.Key + HTTPURLKey attribute.Key + HTTPUserAgentKey attribute.Key +} + +var hc = &httpConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPFlavorKey: semconv.HTTPFlavorKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + HTTPUserAgentKey: semconv.HTTPUserAgentKey, +} + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. The following attributes are returned if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func (c *httpConv) ClientResponse(resp *http.Response) []attribute.KeyValue { + var n int + if resp.StatusCode > 0 { + n++ + } + if resp.ContentLength > 0 { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + if resp.StatusCode > 0 { + attrs = append(attrs, c.HTTPStatusCodeKey.Int(resp.StatusCode)) + } + if resp.ContentLength > 0 { + attrs = append(attrs, c.HTTPResponseContentLengthKey.Int(int(resp.ContentLength))) + } + return attrs +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func (c *httpConv) ClientRequest(req *http.Request) []attribute.KeyValue { + n := 3 // URL, peer name, proto, and method. + var h string + if req.URL != nil { + h = req.URL.Host + } + peer, p := firstHostPort(h, req.Header.Get("Host")) + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) + if port > 0 { + n++ + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + if req.ContentLength > 0 { + n++ + } + userID, _, hasUserID := req.BasicAuth() + if hasUserID { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + attrs = append(attrs, c.flavor(req.Proto)) + + var u string + if req.URL != nil { + // Remove any username/password info that may be in the URL. + userinfo := req.URL.User + req.URL.User = nil + u = req.URL.String() + // Restore any username/password info that was removed. + req.URL.User = userinfo + } + attrs = append(attrs, c.HTTPURLKey.String(u)) + + attrs = append(attrs, c.NetConv.PeerName(peer)) + if port > 0 { + attrs = append(attrs, c.NetConv.PeerPort(port)) + } + + if useragent != "" { + attrs = append(attrs, c.HTTPUserAgentKey.String(useragent)) + } + + if l := req.ContentLength; l > 0 { + attrs = append(attrs, c.HTTPRequestContentLengthKey.Int64(l)) + } + + if hasUserID { + attrs = append(attrs, c.EnduserIDKey.String(userID)) + } + + return attrs +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func (c *httpConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue { + // TODO: This currently does not add the specification required + // `http.target` attribute. It has too high of a cardinality to safely be + // added. An alternate should be added, or this comment removed, when it is + // addressed by the specification. If it is ultimately decided to continue + // not including the attribute, the HTTPTargetKey field of the httpConv + // should be removed as well. + + n := 4 // Method, scheme, proto, and host name. + var host string + var p int + if server == "" { + host, p = splitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = splitHostPort(server) + if p < 0 { + _, p = splitHostPort(req.Host) + } + } + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + n++ + } + peer, peerPort := splitHostPort(req.RemoteAddr) + if peer != "" { + n++ + if peerPort > 0 { + n++ + } + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + userID, _, hasUserID := req.BasicAuth() + if hasUserID { + n++ + } + clientIP := serverClientIP(req.Header.Get("X-Forwarded-For")) + if clientIP != "" { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + attrs = append(attrs, c.scheme(req.TLS != nil)) + attrs = append(attrs, c.flavor(req.Proto)) + attrs = append(attrs, c.NetConv.HostName(host)) + + if hostPort > 0 { + attrs = append(attrs, c.NetConv.HostPort(hostPort)) + } + + if peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + attrs = append(attrs, c.NetConv.SockPeerAddr(peer)) + if peerPort > 0 { + attrs = append(attrs, c.NetConv.SockPeerPort(peerPort)) + } + } + + if useragent != "" { + attrs = append(attrs, c.HTTPUserAgentKey.String(useragent)) + } + + if hasUserID { + attrs = append(attrs, c.EnduserIDKey.String(userID)) + } + + if clientIP != "" { + attrs = append(attrs, c.HTTPClientIPKey.String(clientIP)) + } + + return attrs +} + +// ServerRequestMetrics returns metric attributes for an HTTP request received +// by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port". +func (c *httpConv) ServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { + // TODO: This currently does not add the specification required + // `http.target` attribute. It has too high of a cardinality to safely be + // added. An alternate should be added, or this comment removed, when it is + // addressed by the specification. If it is ultimately decided to continue + // not including the attribute, the HTTPTargetKey field of the httpConv + // should be removed as well. + + n := 4 // Method, scheme, proto, and host name. + var host string + var p int + if server == "" { + host, p = splitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = splitHostPort(server) + if p < 0 { + _, p = splitHostPort(req.Host) + } + } + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.methodMetric(req.Method)) + attrs = append(attrs, c.scheme(req.TLS != nil)) + attrs = append(attrs, c.flavor(req.Proto)) + attrs = append(attrs, c.NetConv.HostName(host)) + + if hostPort > 0 { + attrs = append(attrs, c.NetConv.HostPort(hostPort)) + } + + return attrs +} + +func (c *httpConv) method(method string) attribute.KeyValue { + if method == "" { + return c.HTTPMethodKey.String(http.MethodGet) + } + return c.HTTPMethodKey.String(method) +} + +func (c *httpConv) methodMetric(method string) attribute.KeyValue { + method = strings.ToUpper(method) + switch method { + case http.MethodConnect, http.MethodDelete, http.MethodGet, http.MethodHead, http.MethodOptions, http.MethodPatch, http.MethodPost, http.MethodPut, http.MethodTrace: + default: + method = "_OTHER" + } + return c.HTTPMethodKey.String(method) +} + +func (c *httpConv) scheme(https bool) attribute.KeyValue { // nolint:revive + if https { + return c.HTTPSchemeHTTPS + } + return c.HTTPSchemeHTTP +} + +func (c *httpConv) flavor(proto string) attribute.KeyValue { + switch proto { + case "HTTP/1.0": + return c.HTTPFlavorKey.String("1.0") + case "HTTP/1.1": + return c.HTTPFlavorKey.String("1.1") + case "HTTP/2": + return c.HTTPFlavorKey.String("2.0") + case "HTTP/3": + return c.HTTPFlavorKey.String("3.0") + default: + return c.HTTPFlavorKey.String(proto) + } +} + +func serverClientIP(xForwardedFor string) string { + if idx := strings.Index(xForwardedFor, ","); idx >= 0 { + xForwardedFor = xForwardedFor[:idx] + } + return xForwardedFor +} + +func requiredHTTPPort(https bool, port int) int { // nolint:revive + if https { + if port > 0 && port != 443 { + return port + } + } else { + if port > 0 && port != 80 { + return port + } + } + return -1 +} + +// Return the request host and port from the first non-empty source. +func firstHostPort(source ...string) (host string, port int) { + for _, hostport := range source { + host, port = splitHostPort(hostport) + if host != "" || port > 0 { + break + } + } + return +} + +// RequestHeader returns the contents of h as OpenTelemetry attributes. +func (c *httpConv) RequestHeader(h http.Header) []attribute.KeyValue { + return c.header("http.request.header", h) +} + +// ResponseHeader returns the contents of h as OpenTelemetry attributes. +func (c *httpConv) ResponseHeader(h http.Header) []attribute.KeyValue { + return c.header("http.response.header", h) +} + +func (c *httpConv) header(prefix string, h http.Header) []attribute.KeyValue { + key := func(k string) attribute.Key { + k = strings.ToLower(k) + k = strings.ReplaceAll(k, "-", "_") + k = fmt.Sprintf("%s.%s", prefix, k) + return attribute.Key(k) + } + + attrs := make([]attribute.KeyValue, 0, len(h)) + for k, v := range h { + attrs = append(attrs, key(k).StringSlice(v)) + } + return attrs +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func (c *httpConv) ClientStatus(code int) (codes.Code, string) { + if code < 100 || code >= 600 { + return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) + } + if code >= 400 { + return codes.Error, "" + } + return codes.Unset, "" +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func (c *httpConv) ServerStatus(code int) (codes.Code, string) { + if code < 100 || code >= 600 { + return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) + } + if code >= 500 { + return codes.Error, "" + } + return codes.Unset, "" +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go new file mode 100644 index 000000000..bde889343 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go @@ -0,0 +1,368 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/semconvutil/netconv.go.tmpl + +// Copyright The OpenTelemetry Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" + +import ( + "net" + "strconv" + "strings" + + "go.opentelemetry.io/otel/attribute" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" +) + +// NetTransport returns a trace attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func NetTransport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// NetClient returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. +func NetClient(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// NetServer returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. +func NetServer(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} + +// netConv are the network semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type netConv struct { + NetHostNameKey attribute.Key + NetHostPortKey attribute.Key + NetPeerNameKey attribute.Key + NetPeerPortKey attribute.Key + NetSockFamilyKey attribute.Key + NetSockPeerAddrKey attribute.Key + NetSockPeerPortKey attribute.Key + NetSockHostAddrKey attribute.Key + NetSockHostPortKey attribute.Key + NetTransportOther attribute.KeyValue + NetTransportTCP attribute.KeyValue + NetTransportUDP attribute.KeyValue + NetTransportInProc attribute.KeyValue +} + +var nc = &netConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +func (c *netConv) Transport(network string) attribute.KeyValue { + switch network { + case "tcp", "tcp4", "tcp6": + return c.NetTransportTCP + case "udp", "udp4", "udp6": + return c.NetTransportUDP + case "unix", "unixgram", "unixpacket": + return c.NetTransportInProc + default: + // "ip:*", "ip4:*", and "ip6:*" all are considered other. + return c.NetTransportOther + } +} + +// Host returns attributes for a network host address. +func (c *netConv) Host(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.HostName(h)) + if p > 0 { + attrs = append(attrs, c.HostPort(int(p))) + } + return attrs +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func (c *netConv) Server(address string, ln net.Listener) []attribute.KeyValue { + if ln == nil { + return c.Host(address) + } + + lAddr := ln.Addr() + if lAddr == nil { + return c.Host(address) + } + + hostName, hostPort := splitHostPort(address) + sockHostAddr, sockHostPort := splitHostPort(lAddr.String()) + network := lAddr.Network() + sockFamily := family(network, sockHostAddr) + + n := nonZeroStr(hostName, network, sockHostAddr, sockFamily) + n += positiveInt(hostPort, sockHostPort) + attr := make([]attribute.KeyValue, 0, n) + if hostName != "" { + attr = append(attr, c.HostName(hostName)) + if hostPort > 0 { + // Only if net.host.name is set should net.host.port be. + attr = append(attr, c.HostPort(hostPort)) + } + } + if network != "" { + attr = append(attr, c.Transport(network)) + } + if sockFamily != "" { + attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) + } + if sockHostAddr != "" { + attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) + if sockHostPort > 0 { + // Only if net.sock.host.addr is set should net.sock.host.port be. + attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) + } + } + return attr +} + +func (c *netConv) HostName(name string) attribute.KeyValue { + return c.NetHostNameKey.String(name) +} + +func (c *netConv) HostPort(port int) attribute.KeyValue { + return c.NetHostPortKey.Int(port) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func (c *netConv) Client(address string, conn net.Conn) []attribute.KeyValue { + if conn == nil { + return c.Peer(address) + } + + lAddr, rAddr := conn.LocalAddr(), conn.RemoteAddr() + + var network string + switch { + case lAddr != nil: + network = lAddr.Network() + case rAddr != nil: + network = rAddr.Network() + default: + return c.Peer(address) + } + + peerName, peerPort := splitHostPort(address) + var ( + sockFamily string + sockPeerAddr string + sockPeerPort int + sockHostAddr string + sockHostPort int + ) + + if lAddr != nil { + sockHostAddr, sockHostPort = splitHostPort(lAddr.String()) + } + + if rAddr != nil { + sockPeerAddr, sockPeerPort = splitHostPort(rAddr.String()) + } + + switch { + case sockHostAddr != "": + sockFamily = family(network, sockHostAddr) + case sockPeerAddr != "": + sockFamily = family(network, sockPeerAddr) + } + + n := nonZeroStr(peerName, network, sockPeerAddr, sockHostAddr, sockFamily) + n += positiveInt(peerPort, sockPeerPort, sockHostPort) + attr := make([]attribute.KeyValue, 0, n) + if peerName != "" { + attr = append(attr, c.PeerName(peerName)) + if peerPort > 0 { + // Only if net.peer.name is set should net.peer.port be. + attr = append(attr, c.PeerPort(peerPort)) + } + } + if network != "" { + attr = append(attr, c.Transport(network)) + } + if sockFamily != "" { + attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) + } + if sockPeerAddr != "" { + attr = append(attr, c.NetSockPeerAddrKey.String(sockPeerAddr)) + if sockPeerPort > 0 { + // Only if net.sock.peer.addr is set should net.sock.peer.port be. + attr = append(attr, c.NetSockPeerPortKey.Int(sockPeerPort)) + } + } + if sockHostAddr != "" { + attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) + if sockHostPort > 0 { + // Only if net.sock.host.addr is set should net.sock.host.port be. + attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) + } + } + return attr +} + +func family(network, address string) string { + switch network { + case "unix", "unixgram", "unixpacket": + return "unix" + default: + if ip := net.ParseIP(address); ip != nil { + if ip.To4() == nil { + return "inet6" + } + return "inet" + } + } + return "" +} + +func nonZeroStr(strs ...string) int { + var n int + for _, str := range strs { + if str != "" { + n++ + } + } + return n +} + +func positiveInt(ints ...int) int { + var n int + for _, i := range ints { + if i > 0 { + n++ + } + } + return n +} + +// Peer returns attributes for a network peer address. +func (c *netConv) Peer(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.PeerName(h)) + if p > 0 { + attrs = append(attrs, c.PeerPort(int(p))) + } + return attrs +} + +func (c *netConv) PeerName(name string) attribute.KeyValue { + return c.NetPeerNameKey.String(name) +} + +func (c *netConv) PeerPort(port int) attribute.KeyValue { + return c.NetPeerPortKey.Int(port) +} + +func (c *netConv) SockPeerAddr(addr string) attribute.KeyValue { + return c.NetSockPeerAddrKey.String(addr) +} + +func (c *netConv) SockPeerPort(port int) attribute.KeyValue { + return c.NetSockPeerPortKey.Int(port) +} + +// splitHostPort splits a network address hostport of the form "host", +// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", +// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and +// port. +// +// An empty host is returned if it is not provided or unparsable. A negative +// port is returned if it is not provided or unparsable. +func splitHostPort(hostport string) (host string, port int) { + port = -1 + + if strings.HasPrefix(hostport, "[") { + addrEnd := strings.LastIndex(hostport, "]") + if addrEnd < 0 { + // Invalid hostport. + return + } + if i := strings.LastIndex(hostport[addrEnd:], ":"); i < 0 { + host = hostport[1:addrEnd] + return + } + } else { + if i := strings.LastIndex(hostport, ":"); i < 0 { + host = hostport + return + } + } + + host, pStr, err := net.SplitHostPort(hostport) + if err != nil { + return + } + + p, err := strconv.ParseUint(pStr, 10, 16) + if err != nil { + return + } + return host, int(p) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go index fd5e1e9bc..e835cac12 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go @@ -20,10 +20,10 @@ import ( "net/http" "net/http/httptrace" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/propagation" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) @@ -109,8 +109,8 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { ctx = httptrace.WithClientTrace(ctx, t.clientTrace(ctx)) } - r = r.WithContext(ctx) - span.SetAttributes(semconv.HTTPClientAttributesFromHTTPRequest(r)...) + r = r.Clone(ctx) // According to RoundTripper spec, we shouldn't modify the origin request. + span.SetAttributes(semconvutil.HTTPClientRequest(r)...) t.propagators.Inject(ctx, propagation.HeaderCarrier(r.Header)) res, err := t.rt.RoundTrip(r) @@ -121,8 +121,8 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { return res, err } - span.SetAttributes(semconv.HTTPAttributesFromHTTPStatusCode(res.StatusCode)...) - span.SetStatus(semconv.SpanStatusFromHTTPStatusCode(res.StatusCode)) + span.SetAttributes(semconvutil.HTTPClientResponse(res)...) + span.SetStatus(semconvutil.HTTPClientStatus(res.StatusCode)) res.Body = newWrappedBody(span, res.Body) return res, err diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go index 210ee0b78..8a5cf07bd 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go @@ -16,11 +16,13 @@ package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http // Version is the current release version of the otelhttp instrumentation. func Version() string { - return "0.35.1" + return "0.46.0" // This string is updated by the pre_release.sh script during release } // SemVersion is the semantic version to be supplied to tracer/meter creation. +// +// Deprecated: Use [Version] instead. func SemVersion() string { - return "semver:" + Version() + return Version() } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go index da6468c4e..11a35ed16 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go @@ -50,7 +50,7 @@ func (w *bodyWrapper) Close() error { var _ http.ResponseWriter = &respWriterWrapper{} // respWriterWrapper wraps a http.ResponseWriter in order to track the number of -// bytes written, the last error, and to catch the returned statusCode +// bytes written, the last error, and to catch the first written statusCode. // TODO: The wrapped http.ResponseWriter doesn't implement any of the optional // types (http.Hijacker, http.Pusher, http.CloseNotifier, http.Flusher, etc) // that may be useful when using it in real life situations. @@ -85,11 +85,15 @@ func (w *respWriterWrapper) Write(p []byte) (int, error) { return n, err } +// WriteHeader persists initial statusCode for span attribution. +// All calls to WriteHeader will be propagated to the underlying ResponseWriter +// and will persist the statusCode from the first call. +// Blocking consecutive calls to WriteHeader alters expected behavior and will +// remove warning logs from net/http where developers will notice incorrect handler implementations. func (w *respWriterWrapper) WriteHeader(statusCode int) { - if w.wroteHeader { - return + if !w.wroteHeader { + w.wroteHeader = true + w.statusCode = statusCode } - w.wroteHeader = true - w.statusCode = statusCode w.ResponseWriter.WriteHeader(statusCode) } diff --git a/vendor/go.opentelemetry.io/otel/.codespellignore b/vendor/go.opentelemetry.io/otel/.codespellignore new file mode 100644 index 000000000..ae6a3bcf1 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.codespellignore @@ -0,0 +1,5 @@ +ot +fo +te +collison +consequentially diff --git a/vendor/go.opentelemetry.io/otel/.codespellrc b/vendor/go.opentelemetry.io/otel/.codespellrc new file mode 100644 index 000000000..4afbb1fb3 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.codespellrc @@ -0,0 +1,10 @@ +# https://github.com/codespell-project/codespell +[codespell] +builtin = clear,rare,informal +check-filenames = +check-hidden = +ignore-words = .codespellignore +interactive = 1 +skip = .git,go.mod,go.sum,semconv,venv,.tools +uri-ignore-words-list = * +write = diff --git a/vendor/go.opentelemetry.io/otel/.gitignore b/vendor/go.opentelemetry.io/otel/.gitignore index 0b605b3d6..924805565 100644 --- a/vendor/go.opentelemetry.io/otel/.gitignore +++ b/vendor/go.opentelemetry.io/otel/.gitignore @@ -2,20 +2,25 @@ Thumbs.db .tools/ +venv/ .idea/ .vscode/ *.iml *.so coverage.* +go.work +go.work.sum gen/ +/example/dice/dice /example/fib/fib /example/fib/traces.txt /example/jaeger/jaeger /example/namedtracer/namedtracer +/example/otel-collector/otel-collector /example/opencensus/opencensus /example/passthrough/passthrough /example/prometheus/prometheus +/example/view/view /example/zipkin/zipkin -/example/otel-collector/otel-collector diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml index 253e3b35b..a62511f38 100644 --- a/vendor/go.opentelemetry.io/otel/.golangci.yml +++ b/vendor/go.opentelemetry.io/otel/.golangci.yml @@ -9,22 +9,20 @@ linters: disable-all: true # Specifically enable linters we want to use. enable: - - deadcode - depguard - errcheck - godot - - gofmt + - gofumpt - goimports + - gosec - gosimple - govet - ineffassign - misspell - revive - staticcheck - - structcheck - typecheck - unused - - varcheck issues: # Maximum issues count per one linter. @@ -56,6 +54,20 @@ issues: text: "calls to (.+) only in main[(][)] or init[(][)] functions" linters: - revive + # It's okay to not run gosec in a test. + - path: _test\.go + linters: + - gosec + # Igonoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand) + # as we commonly use it in tests and examples. + - text: "G404:" + linters: + - gosec + # Igonoring gosec G402: TLS MinVersion too low + # as the https://pkg.go.dev/crypto/tls#Config handles MinVersion default well. + - text: "G402: TLS MinVersion too low." + linters: + - gosec include: # revive exported should have comment or be unexported. - EXC0012 @@ -64,30 +76,67 @@ issues: linters-settings: depguard: - # Check the list against standard lib. - # Default: false - include-go-root: true - # A list of packages for the list type specified. - # Default: [] - packages: - - "crypto/md5" - - "crypto/sha1" - - "crypto/**/pkix" - ignore-file-rules: - - "**/*_test.go" - additional-guards: - # Do not allow testing packages in non-test files. - - list-type: denylist - include-go-root: true - packages: - - testing - - github.com/stretchr/testify - ignore-file-rules: - - "**/*_test.go" - - "**/*test/*.go" - - "**/internal/matchers/*.go" + rules: + non-tests: + files: + - "!$test" + - "!**/*test/*.go" + - "!**/internal/matchers/*.go" + deny: + - pkg: "testing" + - pkg: "github.com/stretchr/testify" + - pkg: "crypto/md5" + - pkg: "crypto/sha1" + - pkg: "crypto/**/pkix" + otlp-internal: + files: + - "!**/exporters/otlp/internal/**/*.go" + deny: + - pkg: "go.opentelemetry.io/otel/exporters/otlp/internal" + desc: Do not use cross-module internal packages. + otlptrace-internal: + files: + - "!**/exporters/otlp/otlptrace/*.go" + - "!**/exporters/otlp/otlptrace/internal/**.go" + deny: + - pkg: "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" + desc: Do not use cross-module internal packages. + otlpmetric-internal: + files: + - "!**/exporters/otlp/otlpmetric/internal/*.go" + - "!**/exporters/otlp/otlpmetric/internal/**/*.go" + deny: + - pkg: "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + desc: Do not use cross-module internal packages. + otel-internal: + files: + - "**/sdk/*.go" + - "**/sdk/**/*.go" + - "**/exporters/*.go" + - "**/exporters/**/*.go" + - "**/schema/*.go" + - "**/schema/**/*.go" + - "**/metric/*.go" + - "**/metric/**/*.go" + - "**/bridge/*.go" + - "**/bridge/**/*.go" + - "**/example/*.go" + - "**/example/**/*.go" + - "**/trace/*.go" + - "**/trace/**/*.go" + deny: + - pkg: "go.opentelemetry.io/otel/internal$" + desc: Do not use cross-module internal packages. + - pkg: "go.opentelemetry.io/otel/internal/attribute" + desc: Do not use cross-module internal packages. + - pkg: "go.opentelemetry.io/otel/internal/internaltest" + desc: Do not use cross-module internal packages. + - pkg: "go.opentelemetry.io/otel/internal/matchers" + desc: Do not use cross-module internal packages. godot: exclude: + # Exclude links. + - '^ *\[[^]]+\]:' # Exclude sentence fragments for lists. - '^[ ]*[-•]' # Exclude sentences prefixing a list. @@ -114,8 +163,9 @@ linters-settings: - name: constant-logical-expr disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument + # TODO (#3372) re-enable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 - name: context-as-argument - disabled: false + disabled: true arguments: allowTypesBefore: "*testing.T" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type diff --git a/vendor/go.opentelemetry.io/otel/.lycheeignore b/vendor/go.opentelemetry.io/otel/.lycheeignore index 545d63452..40d62fa2e 100644 --- a/vendor/go.opentelemetry.io/otel/.lycheeignore +++ b/vendor/go.opentelemetry.io/otel/.lycheeignore @@ -1,3 +1,6 @@ http://localhost http://jaeger-collector https://github.com/open-telemetry/opentelemetry-go/milestone/ +https://github.com/open-telemetry/opentelemetry-go/projects +file:///home/runner/work/opentelemetry-go/opentelemetry-go/libraries +file:///home/runner/work/opentelemetry-go/opentelemetry-go/manual diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md index 906e17ce9..c4e7ad475 100644 --- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -8,6 +8,820 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.20.0/0.43.0] 2023-11-10 + +This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementors need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this. + +### Added + +- Add `go.opentelemetry.io/otel/bridge/opencensus.InstallTraceBridge`, which installs the OpenCensus trace bridge, and replaces `opencensus.NewTracer`. (#4567) +- Add scope version to trace and metric bridges in `go.opentelemetry.io/otel/bridge/opencensus`. (#4584) +- Add the `go.opentelemetry.io/otel/trace/embedded` package to be embedded in the exported trace API interfaces. (#4620) +- Add the `go.opentelemetry.io/otel/trace/noop` package as a default no-op implementation of the trace API. (#4620) +- Add context propagation in `go.opentelemetry.io/otel/example/dice`. (#4644) +- Add view configuration to `go.opentelemetry.io/otel/example/prometheus`. (#4649) +- Add `go.opentelemetry.io/otel/metric.WithExplicitBucketBoundaries`, which allows defining default explicit bucket boundaries when creating histogram instruments. (#4603) +- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4660) +- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4660) +- Add Summary, SummaryDataPoint, and QuantileValue to `go.opentelemetry.io/sdk/metric/metricdata`. (#4622) +- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` now supports exemplars from OpenCensus. (#4585) +- Add support for `WithExplicitBucketBoundaries` in `go.opentelemetry.io/otel/sdk/metric`. (#4605) +- Add support for Summary metrics in `go.opentelemetry.io/otel/bridge/opencensus`. (#4668) + +### Deprecated + +- Deprecate `go.opentelemetry.io/otel/bridge/opencensus.NewTracer` in favor of `opencensus.InstallTraceBridge`. (#4567) +- Deprecate `go.opentelemetry.io/otel/example/fib` package is in favor of `go.opentelemetry.io/otel/example/dice`. (#4618) +- Deprecate `go.opentelemetry.io/otel/trace.NewNoopTracerProvider`. + Use the added `NewTracerProvider` function in `go.opentelemetry.io/otel/trace/noop` instead. (#4620) +- Deprecate `go.opentelemetry.io/otel/example/view` package in favor of `go.opentelemetry.io/otel/example/prometheus`. (#4649) +- Deprecate `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4693) + +### Changed + +- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` returns a `*MetricProducer` struct instead of the metric.Producer interface. (#4583) +- The `TracerProvider` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.TracerProvider` type. + This extends the `TracerProvider` interface and is is a breaking change for any existing implementation. + Implementors need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) +- The `Tracer` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Tracer` type. + This extends the `Tracer` interface and is is a breaking change for any existing implementation. + Implementors need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) +- The `Span` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Span` type. + This extends the `Span` interface and is is a breaking change for any existing implementation. + Implementors need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) +- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4670) +- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4670) +- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4669) +- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4669) +- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4679) +- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4679) + +### Fixed + +- Fix improper parsing of characters such us `+`, `/` by `Parse` in `go.opentelemetry.io/otel/baggage` as they were rendered as a whitespace. (#4667) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_RESOURCE_ATTRIBUTES` in `go.opentelemetry.io/otel/sdk/resource` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracegrpc` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp` as they were rendered as a whitespace. (#4699) +- In `go.opentelemetry.op/otel/exporters/prometheus`, the exporter no longer `Collect`s metrics after `Shutdown` is invoked. (#4648) +- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4695) +- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4695) + +## [1.19.0/0.42.0/0.0.7] 2023-09-28 + +This release contains the first stable release of the OpenTelemetry Go [metric SDK]. +Our project stability guarantees now apply to the `go.opentelemetry.io/otel/sdk/metric` package. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Add the "Roll the dice" getting started application example in `go.opentelemetry.io/otel/example/dice`. (#4539) +- The `WithWriter` and `WithPrettyPrint` options to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to set a custom `io.Writer`, and allow displaying the output in human-readable JSON. (#4507) + +### Changed + +- Allow '/' characters in metric instrument names. (#4501) +- The exporter in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` does not prettify its output by default anymore. (#4507) +- Upgrade `gopkg.io/yaml` from `v2` to `v3` in `go.opentelemetry.io/otel/schema`. (#4535) + +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the Prometheus metric on every `Collect` if we know the scope is invalid. (#4499) + +### Removed + +- Remove `"go.opentelemetry.io/otel/bridge/opencensus".NewMetricExporter`, which is replaced by `NewMetricProducer`. (#4566) + +## [1.19.0-rc.1/0.42.0-rc.1] 2023-09-14 + +This is a release candidate for the v1.19.0/v0.42.0 release. +That release is expected to include the `v1` release of the OpenTelemetry Go metric SDK and will provide stability guarantees of that SDK. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Changed + +- Allow '/' characters in metric instrument names. (#4501) + +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the prometheus metric on every `Collect` if we know the scope is invalid. (#4499) + +## [1.18.0/0.41.0/0.0.6] 2023-09-12 + +This release drops the compatibility guarantee of [Go 1.19]. + +### Added + +- Add `WithProducer` option in `go.opentelemetry.op/otel/exporters/prometheus` to restore the ability to register producers on the prometheus exporter's manual reader. (#4473) +- Add `IgnoreValue` option in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest` to allow ignoring values when comparing metrics. (#4447) + +### Changed + +- Use a `TestingT` interface instead of `*testing.T` struct in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest`. (#4483) + +### Deprecated + +- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` was deprecated in `v0.35.0` (#3541). + The deprecation notice format for the function has been corrected to trigger Go documentation and build tooling. (#4470) + +### Removed + +- Removed the deprecated `go.opentelemetry.io/otel/exporters/jaeger` package. (#4467) +- Removed the deprecated `go.opentelemetry.io/otel/example/jaeger` package. (#4467) +- Removed the deprecated `go.opentelemetry.io/otel/sdk/metric/aggregation` package. (#4468) +- Removed the deprecated internal packages in `go.opentelemetry.io/otel/exporters/otlp` and its sub-packages. (#4469) +- Dropped guaranteed support for versions of Go less than 1.20. (#4481) + +## [1.17.0/0.40.0/0.0.5] 2023-08-28 + +### Added + +- Export the `ManualReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Export the `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Add support for exponential histogram aggregations. + A histogram can be configured as an exponential histogram using a view with `"go.opentelemetry.io/otel/sdk/metric".ExponentialHistogram` as the aggregation. (#4245) +- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) +- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) +- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable. (#4287) +- Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#4306) +- Add info and debug logging to the metric SDK in `go.opentelemetry.io/otel/sdk/metric`. (#4315) +- The `go.opentelemetry.io/otel/semconv/v1.21.0` package. + The package contains semantic conventions from the `v1.21.0` version of the OpenTelemetry Semantic Conventions. (#4362) +- Accept 201 to 299 HTTP status as success in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4365) +- Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) +- Expand the set of units supported by the Prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) +- Move the `Aggregation` interface and its implementations from `go.opentelemetry.io/otel/sdk/metric/aggregation` to `go.opentelemetry.io/otel/sdk/metric`. (#4435) +- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) +- Add the `NewAllowKeysFilter` and `NewDenyKeysFilter` functions to `go.opentelemetry.io/otel/attribute` to allow convenient creation of allow-keys and deny-keys filters. (#4444) +- Support Go 1.21. (#4463) + +### Changed + +- Starting from `v1.21.0` of semantic conventions, `go.opentelemetry.io/otel/semconv/{version}/httpconv` and `go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no longer be published. (#4145) +- Log duplicate instrument conflict at a warning level instead of info in `go.opentelemetry.io/otel/sdk/metric`. (#4202) +- Return an error on the creation of new instruments in `go.opentelemetry.io/otel/sdk/metric` if their name doesn't pass regexp validation. (#4210) +- `NewManualReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*ManualReader` instead of `Reader`. (#4244) +- `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*PeriodicReader` instead of `Reader`. (#4244) +- Count the Collect time in the `PeriodicReader` timeout in `go.opentelemetry.io/otel/sdk/metric`. (#4221) +- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- If an attribute set is omitted from an async callback, the previous value will no longer be exported in `go.opentelemetry.io/otel/sdk/metric`. (#4290) +- If an attribute set is observed multiple times in an async callback in `go.opentelemetry.io/otel/sdk/metric`, the values will be summed instead of the last observation winning. (#4289) +- Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) +- Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) +- `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) +- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.21.0`. (#4408) +- Increase instrument name maximum length from 63 to 255 characters in `go.opentelemetry.io/otel/sdk/metric`. (#4434) +- Add `go.opentelemetry.op/otel/sdk/metric.WithProducer` as an `Option` for `"go.opentelemetry.io/otel/sdk/metric".NewManualReader` and `"go.opentelemetry.io/otel/sdk/metric".NewPeriodicReader`. (#4346) + +### Removed + +- Remove `Reader.RegisterProducer` in `go.opentelemetry.io/otel/metric`. + Use the added `WithProducer` option instead. (#4346) +- Remove `Reader.ForceFlush` in `go.opentelemetry.io/otel/metric`. + Notice that `PeriodicReader.ForceFlush` is still available. (#4375) + +### Fixed + +- Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) +- Log an error for calls to `NewView` in `go.opentelemetry.io/otel/sdk/metric` that have empty criteria. (#4307) +- Fix `"go.opentelemetry.io/otel/sdk/resource".WithHostID()` to not set an empty `host.id`. (#4317) +- Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) +- Detect duplicate instruments for case-insensitive names in `go.opentelemetry.io/otel/sdk/metric`. (#4338) +- The `ManualReader` will not panic if `AggregationSelector` returns `nil` in `go.opentelemetry.io/otel/sdk/metric`. (#4350) +- If a `Reader`'s `AggregationSelector` returns `nil` or `DefaultAggregation` the pipeline will use the default aggregation. (#4350) +- Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) +- Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) +- Improve context cancellation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4404, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4407, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4400, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) +- Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) +- Do not append `_total` if the counter already has that suffix for the Prometheus exproter in `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) +- Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) +- Use the first-seen instrument name during instrument name conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4428) + +### Deprecated + +- The `go.opentelemetry.io/otel/exporters/jaeger` package is deprecated. + OpenTelemetry dropped support for Jaeger exporter in July 2023. + Use `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` + or `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` instead. (#4423) +- The `go.opentelemetry.io/otel/example/jaeger` package is deprecated. (#4423) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/internal` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/internal/envconfig` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/internal/retry` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/sdk/metric/aggregation` package is deprecated. + Use the aggregation types added to `go.opentelemetry.io/otel/sdk/metric` instead. (#4435) + +## [1.16.0/0.39.0] 2023-05-18 + +This release contains the first stable release of the OpenTelemetry Go [metric API]. +Our project stability guarantees now apply to the `go.opentelemetry.io/otel/metric` package. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- The `go.opentelemetry.io/otel/semconv/v1.19.0` package. + The package contains semantic conventions from the `v1.19.0` version of the OpenTelemetry specification. (#3848) +- The `go.opentelemetry.io/otel/semconv/v1.20.0` package. + The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) +- The Exponential Histogram data types in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#4165) +- OTLP metrics exporter now supports the Exponential Histogram Data Type. (#4222) +- Fix serialization of `time.Time` zero values in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` packages. (#4271) + +### Changed + +- Use `strings.Cut()` instead of `string.SplitN()` for better readability and memory use. (#4049) +- `MeterProvider` returns noop meters once it has been shutdown. (#4154) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed. + Use `go.opentelemetry.io/otel/metric` instead. (#4055) + +### Fixed + +- Fix build for BSD based systems in `go.opentelemetry.io/otel/sdk/resource`. (#4077) + +## [1.16.0-rc.1/0.39.0-rc.1] 2023-05-03 + +This is a release candidate for the v1.16.0/v0.39.0 release. +That release is expected to include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#4039) + - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. + - Use `GetMeterProivder` for a global `metric.MeterProvider`. + - Use `SetMeterProivder` to set the global `metric.MeterProvider`. + +### Changed + +- Move the `go.opentelemetry.io/otel/metric` module to the `stable-v1` module set. + This stages the metric API to be released as a stable module. (#4038) + +### Removed + +- The `go.opentelemetry.io/otel/metric/global` package is removed. + Use `go.opentelemetry.io/otel` instead. (#4039) + +## [1.15.1/0.38.1] 2023-05-02 + +### Fixed + +- Remove unused imports from `sdk/resource/host_id_bsd.go` which caused build failures. (#4040, #4041) + +## [1.15.0/0.38.0] 2023-04-27 + +### Added + +- The `go.opentelemetry.io/otel/metric/embedded` package. (#3916) +- The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949) +- Add a `WithNamespace` option to `go.opentelemetry.io/otel/exporters/prometheus` to allow users to prefix metrics with a namespace. (#3970) +- The following configuration types were added to `go.opentelemetry.io/otel/metric/instrument` to be used in the configuration of measurement methods. (#3971) + - The `AddConfig` used to hold configuration for addition measurements + - `NewAddConfig` used to create a new `AddConfig` + - `AddOption` used to configure an `AddConfig` + - The `RecordConfig` used to hold configuration for recorded measurements + - `NewRecordConfig` used to create a new `RecordConfig` + - `RecordOption` used to configure a `RecordConfig` + - The `ObserveConfig` used to hold configuration for observed measurements + - `NewObserveConfig` used to create a new `ObserveConfig` + - `ObserveOption` used to configure an `ObserveConfig` +- `WithAttributeSet` and `WithAttributes` are added to `go.opentelemetry.io/otel/metric/instrument`. + They return an option used during a measurement that defines the attribute Set associated with the measurement. (#3971) +- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` to return the OTLP metrics client version. (#3956) +- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlptrace` to return the OTLP trace client version. (#3956) + +### Changed + +- The `Extrema` in `go.opentelemetry.io/otel/sdk/metric/metricdata` is redefined with a generic argument of `[N int64 | float64]`. (#3870) +- Update all exported interfaces from `go.opentelemetry.io/otel/metric` to embed their corresponding interface from `go.opentelemetry.io/otel/metric/embedded`. + This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916) +- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) + - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` +- Add all the methods from `"go.opentelemetry.io/otel/trace".SpanContext` to `bridgeSpanContext` by embedding `otel.SpanContext` in `bridgeSpanContext`. (#3966) +- Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974) +- The measurement methods for all instruments in `go.opentelemetry.io/otel/metric/instrument` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) + - The `Int64Counter.Add` method now accepts `...AddOption` + - The `Float64Counter.Add` method now accepts `...AddOption` + - The `Int64UpDownCounter.Add` method now accepts `...AddOption` + - The `Float64UpDownCounter.Add` method now accepts `...AddOption` + - The `Int64Histogram.Record` method now accepts `...RecordOption` + - The `Float64Histogram.Record` method now accepts `...RecordOption` + - The `Int64Observer.Observe` method now accepts `...ObserveOption` + - The `Float64Observer.Observe` method now accepts `...ObserveOption` +- The `Observer` methods in `go.opentelemetry.io/otel/metric` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) + - The `Observer.ObserveInt64` method now accepts `...ObserveOption` + - The `Observer.ObserveFloat64` method now accepts `...ObserveOption` +- Move global metric back to `go.opentelemetry.io/otel/metric/global` from `go.opentelemetry.io/otel`. (#3986) + +### Fixed + +- `TracerProvider` allows calling `Tracer()` while it's shutting down. + It used to deadlock. (#3924) +- Use the SDK version for the Telemetry SDK resource detector in `go.opentelemetry.io/otel/sdk/resource`. (#3949) +- Fix a data race in `SpanProcessor` returned by `NewSimpleSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace`. (#3951) +- Automatically figure out the default aggregation with `aggregation.Default`. (#3967) + +### Deprecated + +- The `go.opentelemetry.io/otel/metric/instrument` package is deprecated. + Use the equivalent types added to `go.opentelemetry.io/otel/metric` instead. (#4018) + +## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 + +This is a release candidate for the v1.15.0/v0.38.0 release. +That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- The `WithHostID` option to `go.opentelemetry.io/otel/sdk/resource`. (#3812) +- The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828) +- The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`. + Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849) +- Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895) +- The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900) +- Added a log message warning about usage of `SimpleSpanProcessor` in production environments. (#3854) + +### Changed + +- Optimize memory allocation when creation a new `Set` using `NewSet` or `NewSetWithFiltered` in `go.opentelemetry.io/otel/attribute`. (#3832) +- Optimize memory allocation when creation new metric instruments in `go.opentelemetry.io/otel/sdk/metric`. (#3832) +- Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) +- The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844) +- Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) +- The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853) +- Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892) +- Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) +- Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) +- The internal logging changes the verbosity level of info to `V(4)`, the verbosity level of debug to `V(8)`. (#3900) + +### Fixed + +- `TracerProvider` consistently doesn't allow to register a `SpanProcessor` after shutdown. (#3845) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829) +- The unneeded `Synchronous` interface in `go.opentelemetry.io/otel/metric/instrument` was removed. (#3892) +- The `Float64ObserverConfig` and `NewFloat64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. + Use the added `float64` instrument configuration instead. (#3895) +- The `Int64ObserverConfig` and `NewInt64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. + Use the added `int64` instrument configuration instead. (#3895) +- The `NewNoopMeter` function in `go.opentelemetry.io/otel/metric`, use `NewMeterProvider().Meter("")` instead. (#3893) + +## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 + +This is a release candidate for the v1.15.0/v0.38.0 release. +That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +This release drops the compatibility guarantee of [Go 1.18]. + +### Added + +- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#3818) + - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. + - Use `GetMeterProivder` for a global `metric.MeterProvider`. + - Use `SetMeterProivder` to set the global `metric.MeterProvider`. + +### Changed + +- Dropped compatibility testing for [Go 1.18]. + The project no longer guarantees support for this version of Go. (#3813) + +### Fixed + +- Handle empty environment variable as it they were not set. (#3764) +- Clarify the `httpconv` and `netconv` packages in `go.opentelemetry.io/otel/semconv/*` provide tracing semantic conventions. (#3823) +- Fix race conditions in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic. (#3899) +- Fix sending nil `scopeInfo` to metrics channel in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic in `github.com/prometheus/client_golang/prometheus`. (#3899) + +### Deprecated + +- The `go.opentelemetry.io/otel/metric/global` package is deprecated. + Use `go.opentelemetry.io/otel` instead. (#3818) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/unit` package is removed. (#3814) + +## [1.14.0/0.37.0/0.0.4] 2023-02-27 + +This release is the last to support [Go 1.18]. +The next release will require at least [Go 1.19]. + +### Added + +- The `event` type semantic conventions are added to `go.opentelemetry.io/otel/semconv/v1.17.0`. (#3697) +- Support [Go 1.20]. (#3693) +- The `go.opentelemetry.io/otel/semconv/v1.18.0` package. + The package contains semantic conventions from the `v1.18.0` version of the OpenTelemetry specification. (#3719) + - The following `const` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: + - `OtelScopeNameKey` -> `OTelScopeNameKey` + - `OtelScopeVersionKey` -> `OTelScopeVersionKey` + - `OtelLibraryNameKey` -> `OTelLibraryNameKey` + - `OtelLibraryVersionKey` -> `OTelLibraryVersionKey` + - `OtelStatusCodeKey` -> `OTelStatusCodeKey` + - `OtelStatusDescriptionKey` -> `OTelStatusDescriptionKey` + - `OtelStatusCodeOk` -> `OTelStatusCodeOk` + - `OtelStatusCodeError` -> `OTelStatusCodeError` + - The following `func` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: + - `OtelScopeName` -> `OTelScopeName` + - `OtelScopeVersion` -> `OTelScopeVersion` + - `OtelLibraryName` -> `OTelLibraryName` + - `OtelLibraryVersion` -> `OTelLibraryVersion` + - `OtelStatusDescription` -> `OTelStatusDescription` +- A `IsSampled` method is added to the `SpanContext` implementation in `go.opentelemetry.io/otel/bridge/opentracing` to expose the span sampled state. + See the [README](./bridge/opentracing/README.md) for more information. (#3570) +- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/metric`. (#3738) +- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/trace`. (#3739) +- The following environment variables are supported by the periodic `Reader` in `go.opentelemetry.io/otel/sdk/metric`. (#3763) + - `OTEL_METRIC_EXPORT_INTERVAL` sets the time between collections and exports. + - `OTEL_METRIC_EXPORT_TIMEOUT` sets the timeout an export is attempted. + +### Changed + +- Fall-back to `TextMapCarrier` when it's not `HttpHeader`s in `go.opentelemetry.io/otel/bridge/opentracing`. (#3679) +- The `Collect` method of the `"go.opentelemetry.io/otel/sdk/metric".Reader` interface is updated to accept the `metricdata.ResourceMetrics` value the collection will be made into. + This change is made to enable memory reuse by SDK users. (#3732) +- The `WithUnit` option in `go.opentelemetry.io/otel/sdk/metric/instrument` is updated to accept a `string` for the unit value. (#3776) + +### Fixed + +- Ensure `go.opentelemetry.io/otel` does not use generics. (#3723, #3725) +- Multi-reader `MeterProvider`s now export metrics for all readers, instead of just the first reader. (#3720, #3724) +- Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) +- Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) +- Data race issue in OTLP exporter retry mechanism. (#3755, #3756) +- Wrapping empty errors when exporting in `go.opentelemetry.io/otel/sdk/metric`. (#3698, #3772) +- Incorrect "all" and "resource" definition for schema files in `go.opentelemetry.io/otel/schema/v1.1`. (#3777) + +### Deprecated + +- The `go.opentelemetry.io/otel/metric/unit` package is deprecated. + Use the equivalent unit string instead. (#3776) + - Use `"1"` instead of `unit.Dimensionless` + - Use `"By"` instead of `unit.Bytes` + - Use `"ms"` instead of `unit.Milliseconds` + +## [1.13.0/0.36.0] 2023-02-07 + +### Added + +- Attribute `KeyValue` creations functions to `go.opentelemetry.io/otel/semconv/v1.17.0` for all non-enum semantic conventions. + These functions ensure semantic convention type correctness. (#3675) + +### Fixed + +- Removed the `http.target` attribute from being added by `ServerRequest` in the following packages. (#3687) + - `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.14.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.15.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.16.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.17.0/httpconv` + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncint64` package is removed. (#3631) + +## [1.12.0/0.35.0] 2023-01-28 + +### Added + +- The `WithInt64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. + This options is used to configure `int64` Observer callbacks during their creation. (#3507) +- The `WithFloat64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. + This options is used to configure `float64` Observer callbacks during their creation. (#3507) +- The `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric`. + These additions are used to enable external metric Producers. (#3524) +- The `Callback` function type to `go.opentelemetry.io/otel/metric`. + This new named function type is registered with a `Meter`. (#3564) +- The `go.opentelemetry.io/otel/semconv/v1.13.0` package. + The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499) + - The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPAttributesFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientResponse` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPClientAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerMetricAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `NetAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `Transport` in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` and `ClientRequest` or `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`. + - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. +- The `go.opentelemetry.io/otel/semconv/v1.14.0` package. + The package contains semantic conventions from the `v1.14.0` version of the OpenTelemetry specification. (#3566) +- The `go.opentelemetry.io/otel/semconv/v1.15.0` package. + The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578) +- The `go.opentelemetry.io/otel/semconv/v1.16.0` package. + The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579) +- Metric instruments to `go.opentelemetry.io/otel/metric/instrument`. + These instruments are use as replacements of the deprecated `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586) + - `Float64ObservableCounter` replaces the `asyncfloat64.Counter` + - `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter` + - `Float64ObservableGauge` replaces the `asyncfloat64.Gauge` + - `Int64ObservableCounter` replaces the `asyncint64.Counter` + - `Int64ObservableUpDownCounter` replaces the `asyncint64.UpDownCounter` + - `Int64ObservableGauge` replaces the `asyncint64.Gauge` + - `Float64Counter` replaces the `syncfloat64.Counter` + - `Float64UpDownCounter` replaces the `syncfloat64.UpDownCounter` + - `Float64Histogram` replaces the `syncfloat64.Histogram` + - `Int64Counter` replaces the `syncint64.Counter` + - `Int64UpDownCounter` replaces the `syncint64.UpDownCounter` + - `Int64Histogram` replaces the `syncint64.Histogram` +- `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing`. + This is used to create `WrapperTracer` instances from a `TracerProvider`. (#3116) +- The `Extrema` type to `go.opentelemetry.io/otel/sdk/metric/metricdata`. + This type is used to represent min/max values and still be able to distinguish unset and zero values. (#3487) +- The `go.opentelemetry.io/otel/semconv/v1.17.0` package. + The package contains semantic conventions from the `v1.17.0` version of the OpenTelemetry specification. (#3599) + +### Changed + +- Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500) +- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and configuration based on the instrument type. (#3507) + - Use the added `Int64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncint64`. + - Use the added `Float64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncfloat64`. + - Use the added `Int64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncint64`. + - Use the added `Float64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncfloat64`. +- Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package. + This `Registration` can be used to unregister callbacks. (#3522) +- Global error handler uses an atomic value instead of a mutex. (#3543) +- Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541) +- Global logger uses an atomic value instead of a mutex. (#3545) +- The `Shutdown` method of the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` releases all computational resources when called the first time. (#3551) +- The `Sampler` returned from `TraceIDRatioBased` `go.opentelemetry.io/otel/sdk/trace` now uses the rightmost bits for sampling decisions. + This fixes random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) +- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in errors identifying their signal name. + Existing users of the exporters attempting to identify specific errors will need to use `errors.Unwrap()` to get the underlying error. (#3516) +- Exporters from `go.opentelemetry.io/otel/exporters/otlp` will print the final retryable error message when attempts to retry time out. (#3514) +- The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562) + - `InstrumentKindSyncCounter` is renamed to `InstrumentKindCounter` + - `InstrumentKindSyncUpDownCounter` is renamed to `InstrumentKindUpDownCounter` + - `InstrumentKindSyncHistogram` is renamed to `InstrumentKindHistogram` + - `InstrumentKindAsyncCounter` is renamed to `InstrumentKindObservableCounter` + - `InstrumentKindAsyncUpDownCounter` is renamed to `InstrumentKindObservableUpDownCounter` + - `InstrumentKindAsyncGauge` is renamed to `InstrumentKindObservableGauge` +- The `RegisterCallback` method of the `Meter` in `go.opentelemetry.io/otel/metric` changed. + - The named `Callback` replaces the inline function parameter. (#3564) + - `Callback` is required to return an error. (#3576) + - `Callback` accepts the added `Observer` parameter added. + This new parameter is used by `Callback` implementations to observe values for asynchronous instruments instead of calling the `Observe` method of the instrument directly. (#3584) + - The slice of `instrument.Asynchronous` is now passed as a variadic argument. (#3587) +- The exporter from `go.opentelemetry.io/otel/exporters/zipkin` is updated to use the `v1.16.0` version of semantic conventions. + This means it no longer uses the removed `net.peer.ip` or `http.host` attributes to determine the remote endpoint. + Instead it uses the `net.sock.peer` attributes. (#3581) +- The `Min` and `Max` fields of the `HistogramDataPoint` in `go.opentelemetry.io/otel/sdk/metric/metricdata` are now defined with the added `Extrema` type instead of a `*float64`. (#3487) + +### Fixed + +- Asynchronous instruments that use sum aggregators and attribute filters correctly add values from equivalent attribute sets that have been filtered. (#3439, #3549) +- The `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/sdk/metric` only registers a callback for instruments created by that meter. + Trying to register a callback with instruments from a different meter will result in an error being returned. (#3584) + +### Deprecated + +- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. + Use `NewMetricProducer` instead. (#3541) +- The `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/syncint64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `NewWrappedTracerProvider` in `go.opentelemetry.io/otel/bridge/opentracing` is now deprecated. + Use `NewTracerProvider` instead. (#3116) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Int64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Int64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Float64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Float64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64Counter` + - The `UpDownCounter` method is replaced by `Meter.Int64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Int64Histogram` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64Counter` + - The `UpDownCounter` method is replaced by `Meter.Float64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Float64Histogram` + +## [1.11.2/0.34.0] 2022-12-05 + +### Added + +- The `WithView` `Option` is added to the `go.opentelemetry.io/otel/sdk/metric` package. + This option is used to configure the view(s) a `MeterProvider` will use for all `Reader`s that are registered with it. (#3387) +- Add Instrumentation Scope and Version as info metric and label in Prometheus exporter. + This can be disabled using the `WithoutScopeInfo()` option added to that package.(#3273, #3357) +- OTLP exporters now recognize: (#3363) + - `OTEL_EXPORTER_OTLP_INSECURE` + - `OTEL_EXPORTER_OTLP_TRACES_INSECURE` + - `OTEL_EXPORTER_OTLP_METRICS_INSECURE` + - `OTEL_EXPORTER_OTLP_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE` +- The `View` type and related `NewView` function to create a view according to the OpenTelemetry specification are added to `go.opentelemetry.io/otel/sdk/metric`. + These additions are replacements for the `View` type and `New` function from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) +- The `Instrument` and `InstrumentKind` type are added to `go.opentelemetry.io/otel/sdk/metric`. + These additions are replacements for the `Instrument` and `InstrumentKind` types from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) +- The `Stream` type is added to `go.opentelemetry.io/otel/sdk/metric` to define a metric data stream a view will produce. (#3459) +- The `AssertHasAttributes` allows instrument authors to test that datapoints returned have appropriate attributes. (#3487) + +### Changed + +- The `"go.opentelemetry.io/otel/sdk/metric".WithReader` option no longer accepts views to associate with the `Reader`. + Instead, views are now registered directly with the `MeterProvider` via the new `WithView` option. + The views registered with the `MeterProvider` apply to all `Reader`s. (#3387) +- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/sdk/metric".Exporter` interface. (#3260) +- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric".Client` interface. (#3260) +- The `WithTemporalitySelector` and `WithAggregationSelector` `ReaderOption`s have been changed to `ManualReaderOption`s in the `go.opentelemetry.io/otel/sdk/metric` package. (#3260) +- The periodic reader in the `go.opentelemetry.io/otel/sdk/metric` package now uses the temporality and aggregation selectors from its configured exporter instead of accepting them as options. (#3260) + +### Fixed + +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369) +- Remove comparable requirement for `Reader`s. (#3387) +- Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) +- Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) +- Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) +- `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436) +- Re-enabled Attribute Filters in the Metric SDK. (#3396) +- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408) +- Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) +- Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) +- Prevent duplicate Prometheus description, unit, and type. (#3469) +- Prevents panic when using incorrect `attribute.Value.As[Type]Slice()`. (#3489) + +### Removed + +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#3486) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#3486) + +### Deprecated + +- The `go.opentelemetry.io/otel/sdk/metric/view` package is deprecated. + Use `Instrument`, `InstrumentKind`, `View`, and `NewView` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3476) + +## [1.11.1/0.33.0] 2022-10-19 + +### Added + +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` registers with a Prometheus registerer on creation. + By default, it will register with the default Prometheus registerer. + A non-default registerer can be used by passing the `WithRegisterer` option. (#3239) +- Added the `WithAggregationSelector` option to the `go.opentelemetry.io/otel/exporters/prometheus` package to change the default `AggregationSelector` used. (#3341) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` converts the `Resource` associated with metric exports into a `target_info` metric. (#3285) + +### Changed + +- The `"go.opentelemetry.io/otel/exporters/prometheus".New` function is updated to return an error. + It will return an error if the exporter fails to register with Prometheus. (#3239) + +### Fixed + +- The URL-encoded values from the `OTEL_RESOURCE_ATTRIBUTES` environment variable are decoded. (#2963) +- The `baggage.NewMember` function decodes the `value` parameter instead of directly using it. + This fixes the implementation to be compliant with the W3C specification. (#3226) +- Slice attributes of the `attribute` package are now comparable based on their value, not instance. (#3108 #3252) +- The `Shutdown` and `ForceFlush` methods of the `"go.opentelemetry.io/otel/sdk/trace".TraceProvider` no longer return an error when no processor is registered. (#3268) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` cumulatively sums histogram buckets. (#3281) +- The sum of each histogram data point is now uniquely exported by the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) +- Recorded values for asynchronous counters (`Counter` and `UpDownCounter`) are interpreted as exact, not incremental, sum values by the metric SDK. (#3350, #3278) +- `UpDownCounters` are now correctly output as Prometheus gauges in the `go.opentelemetry.io/otel/exporters/prometheus` exporter. (#3358) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` no longer describes the metrics it will send to Prometheus on startup. + Instead the exporter is defined as an "unchecked" collector for Prometheus. + This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now correctly adds `_total` suffixes to counter metrics. (#3360) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now adds a unit suffix to metric names. + This can be disabled using the `WithoutUnits()` option added to that package. (#3352) + +## [1.11.0/0.32.3] 2022-10-12 + +### Added + +- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlptrace/otlptracehttp`). (#3261) + +### Changed + +- `span.SetStatus` has been updated such that calls that lower the status are now no-ops. (#3214) +- Upgrade `golang.org/x/sys/unix` from `v0.0.0-20210423185535-09eb48e85fd7` to `v0.0.0-20220919091848-fb04ddd9f9c8`. + This addresses [GO-2022-0493](https://pkg.go.dev/vuln/GO-2022-0493). (#3235) + +## [0.32.2] Metric SDK (Alpha) - 2022-10-11 + +### Added + +- Added an example of using metric views to customize instruments. (#3177) +- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetrichttp`). (#3261) + +### Changed + +- Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) +- Update histogram default bounds to match the requirements of the latest specification. (#3222) +- Encode the HTTP status code in the OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`) as an integer. (#3265) + +### Fixed + +- Use default view if instrument does not match any registered view of a reader. (#3224, #3237) +- Return the same instrument every time a user makes the exact same instrument creation call. (#3229, #3251) +- Return the existing instrument when a view transforms a creation call to match an existing instrument. (#3240, #3251) +- Log a warning when a conflicting instrument (e.g. description, unit, data-type) is created instead of returning an error. (#3251) +- The OpenCensus bridge no longer sends empty batches of metrics. (#3263) + +## [0.32.1] Metric SDK (Alpha) - 2022-09-22 + +### Changed + +- The Prometheus exporter sanitizes OpenTelemetry instrument names when exporting. + Invalid characters are replaced with `_`. (#3212) + +### Added + +- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been reintroduced. (#3192) +- The OpenCensus bridge example (`go.opentelemetry.io/otel/example/opencensus`) has been reintroduced. (#3206) + +### Fixed + +- Updated go.mods to point to valid versions of the sdk. (#3216) +- Set the `MeterProvider` resource on all exported metric data. (#3218) + +## [0.32.0] Revised Metric SDK (Alpha) - 2022-09-18 + +### Changed + +- The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification. + Please see the package documentation for how the new SDK is initialized and configured. (#3175) +- Update the minimum supported go version to go1.18. Removes support for go1.17 (#3179) + +### Removed + +- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been removed. + A new bridge compliant with the revised metric SDK will be added back in a future release. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/histogram` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/sum` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/basic` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/controllertest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/time` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/export/aggregation` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/export` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/metrictest` package is removed. + A replacement package that supports the new metric SDK will be added back in a future release. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/number` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/basic` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/processortest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/reducer` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/registry` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/sdkapi` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/selector/simple` package is removed, see the new metric SDK. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".ErrUninitializedInstrument` variable was removed. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".ErrBadInstrument` variable was removed. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".Accumulator` type was removed, see the `MeterProvider`in the new metric SDK. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".NewAccumulator` function was removed, see `NewMeterProvider`in the new metric SDK. (#3175) +- The deprecated `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets` function was removed. (#3175) + ## [1.10.0] - 2022-09-09 ### Added @@ -191,7 +1005,7 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod - `OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT` - `OTEL_SPAN_LINK_COUNT_LIMIT` - `OTEL_LINK_ATTRIBUTE_COUNT_LIMIT` - + If the provided environment variables are invalid (negative), the default values would be used. - Rename the `gc` runtime name to `go` (#2560) - Add resource container ID detection. (#2418) @@ -452,7 +1266,7 @@ This release includes an API and SDK for the tracing signal that will comply wit - Setting the global `ErrorHandler` with `"go.opentelemetry.io/otel".SetErrorHandler` multiple times is now supported. (#2160, #2140) - The `"go.opentelemetry.io/otel/attribute".Any` function now supports `int32` values. (#2169) - Multiple calls to `"go.opentelemetry.io/otel/sdk/metric/controller/basic".WithResource()` are handled correctly, and when no resources are provided `"go.opentelemetry.io/otel/sdk/resource".Default()` is used. (#2120) -- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly ommit timestamps. (#2195) +- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly omit timestamps. (#2195) - Fixed typos in resources.go. (#2201) ## [1.0.0-RC2] - 2021-07-26 @@ -898,7 +1712,7 @@ with major version 0. - `NewGRPCDriver` function returns a `ProtocolDriver` that maintains a single gRPC connection to the collector. (#1369) - Added documentation about the project's versioning policy. (#1388) - Added `NewSplitDriver` for OTLP exporter that allows sending traces and metrics to different endpoints. (#1418) -- Added codeql worfklow to GitHub Actions (#1428) +- Added codeql workflow to GitHub Actions (#1428) - Added Gosec workflow to GitHub Actions (#1429) - Add new HTTP driver for OTLP exporter in `exporters/otlp/otlphttp`. Currently it only supports the binary protobuf payloads. (#1420) - Add an OpenCensus exporter bridge. (#1444) @@ -1741,7 +2555,7 @@ There is still a possibility of breaking changes. ### Fixed -- Use stateful batcher on Prometheus exporter fixing regresion introduced in #395. (#428) +- Use stateful batcher on Prometheus exporter fixing regression introduced in #395. (#428) ## [0.2.1] - 2020-01-08 @@ -1907,7 +2721,27 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.10.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.20.0...HEAD +[1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 +[1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0 +[1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1 +[1.18.0/0.41.0/0.0.6]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.18.0 +[1.17.0/0.40.0/0.0.5]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.17.0 +[1.16.0/0.39.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0 +[1.16.0-rc.1/0.39.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0-rc.1 +[1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1 +[1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0 +[1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2 +[1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1 +[1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0 +[1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0 +[1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0 +[1.11.2/0.34.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.2 +[1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1 +[1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0 +[0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2 +[0.32.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.1 +[0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.0 [1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0 [1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0 [1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0 @@ -1959,3 +2793,11 @@ It contains api and sdk for trace and meter. [0.1.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.2 [0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1 [0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0 + +[Go 1.20]: https://go.dev/doc/go1.20 +[Go 1.19]: https://go.dev/doc/go1.19 +[Go 1.18]: https://go.dev/doc/go1.18 + +[metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric +[metric SDK]:https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric +[trace API]:https://pkg.go.dev/go.opentelemetry.io/otel/trace diff --git a/vendor/go.opentelemetry.io/otel/CODEOWNERS b/vendor/go.opentelemetry.io/otel/CODEOWNERS index c4012ed6c..623740007 100644 --- a/vendor/go.opentelemetry.io/otel/CODEOWNERS +++ b/vendor/go.opentelemetry.io/otel/CODEOWNERS @@ -12,6 +12,6 @@ # https://help.github.com/en/articles/about-code-owners # -* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu +* @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu -CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod +CODEOWNERS @MrAlias @MadVikingGod @pellared \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md index 9371a481a..a00dbca7b 100644 --- a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md +++ b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md @@ -6,7 +6,7 @@ OpenTelemetry repo for information on this and other language SIGs. See the [public meeting -notes](https://docs.google.com/document/d/1A63zSWX0x2CyCK_LoNhmQC4rqhLpYXJzXbEPDUQ2n6w/edit#heading=h.9tngw7jdwd6b) +notes](https://docs.google.com/document/d/1E5e7Ld0NuU1iVvf-42tOBpu2VBBLYnh73GJuITGJTTU/edit) for a summary description of past meetings. To request edit access, join the meeting or get in touch on [Slack](https://cloud-native.slack.com/archives/C01NPAXACKT). @@ -28,6 +28,11 @@ precommit` - the `precommit` target is the default). The `precommit` target also fixes the formatting of the code and checks the status of the go module files. +Additionally, there is a `codespell` target that checks for common +typos in the code. It is not run by default, but you can run it +manually with `make codespell`. It will set up a virtual environment +in `venv` and install `codespell` there. + If after running `make precommit` the output of `git status` contains `nothing to commit, working tree clean` then it means that everything is up-to-date and properly formatted. @@ -94,38 +99,66 @@ request ID to the entry you added to `CHANGELOG.md`. ### How to Get PRs Merged -A PR is considered to be **ready to merge** when: - -* It has received two approvals from Collaborators/Maintainers (at - different companies). This is not enforced through technical means - and a PR may be **ready to merge** with a single approval if the change - and its approach have been discussed and consensus reached. -* Feedback has been addressed. -* Any substantive changes to your PR will require that you clear any prior - Approval reviews, this includes changes resulting from other feedback. Unless - the approver explicitly stated that their approval will persist across - changes it should be assumed that the PR needs their review again. Other - project members (e.g. approvers, maintainers) can help with this if there are - any questions or if you forget to clear reviews. -* It has been open for review for at least one working day. This gives - people reasonable time to review. -* Trivial changes (typo, cosmetic, doc, etc.) do not have to wait for - one day and may be merged with a single Maintainer's approval. -* `CHANGELOG.md` has been updated to reflect what has been - added, changed, removed, or fixed. -* `README.md` has been updated if necessary. -* Urgent fix can take exception as long as it has been actively - communicated. - -Any Maintainer can merge the PR once it is **ready to merge**. +A PR is considered **ready to merge** when: + +* It has received two qualified approvals[^1]. + + This is not enforced through automation, but needs to be validated by the + maintainer merging. + * The qualified approvals need to be from [Approver]s/[Maintainer]s + affiliated with different companies. Two qualified approvals from + [Approver]s or [Maintainer]s affiliated with the same company counts as a + single qualified approval. + * PRs introducing changes that have already been discussed and consensus + reached only need one qualified approval. The discussion and resolution + needs to be linked to the PR. + * Trivial changes[^2] only need one qualified approval. + +* All feedback has been addressed. + * All PR comments and suggestions are resolved. + * All GitHub Pull Request reviews with a status of "Request changes" have + been addressed. Another review by the objecting reviewer with a different + status can be submitted to clear the original review, or the review can be + dismissed by a [Maintainer] when the issues from the original review have + been addressed. + * Any comments or reviews that cannot be resolved between the PR author and + reviewers can be submitted to the community [Approver]s and [Maintainer]s + during the weekly SIG meeting. If consensus is reached among the + [Approver]s and [Maintainer]s during the SIG meeting the objections to the + PR may be dismissed or resolved or the PR closed by a [Maintainer]. + * Any substantive changes to the PR require existing Approval reviews be + cleared unless the approver explicitly states that their approval persists + across changes. This includes changes resulting from other feedback. + [Approver]s and [Maintainer]s can help in clearing reviews and they should + be consulted if there are any questions. + +* The PR branch is up to date with the base branch it is merging into. + * To ensure this does not block the PR, it should be configured to allow + maintainers to update it. + +* It has been open for review for at least one working day. This gives people + reasonable time to review. + * Trivial changes[^2] do not have to wait for one day and may be merged with + a single [Maintainer]'s approval. + +* All required GitHub workflows have succeeded. +* Urgent fix can take exception as long as it has been actively communicated + among [Maintainer]s. + +Any [Maintainer] can merge the PR once the above criteria have been met. + +[^1]: A qualified approval is a GitHub Pull Request review with "Approve" + status from an OpenTelemetry Go [Approver] or [Maintainer]. +[^2]: Trivial changes include: typo corrections, cosmetic non-substantive + changes, documentation corrections or updates, dependency updates, etc. ## Design Choices As with other OpenTelemetry clients, opentelemetry-go follows the -[opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification). +[OpenTelemetry Specification](https://opentelemetry.io/docs/specs/otel). It's especially valuable to read through the [library -guidelines](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/library-guidelines.md). +guidelines](https://opentelemetry.io/docs/specs/otel/library-guidelines). ### Focus on Capabilities, Not Structure Compliance @@ -146,23 +179,23 @@ For a deeper discussion, see ## Documentation -Each non-example Go Module should have its own `README.md` containing: +Each (non-internal, non-test) package must be documented using +[Go Doc Comments](https://go.dev/doc/comment), +preferably in a `doc.go` file. + +Prefer using [Examples](https://pkg.go.dev/testing#hdr-Examples) +instead of putting code snippets in Go doc comments. +In some cases, you can even create [Testable Examples](https://go.dev/blog/examples). -- A pkg.go.dev badge which can be generated [here](https://pkg.go.dev/badge/). -- Brief description. -- Installation instructions (and requirements if applicable). -- Hyperlink to an example. Depending on the component the example can be: - - An `example_test.go` like [here](exporters/stdout/stdouttrace/example_test.go). - - A sample Go application with its own `README.md`, like [here](example/zipkin). -- Additional documentation sections such us: - - Configuration, - - Contributing, - - References. +You can install and run a "local Go Doc site" in the following way: -[Here](exporters/jaeger/README.md) is an example of a concise `README.md`. + ```sh + go install golang.org/x/pkgsite/cmd/pkgsite@latest + pkgsite + ``` -Moreover, it should be possible to navigate to any `README.md` from the -root `README.md`. +[`go.opentelemetry.io/otel/metric`](https://pkg.go.dev/go.opentelemetry.io/otel/metric) +is an example of a very well-documented package. ## Style Guide @@ -216,7 +249,7 @@ Meaning a `config` from one package should not be directly used by another. The one exception is the API packages. The configs from the base API, eg. `go.opentelemetry.io/otel/trace.TracerConfig` and `go.opentelemetry.io/otel/metric.InstrumentConfig`, are intended to be consumed -by the SDK therefor it is expected that these are exported. +by the SDK therefore it is expected that these are exported. When a config is exported we want to maintain forward and backward compatibility, to achieve this no fields should be exported but should @@ -234,12 +267,12 @@ func newConfig(options ...Option) config { for _, option := range options { config = option.apply(config) } - // Preform any validation here. + // Perform any validation here. return config } ``` -If validation of the `config` options is also preformed this can return an +If validation of the `config` options is also performed this can return an error as well that is expected to be handled by the instantiation function or propagated to the user. @@ -438,12 +471,37 @@ their parameters appropriately named. #### Interface Stability All exported stable interfaces that include the following warning in their -doumentation are allowed to be extended with additional methods. +documentation are allowed to be extended with additional methods. > Warning: methods may be added to this interface in minor releases. +These interfaces are defined by the OpenTelemetry specification and will be +updated as the specification evolves. + Otherwise, stable interfaces MUST NOT be modified. +#### How to Change Specification Interfaces + +When an API change must be made, we will update the SDK with the new method one +release before the API change. This will allow the SDK one version before the +API change to work seamlessly with the new API. + +If an incompatible version of the SDK is used with the new API the application +will fail to compile. + +#### How Not to Change Specification Interfaces + +We have explored using a v2 of the API to change interfaces and found that there +was no way to introduce a v2 and have it work seamlessly with the v1 of the API. +Problems happened with libraries that upgraded to v2 when an application did not, +and would not produce any telemetry. + +More detail of the approaches considered and their limitations can be found in +the [Use a V2 API to evolve interfaces](https://github.com/open-telemetry/opentelemetry-go/issues/3920) +issue. + +#### How to Change Other Interfaces + If new functionality is needed for an interface that cannot be changed it MUST be added by including an additional interface. That added interface can be a simple interface for the specific functionality that you want to add or it can @@ -498,29 +556,65 @@ functionality should be added, each one will need their own super-set interfaces and will duplicate the pattern. For this reason, the simple targeted interface that defines the specific functionality should be preferred. +### Testing + +The tests should never leak goroutines. + +Use the term `ConcurrentSafe` in the test name when it aims to verify the +absence of race conditions. + +### Internal packages + +The use of internal packages should be scoped to a single module. A sub-module +should never import from a parent internal package. This creates a coupling +between the two modules where a user can upgrade the parent without the child +and if the internal package API has changed it will fail to upgrade[^3]. + +There are two known exceptions to this rule: + +- `go.opentelemetry.io/otel/internal/global` + - This package manages global state for all of opentelemetry-go. It needs to + be a single package in order to ensure the uniqueness of the global state. +- `go.opentelemetry.io/otel/internal/baggage` + - This package provides values in a `context.Context` that need to be + recognized by `go.opentelemetry.io/otel/baggage` and + `go.opentelemetry.io/otel/bridge/opentracing` but remain private. + +If you have duplicate code in multiple modules, make that code into a Go +template stored in `go.opentelemetry.io/otel/internal/shared` and use [gotmpl] +to render the templates in the desired locations. See [#4404] for an example of +this. + +[^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548 + ## Approvers and Maintainers -Approvers: +### Approvers - [Evan Torrie](https://github.com/evantorrie), Verizon Media -- [Josh MacDonald](https://github.com/jmacd), LightStep - [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics - [David Ashpole](https://github.com/dashpole), Google -- [Robert Pająk](https://github.com/pellared), Splunk - [Chester Cheung](https://github.com/hanyuancheung), Tencent -- [Damien Mathieu](https://github.com/dmathieu), Auth0/Okta +- [Damien Mathieu](https://github.com/dmathieu), Elastic +- [Anthony Mirabella](https://github.com/Aneurysm9), AWS -Maintainers: +### Maintainers - [Aaron Clawson](https://github.com/MadVikingGod), LightStep -- [Anthony Mirabella](https://github.com/Aneurysm9), AWS +- [Robert Pająk](https://github.com/pellared), Splunk - [Tyler Yahn](https://github.com/MrAlias), Splunk -Emeritus: +### Emeritus - [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep +- [Josh MacDonald](https://github.com/jmacd), LightStep ### Become an Approver or a Maintainer See the [community membership document in OpenTelemetry community repo](https://github.com/open-telemetry/community/blob/main/community-membership.md). + +[Approver]: #approvers +[Maintainer]: #maintainers +[gotmpl]: https://pkg.go.dev/go.opentelemetry.io/build-tools/gotmpl +[#4404]: https://github.com/open-telemetry/opentelemetry-go/pull/4404 diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile index 18ffaa33a..35fc18996 100644 --- a/vendor/go.opentelemetry.io/otel/Makefile +++ b/vendor/go.opentelemetry.io/otel/Makefile @@ -17,7 +17,7 @@ TOOLS_MOD_DIR := ./internal/tools ALL_DOCS := $(shell find . -name '*.md' -type f | sort) ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort) OTEL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(ALL_GO_MOD_DIRS)) -ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example|^$(TOOLS_MOD_DIR)' | sort) +ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | grep -E -v '^./example|^$(TOOLS_MOD_DIR)' | sort) GO = go TIMEOUT = 60 @@ -25,8 +25,8 @@ TIMEOUT = 60 .DEFAULT_GOAL := precommit .PHONY: precommit ci -precommit: dependabot-generate license-check vanity-import-fix misspell go-mod-tidy golangci-lint-fix test-default -ci: dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage +precommit: generate dependabot-generate license-check misspell go-mod-tidy golangci-lint-fix test-default +ci: generate dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage # Tools @@ -71,21 +71,78 @@ $(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto GOJQ = $(TOOLS)/gojq $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq +GOTMPL = $(TOOLS)/gotmpl +$(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl + +GORELEASE = $(TOOLS)/gorelease +$(GORELEASE): PACKAGE=golang.org/x/exp/cmd/gorelease + +GOVULNCHECK = $(TOOLS)/govulncheck +$(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck + .PHONY: tools -tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) +tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) -# Build +# Virtualized python tools via docker + +# The directory where the virtual environment is created. +VENVDIR := venv + +# The directory where the python tools are installed. +PYTOOLS := $(VENVDIR)/bin + +# The pip executable in the virtual environment. +PIP := $(PYTOOLS)/pip + +# The directory in the docker image where the current directory is mounted. +WORKDIR := /workdir -.PHONY: generate build +# The python image to use for the virtual environment. +PYTHONIMAGE := python:3.11.3-slim-bullseye -generate: $(OTEL_GO_MOD_DIRS:%=generate/%) -generate/%: DIR=$* -generate/%: | $(STRINGER) $(PORTO) +# Run the python image with the current directory mounted. +DOCKERPY := docker run --rm -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE) + +# Create a virtual environment for Python tools. +$(PYTOOLS): +# The `--upgrade` flag is needed to ensure that the virtual environment is +# created with the latest pip version. + @$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip" + +# Install python packages into the virtual environment. +$(PYTOOLS)/%: | $(PYTOOLS) + @$(DOCKERPY) $(PIP) install -r requirements.txt + +CODESPELL = $(PYTOOLS)/codespell +$(CODESPELL): PACKAGE=codespell + +# Generate + +.PHONY: generate +generate: go-generate vanity-import-fix + +.PHONY: go-generate +go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%) +go-generate/%: DIR=$* +go-generate/%: | $(STRINGER) $(GOTMPL) @echo "$(GO) generate $(DIR)/..." \ && cd $(DIR) \ - && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... && $(PORTO) -w . + && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... + +.PHONY: vanity-import-fix +vanity-import-fix: | $(PORTO) + @$(PORTO) --include-internal -w . + +# Generate go.work file for local development. +.PHONY: go-work +go-work: | $(CROSSLINK) + $(CROSSLINK) work --root=$(shell pwd) + +# Build + +.PHONY: build -build: generate $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%) +build: $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%) build/%: DIR=$* build/%: @echo "$(GO) build $(DIR)/..." \ @@ -135,6 +192,18 @@ test-coverage: | $(GOCOVMERGE) done; \ $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt +# Adding a directory will include all benchmarks in that direcotry if a filter is not specified. +BENCHMARK_TARGETS := sdk/trace +.PHONY: benchmark +benchmark: $(BENCHMARK_TARGETS:%=benchmark/%) +BENCHMARK_FILTER = . +# You can override the filter for a particular directory by adding a rule here. +benchmark/sdk/trace: BENCHMARK_FILTER = SpanWithAttributes_8/AlwaysSample +benchmark/%: + @echo "$(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(BENCHMARK_FILTER) $*..." \ + && cd $* \ + $(foreach filter, $(BENCHMARK_FILTER), && $(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(filter)) + .PHONY: golangci-lint golangci-lint-fix golangci-lint-fix: ARGS=--fix golangci-lint-fix: golangci-lint @@ -156,30 +225,38 @@ go-mod-tidy/%: DIR=$* go-mod-tidy/%: | crosslink @echo "$(GO) mod tidy in $(DIR)" \ && cd $(DIR) \ - && $(GO) mod tidy -compat=1.17 + && $(GO) mod tidy -compat=1.20 .PHONY: lint-modules lint-modules: go-mod-tidy .PHONY: lint -lint: misspell lint-modules golangci-lint +lint: misspell lint-modules golangci-lint govulncheck .PHONY: vanity-import-check vanity-import-check: | $(PORTO) - @$(PORTO) --include-internal -l . || echo "(run: make vanity-import-fix)" - -.PHONY: vanity-import-fix -vanity-import-fix: | $(PORTO) - @$(PORTO) --include-internal -w . + @$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 ) .PHONY: misspell misspell: | $(MISSPELL) @$(MISSPELL) -w $(ALL_DOCS) +.PHONY: govulncheck +govulncheck: $(OTEL_GO_MOD_DIRS:%=govulncheck/%) +govulncheck/%: DIR=$* +govulncheck/%: | $(GOVULNCHECK) + @echo "govulncheck ./... in $(DIR)" \ + && cd $(DIR) \ + && $(GOVULNCHECK) ./... + +.PHONY: codespell +codespell: | $(CODESPELL) + @$(DOCKERPY) $(CODESPELL) + .PHONY: license-check license-check: @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './.git/*' ) ; do \ - awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=3 { found=1; next } END { if (!found) print FILENAME }' $$f; \ + awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=4 { found=1; next } END { if (!found) print FILENAME }' $$f; \ done); \ if [ -n "$${licRes}" ]; then \ echo "license header checking failed:"; echo "$${licRes}"; \ @@ -189,7 +266,7 @@ license-check: DEPENDABOT_CONFIG = .github/dependabot.yml .PHONY: dependabot-check dependabot-check: | $(DBOTCONF) - @$(DBOTCONF) verify $(DEPENDABOT_CONFIG) || echo "(run: make dependabot-generate)" + @$(DBOTCONF) verify $(DEPENDABOT_CONFIG) || ( echo "(run: make dependabot-generate)"; exit 1 ) .PHONY: dependabot-generate dependabot-generate: | $(DBOTCONF) @@ -208,11 +285,22 @@ check-clean-work-tree: SEMCONVPKG ?= "semconv/" .PHONY: semconv-generate semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) - @[ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry specification tag"; exit 1 ) - @[ "$(OTEL_SPEC_REPO)" ] || ( echo "OTEL_SPEC_REPO unset: missing path to opentelemetry specification repo"; exit 1 ) - @$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/trace" -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - @$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/resource" -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - @$(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" + [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry semantic-conventions tag"; exit 1 ) + [ "$(OTEL_SEMCONV_REPO)" ] || ( echo "OTEL_SEMCONV_REPO unset: missing path to opentelemetry semantic-conventions repo"; exit 1 ) + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" + +.PHONY: gorelease +gorelease: $(OTEL_GO_MOD_DIRS:%=gorelease/%) +gorelease/%: DIR=$* +gorelease/%:| $(GORELEASE) + @echo "gorelease in $(DIR):" \ + && cd $(DIR) \ + && $(GORELEASE) \ + || echo "" .PHONY: prerelease prerelease: | $(MULTIMOD) @@ -224,3 +312,7 @@ COMMIT ?= "HEAD" add-tags: | $(MULTIMOD) @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) $(MULTIMOD) verify && $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} + +.PHONY: lint-markdown +lint-markdown: + docker run -v "$(CURDIR):$(WORKDIR)" docker://avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md index 4aeecb8bf..2c5b0cc28 100644 --- a/vendor/go.opentelemetry.io/otel/README.md +++ b/vendor/go.opentelemetry.io/otel/README.md @@ -11,22 +11,22 @@ It provides a set of APIs to directly measure performance and behavior of your s ## Project Status -| Signal | Status | Project | -| ------- | ---------- | ------- | -| Traces | Stable | N/A | -| Metrics | Alpha | N/A | -| Logs | Frozen [1] | N/A | +| Signal | Status | +|---------|------------| +| Traces | Stable | +| Metrics | Stable | +| Logs | Design [1] | -- [1]: The Logs signal development is halted for this project while we develop both Traces and Metrics. +- [1]: Currently the logs signal development is in a design phase ([#4696](https://github.com/open-telemetry/opentelemetry-go/issues/4696)). No Logs Pull Requests are currently being accepted. -Progress and status specific to this repository is tracked in our local +Progress and status specific to this repository is tracked in our [project boards](https://github.com/open-telemetry/opentelemetry-go/projects) and [milestones](https://github.com/open-telemetry/opentelemetry-go/milestones). Project versioning information and stability guarantees can be found in the -[versioning documentation](./VERSIONING.md). +[versioning documentation](VERSIONING.md). ### Compatibility @@ -49,22 +49,17 @@ stop ensuring compatibility with these versions in the following manner: Currently, this project supports the following environments. | OS | Go Version | Architecture | -| ------- | ---------- | ------------ | -| Ubuntu | 1.19 | amd64 | -| Ubuntu | 1.18 | amd64 | -| Ubuntu | 1.17 | amd64 | -| Ubuntu | 1.19 | 386 | -| Ubuntu | 1.18 | 386 | -| Ubuntu | 1.17 | 386 | -| MacOS | 1.19 | amd64 | -| MacOS | 1.18 | amd64 | -| MacOS | 1.17 | amd64 | -| Windows | 1.19 | amd64 | -| Windows | 1.18 | amd64 | -| Windows | 1.17 | amd64 | -| Windows | 1.19 | 386 | -| Windows | 1.18 | 386 | -| Windows | 1.17 | 386 | +|---------|------------|--------------| +| Ubuntu | 1.21 | amd64 | +| Ubuntu | 1.20 | amd64 | +| Ubuntu | 1.21 | 386 | +| Ubuntu | 1.20 | 386 | +| MacOS | 1.21 | amd64 | +| MacOS | 1.20 | amd64 | +| Windows | 1.21 | amd64 | +| Windows | 1.20 | amd64 | +| Windows | 1.21 | 386 | +| Windows | 1.20 | 386 | While this project should work for other systems, no compatibility guarantees are made for those systems currently. @@ -102,12 +97,11 @@ export pipeline to send that telemetry to an observability platform. All officially supported exporters for the OpenTelemetry project are contained in the [exporters directory](./exporters). | Exporter | Metrics | Traces | -| :-----------------------------------: | :-----: | :----: | -| [Jaeger](./exporters/jaeger/) | | ✓ | -| [OTLP](./exporters/otlp/) | ✓ | ✓ | -| [Prometheus](./exporters/prometheus/) | ✓ | | -| [stdout](./exporters/stdout/) | ✓ | ✓ | -| [Zipkin](./exporters/zipkin/) | | ✓ | +|---------------------------------------|:-------:|:------:| +| [OTLP](./exporters/otlp/) | ✓ | ✓ | +| [Prometheus](./exporters/prometheus/) | ✓ | | +| [stdout](./exporters/stdout/) | ✓ | ✓ | +| [Zipkin](./exporters/zipkin/) | | ✓ | ## Contributing diff --git a/vendor/go.opentelemetry.io/otel/RELEASING.md b/vendor/go.opentelemetry.io/otel/RELEASING.md index 71e576254..82ce3ee46 100644 --- a/vendor/go.opentelemetry.io/otel/RELEASING.md +++ b/vendor/go.opentelemetry.io/otel/RELEASING.md @@ -2,24 +2,31 @@ ## Semantic Convention Generation -New versions of the [OpenTelemetry specification] mean new versions of the `semconv` package need to be generated. +New versions of the [OpenTelemetry Semantic Conventions] mean new versions of the `semconv` package need to be generated. The `semconv-generate` make target is used for this. -1. Checkout a local copy of the [OpenTelemetry specification] to the desired release tag. -2. Run the `make semconv-generate ...` target from this repository. +1. Checkout a local copy of the [OpenTelemetry Semantic Conventions] to the desired release tag. +2. Pull the latest `otel/semconvgen` image: `docker pull otel/semconvgen:latest` +3. Run the `make semconv-generate ...` target from this repository. For example, ```sh -export TAG="v1.7.0" # Change to the release version you are generating. -export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification" -git -C "$OTEL_SPEC_REPO" checkout "tags/$TAG" -make semconv-generate # Uses the exported TAG and OTEL_SPEC_REPO. +export TAG="v1.21.0" # Change to the release version you are generating. +export OTEL_SEMCONV_REPO="/absolute/path/to/opentelemetry/semantic-conventions" +docker pull otel/semconvgen:latest +make semconv-generate # Uses the exported TAG and OTEL_SEMCONV_REPO. ``` This should create a new sub-package of [`semconv`](./semconv). Ensure things look correct before submitting a pull request to include the addition. +## Breaking changes validation + +You can run `make gorelease` that runs [gorelease](https://pkg.go.dev/golang.org/x/exp/cmd/gorelease) to ensure that there are no unwanted changes done in the public API. + +You can check/report problems with `gorelease` [here](https://golang.org/issues/26420). + ## Pre-Release First, decide which module sets will be released and update their versions @@ -116,7 +123,17 @@ Once verified be sure to [make a release for the `contrib` repository](https://g ### Website Documentation -Update [the documentation](./website_docs) for [the OpenTelemetry website](https://opentelemetry.io/docs/go/). +Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/instrumentation/go]. Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. -[OpenTelemetry specification]: https://github.com/open-telemetry/opentelemetry-specification +[OpenTelemetry Semantic Conventions]: https://github.com/open-telemetry/semantic-conventions +[Go instrumentation documentation]: https://opentelemetry.io/docs/instrumentation/go/ +[content/en/docs/instrumentation/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/instrumentation/go + +### Demo Repository + +Bump the dependencies in the following Go services: + +- [`accountingservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/accountingservice) +- [`checkoutservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/checkoutservice) +- [`productcatalogservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/productcatalogservice) diff --git a/vendor/go.opentelemetry.io/otel/attribute/filter.go b/vendor/go.opentelemetry.io/otel/attribute/filter.go new file mode 100644 index 000000000..638c213d5 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/filter.go @@ -0,0 +1,60 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute // import "go.opentelemetry.io/otel/attribute" + +// Filter supports removing certain attributes from attribute sets. When +// the filter returns true, the attribute will be kept in the filtered +// attribute set. When the filter returns false, the attribute is excluded +// from the filtered attribute set, and the attribute instead appears in +// the removed list of excluded attributes. +type Filter func(KeyValue) bool + +// NewAllowKeysFilter returns a Filter that only allows attributes with one of +// the provided keys. +// +// If keys is empty a deny-all filter is returned. +func NewAllowKeysFilter(keys ...Key) Filter { + if len(keys) <= 0 { + return func(kv KeyValue) bool { return false } + } + + allowed := make(map[Key]struct{}) + for _, k := range keys { + allowed[k] = struct{}{} + } + return func(kv KeyValue) bool { + _, ok := allowed[kv.Key] + return ok + } +} + +// NewDenyKeysFilter returns a Filter that only allows attributes +// that do not have one of the provided keys. +// +// If keys is empty an allow-all filter is returned. +func NewDenyKeysFilter(keys ...Key) Filter { + if len(keys) <= 0 { + return func(kv KeyValue) bool { return true } + } + + forbid := make(map[Key]struct{}) + for _, k := range keys { + forbid[k] = struct{}{} + } + return func(kv KeyValue) bool { + _, ok := forbid[kv.Key] + return !ok + } +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/set.go b/vendor/go.opentelemetry.io/otel/attribute/set.go index 26be59832..9f9303d4f 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/set.go +++ b/vendor/go.opentelemetry.io/otel/attribute/set.go @@ -18,6 +18,7 @@ import ( "encoding/json" "reflect" "sort" + "sync" ) type ( @@ -38,13 +39,6 @@ type ( iface interface{} } - // Filter supports removing certain attributes from attribute sets. When - // the filter returns true, the attribute will be kept in the filtered - // attribute set. When the filter returns false, the attribute is excluded - // from the filtered attribute set, and the attribute instead appears in - // the removed list of excluded attributes. - Filter func(KeyValue) bool - // Sortable implements sort.Interface, used for sorting KeyValue. This is // an exported type to support a memory optimization. A pointer to one of // these is needed for the call to sort.Stable(), which the caller may @@ -62,6 +56,12 @@ var ( iface: [0]KeyValue{}, }, } + + // sortables is a pool of Sortables used to create Sets with a user does + // not provide one. + sortables = sync.Pool{ + New: func() interface{} { return new(Sortable) }, + } ) // EmptySet returns a reference to a Set with no elements. @@ -91,7 +91,7 @@ func (l *Set) Len() int { // Get returns the KeyValue at ordered position idx in this set. func (l *Set) Get(idx int) (KeyValue, bool) { - if l == nil { + if l == nil || !l.equivalent.Valid() { return KeyValue{}, false } value := l.equivalent.reflectValue() @@ -107,7 +107,7 @@ func (l *Set) Get(idx int) (KeyValue, bool) { // Value returns the value of a specified key in this set. func (l *Set) Value(k Key) (Value, bool) { - if l == nil { + if l == nil || !l.equivalent.Valid() { return Value{}, false } rValue := l.equivalent.reflectValue() @@ -191,7 +191,9 @@ func NewSet(kvs ...KeyValue) Set { if len(kvs) == 0 { return empty() } - s, _ := NewSetWithSortableFiltered(kvs, new(Sortable), nil) + srt := sortables.Get().(*Sortable) + s, _ := NewSetWithSortableFiltered(kvs, srt, nil) + sortables.Put(srt) return s } @@ -218,7 +220,10 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { if len(kvs) == 0 { return empty(), nil } - return NewSetWithSortableFiltered(kvs, new(Sortable), filter) + srt := sortables.Get().(*Sortable) + s, filtered := NewSetWithSortableFiltered(kvs, srt, filter) + sortables.Put(srt) + return s, filtered } // NewSetWithSortableFiltered returns a new Set. diff --git a/vendor/go.opentelemetry.io/otel/attribute/value.go b/vendor/go.opentelemetry.io/otel/attribute/value.go index 57899f682..cb21dd5c0 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/value.go +++ b/vendor/go.opentelemetry.io/otel/attribute/value.go @@ -17,9 +17,11 @@ package attribute // import "go.opentelemetry.io/otel/attribute" import ( "encoding/json" "fmt" + "reflect" "strconv" "go.opentelemetry.io/otel/internal" + "go.opentelemetry.io/otel/internal/attribute" ) //go:generate stringer -type=Type @@ -66,12 +68,7 @@ func BoolValue(v bool) Value { // BoolSliceValue creates a BOOLSLICE Value. func BoolSliceValue(v []bool) Value { - cp := make([]bool, len(v)) - copy(cp, v) - return Value{ - vtype: BOOLSLICE, - slice: &cp, - } + return Value{vtype: BOOLSLICE, slice: attribute.BoolSliceValue(v)} } // IntValue creates an INT64 Value. @@ -81,13 +78,14 @@ func IntValue(v int) Value { // IntSliceValue creates an INTSLICE Value. func IntSliceValue(v []int) Value { - cp := make([]int64, 0, len(v)) - for _, i := range v { - cp = append(cp, int64(i)) + var int64Val int64 + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(int64Val))) + for i, val := range v { + cp.Elem().Index(i).SetInt(int64(val)) } return Value{ vtype: INT64SLICE, - slice: &cp, + slice: cp.Elem().Interface(), } } @@ -101,12 +99,7 @@ func Int64Value(v int64) Value { // Int64SliceValue creates an INT64SLICE Value. func Int64SliceValue(v []int64) Value { - cp := make([]int64, len(v)) - copy(cp, v) - return Value{ - vtype: INT64SLICE, - slice: &cp, - } + return Value{vtype: INT64SLICE, slice: attribute.Int64SliceValue(v)} } // Float64Value creates a FLOAT64 Value. @@ -119,12 +112,7 @@ func Float64Value(v float64) Value { // Float64SliceValue creates a FLOAT64SLICE Value. func Float64SliceValue(v []float64) Value { - cp := make([]float64, len(v)) - copy(cp, v) - return Value{ - vtype: FLOAT64SLICE, - slice: &cp, - } + return Value{vtype: FLOAT64SLICE, slice: attribute.Float64SliceValue(v)} } // StringValue creates a STRING Value. @@ -137,12 +125,7 @@ func StringValue(v string) Value { // StringSliceValue creates a STRINGSLICE Value. func StringSliceValue(v []string) Value { - cp := make([]string, len(v)) - copy(cp, v) - return Value{ - vtype: STRINGSLICE, - slice: &cp, - } + return Value{vtype: STRINGSLICE, slice: attribute.StringSliceValue(v)} } // Type returns a type of the Value. @@ -159,10 +142,14 @@ func (v Value) AsBool() bool { // AsBoolSlice returns the []bool value. Make sure that the Value's type is // BOOLSLICE. func (v Value) AsBoolSlice() []bool { - if s, ok := v.slice.(*[]bool); ok { - return *s + if v.vtype != BOOLSLICE { + return nil } - return nil + return v.asBoolSlice() +} + +func (v Value) asBoolSlice() []bool { + return attribute.AsBoolSlice(v.slice) } // AsInt64 returns the int64 value. Make sure that the Value's type is @@ -174,10 +161,14 @@ func (v Value) AsInt64() int64 { // AsInt64Slice returns the []int64 value. Make sure that the Value's type is // INT64SLICE. func (v Value) AsInt64Slice() []int64 { - if s, ok := v.slice.(*[]int64); ok { - return *s + if v.vtype != INT64SLICE { + return nil } - return nil + return v.asInt64Slice() +} + +func (v Value) asInt64Slice() []int64 { + return attribute.AsInt64Slice(v.slice) } // AsFloat64 returns the float64 value. Make sure that the Value's @@ -189,10 +180,14 @@ func (v Value) AsFloat64() float64 { // AsFloat64Slice returns the []float64 value. Make sure that the Value's type is // FLOAT64SLICE. func (v Value) AsFloat64Slice() []float64 { - if s, ok := v.slice.(*[]float64); ok { - return *s + if v.vtype != FLOAT64SLICE { + return nil } - return nil + return v.asFloat64Slice() +} + +func (v Value) asFloat64Slice() []float64 { + return attribute.AsFloat64Slice(v.slice) } // AsString returns the string value. Make sure that the Value's type @@ -204,10 +199,14 @@ func (v Value) AsString() string { // AsStringSlice returns the []string value. Make sure that the Value's type is // STRINGSLICE. func (v Value) AsStringSlice() []string { - if s, ok := v.slice.(*[]string); ok { - return *s + if v.vtype != STRINGSLICE { + return nil } - return nil + return v.asStringSlice() +} + +func (v Value) asStringSlice() []string { + return attribute.AsStringSlice(v.slice) } type unknownValueType struct{} @@ -218,19 +217,19 @@ func (v Value) AsInterface() interface{} { case BOOL: return v.AsBool() case BOOLSLICE: - return v.AsBoolSlice() + return v.asBoolSlice() case INT64: return v.AsInt64() case INT64SLICE: - return v.AsInt64Slice() + return v.asInt64Slice() case FLOAT64: return v.AsFloat64() case FLOAT64SLICE: - return v.AsFloat64Slice() + return v.asFloat64Slice() case STRING: return v.stringly case STRINGSLICE: - return v.AsStringSlice() + return v.asStringSlice() } return unknownValueType{} } @@ -239,19 +238,19 @@ func (v Value) AsInterface() interface{} { func (v Value) Emit() string { switch v.Type() { case BOOLSLICE: - return fmt.Sprint(*(v.slice.(*[]bool))) + return fmt.Sprint(v.asBoolSlice()) case BOOL: return strconv.FormatBool(v.AsBool()) case INT64SLICE: - return fmt.Sprint(*(v.slice.(*[]int64))) + return fmt.Sprint(v.asInt64Slice()) case INT64: return strconv.FormatInt(v.AsInt64(), 10) case FLOAT64SLICE: - return fmt.Sprint(*(v.slice.(*[]float64))) + return fmt.Sprint(v.asFloat64Slice()) case FLOAT64: return fmt.Sprint(v.AsFloat64()) case STRINGSLICE: - return fmt.Sprint(*(v.slice.(*[]string))) + return fmt.Sprint(v.asStringSlice()) case STRING: return v.stringly default: diff --git a/vendor/go.opentelemetry.io/otel/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/baggage/baggage.go index eba180e04..84532cb1d 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/baggage.go +++ b/vendor/go.opentelemetry.io/otel/baggage/baggage.go @@ -61,11 +61,6 @@ type Property struct { // hasValue indicates if a zero-value value means the property does not // have a value or if it was the zero-value. hasValue bool - - // hasData indicates whether the created property contains data or not. - // Properties that do not contain data are invalid with no other check - // required. - hasData bool } // NewKeyProperty returns a new Property for key. @@ -76,7 +71,7 @@ func NewKeyProperty(key string) (Property, error) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) } - p := Property{key: key, hasData: true} + p := Property{key: key} return p, nil } @@ -95,7 +90,6 @@ func NewKeyValueProperty(key, value string) (Property, error) { key: key, value: value, hasValue: true, - hasData: true, } return p, nil } @@ -117,7 +111,7 @@ func parseProperty(property string) (Property, error) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property) } - p := Property{hasData: true} + var p Property if match[1] != "" { p.key = match[1] } else { @@ -136,10 +130,6 @@ func (p Property) validate() error { return fmt.Errorf("invalid property: %w", err) } - if !p.hasData { - return errFunc(fmt.Errorf("%w: %q", errInvalidProperty, p)) - } - if !keyRe.MatchString(p.key) { return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) } @@ -250,8 +240,9 @@ type Member struct { hasData bool } -// NewMember returns a new Member from the passed arguments. An error is -// returned if the created Member would be invalid according to the W3C +// NewMember returns a new Member from the passed arguments. The key will be +// used directly while the value will be url decoded after validation. An error +// is returned if the created Member would be invalid according to the W3C // Baggage specification. func NewMember(key, value string, props ...Property) (Member, error) { m := Member{ @@ -263,7 +254,11 @@ func NewMember(key, value string, props ...Property) (Member, error) { if err := m.validate(); err != nil { return newInvalidMember(), err } - + decodedValue, err := url.PathUnescape(value) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + m.value = decodedValue return m, nil } @@ -284,52 +279,45 @@ func parseMember(member string) (Member, error) { props properties ) - parts := strings.SplitN(member, propertyDelimiter, 2) - switch len(parts) { - case 2: + keyValue, properties, found := strings.Cut(member, propertyDelimiter) + if found { // Parse the member properties. - for _, pStr := range strings.Split(parts[1], propertyDelimiter) { + for _, pStr := range strings.Split(properties, propertyDelimiter) { p, err := parseProperty(pStr) if err != nil { return newInvalidMember(), err } props = append(props, p) } - fallthrough - case 1: - // Parse the member key/value pair. - - // Take into account a value can contain equal signs (=). - kv := strings.SplitN(parts[0], keyValueDelimiter, 2) - if len(kv) != 2 { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member) - } - // "Leading and trailing whitespaces are allowed but MUST be trimmed - // when converting the header into a data structure." - key = strings.TrimSpace(kv[0]) - var err error - value, err = url.QueryUnescape(strings.TrimSpace(kv[1])) - if err != nil { - return newInvalidMember(), fmt.Errorf("%w: %q", err, value) - } - if !keyRe.MatchString(key) { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) - } - if !valueRe.MatchString(value) { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) - } - default: - // This should never happen unless a developer has changed the string - // splitting somehow. Panic instead of failing silently and allowing - // the bug to slip past the CI checks. - panic("failed to parse baggage member") + } + // Parse the member key/value pair. + + // Take into account a value can contain equal signs (=). + k, v, found := strings.Cut(keyValue, keyValueDelimiter) + if !found { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member) + } + // "Leading and trailing whitespaces are allowed but MUST be trimmed + // when converting the header into a data structure." + key = strings.TrimSpace(k) + var err error + value, err = url.PathUnescape(strings.TrimSpace(v)) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %q", err, value) + } + if !keyRe.MatchString(key) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + if !valueRe.MatchString(value) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) } return Member{key: key, value: value, properties: props, hasData: true}, nil } -// validate ensures m conforms to the W3C Baggage specification, returning an -// error otherwise. +// validate ensures m conforms to the W3C Baggage specification. +// A key is just an ASCII string, but a value must be URL encoded UTF-8, +// returning an error otherwise. func (m Member) validate() error { if !m.hasData { return fmt.Errorf("%w: %q", errInvalidMember, m) @@ -465,6 +453,7 @@ func (b Baggage) Member(key string) Member { key: key, value: v.Value, properties: fromInternalProperties(v.Properties), + hasData: true, } } @@ -484,6 +473,7 @@ func (b Baggage) Members() []Member { key: k, value: v.Value, properties: fromInternalProperties(v.Properties), + hasData: true, }) } return members diff --git a/vendor/go.opentelemetry.io/otel/codes/codes.go b/vendor/go.opentelemetry.io/otel/codes/codes.go index 064a9279f..587ebae4e 100644 --- a/vendor/go.opentelemetry.io/otel/codes/codes.go +++ b/vendor/go.opentelemetry.io/otel/codes/codes.go @@ -23,10 +23,20 @@ import ( const ( // Unset is the default status code. Unset Code = 0 + // Error indicates the operation contains an error. + // + // NOTE: The error code in OTLP is 2. + // The value of this enum is only relevant to the internals + // of the Go SDK. Error Code = 1 + // Ok indicates operation has been validated by an Application developers // or Operator to have completed successfully, or contain no error. + // + // NOTE: The Ok code in OTLP is 1. + // The value of this enum is only relevant to the internals + // of the Go SDK. Ok Code = 2 maxCode = 3 diff --git a/vendor/go.opentelemetry.io/otel/codes/doc.go b/vendor/go.opentelemetry.io/otel/codes/doc.go index df3e0f1b6..4e328fbb4 100644 --- a/vendor/go.opentelemetry.io/otel/codes/doc.go +++ b/vendor/go.opentelemetry.io/otel/codes/doc.go @@ -16,6 +16,6 @@ Package codes defines the canonical error codes used by OpenTelemetry. It conforms to [the OpenTelemetry -specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#statuscanonicalcode). +specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/api.md#set-status). */ package codes // import "go.opentelemetry.io/otel/codes" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/config.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/config.go deleted file mode 100644 index b3fd45d9d..000000000 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/config.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package internal contains common functionality for all OTLP exporters. -package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" - -import ( - "fmt" - "path" - "strings" -) - -// CleanPath returns a path with all spaces trimmed and all redundancies removed. If urlPath is empty or cleaning it results in an empty string, defaultPath is returned instead. -func CleanPath(urlPath string, defaultPath string) string { - tmp := path.Clean(strings.TrimSpace(urlPath)) - if tmp == "." { - return defaultPath - } - if !path.IsAbs(tmp) { - tmp = fmt.Sprintf("/%s", tmp) - } - return tmp -} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md deleted file mode 100644 index ca91fd4f4..000000000 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# OpenTelemetry-Go OTLP Span Exporter - -[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlptrace.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) - -[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.5.0/specification/protocol/exporter.md) implementation. - -## Installation - -``` -go get -u go.opentelemetry.io/otel/exporters/otlp/otlptrace -``` - -## Examples - -- [Exporter setup and examples](./otlptracehttp/example_test.go) -- [Full example sending telemetry to a local collector](../../../example/otel-collector) - -## [`otlptrace`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) - -The `otlptrace` package provides an exporter implementing the OTel span exporter interface. -This exporter is configured using a client satisfying the `otlptrace.Client` interface. -This client handles the transformation of data into wire format and the transmission of that data to the collector. - -## [`otlptracegrpc`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc) - -The `otlptracegrpc` package implements a client for the span exporter that sends trace telemetry data to the collector using gRPC with protobuf-encoded payloads. - -## [`otlptracehttp`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp) - -The `otlptracehttp` package implements a client for the span exporter that sends trace telemetry data to the collector using HTTP with protobuf-encoded payloads. - -## Configuration - -### Environment Variables - -The following environment variables can be used (instead of options objects) to -override the default configuration. For more information about how each of -these environment variables is interpreted, see [the OpenTelemetry -specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md). - -| Environment variable | Option | Default value | -| ------------------------------------------------------------------------ |------------------------------ | -------------------------------------------------------- | -| `OTEL_EXPORTER_OTLP_ENDPOINT` `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | `WithEndpoint` `WithInsecure` | `https://localhost:4317` or `https://localhost:4318`[^1] | -| `OTEL_EXPORTER_OTLP_CERTIFICATE` `OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` | `WithTLSClientConfig` | | -| `OTEL_EXPORTER_OTLP_HEADERS` `OTEL_EXPORTER_OTLP_TRACES_HEADERS` | `WithHeaders` | | -| `OTEL_EXPORTER_OTLP_COMPRESSION` `OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` | `WithCompression` | | -| `OTEL_EXPORTER_OTLP_TIMEOUT` `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` | `WithTimeout` | `10s` | - -[^1]: The gRPC client defaults to `https://localhost:4317` and the HTTP client `https://localhost:4318`. - -Configuration using options have precedence over the environment variables. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/doc.go new file mode 100644 index 000000000..9e642235a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/doc.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package otlptrace contains abstractions for OTLP span exporters. +See the official OTLP span exporter implementations: + - [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc], + - [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp]. +*/ +package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go index c5ee6c098..b46a38d60 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go @@ -17,15 +17,14 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" import ( "context" "errors" + "fmt" "sync" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" tracesdk "go.opentelemetry.io/otel/sdk/trace" ) -var ( - errAlreadyStarted = errors.New("already started") -) +var errAlreadyStarted = errors.New("already started") // Exporter exports trace data in the OTLP wire format. type Exporter struct { @@ -45,12 +44,16 @@ func (e *Exporter) ExportSpans(ctx context.Context, ss []tracesdk.ReadOnlySpan) return nil } - return e.client.UploadTraces(ctx, protoSpans) + err := e.client.UploadTraces(ctx, protoSpans) + if err != nil { + return fmt.Errorf("traces export: %w", err) + } + return nil } // Start establishes a connection to the receiving endpoint. func (e *Exporter) Start(ctx context.Context) error { - var err = errAlreadyStarted + err := errAlreadyStarted e.startOnce.Do(func() { e.mu.Lock() e.started = true diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go index 9d6e1898b..b4cc21d7a 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -27,10 +27,10 @@ import ( "google.golang.org/grpc/status" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) @@ -130,13 +130,16 @@ var errAlreadyStopped = errors.New("the client is already stopped") // If the client has already stopped, an error will be returned describing // this. func (c *client) Stop(ctx context.Context) error { + // Make sure to return context error if the context is done when calling this method. + err := ctx.Err() + // Acquire the c.tscMu lock within the ctx lifetime. acquired := make(chan struct{}) go func() { c.tscMu.Lock() close(acquired) }() - var err error + select { case <-ctx.Done(): // The Stop timeout is reached. Kill any remaining exports to force @@ -202,11 +205,12 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc ResourceSpans: protoSpans, }) if resp != nil && resp.PartialSuccess != nil { - otel.Handle(internal.PartialSuccessToError( - internal.TracingPartialSuccess, - resp.PartialSuccess.RejectedSpans, - resp.PartialSuccess.ErrorMessage, - )) + msg := resp.PartialSuccess.GetErrorMessage() + n := resp.PartialSuccess.GetRejectedSpans() + if n != 0 || msg != "" { + err := internal.TracePartialSuccessError(n, msg) + otel.Handle(err) + } } // nil is converted to OK. if status.Code(err) == codes.OK { @@ -255,32 +259,39 @@ func (c *client) exportContext(parent context.Context) (context.Context, context // retryable returns if err identifies a request that can be retried and a // duration to wait for if an explicit throttle time is included in err. func retryable(err error) (bool, time.Duration) { - //func retryable(err error) (bool, time.Duration) { s := status.Convert(err) + return retryableGRPCStatus(s) +} + +func retryableGRPCStatus(s *status.Status) (bool, time.Duration) { switch s.Code() { case codes.Canceled, codes.DeadlineExceeded, - codes.ResourceExhausted, codes.Aborted, codes.OutOfRange, codes.Unavailable, codes.DataLoss: - return true, throttleDelay(s) + // Additionally handle RetryInfo. + _, d := throttleDelay(s) + return true, d + case codes.ResourceExhausted: + // Retry only if the server signals that the recovery from resource exhaustion is possible. + return throttleDelay(s) } // Not a retry-able error. return false, 0 } -// throttleDelay returns a duration to wait for if an explicit throttle time -// is included in the response status. -func throttleDelay(s *status.Status) time.Duration { +// throttleDelay returns of the status is RetryInfo +// and the its duration to wait for if an explicit throttle time. +func throttleDelay(s *status.Status) (bool, time.Duration) { for _, detail := range s.Details() { if t, ok := detail.(*errdetails.RetryInfo); ok { - return t.RetryDelay.AsDuration() + return true, t.RetryDelay.AsDuration() } } - return 0 + return false, 0 } // MarshalLog is the marshaling function used by the logging system to represent this Client. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go new file mode 100644 index 000000000..1f514ef9e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go @@ -0,0 +1,77 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package otlptracegrpc provides an OTLP span exporter using gRPC. +By default the telemetry is sent to https://localhost:4317. + +Exporter should be created using [New]. + +The environment variables described below can be used for configuration. + +OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT (default: "https://localhost:4317") - +target to which the exporter sends telemetry. +The target syntax is defined in https://github.com/grpc/grpc/blob/master/doc/naming.md. +The value must contain a host. +The value may additionally a port, a scheme, and a path. +The value accepts "http" and "https" scheme. +The value should not contain a query string or fragment. +OTEL_EXPORTER_OTLP_TRACES_ENDPOINT takes precedence over OTEL_EXPORTER_OTLP_ENDPOINT. +The configuration can be overridden by [WithEndpoint], [WithInsecure], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_TRACES_INSECURE (default: "false") - +setting "true" disables client transport security for the exporter's gRPC connection. +You can use this only when an endpoint is provided without the http or https scheme. +OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT setting overrides +the scheme defined via OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT. +OTEL_EXPORTER_OTLP_TRACES_INSECURE takes precedence over OTEL_EXPORTER_OTLP_INSECURE. +The configuration can be overridden by [WithInsecure], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS (default: none) - +key-value pairs used as gRPC metadata associated with gRPC requests. +The value is expected to be represented in a format matching to the [W3C Baggage HTTP Header Content Format], +except that additional semi-colon delimited metadata is not supported. +Example value: "key1=value1,key2=value2". +OTEL_EXPORTER_OTLP_TRACES_HEADERS takes precedence over OTEL_EXPORTER_OTLP_HEADERS. +The configuration can be overridden by [WithHeaders] option. + +OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_TRACES_TIMEOUT (default: "10000") - +maximum time in milliseconds the OTLP exporter waits for each batch export. +OTEL_EXPORTER_OTLP_TRACES_TIMEOUT takes precedence over OTEL_EXPORTER_OTLP_TIMEOUT. +The configuration can be overridden by [WithTimeout] option. + +OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_TRACES_COMPRESSION (default: none) - +the gRPC compressor the exporter uses. +Supported value: "gzip". +OTEL_EXPORTER_OTLP_TRACES_COMPRESSION takes precedence over OTEL_EXPORTER_OTLP_COMPRESSION. +The configuration can be overridden by [WithCompressor], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE (default: none) - +the filepath to the trusted certificate to use when verifying a server's TLS credentials. +OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CERTIFICATE. +The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE (default: none) - +the filepath to the client certificate/chain trust for clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE. +The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_CLIENT_KEY, OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY (default: none) - +the filepath to the clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY takes precedence over OTEL_EXPORTER_OTLP_CLIENT_KEY. +The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] option. + +[W3C Baggage HTTP Header Content Format]: https://www.w3.org/TR/baggage/#header-content +*/ +package otlptracegrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/envconfig/envconfig.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go similarity index 57% rename from vendor/go.opentelemetry.io/otel/exporters/otlp/internal/envconfig/envconfig.go rename to vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go index 67003c4a2..5530119e4 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/envconfig/envconfig.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig" import ( "crypto/tls" @@ -23,6 +26,8 @@ import ( "strconv" "strings" "time" + + "go.opentelemetry.io/otel/internal/global" ) // ConfigFn is the generic function used to set a config. @@ -59,13 +64,26 @@ func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { } } +// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. +func WithBool(n string, fn func(bool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b := strings.ToLower(v) == "true" + fn(b) + } + } +} + // WithDuration retrieves the specified config and passes it to ConfigFn as a duration. func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { - if d, err := strconv.Atoi(v); err == nil { - fn(time.Duration(d) * time.Millisecond) + d, err := strconv.Atoi(v) + if err != nil { + global.Error(err, "parse duration", "input", v) + return } + fn(time.Duration(d) * time.Millisecond) } } } @@ -83,26 +101,62 @@ func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { - if u, err := url.Parse(v); err == nil { - fn(u) + u, err := url.Parse(v) + if err != nil { + global.Error(err, "parse url", "input", v) + return } + fn(u) } } } -// WithTLSConfig retrieves the specified config and passes it to ConfigFn as a crypto/tls.Config. -func WithTLSConfig(n string, fn func(*tls.Config)) func(e *EnvOptionsReader) { +// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. +func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { - if b, err := e.ReadFile(v); err == nil { - if c, err := createTLSConfig(b); err == nil { - fn(c) - } + b, err := e.ReadFile(v) + if err != nil { + global.Error(err, "read tls ca cert file", "file", v) + return + } + c, err := createCertPool(b) + if err != nil { + global.Error(err, "create tls cert pool") + return } + fn(c) } } } +// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. +func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { + return func(e *EnvOptionsReader) { + vc, okc := e.GetEnvValue(nc) + vk, okk := e.GetEnvValue(nk) + if !okc || !okk { + return + } + cert, err := e.ReadFile(vc) + if err != nil { + global.Error(err, "read tls client cert", "file", vc) + return + } + key, err := e.ReadFile(vk) + if err != nil { + global.Error(err, "read tls client key", "file", vk) + return + } + crt, err := tls.X509KeyPair(cert, key) + if err != nil { + global.Error(err, "create tls client key pair") + return + } + fn(crt) + } +} + func keyWithNamespace(ns, key string) string { if ns == "" { return key @@ -115,17 +169,20 @@ func stringToHeader(value string) map[string]string { headers := make(map[string]string) for _, header := range headersPairs { - nameValue := strings.SplitN(header, "=", 2) - if len(nameValue) < 2 { + n, v, found := strings.Cut(header, "=") + if !found { + global.Error(errors.New("missing '="), "parse headers", "input", header) continue } - name, err := url.QueryUnescape(nameValue[0]) + name, err := url.PathUnescape(n) if err != nil { + global.Error(err, "escape header key", "key", n) continue } trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(nameValue[1]) + value, err := url.PathUnescape(v) if err != nil { + global.Error(err, "escape header value", "value", v) continue } trimmedValue := strings.TrimSpace(value) @@ -136,13 +193,10 @@ func stringToHeader(value string) map[string]string { return headers } -func createTLSConfig(certBytes []byte) (*tls.Config, error) { +func createCertPool(certBytes []byte) (*x509.CertPool, error) { cp := x509.NewCertPool() if ok := cp.AppendCertsFromPEM(certBytes); !ok { return nil, errors.New("failed to append certificate to the cert pool") } - - return &tls.Config{ - RootCAs: cp, - }, nil + return cp, nil } diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go new file mode 100644 index 000000000..1fb290618 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go @@ -0,0 +1,35 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess.go.tmpl "--data={}" --out=partialsuccess.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess_test.go.tmpl "--data={}" --out=partialsuccess_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry.go.tmpl "--data={}" --out=retry/retry.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry_test.go.tmpl "--data={}" --out=retry/retry_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig.go.tmpl "--data={}" --out=envconfig/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig_test.go.tmpl "--data={}" --out=envconfig/envconfig_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig\"}" --out=otlpconfig/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl "--data={\"retryImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry\"}" --out=otlpconfig/options.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig\"}" --out=otlpconfig/options_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl "--data={}" --out=otlpconfig/optiontypes.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl "--data={}" --out=otlpconfig/tls.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl "--data={}" --out=otlptracetest/client.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl "--data={}" --out=otlptracetest/collector.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl "--data={}" --out=otlptracetest/data.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl "--data={}" --out=otlptracetest/otlptest.go diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go similarity index 74% rename from vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go rename to vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go index b29f618e3..32f6dddb4 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,17 +15,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" import ( "crypto/tls" + "crypto/x509" "net/url" "os" "path" "strings" "time" - "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig" ) // DefaultEnvOptionsReader is the default environments reader. @@ -53,6 +57,7 @@ func ApplyHTTPEnvConfigs(cfg Config) Config { func getOptionsFromEnv() []GenericOption { opts := []GenericOption{} + tlsConf := &tls.Config{} DefaultEnvOptionsReader.Apply( envconfig.WithURL("ENDPOINT", func(u *url.URL) { opts = append(opts, withEndpointScheme(u)) @@ -81,8 +86,13 @@ func getOptionsFromEnv() []GenericOption { return cfg }, withEndpointForGRPC(u))) }), - envconfig.WithTLSConfig("CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), - envconfig.WithTLSConfig("TRACES_CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithCertPool("TRACES_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert("TRACES_CLIENT_CERTIFICATE", "TRACES_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithBool("TRACES_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), envconfig.WithHeaders("TRACES_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), @@ -125,3 +135,19 @@ func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOpt } } } + +// revive:disable-next-line:flag-parameter +func withInsecure(b bool) GenericOption { + if b { + return WithInsecure() + } + return WithSecure() +} + +func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if c.RootCAs != nil || len(c.Certificates) > 0 { + fn(c) + } + } +} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go similarity index 89% rename from vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go rename to vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go index 56e83b853..dddb1f334 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,11 +15,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" import ( "crypto/tls" "fmt" + "path" + "strings" "time" "google.golang.org/grpc" @@ -25,8 +30,8 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" - "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" ) const ( @@ -82,13 +87,28 @@ func NewHTTPConfig(opts ...HTTPOption) Config { for _, opt := range opts { cfg = opt.ApplyHTTPOption(cfg) } - cfg.Traces.URLPath = internal.CleanPath(cfg.Traces.URLPath, DefaultTracesPath) + cfg.Traces.URLPath = cleanPath(cfg.Traces.URLPath, DefaultTracesPath) return cfg } +// cleanPath returns a path with all spaces trimmed and all redundancies +// removed. If urlPath is empty or cleaning it results in an empty string, +// defaultPath is returned instead. +func cleanPath(urlPath string, defaultPath string) string { + tmp := path.Clean(strings.TrimSpace(urlPath)) + if tmp == "." { + return defaultPath + } + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + return tmp +} + // NewGRPCConfig returns a new Config with all settings applied from opts and // any unset setting using the default gRPC config values. func NewGRPCConfig(opts ...GRPCOption) Config { + userAgent := "OTel OTLP Exporter Go/" + otlptrace.Version() cfg := Config{ Traces: SignalConfig{ Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), @@ -97,6 +117,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config { Timeout: DefaultTimeout, }, RetryConfig: retry.DefaultConfig, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { @@ -120,9 +141,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { if cfg.Traces.Compression == GzipCompression { cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) } - if len(cfg.DialOptions) != 0 { - cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) - } if cfg.ReconnectionPeriod != 0 { p := grpc.ConnectParams{ Backoff: backoff.DefaultConfig, diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go similarity index 90% rename from vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go rename to vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go index c2d6c0361..d9dcdc96e 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" const ( // DefaultCollectorGRPCPort is the default gRPC port of the collector. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/tls.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go similarity index 87% rename from vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/tls.go rename to vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go index 7287cf6cf..19b6d4b21 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/tls.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" import ( "crypto/tls" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/partialsuccess.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go similarity index 64% rename from vendor/go.opentelemetry.io/otel/exporters/otlp/internal/partialsuccess.go rename to vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go index 7994706ab..076905e54 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/partialsuccess.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess.go + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,23 +15,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" import "fmt" -// PartialSuccessDropKind indicates the kind of partial success error -// received by an OTLP exporter, which corresponds with the signal -// being exported. -type PartialSuccessDropKind string - -const ( - // TracingPartialSuccess indicates that some spans were rejected. - TracingPartialSuccess PartialSuccessDropKind = "spans" - - // MetricsPartialSuccess indicates that some metric data points were rejected. - MetricsPartialSuccess PartialSuccessDropKind = "metric data points" -) - // PartialSuccess represents the underlying error for all handling // OTLP partial success messages. Use `errors.Is(err, // PartialSuccess{})` to test whether an error passed to the OTel @@ -36,7 +26,7 @@ const ( type PartialSuccess struct { ErrorMessage string RejectedItems int64 - RejectedKind PartialSuccessDropKind + RejectedKind string } var _ error = PartialSuccess{} @@ -56,13 +46,22 @@ func (ps PartialSuccess) Is(err error) bool { return ok } -// PartialSuccessToError produces an error suitable for passing to -// `otel.Handle()` out of the fields in a partial success response, -// independent of which signal produced the outcome. -func PartialSuccessToError(kind PartialSuccessDropKind, itemsRejected int64, errorMessage string) error { +// TracePartialSuccessError returns an error describing a partial success +// response for the trace signal. +func TracePartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "spans", + } +} + +// MetricPartialSuccessError returns an error describing a partial success +// response for the metric signal. +func MetricPartialSuccessError(itemsRejected int64, errorMessage string) error { return PartialSuccess{ ErrorMessage: errorMessage, RejectedItems: itemsRejected, - RejectedKind: kind, + RejectedKind: "metric data points", } } diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/retry.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go similarity index 80% rename from vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/retry.go rename to vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go index 3d43f7aea..3ce7d6632 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/retry.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,7 +18,7 @@ // Package retry provides request retry functionality that can perform // configurable exponential backoff for transient errors and honor any // explicit throttle responses received. -package retry // import "go.opentelemetry.io/otel/exporters/otlp/internal/retry" +package retry // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" import ( "context" @@ -76,21 +79,21 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { } } - // Do not use NewExponentialBackOff since it calls Reset and the code here - // must call Reset after changing the InitialInterval (this saves an - // unnecessary call to Now). - b := &backoff.ExponentialBackOff{ - InitialInterval: c.InitialInterval, - RandomizationFactor: backoff.DefaultRandomizationFactor, - Multiplier: backoff.DefaultMultiplier, - MaxInterval: c.MaxInterval, - MaxElapsedTime: c.MaxElapsedTime, - Stop: backoff.Stop, - Clock: backoff.SystemClock, - } - b.Reset() - return func(ctx context.Context, fn func(context.Context) error) error { + // Do not use NewExponentialBackOff since it calls Reset and the code here + // must call Reset after changing the InitialInterval (this saves an + // unnecessary call to Now). + b := &backoff.ExponentialBackOff{ + InitialInterval: c.InitialInterval, + RandomizationFactor: backoff.DefaultRandomizationFactor, + Multiplier: backoff.DefaultMultiplier, + MaxInterval: c.MaxInterval, + MaxElapsedTime: c.MaxElapsedTime, + Stop: backoff.Stop, + Clock: backoff.SystemClock, + } + b.Reset() + for { err := fn(ctx) if err == nil { @@ -119,8 +122,8 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { delay = throttle } - if err := waitFunc(ctx, delay); err != nil { - return err + if ctxErr := waitFunc(ctx, delay); ctxErr != nil { + return fmt.Errorf("%w: %s", ctxErr, err) } } } @@ -129,6 +132,9 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { // Allow override for testing. var waitFunc = wait +// wait takes the caller's context, and the amount of time to wait. It will +// return nil if the timer fires before or at the same time as the context's +// deadline. This indicates that the call can be retried. func wait(ctx context.Context, delay time.Duration) error { timer := time.NewTimer(delay) defer timer.Stop() diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go index 3d09ce590..17ffeaf6e 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -22,8 +22,8 @@ import ( "google.golang.org/grpc/credentials" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" ) // Option applies an option to the gRPC driver. @@ -93,13 +93,7 @@ func compressorToCompression(compressor string) otlpconfig.Compression { } // WithCompressor sets the compressor for the gRPC client to use when sending -// requests. It is the responsibility of the caller to ensure that the -// compressor set has been registered with google.golang.org/grpc/encoding. -// This can be done by encoding.RegisterCompressor. Some compressors -// auto-register on import, such as gzip, which can be registered by calling -// `import _ "google.golang.org/grpc/encoding/gzip"`. -// -// This option has no effect if WithGRPCConn is used. +// requests. Supported compressor values: "gzip". func WithCompressor(compressor string) Option { return wrappedOption{otlpconfig.WithCompression(compressorToCompression(compressor))} } diff --git a/vendor/go.opentelemetry.io/otel/metric/unit/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go similarity index 65% rename from vendor/go.opentelemetry.io/otel/metric/unit/doc.go rename to vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go index f8e723593..620ea88bf 100644 --- a/vendor/go.opentelemetry.io/otel/metric/unit/doc.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package unit provides units. -// -// This package is currently in a pre-GA phase. Backwards incompatible changes -// may be introduced in subsequent minor version releases as we work to track -// the evolving OpenTelemetry specification and user feedback. -package unit // import "go.opentelemetry.io/otel/metric/unit" +package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + +// Version is the current release version of the OpenTelemetry OTLP trace exporter in use. +func Version() string { + return "1.20.0" +} diff --git a/vendor/go.opentelemetry.io/otel/handler.go b/vendor/go.opentelemetry.io/otel/handler.go index 36cf09f72..4115fe3bb 100644 --- a/vendor/go.opentelemetry.io/otel/handler.go +++ b/vendor/go.opentelemetry.io/otel/handler.go @@ -15,59 +15,16 @@ package otel // import "go.opentelemetry.io/otel" import ( - "log" - "os" - "sync" + "go.opentelemetry.io/otel/internal/global" ) var ( - // globalErrorHandler provides an ErrorHandler that can be used - // throughout an OpenTelemetry instrumented project. When a user - // specified ErrorHandler is registered (`SetErrorHandler`) all calls to - // `Handle` and will be delegated to the registered ErrorHandler. - globalErrorHandler = defaultErrorHandler() - - // Compile-time check that delegator implements ErrorHandler. - _ ErrorHandler = (*delegator)(nil) - // Compile-time check that errLogger implements ErrorHandler. - _ ErrorHandler = (*errLogger)(nil) + // Compile-time check global.ErrDelegator implements ErrorHandler. + _ ErrorHandler = (*global.ErrDelegator)(nil) + // Compile-time check global.ErrLogger implements ErrorHandler. + _ ErrorHandler = (*global.ErrLogger)(nil) ) -type delegator struct { - lock *sync.RWMutex - eh ErrorHandler -} - -func (d *delegator) Handle(err error) { - d.lock.RLock() - defer d.lock.RUnlock() - d.eh.Handle(err) -} - -// setDelegate sets the ErrorHandler delegate. -func (d *delegator) setDelegate(eh ErrorHandler) { - d.lock.Lock() - defer d.lock.Unlock() - d.eh = eh -} - -func defaultErrorHandler() *delegator { - return &delegator{ - lock: &sync.RWMutex{}, - eh: &errLogger{l: log.New(os.Stderr, "", log.LstdFlags)}, - } -} - -// errLogger logs errors if no delegate is set, otherwise they are delegated. -type errLogger struct { - l *log.Logger -} - -// Handle logs err if no delegate is set, otherwise it is delegated. -func (h *errLogger) Handle(err error) { - h.l.Print(err) -} - // GetErrorHandler returns the global ErrorHandler instance. // // The default ErrorHandler instance returned will log all errors to STDERR @@ -77,9 +34,7 @@ func (h *errLogger) Handle(err error) { // // Subsequent calls to SetErrorHandler after the first will not forward errors // to the new ErrorHandler for prior returned instances. -func GetErrorHandler() ErrorHandler { - return globalErrorHandler -} +func GetErrorHandler() ErrorHandler { return global.GetErrorHandler() } // SetErrorHandler sets the global ErrorHandler to h. // @@ -87,11 +42,7 @@ func GetErrorHandler() ErrorHandler { // GetErrorHandler will send errors to h instead of the default logging // ErrorHandler. Subsequent calls will set the global ErrorHandler, but not // delegate errors to h. -func SetErrorHandler(h ErrorHandler) { - globalErrorHandler.setDelegate(h) -} +func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) } // Handle is a convenience function for ErrorHandler().Handle(err). -func Handle(err error) { - GetErrorHandler().Handle(err) -} +func Handle(err error) { global.Handle(err) } diff --git a/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go b/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go new file mode 100644 index 000000000..622c3ee3f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go @@ -0,0 +1,111 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package attribute provide several helper functions for some commonly used +logic of processing attributes. +*/ +package attribute // import "go.opentelemetry.io/otel/internal/attribute" + +import ( + "reflect" +) + +// BoolSliceValue converts a bool slice into an array with same elements as slice. +func BoolSliceValue(v []bool) interface{} { + var zero bool + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]bool), v) + return cp.Elem().Interface() +} + +// Int64SliceValue converts an int64 slice into an array with same elements as slice. +func Int64SliceValue(v []int64) interface{} { + var zero int64 + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]int64), v) + return cp.Elem().Interface() +} + +// Float64SliceValue converts a float64 slice into an array with same elements as slice. +func Float64SliceValue(v []float64) interface{} { + var zero float64 + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]float64), v) + return cp.Elem().Interface() +} + +// StringSliceValue converts a string slice into an array with same elements as slice. +func StringSliceValue(v []string) interface{} { + var zero string + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]string), v) + return cp.Elem().Interface() +} + +// AsBoolSlice converts a bool array into a slice into with same elements as array. +func AsBoolSlice(v interface{}) []bool { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero bool + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]bool) +} + +// AsInt64Slice converts an int64 array into a slice into with same elements as array. +func AsInt64Slice(v interface{}) []int64 { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero int64 + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]int64) +} + +// AsFloat64Slice converts a float64 array into a slice into with same elements as array. +func AsFloat64Slice(v interface{}) []float64 { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero float64 + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]float64) +} + +// AsStringSlice converts a string array into a slice into with same elements as array. +func AsStringSlice(v interface{}) []string { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero string + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]string) +} diff --git a/vendor/go.opentelemetry.io/otel/internal/gen.go b/vendor/go.opentelemetry.io/otel/internal/gen.go new file mode 100644 index 000000000..f532f07e9 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/gen.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/internal" + +//go:generate gotmpl --body=./shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go +//go:generate gotmpl --body=./shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go +//go:generate gotmpl --body=./shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go + +//go:generate gotmpl --body=./shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go +//go:generate gotmpl --body=./shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go +//go:generate gotmpl --body=./shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go +//go:generate gotmpl --body=./shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go +//go:generate gotmpl --body=./shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/internal/matchers\"}" --out=internaltest/harness.go +//go:generate gotmpl --body=./shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go +//go:generate gotmpl --body=./shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go +//go:generate gotmpl --body=./shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go +//go:generate gotmpl --body=./shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/vendor/go.opentelemetry.io/otel/internal/global/handler.go b/vendor/go.opentelemetry.io/otel/internal/global/handler.go new file mode 100644 index 000000000..5e9b83047 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/handler.go @@ -0,0 +1,102 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "log" + "os" + "sync/atomic" +) + +var ( + // GlobalErrorHandler provides an ErrorHandler that can be used + // throughout an OpenTelemetry instrumented project. When a user + // specified ErrorHandler is registered (`SetErrorHandler`) all calls to + // `Handle` and will be delegated to the registered ErrorHandler. + GlobalErrorHandler = defaultErrorHandler() + + // Compile-time check that delegator implements ErrorHandler. + _ ErrorHandler = (*ErrDelegator)(nil) + // Compile-time check that errLogger implements ErrorHandler. + _ ErrorHandler = (*ErrLogger)(nil) +) + +// ErrorHandler handles irremediable events. +type ErrorHandler interface { + // Handle handles any error deemed irremediable by an OpenTelemetry + // component. + Handle(error) +} + +type ErrDelegator struct { + delegate atomic.Pointer[ErrorHandler] +} + +func (d *ErrDelegator) Handle(err error) { + d.getDelegate().Handle(err) +} + +func (d *ErrDelegator) getDelegate() ErrorHandler { + return *d.delegate.Load() +} + +// setDelegate sets the ErrorHandler delegate. +func (d *ErrDelegator) setDelegate(eh ErrorHandler) { + d.delegate.Store(&eh) +} + +func defaultErrorHandler() *ErrDelegator { + d := &ErrDelegator{} + d.setDelegate(&ErrLogger{l: log.New(os.Stderr, "", log.LstdFlags)}) + return d +} + +// ErrLogger logs errors if no delegate is set, otherwise they are delegated. +type ErrLogger struct { + l *log.Logger +} + +// Handle logs err if no delegate is set, otherwise it is delegated. +func (h *ErrLogger) Handle(err error) { + h.l.Print(err) +} + +// GetErrorHandler returns the global ErrorHandler instance. +// +// The default ErrorHandler instance returned will log all errors to STDERR +// until an override ErrorHandler is set with SetErrorHandler. All +// ErrorHandler returned prior to this will automatically forward errors to +// the set instance instead of logging. +// +// Subsequent calls to SetErrorHandler after the first will not forward errors +// to the new ErrorHandler for prior returned instances. +func GetErrorHandler() ErrorHandler { + return GlobalErrorHandler +} + +// SetErrorHandler sets the global ErrorHandler to h. +// +// The first time this is called all ErrorHandler previously returned from +// GetErrorHandler will send errors to h instead of the default logging +// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not +// delegate errors to h. +func SetErrorHandler(h ErrorHandler) { + GlobalErrorHandler.setDelegate(h) +} + +// Handle is a convenience function for ErrorHandler().Handle(err). +func Handle(err error) { + GetErrorHandler().Handle(err) +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go new file mode 100644 index 000000000..ebb13c206 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go @@ -0,0 +1,371 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "context" + "sync/atomic" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" +) + +// unwrapper unwraps to return the underlying instrument implementation. +type unwrapper interface { + Unwrap() metric.Observable +} + +type afCounter struct { + embedded.Float64ObservableCounter + metric.Float64Observable + + name string + opts []metric.Float64ObservableCounterOption + + delegate atomic.Value // metric.Float64ObservableCounter +} + +var ( + _ unwrapper = (*afCounter)(nil) + _ metric.Float64ObservableCounter = (*afCounter)(nil) +) + +func (i *afCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64ObservableCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *afCounter) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64ObservableCounter) + } + return nil +} + +type afUpDownCounter struct { + embedded.Float64ObservableUpDownCounter + metric.Float64Observable + + name string + opts []metric.Float64ObservableUpDownCounterOption + + delegate atomic.Value // metric.Float64ObservableUpDownCounter +} + +var ( + _ unwrapper = (*afUpDownCounter)(nil) + _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) +) + +func (i *afUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *afUpDownCounter) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64ObservableUpDownCounter) + } + return nil +} + +type afGauge struct { + embedded.Float64ObservableGauge + metric.Float64Observable + + name string + opts []metric.Float64ObservableGaugeOption + + delegate atomic.Value // metric.Float64ObservableGauge +} + +var ( + _ unwrapper = (*afGauge)(nil) + _ metric.Float64ObservableGauge = (*afGauge)(nil) +) + +func (i *afGauge) setDelegate(m metric.Meter) { + ctr, err := m.Float64ObservableGauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *afGauge) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64ObservableGauge) + } + return nil +} + +type aiCounter struct { + embedded.Int64ObservableCounter + metric.Int64Observable + + name string + opts []metric.Int64ObservableCounterOption + + delegate atomic.Value // metric.Int64ObservableCounter +} + +var ( + _ unwrapper = (*aiCounter)(nil) + _ metric.Int64ObservableCounter = (*aiCounter)(nil) +) + +func (i *aiCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64ObservableCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *aiCounter) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64ObservableCounter) + } + return nil +} + +type aiUpDownCounter struct { + embedded.Int64ObservableUpDownCounter + metric.Int64Observable + + name string + opts []metric.Int64ObservableUpDownCounterOption + + delegate atomic.Value // metric.Int64ObservableUpDownCounter +} + +var ( + _ unwrapper = (*aiUpDownCounter)(nil) + _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) +) + +func (i *aiUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *aiUpDownCounter) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64ObservableUpDownCounter) + } + return nil +} + +type aiGauge struct { + embedded.Int64ObservableGauge + metric.Int64Observable + + name string + opts []metric.Int64ObservableGaugeOption + + delegate atomic.Value // metric.Int64ObservableGauge +} + +var ( + _ unwrapper = (*aiGauge)(nil) + _ metric.Int64ObservableGauge = (*aiGauge)(nil) +) + +func (i *aiGauge) setDelegate(m metric.Meter) { + ctr, err := m.Int64ObservableGauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *aiGauge) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64ObservableGauge) + } + return nil +} + +// Sync Instruments. +type sfCounter struct { + embedded.Float64Counter + + name string + opts []metric.Float64CounterOption + + delegate atomic.Value // metric.Float64Counter +} + +var _ metric.Float64Counter = (*sfCounter)(nil) + +func (i *sfCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64Counter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64Counter).Add(ctx, incr, opts...) + } +} + +type sfUpDownCounter struct { + embedded.Float64UpDownCounter + + name string + opts []metric.Float64UpDownCounterOption + + delegate atomic.Value // metric.Float64UpDownCounter +} + +var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil) + +func (i *sfUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64UpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64UpDownCounter).Add(ctx, incr, opts...) + } +} + +type sfHistogram struct { + embedded.Float64Histogram + + name string + opts []metric.Float64HistogramOption + + delegate atomic.Value // metric.Float64Histogram +} + +var _ metric.Float64Histogram = (*sfHistogram)(nil) + +func (i *sfHistogram) setDelegate(m metric.Meter) { + ctr, err := m.Float64Histogram(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64Histogram).Record(ctx, x, opts...) + } +} + +type siCounter struct { + embedded.Int64Counter + + name string + opts []metric.Int64CounterOption + + delegate atomic.Value // metric.Int64Counter +} + +var _ metric.Int64Counter = (*siCounter)(nil) + +func (i *siCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64Counter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64Counter).Add(ctx, x, opts...) + } +} + +type siUpDownCounter struct { + embedded.Int64UpDownCounter + + name string + opts []metric.Int64UpDownCounterOption + + delegate atomic.Value // metric.Int64UpDownCounter +} + +var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil) + +func (i *siUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64UpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64UpDownCounter).Add(ctx, x, opts...) + } +} + +type siHistogram struct { + embedded.Int64Histogram + + name string + opts []metric.Int64HistogramOption + + delegate atomic.Value // metric.Int64Histogram +} + +var _ metric.Int64Histogram = (*siHistogram)(nil) + +func (i *siHistogram) setDelegate(m metric.Meter) { + ctr, err := m.Int64Histogram(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64Histogram).Record(ctx, x, opts...) + } +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go index ccb325871..c6f305a2b 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go @@ -17,47 +17,53 @@ package global // import "go.opentelemetry.io/otel/internal/global" import ( "log" "os" - "sync" + "sync/atomic" "github.com/go-logr/logr" "github.com/go-logr/stdr" ) -// globalLogger is the logging interface used within the otel api and sdk provide deatails of the internals. +// globalLogger is the logging interface used within the otel api and sdk provide details of the internals. // // The default logger uses stdr which is backed by the standard `log.Logger` // interface. This logger will only show messages at the Error Level. -var globalLogger logr.Logger = stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)) -var globalLoggerLock = &sync.RWMutex{} +var globalLogger atomic.Pointer[logr.Logger] + +func init() { + SetLogger(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) +} // SetLogger overrides the globalLogger with l. // -// To see Info messages use a logger with `l.V(1).Enabled() == true` -// To see Debug messages use a logger with `l.V(5).Enabled() == true`. +// To see Warn messages use a logger with `l.V(1).Enabled() == true` +// To see Info messages use a logger with `l.V(4).Enabled() == true` +// To see Debug messages use a logger with `l.V(8).Enabled() == true`. func SetLogger(l logr.Logger) { - globalLoggerLock.Lock() - defer globalLoggerLock.Unlock() - globalLogger = l + globalLogger.Store(&l) +} + +func getLogger() logr.Logger { + return *globalLogger.Load() } // Info prints messages about the general state of the API or SDK. -// This should usually be less then 5 messages a minute. +// This should usually be less than 5 messages a minute. func Info(msg string, keysAndValues ...interface{}) { - globalLoggerLock.RLock() - defer globalLoggerLock.RUnlock() - globalLogger.V(1).Info(msg, keysAndValues...) + getLogger().V(4).Info(msg, keysAndValues...) } // Error prints messages about exceptional states of the API or SDK. func Error(err error, msg string, keysAndValues ...interface{}) { - globalLoggerLock.RLock() - defer globalLoggerLock.RUnlock() - globalLogger.Error(err, msg, keysAndValues...) + getLogger().Error(err, msg, keysAndValues...) } // Debug prints messages about all internal changes in the API or SDK. func Debug(msg string, keysAndValues ...interface{}) { - globalLoggerLock.RLock() - defer globalLoggerLock.RUnlock() - globalLogger.V(5).Info(msg, keysAndValues...) + getLogger().V(8).Info(msg, keysAndValues...) +} + +// Warn prints messages about warnings in the API or SDK. +// Not an error but is likely more important than an informational event. +func Warn(msg string, keysAndValues ...interface{}) { + getLogger().V(1).Info(msg, keysAndValues...) } diff --git a/vendor/go.opentelemetry.io/otel/internal/global/meter.go b/vendor/go.opentelemetry.io/otel/internal/global/meter.go new file mode 100644 index 000000000..0097db478 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/meter.go @@ -0,0 +1,354 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "container/list" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" +) + +// meterProvider is a placeholder for a configured SDK MeterProvider. +// +// All MeterProvider functionality is forwarded to a delegate once +// configured. +type meterProvider struct { + embedded.MeterProvider + + mtx sync.Mutex + meters map[il]*meter + + delegate metric.MeterProvider +} + +// setDelegate configures p to delegate all MeterProvider functionality to +// provider. +// +// All Meters provided prior to this function call are switched out to be +// Meters provided by provider. All instruments and callbacks are recreated and +// delegated. +// +// It is guaranteed by the caller that this happens only once. +func (p *meterProvider) setDelegate(provider metric.MeterProvider) { + p.mtx.Lock() + defer p.mtx.Unlock() + + p.delegate = provider + + if len(p.meters) == 0 { + return + } + + for _, meter := range p.meters { + meter.setDelegate(provider) + } + + p.meters = nil +} + +// Meter implements MeterProvider. +func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter { + p.mtx.Lock() + defer p.mtx.Unlock() + + if p.delegate != nil { + return p.delegate.Meter(name, opts...) + } + + // At this moment it is guaranteed that no sdk is installed, save the meter in the meters map. + + c := metric.NewMeterConfig(opts...) + key := il{ + name: name, + version: c.InstrumentationVersion(), + } + + if p.meters == nil { + p.meters = make(map[il]*meter) + } + + if val, ok := p.meters[key]; ok { + return val + } + + t := &meter{name: name, opts: opts} + p.meters[key] = t + return t +} + +// meter is a placeholder for a metric.Meter. +// +// All Meter functionality is forwarded to a delegate once configured. +// Otherwise, all functionality is forwarded to a NoopMeter. +type meter struct { + embedded.Meter + + name string + opts []metric.MeterOption + + mtx sync.Mutex + instruments []delegatedInstrument + + registry list.List + + delegate atomic.Value // metric.Meter +} + +type delegatedInstrument interface { + setDelegate(metric.Meter) +} + +// setDelegate configures m to delegate all Meter functionality to Meters +// created by provider. +// +// All subsequent calls to the Meter methods will be passed to the delegate. +// +// It is guaranteed by the caller that this happens only once. +func (m *meter) setDelegate(provider metric.MeterProvider) { + meter := provider.Meter(m.name, m.opts...) + m.delegate.Store(meter) + + m.mtx.Lock() + defer m.mtx.Unlock() + + for _, inst := range m.instruments { + inst.setDelegate(meter) + } + + for e := m.registry.Front(); e != nil; e = e.Next() { + r := e.Value.(*registration) + r.setDelegate(meter) + m.registry.Remove(e) + } + + m.instruments = nil + m.registry.Init() +} + +func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64Counter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64UpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64Histogram(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siHistogram{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64ObservableCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &aiCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64ObservableUpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &aiUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64ObservableGauge(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &aiGauge{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64Counter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64UpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64Histogram(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfHistogram{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64ObservableCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &afCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64ObservableUpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &afUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64ObservableGauge(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &afGauge{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +// RegisterCallback captures the function that will be called during Collect. +func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + insts = unwrapInstruments(insts) + return del.RegisterCallback(f, insts...) + } + + m.mtx.Lock() + defer m.mtx.Unlock() + + reg := ®istration{instruments: insts, function: f} + e := m.registry.PushBack(reg) + reg.unreg = func() error { + m.mtx.Lock() + _ = m.registry.Remove(e) + m.mtx.Unlock() + return nil + } + return reg, nil +} + +type wrapped interface { + unwrap() metric.Observable +} + +func unwrapInstruments(instruments []metric.Observable) []metric.Observable { + out := make([]metric.Observable, 0, len(instruments)) + + for _, inst := range instruments { + if in, ok := inst.(wrapped); ok { + out = append(out, in.unwrap()) + } else { + out = append(out, inst) + } + } + + return out +} + +type registration struct { + embedded.Registration + + instruments []metric.Observable + function metric.Callback + + unreg func() error + unregMu sync.Mutex +} + +func (c *registration) setDelegate(m metric.Meter) { + insts := unwrapInstruments(c.instruments) + + c.unregMu.Lock() + defer c.unregMu.Unlock() + + if c.unreg == nil { + // Unregister already called. + return + } + + reg, err := m.RegisterCallback(c.function, insts...) + if err != nil { + GetErrorHandler().Handle(err) + } + + c.unreg = reg.Unregister +} + +func (c *registration) Unregister() error { + c.unregMu.Lock() + defer c.unregMu.Unlock() + if c.unreg == nil { + // Unregister already called. + return nil + } + + var err error + err, c.unreg = c.unreg(), nil + return err +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/state.go b/vendor/go.opentelemetry.io/otel/internal/global/state.go index 1ad38f828..7985005bc 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/state.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/state.go @@ -19,6 +19,7 @@ import ( "sync" "sync/atomic" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -31,14 +32,20 @@ type ( propagatorsHolder struct { tm propagation.TextMapPropagator } + + meterProviderHolder struct { + mp metric.MeterProvider + } ) var ( - globalTracer = defaultTracerValue() - globalPropagators = defaultPropagatorsValue() + globalTracer = defaultTracerValue() + globalPropagators = defaultPropagatorsValue() + globalMeterProvider = defaultMeterProvider() delegateTraceOnce sync.Once delegateTextMapPropagatorOnce sync.Once + delegateMeterOnce sync.Once ) // TracerProvider is the internal implementation for global.TracerProvider. @@ -102,6 +109,34 @@ func SetTextMapPropagator(p propagation.TextMapPropagator) { globalPropagators.Store(propagatorsHolder{tm: p}) } +// MeterProvider is the internal implementation for global.MeterProvider. +func MeterProvider() metric.MeterProvider { + return globalMeterProvider.Load().(meterProviderHolder).mp +} + +// SetMeterProvider is the internal implementation for global.SetMeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + current := MeterProvider() + if _, cOk := current.(*meterProvider); cOk { + if _, mpOk := mp.(*meterProvider); mpOk && current == mp { + // Do not assign the default delegating MeterProvider to delegate + // to itself. + Error( + errors.New("no delegate configured in meter provider"), + "Setting meter provider to it's current value. No delegate will be configured", + ) + return + } + } + + delegateMeterOnce.Do(func() { + if def, ok := current.(*meterProvider); ok { + def.setDelegate(mp) + } + }) + globalMeterProvider.Store(meterProviderHolder{mp: mp}) +} + func defaultTracerValue() *atomic.Value { v := &atomic.Value{} v.Store(tracerProviderHolder{tp: &tracerProvider{}}) @@ -113,3 +148,9 @@ func defaultPropagatorsValue() *atomic.Value { v.Store(propagatorsHolder{tm: newTextMapPropagator()}) return v } + +func defaultMeterProvider() *atomic.Value { + v := &atomic.Value{} + v.Store(meterProviderHolder{mp: &meterProvider{}}) + return v +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/trace.go b/vendor/go.opentelemetry.io/otel/internal/global/trace.go index 5f008d098..3f61ec12a 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/trace.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/trace.go @@ -39,6 +39,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" ) // tracerProvider is a placeholder for a configured SDK TracerProvider. @@ -46,6 +47,8 @@ import ( // All TracerProvider functionality is forwarded to a delegate once // configured. type tracerProvider struct { + embedded.TracerProvider + mtx sync.Mutex tracers map[il]*tracer delegate trace.TracerProvider @@ -119,6 +122,8 @@ type il struct { // All Tracer functionality is forwarded to a delegate once configured. // Otherwise, all functionality is forwarded to a NoopTracer. type tracer struct { + embedded.Tracer + name string opts []trace.TracerOption provider *tracerProvider @@ -156,6 +161,8 @@ func (t *tracer) Start(ctx context.Context, name string, opts ...trace.SpanStart // SpanContext. It performs no operations other than to return the wrapped // SpanContext. type nonRecordingSpan struct { + embedded.Span + sc trace.SpanContext tracer *tracer } diff --git a/vendor/go.opentelemetry.io/otel/metric.go b/vendor/go.opentelemetry.io/otel/metric.go new file mode 100644 index 000000000..f95517195 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric.go @@ -0,0 +1,53 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/metric" +) + +// Meter returns a Meter from the global MeterProvider. The name must be the +// name of the library providing instrumentation. This name may be the same as +// the instrumented code only if that code provides built-in instrumentation. +// If the name is empty, then a implementation defined default name will be +// used instead. +// +// If this is called before a global MeterProvider is registered the returned +// Meter will be a No-op implementation of a Meter. When a global MeterProvider +// is registered for the first time, the returned Meter, and all the +// instruments it has created or will create, are recreated automatically from +// the new MeterProvider. +// +// This is short for GetMeterProvider().Meter(name). +func Meter(name string, opts ...metric.MeterOption) metric.Meter { + return GetMeterProvider().Meter(name, opts...) +} + +// GetMeterProvider returns the registered global meter provider. +// +// If no global GetMeterProvider has been registered, a No-op GetMeterProvider +// implementation is returned. When a global GetMeterProvider is registered for +// the first time, the returned GetMeterProvider, and all the Meters it has +// created or will create, are recreated automatically from the new +// GetMeterProvider. +func GetMeterProvider() metric.MeterProvider { + return global.MeterProvider() +} + +// SetMeterProvider registers mp as the global MeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + global.SetMeterProvider(mp) +} diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go new file mode 100644 index 000000000..072baa8e8 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go @@ -0,0 +1,271 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Float64Observable describes a set of instruments used asynchronously to +// record float64 measurements once per collection cycle. Observations of +// these instruments are only made within a callback. +// +// Warning: Methods may be added to this interface in minor releases. +type Float64Observable interface { + Observable + + float64Observable() +} + +// Float64ObservableCounter is an instrument used to asynchronously record +// increasing float64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. The value observed is +// assumed the to be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for +// unimplemented methods. +type Float64ObservableCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64ObservableCounter + + Float64Observable +} + +// Float64ObservableCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Float64ObservableCounterConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableCounterConfig returns a new +// [Float64ObservableCounterConfig] with all opts applied. +func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig { + var config Float64ObservableCounterConfig + for _, o := range opts { + config = o.applyFloat64ObservableCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableCounterConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableCounterOption applies options to a +// [Float64ObservableCounterConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableCounterOption. +type Float64ObservableCounterOption interface { + applyFloat64ObservableCounter(Float64ObservableCounterConfig) Float64ObservableCounterConfig +} + +// Float64ObservableUpDownCounter is an instrument used to asynchronously +// record float64 measurements once per collection cycle. Observations are only +// made within a callback for this instrument. The value observed is assumed +// the to be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64ObservableUpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64ObservableUpDownCounter + + Float64Observable +} + +// Float64ObservableUpDownCounterConfig contains options for asynchronous +// counter instruments that record int64 values. +type Float64ObservableUpDownCounterConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableUpDownCounterConfig returns a new +// [Float64ObservableUpDownCounterConfig] with all opts applied. +func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig { + var config Float64ObservableUpDownCounterConfig + for _, o := range opts { + config = o.applyFloat64ObservableUpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableUpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableUpDownCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableUpDownCounterConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableUpDownCounterOption applies options to a +// [Float64ObservableUpDownCounterConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableUpDownCounterOption. +type Float64ObservableUpDownCounterOption interface { + applyFloat64ObservableUpDownCounter(Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig +} + +// Float64ObservableGauge is an instrument used to asynchronously record +// instantaneous float64 measurements once per collection cycle. Observations +// are only made within a callback for this instrument. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64ObservableGauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64ObservableGauge + + Float64Observable +} + +// Float64ObservableGaugeConfig contains options for asynchronous counter +// instruments that record int64 values. +type Float64ObservableGaugeConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableGaugeConfig returns a new [Float64ObservableGaugeConfig] +// with all opts applied. +func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig { + var config Float64ObservableGaugeConfig + for _, o := range opts { + config = o.applyFloat64ObservableGauge(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableGaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableGaugeConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableGaugeConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableGaugeOption applies options to a +// [Float64ObservableGaugeConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableGaugeOption. +type Float64ObservableGaugeOption interface { + applyFloat64ObservableGauge(Float64ObservableGaugeConfig) Float64ObservableGaugeConfig +} + +// Float64Observer is a recorder of float64 measurements. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Observer + + // Observe records the float64 value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Observe(value float64, options ...ObserveOption) +} + +// Float64Callback is a function registered with a Meter that makes +// observations for a Float64Observerable instrument it is registered with. +// Calls to the Float64Observer record measurement values for the +// Float64Observable. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Float64Callbacks. Meaning, it should not report measurements with the same +// attributes as another Float64Callbacks also registered for the same +// instrument. +// +// The function needs to be concurrent safe. +type Float64Callback func(context.Context, Float64Observer) error + +// Float64ObservableOption applies options to float64 Observer instruments. +type Float64ObservableOption interface { + Float64ObservableCounterOption + Float64ObservableUpDownCounterOption + Float64ObservableGaugeOption +} + +type float64CallbackOpt struct { + cback Float64Callback +} + +func (o float64CallbackOpt) applyFloat64ObservableCounter(cfg Float64ObservableCounterConfig) Float64ObservableCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o float64CallbackOpt) applyFloat64ObservableUpDownCounter(cfg Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o float64CallbackOpt) applyFloat64ObservableGauge(cfg Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +// WithFloat64Callback adds callback to be called for an instrument. +func WithFloat64Callback(callback Float64Callback) Float64ObservableOption { + return float64CallbackOpt{callback} +} diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go new file mode 100644 index 000000000..9bd6ebf02 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go @@ -0,0 +1,269 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Int64Observable describes a set of instruments used asynchronously to record +// int64 measurements once per collection cycle. Observations of these +// instruments are only made within a callback. +// +// Warning: Methods may be added to this interface in minor releases. +type Int64Observable interface { + Observable + + int64Observable() +} + +// Int64ObservableCounter is an instrument used to asynchronously record +// increasing int64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. The value observed is +// assumed the to be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64ObservableCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64ObservableCounter + + Int64Observable +} + +// Int64ObservableCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableCounterConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableCounterConfig returns a new [Int64ObservableCounterConfig] +// with all opts applied. +func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig { + var config Int64ObservableCounterConfig + for _, o := range opts { + config = o.applyInt64ObservableCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableCounterOption applies options to a +// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableCounterOption. +type Int64ObservableCounterOption interface { + applyInt64ObservableCounter(Int64ObservableCounterConfig) Int64ObservableCounterConfig +} + +// Int64ObservableUpDownCounter is an instrument used to asynchronously record +// int64 measurements once per collection cycle. Observations are only made +// within a callback for this instrument. The value observed is assumed the to +// be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64ObservableUpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64ObservableUpDownCounter + + Int64Observable +} + +// Int64ObservableUpDownCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableUpDownCounterConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableUpDownCounterConfig returns a new +// [Int64ObservableUpDownCounterConfig] with all opts applied. +func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig { + var config Int64ObservableUpDownCounterConfig + for _, o := range opts { + config = o.applyInt64ObservableUpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableUpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableUpDownCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableUpDownCounterOption applies options to a +// [Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableUpDownCounterOption. +type Int64ObservableUpDownCounterOption interface { + applyInt64ObservableUpDownCounter(Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig +} + +// Int64ObservableGauge is an instrument used to asynchronously record +// instantaneous int64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64ObservableGauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64ObservableGauge + + Int64Observable +} + +// Int64ObservableGaugeConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableGaugeConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableGaugeConfig returns a new [Int64ObservableGaugeConfig] +// with all opts applied. +func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig { + var config Int64ObservableGaugeConfig + for _, o := range opts { + config = o.applyInt64ObservableGauge(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableGaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableGaugeConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableGaugeOption applies options to a +// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableGaugeOption. +type Int64ObservableGaugeOption interface { + applyInt64ObservableGauge(Int64ObservableGaugeConfig) Int64ObservableGaugeConfig +} + +// Int64Observer is a recorder of int64 measurements. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Observer + + // Observe records the int64 value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Observe(value int64, options ...ObserveOption) +} + +// Int64Callback is a function registered with a Meter that makes observations +// for an Int64Observerable instrument it is registered with. Calls to the +// Int64Observer record measurement values for the Int64Observable. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Int64Callbacks. Meaning, it should not report measurements with the same +// attributes as another Int64Callbacks also registered for the same +// instrument. +// +// The function needs to be concurrent safe. +type Int64Callback func(context.Context, Int64Observer) error + +// Int64ObservableOption applies options to int64 Observer instruments. +type Int64ObservableOption interface { + Int64ObservableCounterOption + Int64ObservableUpDownCounterOption + Int64ObservableGaugeOption +} + +type int64CallbackOpt struct { + cback Int64Callback +} + +func (o int64CallbackOpt) applyInt64ObservableCounter(cfg Int64ObservableCounterConfig) Int64ObservableCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o int64CallbackOpt) applyInt64ObservableUpDownCounter(cfg Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o int64CallbackOpt) applyInt64ObservableGauge(cfg Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +// WithInt64Callback adds callback to be called for an instrument. +func WithInt64Callback(callback Int64Callback) Int64ObservableOption { + return int64CallbackOpt{callback} +} diff --git a/vendor/go.opentelemetry.io/otel/metric/config.go b/vendor/go.opentelemetry.io/otel/metric/config.go index 621e4c5fc..778ad2d74 100644 --- a/vendor/go.opentelemetry.io/otel/metric/config.go +++ b/vendor/go.opentelemetry.io/otel/metric/config.go @@ -14,17 +14,30 @@ package metric // import "go.opentelemetry.io/otel/metric" +import "go.opentelemetry.io/otel/attribute" + // MeterConfig contains options for Meters. type MeterConfig struct { instrumentationVersion string schemaURL string + attrs attribute.Set + + // Ensure forward compatibility by explicitly making this not comparable. + noCmp [0]func() //nolint: unused // This is indeed used. } -// InstrumentationVersion is the version of the library providing instrumentation. +// InstrumentationVersion returns the version of the library providing +// instrumentation. func (cfg MeterConfig) InstrumentationVersion() string { return cfg.instrumentationVersion } +// InstrumentationAttributes returns the attributes associated with the library +// providing instrumentation. +func (cfg MeterConfig) InstrumentationAttributes() attribute.Set { + return cfg.attrs +} + // SchemaURL is the schema_url of the library providing instrumentation. func (cfg MeterConfig) SchemaURL() string { return cfg.schemaURL @@ -60,6 +73,16 @@ func WithInstrumentationVersion(version string) MeterOption { }) } +// WithInstrumentationAttributes sets the instrumentation attributes. +// +// The passed attributes will be de-duplicated. +func WithInstrumentationAttributes(attr ...attribute.KeyValue) MeterOption { + return meterOptionFunc(func(config MeterConfig) MeterConfig { + config.attrs = attribute.NewSet(attr...) + return config + }) +} + // WithSchemaURL sets the schema URL. func WithSchemaURL(schemaURL string) MeterOption { return meterOptionFunc(func(config MeterConfig) MeterConfig { diff --git a/vendor/go.opentelemetry.io/otel/metric/doc.go b/vendor/go.opentelemetry.io/otel/metric/doc.go index bd6f43437..54716e13b 100644 --- a/vendor/go.opentelemetry.io/otel/metric/doc.go +++ b/vendor/go.opentelemetry.io/otel/metric/doc.go @@ -13,11 +13,158 @@ // limitations under the License. /* -Package metric provides an implementation of the metrics part of the -OpenTelemetry API. +Package metric provides the OpenTelemetry API used to measure metrics about +source code operation. -This package is currently in a pre-GA phase. Backwards incompatible changes -may be introduced in subsequent minor version releases as we work to track the -evolving OpenTelemetry specification and user feedback. +This API is separate from its implementation so the instrumentation built from +it is reusable. See [go.opentelemetry.io/otel/sdk/metric] for the official +OpenTelemetry implementation of this API. + +All measurements made with this package are made via instruments. These +instruments are created by a [Meter] which itself is created by a +[MeterProvider]. Applications need to accept a [MeterProvider] implementation +as a starting point when instrumenting. This can be done directly, or by using +the OpenTelemetry global MeterProvider via [GetMeterProvider]. Using an +appropriately named [Meter] from the accepted [MeterProvider], instrumentation +can then be built from the [Meter]'s instruments. + +# Instruments + +Each instrument is designed to make measurements of a particular type. Broadly, +all instruments fall into two overlapping logical categories: asynchronous or +synchronous, and int64 or float64. + +All synchronous instruments ([Int64Counter], [Int64UpDownCounter], +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are used to measure the operation and performance of source +code during the source code execution. These instruments only make measurements +when the source code they instrument is run. + +All asynchronous instruments ([Int64ObservableCounter], +[Int64ObservableUpDownCounter], [Int64ObservableGauge], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], and +[Float64ObservableGauge]) are used to measure metrics outside of the execution +of source code. They are said to make "observations" via a callback function +called once every measurement collection cycle. + +Each instrument is also grouped by the value type it measures. Either int64 or +float64. The value being measured will dictate which instrument in these +categories to use. + +Outside of these two broad categories, instruments are described by the +function they are designed to serve. All Counters ([Int64Counter], +[Float64Counter], [Int64ObservableCounter], and [Float64ObservableCounter]) are +designed to measure values that never decrease in value, but instead only +incrementally increase in value. UpDownCounters ([Int64UpDownCounter], +[Float64UpDownCounter], [Int64ObservableUpDownCounter], and +[Float64ObservableUpDownCounter]) on the other hand, are designed to measure +values that can increase and decrease. When more information needs to be +conveyed about all the synchronous measurements made during a collection cycle, +a Histogram ([Int64Histogram] and [Float64Histogram]) should be used. Finally, +when just the most recent measurement needs to be conveyed about an +asynchronous measurement, a Gauge ([Int64ObservableGauge] and +[Float64ObservableGauge]) should be used. + +See the [OpenTelemetry documentation] for more information about instruments +and their intended use. + +# Measurements + +Measurements are made by recording values and information about the values with +an instrument. How these measurements are recorded depends on the instrument. + +Measurements for synchronous instruments ([Int64Counter], [Int64UpDownCounter], +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are recorded using the instrument methods directly. All +counter instruments have an Add method that is used to measure an increment +value, and all histogram instruments have a Record method to measure a data +point. + +Asynchronous instruments ([Int64ObservableCounter], +[Int64ObservableUpDownCounter], [Int64ObservableGauge], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], and +[Float64ObservableGauge]) record measurements within a callback function. The +callback is registered with the Meter which ensures the callback is called once +per collection cycle. A callback can be registered two ways: during the +instrument's creation using an option, or later using the RegisterCallback +method of the [Meter] that created the instrument. + +If the following criteria are met, an option ([WithInt64Callback] or +[WithFloat64Callback]) can be used during the asynchronous instrument's +creation to register a callback ([Int64Callback] or [Float64Callback], +respectively): + + - The measurement process is known when the instrument is created + - Only that instrument will make a measurement within the callback + - The callback never needs to be unregistered + +If the criteria are not met, use the RegisterCallback method of the [Meter] that +created the instrument to register a [Callback]. + +# API Implementations + +This package does not conform to the standard Go versioning policy, all of its +interfaces may have methods added to them without a package major version bump. +This non-standard API evolution could surprise an uninformed implementation +author. They could unknowingly build their implementation in a way that would +result in a runtime panic for their users that update to the new API. + +The API is designed to help inform an instrumentation author about this +non-standard API evolution. It requires them to choose a default behavior for +unimplemented interface methods. There are three behavior choices they can +make: + + - Compilation failure + - Panic + - Default to another implementation + +All interfaces in this API embed a corresponding interface from +[go.opentelemetry.io/otel/metric/embedded]. If an author wants the default +behavior of their implementations to be a compilation failure, signaling to +their users they need to update to the latest version of that implementation, +they need to embed the corresponding interface from +[go.opentelemetry.io/otel/metric/embedded] in their implementation. For +example, + + import "go.opentelemetry.io/otel/metric/embedded" + + type MeterProvider struct { + embedded.MeterProvider + // ... + } + +If an author wants the default behavior of their implementations to a panic, +they need to embed the API interface directly. + + import "go.opentelemetry.io/otel/metric" + + type MeterProvider struct { + metric.MeterProvider + // ... + } + +This is not a recommended behavior as it could lead to publishing packages that +contain runtime panics when users update other package that use newer versions +of [go.opentelemetry.io/otel/metric]. + +Finally, an author can embed another implementation in theirs. The embedded +implementation will be used for methods not defined by the author. For example, +an author who wants to default to silently dropping the call can use +[go.opentelemetry.io/otel/metric/noop]: + + import "go.opentelemetry.io/otel/metric/noop" + + type MeterProvider struct { + noop.MeterProvider + // ... + } + +It is strongly recommended that authors only embed +[go.opentelemetry.io/otel/metric/noop] if they choose this default behavior. +That implementation is the only one OpenTelemetry authors can guarantee will +fully implement all the API interfaces when a user updates their API. + +[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ +[GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider */ package metric // import "go.opentelemetry.io/otel/metric" diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go new file mode 100644 index 000000000..ae0bdbd2e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go @@ -0,0 +1,234 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package embedded provides interfaces embedded within the [OpenTelemetry +// metric API]. +// +// Implementers of the [OpenTelemetry metric API] can embed the relevant type +// from this package into their implementation directly. Doing so will result +// in a compilation error for users when the [OpenTelemetry metric API] is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [OpenTelemetry metric API]: https://pkg.go.dev/go.opentelemetry.io/otel/metric +package embedded // import "go.opentelemetry.io/otel/metric/embedded" + +// MeterProvider is embedded in +// [go.opentelemetry.io/otel/metric.MeterProvider]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.MeterProvider] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.MeterProvider] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type MeterProvider interface{ meterProvider() } + +// Meter is embedded in [go.opentelemetry.io/otel/metric.Meter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Meter] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Meter] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Meter interface{ meter() } + +// Float64Observer is embedded in +// [go.opentelemetry.io/otel/metric.Float64Observer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Observer] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64Observer] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Float64Observer interface{ float64Observer() } + +// Int64Observer is embedded in +// [go.opentelemetry.io/otel/metric.Int64Observer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Observer] if you want users +// to experience a compilation error, signaling they need to update to your +// latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64Observer] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64Observer interface{ int64Observer() } + +// Observer is embedded in [go.opentelemetry.io/otel/metric.Observer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Observer] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Observer] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Observer interface{ observer() } + +// Registration is embedded in [go.opentelemetry.io/otel/metric.Registration]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Registration] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Registration] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Registration interface{ registration() } + +// Float64Counter is embedded in +// [go.opentelemetry.io/otel/metric.Float64Counter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Counter] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64Counter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Float64Counter interface{ float64Counter() } + +// Float64Histogram is embedded in +// [go.opentelemetry.io/otel/metric.Float64Histogram]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Histogram] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64Histogram] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Float64Histogram interface{ float64Histogram() } + +// Float64ObservableCounter is embedded in +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64ObservableCounter interface{ float64ObservableCounter() } + +// Float64ObservableGauge is embedded in +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64ObservableGauge interface{ float64ObservableGauge() } + +// Float64ObservableUpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] +// if you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() } + +// Float64UpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Float64UpDownCounter interface{ float64UpDownCounter() } + +// Int64Counter is embedded in +// [go.opentelemetry.io/otel/metric.Int64Counter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Counter] if you want users +// to experience a compilation error, signaling they need to update to your +// latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64Counter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64Counter interface{ int64Counter() } + +// Int64Histogram is embedded in +// [go.opentelemetry.io/otel/metric.Int64Histogram]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Histogram] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64Histogram] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64Histogram interface{ int64Histogram() } + +// Int64ObservableCounter is embedded in +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Int64ObservableCounter interface{ int64ObservableCounter() } + +// Int64ObservableGauge is embedded in +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Int64ObservableGauge interface{ int64ObservableGauge() } + +// Int64ObservableUpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] if +// you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() } + +// Int64UpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64UpDownCounter interface{ int64UpDownCounter() } diff --git a/vendor/go.opentelemetry.io/otel/metric/global/global.go b/vendor/go.opentelemetry.io/otel/metric/global/global.go deleted file mode 100644 index 05a67c2e9..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/global/global.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/metric/global" - -import ( - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/internal/global" -) - -// Meter returns a Meter from the global MeterProvider. The -// instrumentationName must be the name of the library providing -// instrumentation. This name may be the same as the instrumented code only if -// that code provides built-in instrumentation. If the instrumentationName is -// empty, then a implementation defined default name will be used instead. -// -// This is short for MeterProvider().Meter(name). -func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { - return MeterProvider().Meter(instrumentationName, opts...) -} - -// MeterProvider returns the registered global trace provider. -// If none is registered then a No-op MeterProvider is returned. -func MeterProvider() metric.MeterProvider { - return global.MeterProvider() -} - -// SetMeterProvider registers `mp` as the global meter provider. -func SetMeterProvider(mp metric.MeterProvider) { - global.SetMeterProvider(mp) -} diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument.go b/vendor/go.opentelemetry.io/otel/metric/instrument.go new file mode 100644 index 000000000..be89cd533 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/instrument.go @@ -0,0 +1,357 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import "go.opentelemetry.io/otel/attribute" + +// Observable is used as a grouping mechanism for all instruments that are +// updated within a Callback. +type Observable interface { + observable() +} + +// InstrumentOption applies options to all instruments. +type InstrumentOption interface { + Int64CounterOption + Int64UpDownCounterOption + Int64HistogramOption + Int64ObservableCounterOption + Int64ObservableUpDownCounterOption + Int64ObservableGaugeOption + + Float64CounterOption + Float64UpDownCounterOption + Float64HistogramOption + Float64ObservableCounterOption + Float64ObservableUpDownCounterOption + Float64ObservableGaugeOption +} + +// HistogramOption applies options to histogram instruments. +type HistogramOption interface { + Int64HistogramOption + Float64HistogramOption +} + +type descOpt string + +func (o descOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + c.description = string(o) + return c +} + +// WithDescription sets the instrument description. +func WithDescription(desc string) InstrumentOption { return descOpt(desc) } + +type unitOpt string + +func (o unitOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + c.unit = string(o) + return c +} + +// WithUnit sets the instrument unit. +// +// The unit u should be defined using the appropriate [UCUM](https://ucum.org) case-sensitive code. +func WithUnit(u string) InstrumentOption { return unitOpt(u) } + +// WithExplicitBucketBoundaries sets the instrument explicit bucket boundaries. +// +// This option is considered "advisory", and may be ignored by API implementations. +func WithExplicitBucketBoundaries(bounds ...float64) HistogramOption { return bucketOpt(bounds) } + +type bucketOpt []float64 + +func (o bucketOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.explicitBucketBoundaries = o + return c +} + +func (o bucketOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.explicitBucketBoundaries = o + return c +} + +// AddOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as an AddOption. +type AddOption interface { + applyAdd(AddConfig) AddConfig +} + +// AddConfig contains options for an addition measurement. +type AddConfig struct { + attrs attribute.Set +} + +// NewAddConfig returns a new [AddConfig] with all opts applied. +func NewAddConfig(opts []AddOption) AddConfig { + config := AddConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyAdd(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c AddConfig) Attributes() attribute.Set { + return c.attrs +} + +// RecordOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as a RecordOption. +type RecordOption interface { + applyRecord(RecordConfig) RecordConfig +} + +// RecordConfig contains options for a recorded measurement. +type RecordConfig struct { + attrs attribute.Set +} + +// NewRecordConfig returns a new [RecordConfig] with all opts applied. +func NewRecordConfig(opts []RecordOption) RecordConfig { + config := RecordConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyRecord(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c RecordConfig) Attributes() attribute.Set { + return c.attrs +} + +// ObserveOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as a ObserveOption. +type ObserveOption interface { + applyObserve(ObserveConfig) ObserveConfig +} + +// ObserveConfig contains options for an observed measurement. +type ObserveConfig struct { + attrs attribute.Set +} + +// NewObserveConfig returns a new [ObserveConfig] with all opts applied. +func NewObserveConfig(opts []ObserveOption) ObserveConfig { + config := ObserveConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyObserve(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c ObserveConfig) Attributes() attribute.Set { + return c.attrs +} + +// MeasurementOption applies options to all instrument measurement. +type MeasurementOption interface { + AddOption + RecordOption + ObserveOption +} + +type attrOpt struct { + set attribute.Set +} + +// mergeSets returns the union of keys between a and b. Any duplicate keys will +// use the value associated with b. +func mergeSets(a, b attribute.Set) attribute.Set { + // NewMergeIterator uses the first value for any duplicates. + iter := attribute.NewMergeIterator(&b, &a) + merged := make([]attribute.KeyValue, 0, a.Len()+b.Len()) + for iter.Next() { + merged = append(merged, iter.Attribute()) + } + return attribute.NewSet(merged...) +} + +func (o attrOpt) applyAdd(c AddConfig) AddConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +func (o attrOpt) applyRecord(c RecordConfig) RecordConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +func (o attrOpt) applyObserve(c ObserveConfig) ObserveConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +// WithAttributeSet sets the attribute Set associated with a measurement is +// made with. +// +// If multiple WithAttributeSet or WithAttributes options are passed the +// attributes will be merged together in the order they are passed. Attributes +// with duplicate keys will use the last value passed. +func WithAttributeSet(attributes attribute.Set) MeasurementOption { + return attrOpt{set: attributes} +} + +// WithAttributes converts attributes into an attribute Set and sets the Set to +// be associated with a measurement. This is shorthand for: +// +// cp := make([]attribute.KeyValue, len(attributes)) +// copy(cp, attributes) +// WithAttributes(attribute.NewSet(cp...)) +// +// [attribute.NewSet] may modify the passed attributes so this will make a copy +// of attributes before creating a set in order to ensure this function is +// concurrent safe. This makes this option function less optimized in +// comparison to [WithAttributeSet]. Therefore, [WithAttributeSet] should be +// preferred for performance sensitive code. +// +// See [WithAttributeSet] for information about how multiple WithAttributes are +// merged. +func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption { + cp := make([]attribute.KeyValue, len(attributes)) + copy(cp, attributes) + return attrOpt{set: attribute.NewSet(cp...)} +} diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64/asyncfloat64.go deleted file mode 100644 index 370715f69..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64/asyncfloat64.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package asyncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// InstrumentProvider provides access to individual instruments. -type InstrumentProvider interface { - // Counter creates an instrument for recording increasing values. - Counter(name string, opts ...instrument.Option) (Counter, error) - - // UpDownCounter creates an instrument for recording changes of a value. - UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) - - // Gauge creates an instrument for recording the current value. - Gauge(name string, opts ...instrument.Option) (Gauge, error) -} - -// Counter is an instrument that records increasing values. -type Counter interface { - // Observe records the state of the instrument. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} - -// UpDownCounter is an instrument that records increasing or decreasing values. -type UpDownCounter interface { - // Observe records the state of the instrument. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} - -// Gauge is an instrument that records independent readings. -type Gauge interface { - // Observe records the state of the instrument. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64/asyncint64.go deleted file mode 100644 index 41a561bc4..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64/asyncint64.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package asyncint64 // import "go.opentelemetry.io/otel/metric/instrument/asyncint64" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// InstrumentProvider provides access to individual instruments. -type InstrumentProvider interface { - // Counter creates an instrument for recording increasing values. - Counter(name string, opts ...instrument.Option) (Counter, error) - - // UpDownCounter creates an instrument for recording changes of a value. - UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) - - // Gauge creates an instrument for recording the current value. - Gauge(name string, opts ...instrument.Option) (Gauge, error) -} - -// Counter is an instrument that records increasing values. -type Counter interface { - // Observe records the state of the instrument. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} - -// UpDownCounter is an instrument that records increasing or decreasing values. -type UpDownCounter interface { - // Observe records the state of the instrument. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} - -// Gauge is an instrument that records independent readings. -type Gauge interface { - // Observe records the state of the instrument. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/config.go b/vendor/go.opentelemetry.io/otel/metric/instrument/config.go deleted file mode 100644 index 8778bce16..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/instrument/config.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package instrument // import "go.opentelemetry.io/otel/metric/instrument" - -import "go.opentelemetry.io/otel/metric/unit" - -// Config contains options for metric instrument descriptors. -type Config struct { - description string - unit unit.Unit -} - -// Description describes the instrument in human-readable terms. -func (cfg Config) Description() string { - return cfg.description -} - -// Unit describes the measurement unit for an instrument. -func (cfg Config) Unit() unit.Unit { - return cfg.unit -} - -// Option is an interface for applying metric instrument options. -type Option interface { - applyInstrument(Config) Config -} - -// NewConfig creates a new Config and applies all the given options. -func NewConfig(opts ...Option) Config { - var config Config - for _, o := range opts { - config = o.applyInstrument(config) - } - return config -} - -type optionFunc func(Config) Config - -func (fn optionFunc) applyInstrument(cfg Config) Config { - return fn(cfg) -} - -// WithDescription applies provided description. -func WithDescription(desc string) Option { - return optionFunc(func(cfg Config) Config { - cfg.description = desc - return cfg - }) -} - -// WithUnit applies provided unit. -func WithUnit(u unit.Unit) Option { - return optionFunc(func(cfg Config) Config { - cfg.unit = u - return cfg - }) -} diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64/syncfloat64.go deleted file mode 100644 index 435db1127..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64/syncfloat64.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package syncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// InstrumentProvider provides access to individual instruments. -type InstrumentProvider interface { - // Counter creates an instrument for recording increasing values. - Counter(name string, opts ...instrument.Option) (Counter, error) - // UpDownCounter creates an instrument for recording changes of a value. - UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) - // Histogram creates an instrument for recording a distribution of values. - Histogram(name string, opts ...instrument.Option) (Histogram, error) -} - -// Counter is an instrument that records increasing values. -type Counter interface { - // Add records a change to the counter. - Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} - -// UpDownCounter is an instrument that records increasing or decreasing values. -type UpDownCounter interface { - // Add records a change to the counter. - Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} - -// Histogram is an instrument that records a distribution of values. -type Histogram interface { - // Record adds an additional value to the distribution. - Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/syncint64/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/instrument/syncint64/syncint64.go deleted file mode 100644 index c77a46728..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/instrument/syncint64/syncint64.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package syncint64 // import "go.opentelemetry.io/otel/metric/instrument/syncint64" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// InstrumentProvider provides access to individual instruments. -type InstrumentProvider interface { - // Counter creates an instrument for recording increasing values. - Counter(name string, opts ...instrument.Option) (Counter, error) - // UpDownCounter creates an instrument for recording changes of a value. - UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) - // Histogram creates an instrument for recording a distribution of values. - Histogram(name string, opts ...instrument.Option) (Histogram, error) -} - -// Counter is an instrument that records increasing values. -type Counter interface { - // Add records a change to the counter. - Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} - -// UpDownCounter is an instrument that records increasing or decreasing values. -type UpDownCounter interface { - // Add records a change to the counter. - Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} - -// Histogram is an instrument that records a distribution of values. -type Histogram interface { - // Record adds an additional value to the distribution. - Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} diff --git a/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go deleted file mode 100644 index aed8b6660..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/metric/internal/global" - -import ( - "context" - "sync/atomic" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" -) - -type afCounter struct { - name string - opts []instrument.Option - - delegate atomic.Value //asyncfloat64.Counter - - instrument.Asynchronous -} - -func (i *afCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncFloat64().Counter(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *afCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncfloat64.Counter).Observe(ctx, x, attrs...) - } -} - -func (i *afCounter) unwrap() instrument.Asynchronous { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncfloat64.Counter) - } - return nil -} - -type afUpDownCounter struct { - name string - opts []instrument.Option - - delegate atomic.Value //asyncfloat64.UpDownCounter - - instrument.Asynchronous -} - -func (i *afUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncFloat64().UpDownCounter(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *afUpDownCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncfloat64.UpDownCounter).Observe(ctx, x, attrs...) - } -} - -func (i *afUpDownCounter) unwrap() instrument.Asynchronous { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncfloat64.UpDownCounter) - } - return nil -} - -type afGauge struct { - name string - opts []instrument.Option - - delegate atomic.Value //asyncfloat64.Gauge - - instrument.Asynchronous -} - -func (i *afGauge) setDelegate(m metric.Meter) { - ctr, err := m.AsyncFloat64().Gauge(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *afGauge) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncfloat64.Gauge).Observe(ctx, x, attrs...) - } -} - -func (i *afGauge) unwrap() instrument.Asynchronous { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncfloat64.Gauge) - } - return nil -} - -type aiCounter struct { - name string - opts []instrument.Option - - delegate atomic.Value //asyncint64.Counter - - instrument.Asynchronous -} - -func (i *aiCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncInt64().Counter(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *aiCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncint64.Counter).Observe(ctx, x, attrs...) - } -} - -func (i *aiCounter) unwrap() instrument.Asynchronous { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncint64.Counter) - } - return nil -} - -type aiUpDownCounter struct { - name string - opts []instrument.Option - - delegate atomic.Value //asyncint64.UpDownCounter - - instrument.Asynchronous -} - -func (i *aiUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncInt64().UpDownCounter(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *aiUpDownCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncint64.UpDownCounter).Observe(ctx, x, attrs...) - } -} - -func (i *aiUpDownCounter) unwrap() instrument.Asynchronous { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncint64.UpDownCounter) - } - return nil -} - -type aiGauge struct { - name string - opts []instrument.Option - - delegate atomic.Value //asyncint64.Gauge - - instrument.Asynchronous -} - -func (i *aiGauge) setDelegate(m metric.Meter) { - ctr, err := m.AsyncInt64().Gauge(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *aiGauge) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncint64.Gauge).Observe(ctx, x, attrs...) - } -} - -func (i *aiGauge) unwrap() instrument.Asynchronous { - if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncint64.Gauge) - } - return nil -} - -//Sync Instruments. -type sfCounter struct { - name string - opts []instrument.Option - - delegate atomic.Value //syncfloat64.Counter - - instrument.Synchronous -} - -func (i *sfCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncFloat64().Counter(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncfloat64.Counter).Add(ctx, incr, attrs...) - } -} - -type sfUpDownCounter struct { - name string - opts []instrument.Option - - delegate atomic.Value //syncfloat64.UpDownCounter - - instrument.Synchronous -} - -func (i *sfUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncFloat64().UpDownCounter(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncfloat64.UpDownCounter).Add(ctx, incr, attrs...) - } -} - -type sfHistogram struct { - name string - opts []instrument.Option - - delegate atomic.Value //syncfloat64.Histogram - - instrument.Synchronous -} - -func (i *sfHistogram) setDelegate(m metric.Meter) { - ctr, err := m.SyncFloat64().Histogram(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncfloat64.Histogram).Record(ctx, x, attrs...) - } -} - -type siCounter struct { - name string - opts []instrument.Option - - delegate atomic.Value //syncint64.Counter - - instrument.Synchronous -} - -func (i *siCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncInt64().Counter(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncint64.Counter).Add(ctx, x, attrs...) - } -} - -type siUpDownCounter struct { - name string - opts []instrument.Option - - delegate atomic.Value //syncint64.UpDownCounter - - instrument.Synchronous -} - -func (i *siUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncInt64().UpDownCounter(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncint64.UpDownCounter).Add(ctx, x, attrs...) - } -} - -type siHistogram struct { - name string - opts []instrument.Option - - delegate atomic.Value //syncint64.Histogram - - instrument.Synchronous -} - -func (i *siHistogram) setDelegate(m metric.Meter) { - ctr, err := m.SyncInt64().Histogram(i.name, i.opts...) - if err != nil { - otel.Handle(err) - return - } - i.delegate.Store(ctr) -} - -func (i *siHistogram) Record(ctx context.Context, x int64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncint64.Histogram).Record(ctx, x, attrs...) - } -} diff --git a/vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go b/vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go deleted file mode 100644 index 0fa924f39..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/metric/internal/global" - -import ( - "context" - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" -) - -// meterProvider is a placeholder for a configured SDK MeterProvider. -// -// All MeterProvider functionality is forwarded to a delegate once -// configured. -type meterProvider struct { - mtx sync.Mutex - meters map[il]*meter - - delegate metric.MeterProvider -} - -type il struct { - name string - version string -} - -// setDelegate configures p to delegate all MeterProvider functionality to -// provider. -// -// All Meters provided prior to this function call are switched out to be -// Meters provided by provider. All instruments and callbacks are recreated and -// delegated. -// -// It is guaranteed by the caller that this happens only once. -func (p *meterProvider) setDelegate(provider metric.MeterProvider) { - p.mtx.Lock() - defer p.mtx.Unlock() - - p.delegate = provider - - if len(p.meters) == 0 { - return - } - - for _, meter := range p.meters { - meter.setDelegate(provider) - } - - p.meters = nil -} - -// Meter implements MeterProvider. -func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter { - p.mtx.Lock() - defer p.mtx.Unlock() - - if p.delegate != nil { - return p.delegate.Meter(name, opts...) - } - - // At this moment it is guaranteed that no sdk is installed, save the meter in the meters map. - - c := metric.NewMeterConfig(opts...) - key := il{ - name: name, - version: c.InstrumentationVersion(), - } - - if p.meters == nil { - p.meters = make(map[il]*meter) - } - - if val, ok := p.meters[key]; ok { - return val - } - - t := &meter{name: name, opts: opts} - p.meters[key] = t - return t -} - -// meter is a placeholder for a metric.Meter. -// -// All Meter functionality is forwarded to a delegate once configured. -// Otherwise, all functionality is forwarded to a NoopMeter. -type meter struct { - name string - opts []metric.MeterOption - - mtx sync.Mutex - instruments []delegatedInstrument - callbacks []delegatedCallback - - delegate atomic.Value // metric.Meter -} - -type delegatedInstrument interface { - setDelegate(metric.Meter) -} - -// setDelegate configures m to delegate all Meter functionality to Meters -// created by provider. -// -// All subsequent calls to the Meter methods will be passed to the delegate. -// -// It is guaranteed by the caller that this happens only once. -func (m *meter) setDelegate(provider metric.MeterProvider) { - meter := provider.Meter(m.name, m.opts...) - m.delegate.Store(meter) - - m.mtx.Lock() - defer m.mtx.Unlock() - - for _, inst := range m.instruments { - inst.setDelegate(meter) - } - - for _, callback := range m.callbacks { - callback.setDelegate(meter) - } - - m.instruments = nil - m.callbacks = nil -} - -// AsyncInt64 is the namespace for the Asynchronous Integer instruments. -// -// To Observe data with instruments it must be registered in a callback. -func (m *meter) AsyncInt64() asyncint64.InstrumentProvider { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.AsyncInt64() - } - return (*aiInstProvider)(m) -} - -// AsyncFloat64 is the namespace for the Asynchronous Float instruments. -// -// To Observe data with instruments it must be registered in a callback. -func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.AsyncFloat64() - } - return (*afInstProvider)(m) -} - -// RegisterCallback captures the function that will be called during Collect. -// -// It is only valid to call Observe within the scope of the passed function, -// and only on the instruments that were registered with this call. -func (m *meter) RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error { - if del, ok := m.delegate.Load().(metric.Meter); ok { - insts = unwrapInstruments(insts) - return del.RegisterCallback(insts, function) - } - - m.mtx.Lock() - defer m.mtx.Unlock() - m.callbacks = append(m.callbacks, delegatedCallback{ - instruments: insts, - function: function, - }) - - return nil -} - -type wrapped interface { - unwrap() instrument.Asynchronous -} - -func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Asynchronous { - out := make([]instrument.Asynchronous, 0, len(instruments)) - - for _, inst := range instruments { - if in, ok := inst.(wrapped); ok { - out = append(out, in.unwrap()) - } else { - out = append(out, inst) - } - } - - return out -} - -// SyncInt64 is the namespace for the Synchronous Integer instruments. -func (m *meter) SyncInt64() syncint64.InstrumentProvider { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.SyncInt64() - } - return (*siInstProvider)(m) -} - -// SyncFloat64 is the namespace for the Synchronous Float instruments. -func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.SyncFloat64() - } - return (*sfInstProvider)(m) -} - -type delegatedCallback struct { - instruments []instrument.Asynchronous - function func(context.Context) -} - -func (c *delegatedCallback) setDelegate(m metric.Meter) { - insts := unwrapInstruments(c.instruments) - err := m.RegisterCallback(insts, c.function) - if err != nil { - otel.Handle(err) - } -} - -type afInstProvider meter - -// Counter creates an instrument for recording increasing values. -func (ip *afInstProvider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &afCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip *afInstProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &afUpDownCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// Gauge creates an instrument for recording the current value. -func (ip *afInstProvider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &afGauge{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -type aiInstProvider meter - -// Counter creates an instrument for recording increasing values. -func (ip *aiInstProvider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &aiCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip *aiInstProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &aiUpDownCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// Gauge creates an instrument for recording the current value. -func (ip *aiInstProvider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &aiGauge{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -type sfInstProvider meter - -// Counter creates an instrument for recording increasing values. -func (ip *sfInstProvider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &sfCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip *sfInstProvider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &sfUpDownCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// Histogram creates an instrument for recording a distribution of values. -func (ip *sfInstProvider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &sfHistogram{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -type siInstProvider meter - -// Counter creates an instrument for recording increasing values. -func (ip *siInstProvider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &siCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip *siInstProvider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &siUpDownCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// Histogram creates an instrument for recording a distribution of values. -func (ip *siInstProvider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &siHistogram{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} diff --git a/vendor/go.opentelemetry.io/otel/metric/internal/global/state.go b/vendor/go.opentelemetry.io/otel/metric/internal/global/state.go deleted file mode 100644 index 47c0d787d..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/internal/global/state.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// htmp://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 global // import "go.opentelemetry.io/otel/metric/internal/global" - -import ( - "errors" - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/metric" -) - -var ( - globalMeterProvider = defaultMeterProvider() - - delegateMeterOnce sync.Once -) - -type meterProviderHolder struct { - mp metric.MeterProvider -} - -// MeterProvider is the internal implementation for global.MeterProvider. -func MeterProvider() metric.MeterProvider { - return globalMeterProvider.Load().(meterProviderHolder).mp -} - -// SetMeterProvider is the internal implementation for global.SetMeterProvider. -func SetMeterProvider(mp metric.MeterProvider) { - current := MeterProvider() - if _, cOk := current.(*meterProvider); cOk { - if _, mpOk := mp.(*meterProvider); mpOk && current == mp { - // Do not assign the default delegating MeterProvider to delegate - // to itself. - global.Error( - errors.New("no delegate configured in meter provider"), - "Setting meter provider to it's current value. No delegate will be configured", - ) - return - } - } - - delegateMeterOnce.Do(func() { - if def, ok := current.(*meterProvider); ok { - def.setDelegate(mp) - } - }) - globalMeterProvider.Store(meterProviderHolder{mp: mp}) -} - -func defaultMeterProvider() *atomic.Value { - v := &atomic.Value{} - v.Store(meterProviderHolder{mp: &meterProvider{}}) - return v -} diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go index 21fc1c499..2520bc74a 100644 --- a/vendor/go.opentelemetry.io/otel/metric/meter.go +++ b/vendor/go.opentelemetry.io/otel/metric/meter.go @@ -17,44 +17,196 @@ package metric // import "go.opentelemetry.io/otel/metric" import ( "context" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/metric/embedded" ) // MeterProvider provides access to named Meter instances, for instrumenting -// an application or library. +// an application or package. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type MeterProvider interface { - // Meter creates an instance of a `Meter` interface. The instrumentationName - // must be the name of the library providing instrumentation. This name may - // be the same as the instrumented code only if that code provides built-in - // instrumentation. If the instrumentationName is empty, then a - // implementation defined default name will be used instead. - Meter(instrumentationName string, opts ...MeterOption) Meter + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.MeterProvider + + // Meter returns a new Meter with the provided name and configuration. + // + // A Meter should be scoped at most to a single package. The name needs to + // be unique so it does not collide with other names used by + // an application, nor other applications. To achieve this, the import path + // of the instrumentation package is recommended to be used as name. + // + // If the name is empty, then an implementation defined default name will + // be used instead. + Meter(name string, opts ...MeterOption) Meter } // Meter provides access to instrument instances for recording metrics. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Meter interface { - // AsyncInt64 is the namespace for the Asynchronous Integer instruments. + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Meter + + // Int64Counter returns a new Int64Counter instrument identified by name + // and configured with options. The instrument is used to synchronously + // record increasing int64 measurements during a computational operation. + Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error) + // Int64UpDownCounter returns a new Int64UpDownCounter instrument + // identified by name and configured with options. The instrument is used + // to synchronously record int64 measurements during a computational + // operation. + Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error) + // Int64Histogram returns a new Int64Histogram instrument identified by + // name and configured with options. The instrument is used to + // synchronously record the distribution of int64 measurements during a + // computational operation. + Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error) + // Int64ObservableCounter returns a new Int64ObservableCounter identified + // by name and configured with options. The instrument is used to + // asynchronously record increasing int64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error) + // Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter + // instrument identified by name and configured with options. The + // instrument is used to asynchronously record int64 measurements once per + // a measurement collection cycle. // - // To Observe data with instruments it must be registered in a callback. - AsyncInt64() asyncint64.InstrumentProvider + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error) + // Int64ObservableGauge returns a new Int64ObservableGauge instrument + // identified by name and configured with options. The instrument is used + // to asynchronously record instantaneous int64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error) - // AsyncFloat64 is the namespace for the Asynchronous Float instruments + // Float64Counter returns a new Float64Counter instrument identified by + // name and configured with options. The instrument is used to + // synchronously record increasing float64 measurements during a + // computational operation. + Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error) + // Float64UpDownCounter returns a new Float64UpDownCounter instrument + // identified by name and configured with options. The instrument is used + // to synchronously record float64 measurements during a computational + // operation. + Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error) + // Float64Histogram returns a new Float64Histogram instrument identified by + // name and configured with options. The instrument is used to + // synchronously record the distribution of float64 measurements during a + // computational operation. + Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error) + // Float64ObservableCounter returns a new Float64ObservableCounter + // instrument identified by name and configured with options. The + // instrument is used to asynchronously record increasing float64 + // measurements once per a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error) + // Float64ObservableUpDownCounter returns a new + // Float64ObservableUpDownCounter instrument identified by name and + // configured with options. The instrument is used to asynchronously record + // float64 measurements once per a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error) + // Float64ObservableGauge returns a new Float64ObservableGauge instrument + // identified by name and configured with options. The instrument is used + // to asynchronously record instantaneous float64 measurements once per a + // measurement collection cycle. // - // To Observe data with instruments it must be registered in a callback. - AsyncFloat64() asyncfloat64.InstrumentProvider + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error) - // RegisterCallback captures the function that will be called during Collect. + // RegisterCallback registers f to be called during the collection of a + // measurement cycle. + // + // If Unregister of the returned Registration is called, f needs to be + // unregistered and not called during collection. + // + // The instruments f is registered with are the only instruments that f may + // observe values for. + // + // If no instruments are passed, f should not be registered nor called + // during collection. // - // It is only valid to call Observe within the scope of the passed function, - // and only on the instruments that were registered with this call. - RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error + // The function f needs to be concurrent safe. + RegisterCallback(f Callback, instruments ...Observable) (Registration, error) +} + +// Callback is a function registered with a Meter that makes observations for +// the set of instruments it is registered with. The Observer parameter is used +// to record measurement observations for these instruments. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Callbacks. Meaning, it should not report measurements for an instrument with +// the same attributes as another Callback will report. +// +// The function needs to be concurrent safe. +type Callback func(context.Context, Observer) error + +// Observer records measurements for multiple instruments in a Callback. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Observer + + // ObserveFloat64 records the float64 value for obsrv. + ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption) + // ObserveInt64 records the int64 value for obsrv. + ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption) +} - // SyncInt64 is the namespace for the Synchronous Integer instruments - SyncInt64() syncint64.InstrumentProvider - // SyncFloat64 is the namespace for the Synchronous Float instruments - SyncFloat64() syncfloat64.InstrumentProvider +// Registration is an token representing the unique registration of a callback +// for a set of instruments with a Meter. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Registration interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Registration + + // Unregister removes the callback registration from a Meter. + // + // This method needs to be idempotent and concurrent safe. + Unregister() error } diff --git a/vendor/go.opentelemetry.io/otel/metric/noop.go b/vendor/go.opentelemetry.io/otel/metric/noop.go deleted file mode 100644 index e8b9a9a14..000000000 --- a/vendor/go.opentelemetry.io/otel/metric/noop.go +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" -) - -// NewNoopMeterProvider creates a MeterProvider that does not record any metrics. -func NewNoopMeterProvider() MeterProvider { - return noopMeterProvider{} -} - -type noopMeterProvider struct{} - -func (noopMeterProvider) Meter(string, ...MeterOption) Meter { - return noopMeter{} -} - -// NewNoopMeter creates a Meter that does not record any metrics. -func NewNoopMeter() Meter { - return noopMeter{} -} - -type noopMeter struct{} - -// AsyncInt64 creates an instrument that does not record any metrics. -func (noopMeter) AsyncInt64() asyncint64.InstrumentProvider { - return nonrecordingAsyncInt64Instrument{} -} - -// AsyncFloat64 creates an instrument that does not record any metrics. -func (noopMeter) AsyncFloat64() asyncfloat64.InstrumentProvider { - return nonrecordingAsyncFloat64Instrument{} -} - -// SyncInt64 creates an instrument that does not record any metrics. -func (noopMeter) SyncInt64() syncint64.InstrumentProvider { - return nonrecordingSyncInt64Instrument{} -} - -// SyncFloat64 creates an instrument that does not record any metrics. -func (noopMeter) SyncFloat64() syncfloat64.InstrumentProvider { - return nonrecordingSyncFloat64Instrument{} -} - -// RegisterCallback creates a register callback that does not record any metrics. -func (noopMeter) RegisterCallback([]instrument.Asynchronous, func(context.Context)) error { - return nil -} - -type nonrecordingAsyncFloat64Instrument struct { - instrument.Asynchronous -} - -var ( - _ asyncfloat64.InstrumentProvider = nonrecordingAsyncFloat64Instrument{} - _ asyncfloat64.Counter = nonrecordingAsyncFloat64Instrument{} - _ asyncfloat64.UpDownCounter = nonrecordingAsyncFloat64Instrument{} - _ asyncfloat64.Gauge = nonrecordingAsyncFloat64Instrument{} -) - -func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Option) (asyncfloat64.Counter, error) { - return n, nil -} - -func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(string, ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - return n, nil -} - -func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Option) (asyncfloat64.Gauge, error) { - return n, nil -} - -func (nonrecordingAsyncFloat64Instrument) Observe(context.Context, float64, ...attribute.KeyValue) { - -} - -type nonrecordingAsyncInt64Instrument struct { - instrument.Asynchronous -} - -var ( - _ asyncint64.InstrumentProvider = nonrecordingAsyncInt64Instrument{} - _ asyncint64.Counter = nonrecordingAsyncInt64Instrument{} - _ asyncint64.UpDownCounter = nonrecordingAsyncInt64Instrument{} - _ asyncint64.Gauge = nonrecordingAsyncInt64Instrument{} -) - -func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Option) (asyncint64.Counter, error) { - return n, nil -} - -func (n nonrecordingAsyncInt64Instrument) UpDownCounter(string, ...instrument.Option) (asyncint64.UpDownCounter, error) { - return n, nil -} - -func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Option) (asyncint64.Gauge, error) { - return n, nil -} - -func (nonrecordingAsyncInt64Instrument) Observe(context.Context, int64, ...attribute.KeyValue) { -} - -type nonrecordingSyncFloat64Instrument struct { - instrument.Synchronous -} - -var ( - _ syncfloat64.InstrumentProvider = nonrecordingSyncFloat64Instrument{} - _ syncfloat64.Counter = nonrecordingSyncFloat64Instrument{} - _ syncfloat64.UpDownCounter = nonrecordingSyncFloat64Instrument{} - _ syncfloat64.Histogram = nonrecordingSyncFloat64Instrument{} -) - -func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Option) (syncfloat64.Counter, error) { - return n, nil -} - -func (n nonrecordingSyncFloat64Instrument) UpDownCounter(string, ...instrument.Option) (syncfloat64.UpDownCounter, error) { - return n, nil -} - -func (n nonrecordingSyncFloat64Instrument) Histogram(string, ...instrument.Option) (syncfloat64.Histogram, error) { - return n, nil -} - -func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) { - -} - -func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) { - -} - -type nonrecordingSyncInt64Instrument struct { - instrument.Synchronous -} - -var ( - _ syncint64.InstrumentProvider = nonrecordingSyncInt64Instrument{} - _ syncint64.Counter = nonrecordingSyncInt64Instrument{} - _ syncint64.UpDownCounter = nonrecordingSyncInt64Instrument{} - _ syncint64.Histogram = nonrecordingSyncInt64Instrument{} -) - -func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Option) (syncint64.Counter, error) { - return n, nil -} - -func (n nonrecordingSyncInt64Instrument) UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) { - return n, nil -} - -func (n nonrecordingSyncInt64Instrument) Histogram(string, ...instrument.Option) (syncint64.Histogram, error) { - return n, nil -} - -func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) { -} -func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) { -} diff --git a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go new file mode 100644 index 000000000..0a4825ae6 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go @@ -0,0 +1,185 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Float64Counter is an instrument that records increasing float64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Counter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Counter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr float64, options ...AddOption) +} + +// Float64CounterConfig contains options for synchronous counter instruments that +// record int64 values. +type Float64CounterConfig struct { + description string + unit string +} + +// NewFloat64CounterConfig returns a new [Float64CounterConfig] with all opts +// applied. +func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig { + var config Float64CounterConfig + for _, o := range opts { + config = o.applyFloat64Counter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64CounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64CounterConfig) Unit() string { + return c.unit +} + +// Float64CounterOption applies options to a [Float64CounterConfig]. See +// [InstrumentOption] for other options that can be used as a +// Float64CounterOption. +type Float64CounterOption interface { + applyFloat64Counter(Float64CounterConfig) Float64CounterConfig +} + +// Float64UpDownCounter is an instrument that records increasing or decreasing +// float64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64UpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64UpDownCounter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr float64, options ...AddOption) +} + +// Float64UpDownCounterConfig contains options for synchronous counter +// instruments that record int64 values. +type Float64UpDownCounterConfig struct { + description string + unit string +} + +// NewFloat64UpDownCounterConfig returns a new [Float64UpDownCounterConfig] +// with all opts applied. +func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig { + var config Float64UpDownCounterConfig + for _, o := range opts { + config = o.applyFloat64UpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64UpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64UpDownCounterConfig) Unit() string { + return c.unit +} + +// Float64UpDownCounterOption applies options to a +// [Float64UpDownCounterConfig]. See [InstrumentOption] for other options that +// can be used as a Float64UpDownCounterOption. +type Float64UpDownCounterOption interface { + applyFloat64UpDownCounter(Float64UpDownCounterConfig) Float64UpDownCounterConfig +} + +// Float64Histogram is an instrument that records a distribution of float64 +// values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Histogram interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Histogram + + // Record adds an additional value to the distribution. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, incr float64, options ...RecordOption) +} + +// Float64HistogramConfig contains options for synchronous counter instruments +// that record int64 values. +type Float64HistogramConfig struct { + description string + unit string + explicitBucketBoundaries []float64 +} + +// NewFloat64HistogramConfig returns a new [Float64HistogramConfig] with all +// opts applied. +func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig { + var config Float64HistogramConfig + for _, o := range opts { + config = o.applyFloat64Histogram(config) + } + return config +} + +// Description returns the configured description. +func (c Float64HistogramConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64HistogramConfig) Unit() string { + return c.unit +} + +// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. +func (c Float64HistogramConfig) ExplicitBucketBoundaries() []float64 { + return c.explicitBucketBoundaries +} + +// Float64HistogramOption applies options to a [Float64HistogramConfig]. See +// [InstrumentOption] for other options that can be used as a +// Float64HistogramOption. +type Float64HistogramOption interface { + applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig +} diff --git a/vendor/go.opentelemetry.io/otel/metric/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/syncint64.go new file mode 100644 index 000000000..56667d32f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/syncint64.go @@ -0,0 +1,185 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Int64Counter is an instrument that records increasing int64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Counter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Counter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr int64, options ...AddOption) +} + +// Int64CounterConfig contains options for synchronous counter instruments that +// record int64 values. +type Int64CounterConfig struct { + description string + unit string +} + +// NewInt64CounterConfig returns a new [Int64CounterConfig] with all opts +// applied. +func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig { + var config Int64CounterConfig + for _, o := range opts { + config = o.applyInt64Counter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64CounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64CounterConfig) Unit() string { + return c.unit +} + +// Int64CounterOption applies options to a [Int64CounterConfig]. See +// [InstrumentOption] for other options that can be used as an +// Int64CounterOption. +type Int64CounterOption interface { + applyInt64Counter(Int64CounterConfig) Int64CounterConfig +} + +// Int64UpDownCounter is an instrument that records increasing or decreasing +// int64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64UpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64UpDownCounter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr int64, options ...AddOption) +} + +// Int64UpDownCounterConfig contains options for synchronous counter +// instruments that record int64 values. +type Int64UpDownCounterConfig struct { + description string + unit string +} + +// NewInt64UpDownCounterConfig returns a new [Int64UpDownCounterConfig] with +// all opts applied. +func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig { + var config Int64UpDownCounterConfig + for _, o := range opts { + config = o.applyInt64UpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64UpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64UpDownCounterConfig) Unit() string { + return c.unit +} + +// Int64UpDownCounterOption applies options to a [Int64UpDownCounterConfig]. +// See [InstrumentOption] for other options that can be used as an +// Int64UpDownCounterOption. +type Int64UpDownCounterOption interface { + applyInt64UpDownCounter(Int64UpDownCounterConfig) Int64UpDownCounterConfig +} + +// Int64Histogram is an instrument that records a distribution of int64 +// values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Histogram interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Histogram + + // Record adds an additional value to the distribution. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, incr int64, options ...RecordOption) +} + +// Int64HistogramConfig contains options for synchronous counter instruments +// that record int64 values. +type Int64HistogramConfig struct { + description string + unit string + explicitBucketBoundaries []float64 +} + +// NewInt64HistogramConfig returns a new [Int64HistogramConfig] with all opts +// applied. +func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig { + var config Int64HistogramConfig + for _, o := range opts { + config = o.applyInt64Histogram(config) + } + return config +} + +// Description returns the configured description. +func (c Int64HistogramConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64HistogramConfig) Unit() string { + return c.unit +} + +// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. +func (c Int64HistogramConfig) ExplicitBucketBoundaries() []float64 { + return c.explicitBucketBoundaries +} + +// Int64HistogramOption applies options to a [Int64HistogramConfig]. See +// [InstrumentOption] for other options that can be used as an +// Int64HistogramOption. +type Int64HistogramOption interface { + applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig +} diff --git a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go index 902692da0..75a8f3435 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go +++ b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go @@ -40,8 +40,10 @@ const ( // their proprietary information. type TraceContext struct{} -var _ TextMapPropagator = TraceContext{} -var traceCtxRegExp = regexp.MustCompile("^(?P[0-9a-f]{2})-(?P[a-f0-9]{32})-(?P[a-f0-9]{16})-(?P[a-f0-9]{2})(?:-.*)?$") +var ( + _ TextMapPropagator = TraceContext{} + traceCtxRegExp = regexp.MustCompile("^(?P[0-9a-f]{2})-(?P[a-f0-9]{32})-(?P[a-f0-9]{16})-(?P[a-f0-9]{2})(?:-.*)?$") +) // Inject set tracecontext from the Context into the carrier. func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) { diff --git a/vendor/go.opentelemetry.io/otel/requirements.txt b/vendor/go.opentelemetry.io/otel/requirements.txt new file mode 100644 index 000000000..e0a43e138 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/requirements.txt @@ -0,0 +1 @@ +codespell==2.2.6 diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go b/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go index 5e94b8ae5..59dcfab25 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go +++ b/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go @@ -70,8 +70,8 @@ const ( // returned. func firstInt(defaultValue int, keys ...string) int { for _, key := range keys { - value, ok := os.LookupEnv(key) - if !ok { + value := os.Getenv(key) + if value == "" { continue } @@ -88,10 +88,10 @@ func firstInt(defaultValue int, keys ...string) int { } // IntEnvOr returns the int value of the environment variable with name key if -// it exists and the value is an int. Otherwise, defaultValue is returned. +// it exists, it is not empty, and the value is an int. Otherwise, defaultValue is returned. func IntEnvOr(key string, defaultValue int) int { - value, ok := os.LookupEnv(key) - if !ok { + value := os.Getenv(key) + if value == "" { return defaultValue } diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/gen.go b/vendor/go.opentelemetry.io/otel/sdk/internal/gen.go new file mode 100644 index 000000000..bd84f624b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/internal/gen.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/sdk/internal" + +//go:generate gotmpl --body=../../internal/shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go +//go:generate gotmpl --body=../../internal/shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go +//go:generate gotmpl --body=../../internal/shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go + +//go:generate gotmpl --body=../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go +//go:generate gotmpl --body=../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go +//go:generate gotmpl --body=../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go +//go:generate gotmpl --body=../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go +//go:generate gotmpl --body=../../internal/shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/sdk/internal/matchers\"}" --out=internaltest/harness.go +//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go +//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go +//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go +//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go b/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go index 84a02306e..dfeaaa8ca 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go +++ b/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go @@ -14,16 +14,7 @@ package internal // import "go.opentelemetry.io/otel/sdk/internal" -import ( - "fmt" - "time" - - "go.opentelemetry.io/otel" -) - -// UserAgent is the user agent to be added to the outgoing -// requests from the exporters. -var UserAgent = fmt.Sprintf("opentelemetry-go/%s", otel.Version()) +import "time" // MonotonicEndTime returns the end time at present // but offset from start, monotonically. diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go index c1d220408..4279013be 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go @@ -18,14 +18,13 @@ import ( "context" "errors" "fmt" + "strings" ) -var ( - // ErrPartialResource is returned by a detector when complete source - // information for a Resource is unavailable or the source information - // contains invalid values that are omitted from the returned Resource. - ErrPartialResource = errors.New("partial resource") -) +// ErrPartialResource is returned by a detector when complete source +// information for a Resource is unavailable or the source information +// contains invalid values that are omitted from the returned Resource. +var ErrPartialResource = errors.New("partial resource") // Detector detects OpenTelemetry resource information. type Detector interface { @@ -45,28 +44,65 @@ type Detector interface { // Detect calls all input detectors sequentially and merges each result with the previous one. // It returns the merged error too. func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { - var autoDetectedRes *Resource - var errInfo []string + r := new(Resource) + return r, detect(ctx, r, detectors) +} + +// detect runs all detectors using ctx and merges the result into res. This +// assumes res is allocated and not nil, it will panic otherwise. +func detect(ctx context.Context, res *Resource, detectors []Detector) error { + var ( + r *Resource + errs detectErrs + err error + ) + for _, detector := range detectors { if detector == nil { continue } - res, err := detector.Detect(ctx) + r, err = detector.Detect(ctx) if err != nil { - errInfo = append(errInfo, err.Error()) + errs = append(errs, err) if !errors.Is(err, ErrPartialResource) { continue } } - autoDetectedRes, err = Merge(autoDetectedRes, res) + r, err = Merge(res, r) if err != nil { - errInfo = append(errInfo, err.Error()) + errs = append(errs, err) } + *res = *r + } + + if len(errs) == 0 { + return nil + } + return errs +} + +type detectErrs []error + +func (e detectErrs) Error() string { + errStr := make([]string, len(e)) + for i, err := range e { + errStr[i] = fmt.Sprintf("* %s", err) } - var aggregatedError error - if len(errInfo) > 0 { - aggregatedError = fmt.Errorf("detecting resources: %s", errInfo) + format := "%d errors occurred detecting resource:\n\t%s" + return fmt.Sprintf(format, len(e), strings.Join(errStr, "\n\t")) +} + +func (e detectErrs) Unwrap() error { + switch len(e) { + case 0: + return nil + case 1: + return e[0] } - return autoDetectedRes, aggregatedError + return e[1:] +} + +func (e detectErrs) Is(target error) bool { + return len(e) != 0 && errors.Is(e[0], target) } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go b/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go index 7af46c61a..c63a0dd1f 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go @@ -20,9 +20,9 @@ import ( "os" "path/filepath" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + "go.opentelemetry.io/otel/sdk" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type ( @@ -60,9 +60,9 @@ var ( func (telemetrySDK) Detect(context.Context) (*Resource, error) { return NewWithAttributes( semconv.SchemaURL, - semconv.TelemetrySDKNameKey.String("opentelemetry"), - semconv.TelemetrySDKLanguageKey.String("go"), - semconv.TelemetrySDKVersionKey.String(otel.Version()), + semconv.TelemetrySDKName("opentelemetry"), + semconv.TelemetrySDKLanguageGo, + semconv.TelemetrySDKVersion(sdk.Version()), ), nil } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/config.go b/vendor/go.opentelemetry.io/otel/sdk/resource/config.go index 8e212b121..f263919f6 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/config.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/config.go @@ -71,6 +71,11 @@ func WithHost() Option { return WithDetectors(host{}) } +// WithHostID adds host ID information to the configured resource. +func WithHostID() Option { + return WithDetectors(hostIDDetector{}) +} + // WithTelemetrySDK adds TelemetrySDK version info to the configured resource. func WithTelemetrySDK() Option { return WithDetectors(telemetrySDK{}) @@ -194,6 +199,8 @@ func WithContainer() Option { } // WithContainerID adds an attribute with the id of the container to the configured Resource. +// Note: WithContainerID will not extract the correct container ID in an ECS environment. +// Please use the ECS resource detector instead (https://pkg.go.dev/go.opentelemetry.io/contrib/detectors/aws/ecs). func WithContainerID() Option { return WithDetectors(cgroupContainerIDDetector{}) } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/container.go b/vendor/go.opentelemetry.io/otel/sdk/resource/container.go index 7a897e969..3d5362282 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/container.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/container.go @@ -22,7 +22,7 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type containerIDProvider func() (string, error) @@ -47,7 +47,7 @@ func (cgroupContainerIDDetector) Detect(ctx context.Context) (*Resource, error) if containerID == "" { return Empty(), nil } - return NewWithAttributes(semconv.SchemaURL, semconv.ContainerIDKey.String(containerID)), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ContainerID(containerID)), nil } var ( diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go b/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go index 9aab3d839..d55a50b0d 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go @@ -25,4 +25,7 @@ // OTEL_RESOURCE_ATTRIBUTES the FromEnv Detector can be used. It will interpret // the value as a list of comma delimited key/value pairs // (e.g. `=,=,...`). +// +// While this package provides a stable API, +// the attributes added by resource detectors may change. package resource // import "go.opentelemetry.io/otel/sdk/resource" diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/env.go b/vendor/go.opentelemetry.io/otel/sdk/resource/env.go index eb22d0079..e29ae563a 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/env.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/env.go @@ -17,25 +17,25 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" import ( "context" "fmt" + "net/url" "os" "strings" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) const ( // resourceAttrKey is the environment variable name OpenTelemetry Resource information will be read from. - resourceAttrKey = "OTEL_RESOURCE_ATTRIBUTES" + resourceAttrKey = "OTEL_RESOURCE_ATTRIBUTES" //nolint:gosec // False positive G101: Potential hardcoded credentials // svcNameKey is the environment variable name that Service Name information will be read from. svcNameKey = "OTEL_SERVICE_NAME" ) -var ( - // errMissingValue is returned when a resource value is missing. - errMissingValue = fmt.Errorf("%w: missing value", ErrPartialResource) -) +// errMissingValue is returned when a resource value is missing. +var errMissingValue = fmt.Errorf("%w: missing value", ErrPartialResource) // fromEnv is a Detector that implements the Detector and collects // resources from environment. This Detector is included as a @@ -57,7 +57,7 @@ func (fromEnv) Detect(context.Context) (*Resource, error) { var res *Resource if svcName != "" { - res = NewSchemaless(semconv.ServiceNameKey.String(svcName)) + res = NewSchemaless(semconv.ServiceName(svcName)) } r2, err := constructOTResources(attrs) @@ -80,16 +80,23 @@ func constructOTResources(s string) (*Resource, error) { return Empty(), nil } pairs := strings.Split(s, ",") - attrs := []attribute.KeyValue{} + var attrs []attribute.KeyValue var invalid []string for _, p := range pairs { - field := strings.SplitN(p, "=", 2) - if len(field) != 2 { + k, v, found := strings.Cut(p, "=") + if !found { invalid = append(invalid, p) continue } - k, v := strings.TrimSpace(field[0]), strings.TrimSpace(field[1]) - attrs = append(attrs, attribute.String(k, v)) + key := strings.TrimSpace(k) + val, err := url.PathUnescape(strings.TrimSpace(v)) + if err != nil { + // Retain original value if decoding fails, otherwise it will be + // an empty string. + val = v + otel.Handle(err) + } + attrs = append(attrs, attribute.String(key, val)) } var err error if len(invalid) > 0 { diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go new file mode 100644 index 000000000..fb1ebf2ca --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go @@ -0,0 +1,120 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import ( + "context" + "errors" + "strings" + + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" +) + +type hostIDProvider func() (string, error) + +var defaultHostIDProvider hostIDProvider = platformHostIDReader.read + +var hostID = defaultHostIDProvider + +type hostIDReader interface { + read() (string, error) +} + +type fileReader func(string) (string, error) + +type commandExecutor func(string, ...string) (string, error) + +// hostIDReaderBSD implements hostIDReader. +type hostIDReaderBSD struct { + execCommand commandExecutor + readFile fileReader +} + +// read attempts to read the machine-id from /etc/hostid. If not found it will +// execute `kenv -q smbios.system.uuid`. If neither location yields an id an +// error will be returned. +func (r *hostIDReaderBSD) read() (string, error) { + if result, err := r.readFile("/etc/hostid"); err == nil { + return strings.TrimSpace(result), nil + } + + if result, err := r.execCommand("kenv", "-q", "smbios.system.uuid"); err == nil { + return strings.TrimSpace(result), nil + } + + return "", errors.New("host id not found in: /etc/hostid or kenv") +} + +// hostIDReaderDarwin implements hostIDReader. +type hostIDReaderDarwin struct { + execCommand commandExecutor +} + +// read executes `ioreg -rd1 -c "IOPlatformExpertDevice"` and parses host id +// from the IOPlatformUUID line. If the command fails or the uuid cannot be +// parsed an error will be returned. +func (r *hostIDReaderDarwin) read() (string, error) { + result, err := r.execCommand("ioreg", "-rd1", "-c", "IOPlatformExpertDevice") + if err != nil { + return "", err + } + + lines := strings.Split(result, "\n") + for _, line := range lines { + if strings.Contains(line, "IOPlatformUUID") { + parts := strings.Split(line, " = ") + if len(parts) == 2 { + return strings.Trim(parts[1], "\""), nil + } + break + } + } + + return "", errors.New("could not parse IOPlatformUUID") +} + +type hostIDReaderLinux struct { + readFile fileReader +} + +// read attempts to read the machine-id from /etc/machine-id followed by +// /var/lib/dbus/machine-id. If neither location yields an ID an error will +// be returned. +func (r *hostIDReaderLinux) read() (string, error) { + if result, err := r.readFile("/etc/machine-id"); err == nil { + return strings.TrimSpace(result), nil + } + + if result, err := r.readFile("/var/lib/dbus/machine-id"); err == nil { + return strings.TrimSpace(result), nil + } + + return "", errors.New("host id not found in: /etc/machine-id or /var/lib/dbus/machine-id") +} + +type hostIDDetector struct{} + +// Detect returns a *Resource containing the platform specific host id. +func (hostIDDetector) Detect(ctx context.Context) (*Resource, error) { + hostID, err := hostID() + if err != nil { + return nil, err + } + + return NewWithAttributes( + semconv.SchemaURL, + semconv.HostID(hostID), + ), nil +} diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go similarity index 54% rename from vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go rename to vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go index e1bbb850d..1778bbacf 100644 --- a/vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go @@ -12,19 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +//go:build dragonfly || freebsd || netbsd || openbsd || solaris +// +build dragonfly freebsd netbsd openbsd solaris -// Asynchronous instruments are instruments that are updated within a Callback. -// If an instrument is observed outside of it's callback it should be an error. -// -// This interface is used as a grouping mechanism. -type Asynchronous interface { - asynchronous() -} +package resource // import "go.opentelemetry.io/otel/sdk/resource" -// Synchronous instruments are updated in line with application code. -// -// This interface is used as a grouping mechanism. -type Synchronous interface { - synchronous() +var platformHostIDReader hostIDReader = &hostIDReaderBSD{ + execCommand: execCommand, + readFile: readFile, } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go new file mode 100644 index 000000000..ba41409b2 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go @@ -0,0 +1,19 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +var platformHostIDReader hostIDReader = &hostIDReaderDarwin{ + execCommand: execCommand, +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go new file mode 100644 index 000000000..207acb0ed --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import "os/exec" + +func execCommand(name string, arg ...string) (string, error) { + cmd := exec.Command(name, arg...) + b, err := cmd.Output() + if err != nil { + return "", err + } + + return string(b), nil +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go new file mode 100644 index 000000000..410579b8f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go @@ -0,0 +1,22 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +var platformHostIDReader hostIDReader = &hostIDReaderLinux{ + readFile: readFile, +} diff --git a/vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go similarity index 55% rename from vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.go rename to vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go index d10ad6653..721e3ca6e 100644 --- a/vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go @@ -1,10 +1,10 @@ -// Copyright 2020 Google LLC +// Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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, @@ -12,12 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package field_mask aliases all exported identifiers in -// package "google.golang.org/protobuf/types/known/fieldmaskpb". -package field_mask +//go:build linux || dragonfly || freebsd || netbsd || openbsd || solaris -import "google.golang.org/protobuf/types/known/fieldmaskpb" +package resource // import "go.opentelemetry.io/otel/sdk/resource" -type FieldMask = fieldmaskpb.FieldMask +import "os" -var File_google_protobuf_field_mask_proto = fieldmaskpb.File_google_protobuf_field_mask_proto +func readFile(filename string) (string, error) { + b, err := os.ReadFile(filename) + if err != nil { + return "", err + } + + return string(b), nil +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go new file mode 100644 index 000000000..89df9d688 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go @@ -0,0 +1,36 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !darwin +// +build !dragonfly +// +build !freebsd +// +build !linux +// +build !netbsd +// +build !openbsd +// +build !solaris +// +build !windows + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +// hostIDReaderUnsupported is a placeholder implementation for operating systems +// for which this project currently doesn't support host.id +// attribute detection. See build tags declaration early on this file +// for a list of unsupported OSes. +type hostIDReaderUnsupported struct{} + +func (*hostIDReaderUnsupported) read() (string, error) { + return "", nil +} + +var platformHostIDReader hostIDReader = &hostIDReaderUnsupported{} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go new file mode 100644 index 000000000..5b431c6ee --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go @@ -0,0 +1,48 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import ( + "golang.org/x/sys/windows/registry" +) + +// implements hostIDReader +type hostIDReaderWindows struct{} + +// read reads MachineGuid from the windows registry key: +// SOFTWARE\Microsoft\Cryptography +func (*hostIDReaderWindows) read() (string, error) { + k, err := registry.OpenKey( + registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Cryptography`, + registry.QUERY_VALUE|registry.WOW64_64KEY, + ) + + if err != nil { + return "", err + } + defer k.Close() + + guid, _, err := k.GetStringValue("MachineGuid") + if err != nil { + return "", err + } + + return guid, nil +} + +var platformHostIDReader hostIDReader = &hostIDReaderWindows{} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/os.go b/vendor/go.opentelemetry.io/otel/sdk/resource/os.go index 3b4d0c14d..0cbd55973 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/os.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/os.go @@ -19,7 +19,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type osDescriptionProvider func() (string, error) @@ -36,8 +36,10 @@ func setOSDescriptionProvider(osDescriptionProvider osDescriptionProvider) { osDescription = osDescriptionProvider } -type osTypeDetector struct{} -type osDescriptionDetector struct{} +type ( + osTypeDetector struct{} + osDescriptionDetector struct{} +) // Detect returns a *Resource that describes the operating system type the // service is running on. @@ -56,14 +58,13 @@ func (osTypeDetector) Detect(ctx context.Context) (*Resource, error) { // service is running on. func (osDescriptionDetector) Detect(ctx context.Context) (*Resource, error) { description, err := osDescription() - if err != nil { return nil, err } return NewWithAttributes( semconv.SchemaURL, - semconv.OSDescriptionKey.String(description), + semconv.OSDescription(description), ), nil } @@ -75,6 +76,7 @@ func mapRuntimeOSToSemconvOSType(osType string) attribute.KeyValue { // the elements in this map are the intersection between // available GOOS values and defined semconv OS types osTypeAttributeMap := map[string]attribute.KeyValue{ + "aix": semconv.OSTypeAIX, "darwin": semconv.OSTypeDarwin, "dragonfly": semconv.OSTypeDragonflyBSD, "freebsd": semconv.OSTypeFreeBSD, @@ -83,6 +85,7 @@ func mapRuntimeOSToSemconvOSType(osType string) attribute.KeyValue { "openbsd": semconv.OSTypeOpenBSD, "solaris": semconv.OSTypeSolaris, "windows": semconv.OSTypeWindows, + "zos": semconv.OSTypeZOS, } var osTypeAttribute attribute.KeyValue diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go b/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go index fba6790e4..c771942de 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go @@ -85,14 +85,14 @@ func skip(line string) bool { // parse attempts to split the provided line on the first '=' character, and then // sanitize each side of the split before returning them as a key-value pair. func parse(line string) (string, string, bool) { - parts := strings.SplitN(line, "=", 2) + k, v, found := strings.Cut(line, "=") - if len(parts) != 2 || len(parts[0]) == 0 { + if !found || len(k) == 0 { return "", "", false } - key := strings.TrimSpace(parts[0]) - value := unescape(unquote(strings.TrimSpace(parts[1]))) + key := strings.TrimSpace(k) + value := unescape(unquote(strings.TrimSpace(v))) return key, value, true } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/process.go b/vendor/go.opentelemetry.io/otel/sdk/resource/process.go index 9a169f663..ecdd11dd7 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/process.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/process.go @@ -22,17 +22,19 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) -type pidProvider func() int -type executablePathProvider func() (string, error) -type commandArgsProvider func() []string -type ownerProvider func() (*user.User, error) -type runtimeNameProvider func() string -type runtimeVersionProvider func() string -type runtimeOSProvider func() string -type runtimeArchProvider func() string +type ( + pidProvider func() int + executablePathProvider func() (string, error) + commandArgsProvider func() []string + ownerProvider func() (*user.User, error) + runtimeNameProvider func() string + runtimeVersionProvider func() string + runtimeOSProvider func() string + runtimeArchProvider func() string +) var ( defaultPidProvider pidProvider = os.Getpid @@ -108,26 +110,28 @@ func setUserProviders(ownerProvider ownerProvider) { owner = ownerProvider } -type processPIDDetector struct{} -type processExecutableNameDetector struct{} -type processExecutablePathDetector struct{} -type processCommandArgsDetector struct{} -type processOwnerDetector struct{} -type processRuntimeNameDetector struct{} -type processRuntimeVersionDetector struct{} -type processRuntimeDescriptionDetector struct{} +type ( + processPIDDetector struct{} + processExecutableNameDetector struct{} + processExecutablePathDetector struct{} + processCommandArgsDetector struct{} + processOwnerDetector struct{} + processRuntimeNameDetector struct{} + processRuntimeVersionDetector struct{} + processRuntimeDescriptionDetector struct{} +) // Detect returns a *Resource that describes the process identifier (PID) of the // executing process. func (processPIDDetector) Detect(ctx context.Context) (*Resource, error) { - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessPIDKey.Int(pid())), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessPID(pid())), nil } // Detect returns a *Resource that describes the name of the process executable. func (processExecutableNameDetector) Detect(ctx context.Context) (*Resource, error) { executableName := filepath.Base(commandArgs()[0]) - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessExecutableNameKey.String(executableName)), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessExecutableName(executableName)), nil } // Detect returns a *Resource that describes the full path of the process executable. @@ -137,13 +141,13 @@ func (processExecutablePathDetector) Detect(ctx context.Context) (*Resource, err return nil, err } - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessExecutablePathKey.String(executablePath)), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessExecutablePath(executablePath)), nil } // Detect returns a *Resource that describes all the command arguments as received // by the process. func (processCommandArgsDetector) Detect(ctx context.Context) (*Resource, error) { - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessCommandArgsKey.StringSlice(commandArgs())), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessCommandArgs(commandArgs()...)), nil } // Detect returns a *Resource that describes the username of the user that owns the @@ -154,18 +158,18 @@ func (processOwnerDetector) Detect(ctx context.Context) (*Resource, error) { return nil, err } - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessOwnerKey.String(owner.Username)), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessOwner(owner.Username)), nil } // Detect returns a *Resource that describes the name of the compiler used to compile // this process image. func (processRuntimeNameDetector) Detect(ctx context.Context) (*Resource, error) { - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessRuntimeNameKey.String(runtimeName())), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessRuntimeName(runtimeName())), nil } // Detect returns a *Resource that describes the version of the runtime of this process. func (processRuntimeVersionDetector) Detect(ctx context.Context) (*Resource, error) { - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessRuntimeVersionKey.String(runtimeVersion())), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessRuntimeVersion(runtimeVersion())), nil } // Detect returns a *Resource that describes the runtime of this process. @@ -175,6 +179,6 @@ func (processRuntimeDescriptionDetector) Detect(ctx context.Context) (*Resource, return NewWithAttributes( semconv.SchemaURL, - semconv.ProcessRuntimeDescriptionKey.String(runtimeDescription), + semconv.ProcessRuntimeDescription(runtimeDescription), ), nil } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go index c425ff05d..176ff1066 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go @@ -17,7 +17,6 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" import ( "context" "errors" - "fmt" "sync" "go.opentelemetry.io/otel" @@ -37,7 +36,6 @@ type Resource struct { } var ( - emptyResource Resource defaultResource *Resource defaultResourceOnce sync.Once ) @@ -51,17 +49,8 @@ func New(ctx context.Context, opts ...Option) (*Resource, error) { cfg = opt.apply(cfg) } - resource, err := Detect(ctx, cfg.detectors...) - - var err2 error - resource, err2 = Merge(resource, &Resource{schemaURL: cfg.schemaURL}) - if err == nil { - err = err2 - } else if err2 != nil { - err = fmt.Errorf("detecting resources: %s", []string{err.Error(), err2.Error()}) - } - - return resource, err + r := &Resource{schemaURL: cfg.schemaURL} + return r, detect(ctx, r, cfg.detectors) } // NewWithAttributes creates a resource from attrs and associates the resource with a @@ -80,18 +69,18 @@ func NewWithAttributes(schemaURL string, attrs ...attribute.KeyValue) *Resource // of the attrs is known use NewWithAttributes instead. func NewSchemaless(attrs ...attribute.KeyValue) *Resource { if len(attrs) == 0 { - return &emptyResource + return &Resource{} } // Ensure attributes comply with the specification: - // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.1/specification/common/common.md#attributes + // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/common/README.md#attribute s, _ := attribute.NewSetWithFiltered(attrs, func(kv attribute.KeyValue) bool { return kv.Valid() }) // If attrs only contains invalid entries do not allocate a new resource. if s.Len() == 0 { - return &emptyResource + return &Resource{} } return &Resource{attrs: s} //nolint @@ -164,7 +153,7 @@ func (r *Resource) Equal(eq *Resource) bool { // if resource b's value is empty. // // The SchemaURL of the resources will be merged according to the spec rules: -// https://github.com/open-telemetry/opentelemetry-specification/blob/bad49c714a62da5493f2d1d9bafd7ebe8c8ce7eb/specification/resource/sdk.md#merge +// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge // If the resources have different non-empty schemaURL an empty resource and an error // will be returned. func Merge(a, b *Resource) (*Resource, error) { @@ -205,7 +194,7 @@ func Merge(a, b *Resource) (*Resource, error) { // Empty returns an instance of Resource with no attributes. It is // equivalent to a `nil` Resource. func Empty() *Resource { - return &emptyResource + return &Resource{} } // Default returns an instance of Resource with a default @@ -224,7 +213,7 @@ func Default() *Resource { } // If Detect did not return a valid resource, fall back to emptyResource. if defaultResource == nil { - defaultResource = &emptyResource + defaultResource = &Resource{} } }) return defaultResource diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go index a2d7db490..c9c7effbf 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go @@ -16,7 +16,6 @@ package trace // import "go.opentelemetry.io/otel/sdk/trace" import ( "context" - "runtime" "sync" "sync/atomic" "time" @@ -84,6 +83,7 @@ type batchSpanProcessor struct { stopWait sync.WaitGroup stopOnce sync.Once stopCh chan struct{} + stopped atomic.Bool } var _ SpanProcessor = (*batchSpanProcessor)(nil) @@ -91,7 +91,7 @@ var _ SpanProcessor = (*batchSpanProcessor)(nil) // NewBatchSpanProcessor creates a new SpanProcessor that will send completed // span batches to the exporter with the supplied options. // -// If the exporter is nil, the span processor will preform no action. +// If the exporter is nil, the span processor will perform no action. func NewBatchSpanProcessor(exporter SpanExporter, options ...BatchSpanProcessorOption) SpanProcessor { maxQueueSize := env.BatchSpanProcessorMaxQueueSize(DefaultMaxQueueSize) maxExportBatchSize := env.BatchSpanProcessorMaxExportBatchSize(DefaultMaxExportBatchSize) @@ -137,6 +137,11 @@ func (bsp *batchSpanProcessor) OnStart(parent context.Context, s ReadWriteSpan) // OnEnd method enqueues a ReadOnlySpan for later processing. func (bsp *batchSpanProcessor) OnEnd(s ReadOnlySpan) { + // Do not enqueue spans after Shutdown. + if bsp.stopped.Load() { + return + } + // Do not enqueue spans if we are just going to drop them. if bsp.e == nil { return @@ -149,6 +154,7 @@ func (bsp *batchSpanProcessor) OnEnd(s ReadOnlySpan) { func (bsp *batchSpanProcessor) Shutdown(ctx context.Context) error { var err error bsp.stopOnce.Do(func() { + bsp.stopped.Store(true) wait := make(chan struct{}) go func() { close(bsp.stopCh) @@ -181,11 +187,24 @@ func (f forceFlushSpan) SpanContext() trace.SpanContext { // ForceFlush exports all ended spans that have not yet been exported. func (bsp *batchSpanProcessor) ForceFlush(ctx context.Context) error { + // Interrupt if context is already canceled. + if err := ctx.Err(); err != nil { + return err + } + + // Do nothing after Shutdown. + if bsp.stopped.Load() { + return nil + } + var err error if bsp.e != nil { flushCh := make(chan struct{}) if bsp.enqueueBlockOnQueueFull(ctx, forceFlushSpan{flushed: flushCh}) { select { + case <-bsp.stopCh: + // The batchSpanProcessor is Shutdown. + return nil case <-flushCh: // Processed any items in queue prior to ForceFlush being called case <-ctx.Done(): @@ -326,11 +345,9 @@ func (bsp *batchSpanProcessor) drainQueue() { for { select { case sd := <-bsp.queue: - if sd == nil { - if err := bsp.exportSpans(ctx); err != nil { - otel.Handle(err) - } - return + if _, ok := sd.(forceFlushSpan); ok { + // Ignore flush requests as they are not valid spans. + continue } bsp.batchMutex.Lock() @@ -344,7 +361,11 @@ func (bsp *batchSpanProcessor) drainQueue() { } } default: - close(bsp.queue) + // There are no more enqueued spans. Make final export. + if err := bsp.exportSpans(ctx); err != nil { + otel.Handle(err) + } + return } } } @@ -358,34 +379,11 @@ func (bsp *batchSpanProcessor) enqueue(sd ReadOnlySpan) { } } -func recoverSendOnClosedChan() { - x := recover() - switch err := x.(type) { - case nil: - return - case runtime.Error: - if err.Error() == "send on closed channel" { - return - } - } - panic(x) -} - func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd ReadOnlySpan) bool { if !sd.SpanContext().IsSampled() { return false } - // This ensures the bsp.queue<- below does not panic as the - // processor shuts down. - defer recoverSendOnClosedChan() - - select { - case <-bsp.stopCh: - return false - default: - } - select { case bsp.queue <- sd: return true @@ -399,16 +397,6 @@ func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan) return false } - // This ensures the bsp.queue<- below does not panic as the - // processor shuts down. - defer recoverSendOnClosedChan() - - select { - case <-bsp.stopCh: - return false - default: - } - select { case bsp.queue <- sd: return true diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go index 292ea5481..7d46c4b48 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go @@ -25,6 +25,8 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" + "go.opentelemetry.io/otel/trace/noop" ) const ( @@ -73,9 +75,13 @@ func (cfg tracerProviderConfig) MarshalLog() interface{} { // TracerProvider is an OpenTelemetry TracerProvider. It provides Tracers to // instrumentation so it can trace operational flow through a system. type TracerProvider struct { + embedded.TracerProvider + mu sync.Mutex namedTracer map[instrumentation.Scope]*tracer - spanProcessors atomic.Value + spanProcessors atomic.Pointer[spanProcessorStates] + + isShutdown atomic.Bool // These fields are not protected by the lock mu. They are assumed to be // immutable after creation of the TracerProvider. @@ -116,12 +122,13 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { spanLimits: o.spanLimits, resource: o.resource, } - global.Info("TracerProvider created", "config", o) + spss := make(spanProcessorStates, 0, len(o.processors)) for _, sp := range o.processors { - tp.RegisterSpanProcessor(sp) + spss = append(spss, newSpanProcessorState(sp)) } + tp.spanProcessors.Store(&spss) return tp } @@ -134,10 +141,11 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { // // This method is safe to be called concurrently. func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + // This check happens before the mutex is acquired to avoid deadlocking if Tracer() is called from within Shutdown(). + if p.isShutdown.Load() { + return noop.NewTracerProvider().Tracer(name, opts...) + } c := trace.NewTracerConfig(opts...) - - p.mu.Lock() - defer p.mu.Unlock() if name == "" { name = defaultTracerName } @@ -146,57 +154,87 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T Version: c.InstrumentationVersion(), SchemaURL: c.SchemaURL(), } - t, ok := p.namedTracer[is] - if !ok { - t = &tracer{ - provider: p, - instrumentationScope: is, + + t, ok := func() (trace.Tracer, bool) { + p.mu.Lock() + defer p.mu.Unlock() + // Must check the flag after acquiring the mutex to avoid returning a valid tracer if Shutdown() ran + // after the first check above but before we acquired the mutex. + if p.isShutdown.Load() { + return noop.NewTracerProvider().Tracer(name, opts...), true } - p.namedTracer[is] = t - global.Info("Tracer created", "name", name, "version", c.InstrumentationVersion(), "schemaURL", c.SchemaURL()) + t, ok := p.namedTracer[is] + if !ok { + t = &tracer{ + provider: p, + instrumentationScope: is, + } + p.namedTracer[is] = t + } + return t, ok + }() + if !ok { + // This code is outside the mutex to not hold the lock while calling third party logging code: + // - That code may do slow things like I/O, which would prolong the duration the lock is held, + // slowing down all tracing consumers. + // - Logging code may be instrumented with tracing and deadlock because it could try + // acquiring the same non-reentrant mutex. + global.Info("Tracer created", "name", name, "version", is.Version, "schemaURL", is.SchemaURL) } return t } // RegisterSpanProcessor adds the given SpanProcessor to the list of SpanProcessors. -func (p *TracerProvider) RegisterSpanProcessor(s SpanProcessor) { +func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) { + // This check prevents calls during a shutdown. + if p.isShutdown.Load() { + return + } p.mu.Lock() defer p.mu.Unlock() - newSPS := spanProcessorStates{} - if old, ok := p.spanProcessors.Load().(spanProcessorStates); ok { - newSPS = append(newSPS, old...) - } - newSpanSync := &spanProcessorState{ - sp: s, - state: &sync.Once{}, + // This check prevents calls after a shutdown. + if p.isShutdown.Load() { + return } - newSPS = append(newSPS, newSpanSync) - p.spanProcessors.Store(newSPS) + + current := p.getSpanProcessors() + newSPS := make(spanProcessorStates, 0, len(current)+1) + newSPS = append(newSPS, current...) + newSPS = append(newSPS, newSpanProcessorState(sp)) + p.spanProcessors.Store(&newSPS) } // UnregisterSpanProcessor removes the given SpanProcessor from the list of SpanProcessors. -func (p *TracerProvider) UnregisterSpanProcessor(s SpanProcessor) { +func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) { + // This check prevents calls during a shutdown. + if p.isShutdown.Load() { + return + } p.mu.Lock() defer p.mu.Unlock() - spss := spanProcessorStates{} - old, ok := p.spanProcessors.Load().(spanProcessorStates) - if !ok || len(old) == 0 { + // This check prevents calls after a shutdown. + if p.isShutdown.Load() { + return + } + old := p.getSpanProcessors() + if len(old) == 0 { return } - spss = append(spss, old...) + spss := make(spanProcessorStates, len(old)) + copy(spss, old) // stop the span processor if it is started and remove it from the list var stopOnce *spanProcessorState var idx int for i, sps := range spss { - if sps.sp == s { + if sps.sp == sp { stopOnce = sps idx = i } } if stopOnce != nil { stopOnce.state.Do(func() { - if err := s.Shutdown(context.Background()); err != nil { + if err := sp.Shutdown(context.Background()); err != nil { otel.Handle(err) } }) @@ -207,16 +245,13 @@ func (p *TracerProvider) UnregisterSpanProcessor(s SpanProcessor) { spss[len(spss)-1] = nil spss = spss[:len(spss)-1] - p.spanProcessors.Store(spss) + p.spanProcessors.Store(&spss) } // ForceFlush immediately exports all spans that have not yet been exported for // all the registered span processors. func (p *TracerProvider) ForceFlush(ctx context.Context) error { - spss, ok := p.spanProcessors.Load().(spanProcessorStates) - if !ok { - return fmt.Errorf("failed to load span processors") - } + spss := p.getSpanProcessors() if len(spss) == 0 { return nil } @@ -235,14 +270,23 @@ func (p *TracerProvider) ForceFlush(ctx context.Context) error { return nil } -// Shutdown shuts down the span processors in the order they were registered. +// Shutdown shuts down TracerProvider. All registered span processors are shut down +// in the order they were registered and any held computational resources are released. +// After Shutdown is called, all methods are no-ops. func (p *TracerProvider) Shutdown(ctx context.Context) error { - spss, ok := p.spanProcessors.Load().(spanProcessorStates) - if !ok { - return fmt.Errorf("failed to load span processors") + // This check prevents deadlocks in case of recursive shutdown. + if p.isShutdown.Load() { + return nil } + p.mu.Lock() + defer p.mu.Unlock() + // This check prevents calls after a shutdown has already been done concurrently. + if !p.isShutdown.CompareAndSwap(false, true) { // did toggle? + return nil + } + var retErr error - for _, sps := range spss { + for _, sps := range p.getSpanProcessors() { select { case <-ctx.Done(): return ctx.Err() @@ -262,9 +306,14 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { } } } + p.spanProcessors.Store(&spanProcessorStates{}) return retErr } +func (p *TracerProvider) getSpanProcessors() spanProcessorStates { + return *(p.spanProcessors.Load()) +} + // TracerProviderOption configures a TracerProvider. type TracerProviderOption interface { apply(tracerProviderConfig) tracerProviderConfig diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go b/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go index a6dcf4b30..a7bc125b9 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go @@ -81,7 +81,7 @@ type traceIDRatioSampler struct { func (ts traceIDRatioSampler) ShouldSample(p SamplingParameters) SamplingResult { psc := trace.SpanContextFromContext(p.ParentContext) - x := binary.BigEndian.Uint64(p.TraceID[0:8]) >> 1 + x := binary.BigEndian.Uint64(p.TraceID[8:16]) >> 1 if x < ts.traceIDUpperBound { return SamplingResult{ Decision: RecordAndSample, @@ -158,15 +158,15 @@ func NeverSample() Sampler { return alwaysOffSampler{} } -// ParentBased returns a composite sampler which behaves differently, +// ParentBased returns a sampler decorator which behaves differently, // based on the parent of the span. If the span has no parent, -// the root(Sampler) is used to make sampling decision. If the span has +// the decorated sampler is used to make sampling decision. If the span has // a parent, depending on whether the parent is remote and whether it // is sampled, one of the following samplers will apply: -// - remoteParentSampled(Sampler) (default: AlwaysOn) -// - remoteParentNotSampled(Sampler) (default: AlwaysOff) -// - localParentSampled(Sampler) (default: AlwaysOn) -// - localParentNotSampled(Sampler) (default: AlwaysOff) +// - remoteParentSampled(Sampler) (default: AlwaysOn) +// - remoteParentNotSampled(Sampler) (default: AlwaysOff) +// - localParentSampled(Sampler) (default: AlwaysOn) +// - localParentNotSampled(Sampler) (default: AlwaysOff) func ParentBased(root Sampler, samplers ...ParentBasedSamplerOption) Sampler { return parentBased{ root: root, diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go index e8530a959..f8770fff7 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go @@ -19,12 +19,13 @@ import ( "sync" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/internal/global" ) // simpleSpanProcessor is a SpanProcessor that synchronously sends all // completed Spans to a trace.Exporter immediately. type simpleSpanProcessor struct { - exporterMu sync.RWMutex + exporterMu sync.Mutex exporter SpanExporter stopOnce sync.Once } @@ -43,6 +44,8 @@ func NewSimpleSpanProcessor(exporter SpanExporter) SpanProcessor { ssp := &simpleSpanProcessor{ exporter: exporter, } + global.Warn("SimpleSpanProcessor is not recommended for production use, consider using BatchSpanProcessor instead.") + return ssp } @@ -51,8 +54,8 @@ func (ssp *simpleSpanProcessor) OnStart(context.Context, ReadWriteSpan) {} // OnEnd immediately exports a ReadOnlySpan. func (ssp *simpleSpanProcessor) OnEnd(s ReadOnlySpan) { - ssp.exporterMu.RLock() - defer ssp.exporterMu.RUnlock() + ssp.exporterMu.Lock() + defer ssp.exporterMu.Unlock() if ssp.exporter != nil && s.SpanContext().TraceFlags().IsSampled() { if err := ssp.exporter.ExportSpans(context.Background(), []ReadOnlySpan{s}); err != nil { diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go index 449cf6c25..36dbf6776 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go @@ -30,8 +30,9 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" ) // ReadOnlySpan allows reading information from the data structure underlying a @@ -108,6 +109,8 @@ type ReadWriteSpan interface { // recordingSpan is an implementation of the OpenTelemetry Span API // representing the individual component of a trace that is sampled. type recordingSpan struct { + embedded.Span + // mu protects the contents of this span. mu sync.Mutex @@ -158,8 +161,10 @@ type recordingSpan struct { tracer *tracer } -var _ ReadWriteSpan = (*recordingSpan)(nil) -var _ runtimeTracer = (*recordingSpan)(nil) +var ( + _ ReadWriteSpan = (*recordingSpan)(nil) + _ runtimeTracer = (*recordingSpan)(nil) +) // SpanContext returns the SpanContext of this span. func (s *recordingSpan) SpanContext() trace.SpanContext { @@ -189,15 +194,18 @@ func (s *recordingSpan) SetStatus(code codes.Code, description string) { if !s.IsRecording() { return } + s.mu.Lock() + defer s.mu.Unlock() + if s.status.Code > code { + return + } status := Status{Code: code} if code == codes.Error { status.Description = description } - s.mu.Lock() s.status = status - s.mu.Unlock() } // SetAttributes sets attributes of this span. @@ -299,7 +307,7 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) { // most a length of limit. Each string slice value is truncated in this fashion // (the slice length itself is unaffected). // -// No truncation is perfromed for a negative limit. +// No truncation is performed for a negative limit. func truncateAttr(limit int, attr attribute.KeyValue) attribute.KeyValue { if limit < 0 { return attr @@ -310,26 +318,13 @@ func truncateAttr(limit int, attr attribute.KeyValue) attribute.KeyValue { return attr.Key.String(safeTruncate(v, limit)) } case attribute.STRINGSLICE: - // Do no mutate the original, make a copy. - trucated := attr.Key.StringSlice(attr.Value.AsStringSlice()) - // Do not do this. - // - // v := trucated.Value.AsStringSlice() - // cp := make([]string, len(v)) - // /* Copy and truncate values to cp ... */ - // trucated.Value = attribute.StringSliceValue(cp) - // - // Copying the []string and then assigning it back as a new value with - // attribute.StringSliceValue will copy the data twice. Instead, we - // already made a copy above that only this function owns, update the - // underlying slice data of our copy. - v := trucated.Value.AsStringSlice() + v := attr.Value.AsStringSlice() for i := range v { if len(v[i]) > limit { v[i] = safeTruncate(v[i], limit) } } - return trucated + return attr.Key.StringSlice(v) } return attr } @@ -393,14 +388,14 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { defer panic(recovered) opts := []trace.EventOption{ trace.WithAttributes( - semconv.ExceptionTypeKey.String(typeStr(recovered)), - semconv.ExceptionMessageKey.String(fmt.Sprint(recovered)), + semconv.ExceptionType(typeStr(recovered)), + semconv.ExceptionMessage(fmt.Sprint(recovered)), ), } if config.StackTrace() { opts = append(opts, trace.WithAttributes( - semconv.ExceptionStacktraceKey.String(recordStackTrace()), + semconv.ExceptionStacktrace(recordStackTrace()), )) } @@ -420,14 +415,13 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { } s.mu.Unlock() - if sps, ok := s.tracer.provider.spanProcessors.Load().(spanProcessorStates); ok { - if len(sps) == 0 { - return - } - snap := s.snapshot() - for _, sp := range sps { - sp.sp.OnEnd(snap) - } + sps := s.tracer.provider.getSpanProcessors() + if len(sps) == 0 { + return + } + snap := s.snapshot() + for _, sp := range sps { + sp.sp.OnEnd(snap) } } @@ -441,14 +435,14 @@ func (s *recordingSpan) RecordError(err error, opts ...trace.EventOption) { } opts = append(opts, trace.WithAttributes( - semconv.ExceptionTypeKey.String(typeStr(err)), - semconv.ExceptionMessageKey.String(err.Error()), + semconv.ExceptionType(typeStr(err)), + semconv.ExceptionMessage(err.Error()), )) c := trace.NewEventConfig(opts...) if c.StackTrace() { opts = append(opts, trace.WithAttributes( - semconv.ExceptionStacktraceKey.String(recordStackTrace()), + semconv.ExceptionStacktrace(recordStackTrace()), )) } @@ -783,6 +777,8 @@ func (s *recordingSpan) runtimeTrace(ctx context.Context) context.Context { // that wraps a SpanContext. It performs no operations other than to return // the wrapped SpanContext or TracerProvider that created it. type nonRecordingSpan struct { + embedded.Span + // tracer is the SDK tracer that created this span. tracer *tracer sc trace.SpanContext diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go index 9fb3d6eac..c9bd52f7a 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go @@ -38,7 +38,7 @@ type SpanExporter interface { // must never be done outside of a new major release. // Shutdown notifies the exporter of a pending halt to operations. The - // exporter is expected to preform any cleanup or synchronization it + // exporter is expected to perform any cleanup or synchronization it // requires while honoring all timeouts and cancellations contained in // the passed context. Shutdown(ctx context.Context) error diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go index b649a2ff0..9c53657a7 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go @@ -62,6 +62,11 @@ type SpanProcessor interface { type spanProcessorState struct { sp SpanProcessor - state *sync.Once + state sync.Once } + +func newSpanProcessorState(sp SpanProcessor) *spanProcessorState { + return &spanProcessorState{sp: sp} +} + type spanProcessorStates []*spanProcessorState diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go b/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go index 7b11fc465..301e1a7ab 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go @@ -20,9 +20,12 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" ) type tracer struct { + embedded.Tracer + provider *TracerProvider instrumentationScope instrumentation.Scope } @@ -51,7 +54,7 @@ func (tr *tracer) Start(ctx context.Context, name string, options ...trace.SpanS s := tr.newSpan(ctx, name, &config) if rw, ok := s.(ReadWriteSpan); ok && s.IsRecording() { - sps, _ := tr.provider.spanProcessors.Load().(spanProcessorStates) + sps := tr.provider.getSpanProcessors() for _, sp := range sps { sp.sp.OnStart(ctx, rw) } diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/version.go b/vendor/go.opentelemetry.io/otel/sdk/trace/version.go new file mode 100644 index 000000000..d3457ed13 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/sdk/trace" + +// version is the current release version of the metric SDK in use. +func version() string { + return "1.16.0-rc.1" +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/version.go b/vendor/go.opentelemetry.io/otel/sdk/version.go new file mode 100644 index 000000000..7048c788e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sdk // import "go.opentelemetry.io/otel/sdk" + +// Version is the current release version of the OpenTelemetry SDK in use. +func Version() string { + return "1.20.0" +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/internal/http.go b/vendor/go.opentelemetry.io/otel/semconv/internal/http.go index b580eedef..19c394c69 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/internal/http.go +++ b/vendor/go.opentelemetry.io/otel/semconv/internal/http.go @@ -232,10 +232,12 @@ func (sc *SemanticConventions) HTTPServerAttributesFromHTTPRequest(serverName, r if route != "" { attrs = append(attrs, sc.HTTPRouteKey.String(route)) } - if values, ok := request.Header["X-Forwarded-For"]; ok && len(values) > 0 { - if addresses := strings.SplitN(values[0], ",", 2); len(addresses) > 0 { - attrs = append(attrs, sc.HTTPClientIPKey.String(addresses[0])) + if values := request.Header["X-Forwarded-For"]; len(values) > 0 { + addr := values[0] + if i := strings.Index(addr, ","); i > 0 { + addr = addr[:i] } + attrs = append(attrs, sc.HTTPClientIPKey.String(addr)) } return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go new file mode 100644 index 000000000..71a1f7748 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.17.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go new file mode 100644 index 000000000..679c40c4d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +import "go.opentelemetry.io/otel/attribute" + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/vendor/go.opentelemetry.io/otel/metric/unit/unit.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go similarity index 70% rename from vendor/go.opentelemetry.io/otel/metric/unit/unit.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go index 647d77302..9b8c559de 100644 --- a/vendor/go.opentelemetry.io/otel/metric/unit/unit.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go @@ -12,14 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package unit // import "go.opentelemetry.io/otel/metric/unit" +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" -// Unit is a determinate standard quantity of measurement. -type Unit string - -// Units defined by OpenTelemetry. const ( - Dimensionless Unit = "1" - Bytes Unit = "By" - Milliseconds Unit = "ms" + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" ) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go new file mode 100644 index 000000000..d5c4b5c13 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go new file mode 100644 index 000000000..39a2eab3a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go @@ -0,0 +1,2010 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserUserAgentKey is the attribute Key conforming to the + // "browser.user_agent" semantic conventions. It represents the full + // user-agent string provided by the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) + // AppleWebKit/537.36 (KHTML, ' + // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' + // Note: The user-agent value SHOULD be provided only from browsers that do + // not have a mechanism to retrieve brands and platform individually from + // the User-Agent Client Hints API. To retrieve the value, the legacy + // `navigator.userAgent` API can be used. + BrowserUserAgentKey = attribute.Key("browser.user_agent") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserUserAgent returns an attribute KeyValue conforming to the +// "browser.user_agent" semantic conventions. It represents the full user-agent +// string provided by the browser +func BrowserUserAgent(val string) attribute.KeyValue { + return BrowserUserAgentKey.String(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGoogleCloudOpenshift = CloudPlatformKey.String("google_cloud_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// A container instance. +const ( + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageTagKey is the attribute Key conforming to the + // "container.image.tag" semantic conventions. It represents the container + // image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageTag returns an attribute KeyValue conforming to the +// "container.image.tag" semantic conventions. It represents the container +// image tag. +func ContainerImageTag(val string) attribute.KeyValue { + return ContainerImageTagKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment +// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka +// deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// A serverless instance. +const ( + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `faas.id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSIDKey is the attribute Key conforming to the "faas.id" semantic + // conventions. It represents the unique ID of the single function that + // this runtime instance executes. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so consider setting `faas.id` as a span attribute instead. + // + // The exact value to use for `faas.id` depends on the cloud provider: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + FaaSIDKey = attribute.Key("faas.id") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function in MiB. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSID returns an attribute KeyValue conforming to the "faas.id" semantic +// conventions. It represents the unique ID of the single function that this +// runtime instance executes. +func FaaSID(val string) attribute.KeyValue { + return FaaSIDKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function in MiB. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// A host is defined as a general computing instance. +const ( + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // Linux systems, the `machine-id` located in `/etc/machine-id` or + // `/var/lib/dbus/machine-id` may be used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID. For Cloud, this + // value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized Linux +// systems, the `machine-id` located in `/etc/machine-id` or +// `/var/lib/dbus/machine-id` may be used. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID. For +// Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](../../resource/semantic_conventions/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + + // TelemetryAutoVersionKey is the attribute Key conforming to the + // "telemetry.auto.version" semantic conventions. It represents the version + // string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// TelemetryAutoVersion returns an attribute KeyValue conforming to the +// "telemetry.auto.version" semantic conventions. It represents the version +// string of the auto instrumentation agent, if used. +func TelemetryAutoVersion(val string) attribute.KeyValue { + return TelemetryAutoVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OtelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OtelScopeNameKey = attribute.Key("otel.scope.name") + + // OtelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OtelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OtelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OtelScopeName(val string) attribute.KeyValue { + return OtelScopeNameKey.String(val) +} + +// OtelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OtelScopeVersion(val string) attribute.KeyValue { + return OtelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OtelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. It represents the deprecated, + // use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OtelLibraryNameKey = attribute.Key("otel.library.name") + + // OtelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. It represents the + // deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OtelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OtelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. It represents the deprecated, use +// the `otel.scope.name` attribute. +func OtelLibraryName(val string) attribute.KeyValue { + return OtelLibraryNameKey.String(val) +} + +// OtelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. It represents the deprecated, +// use the `otel.scope.version` attribute. +func OtelLibraryVersion(val string) attribute.KeyValue { + return OtelLibraryVersionKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go new file mode 100644 index 000000000..42fc525d1 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.17.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go new file mode 100644 index 000000000..8c4a7299d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go @@ -0,0 +1,3375 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable and not + // explicitly disabled via instrumentation configuration.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no + // longer required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OtelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OtelStatusCodeKey = attribute.Key("otel.status_code") + + // OtelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OtelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OtelStatusCodeOk = OtelStatusCodeKey.String("OK") + // The operation contains an error + OtelStatusCodeError = OtelStatusCodeKey.String("ERROR") +) + +// OtelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OtelStatusDescription(val string) attribute.KeyValue { + return OtelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function execution. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + // + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSExecutionKey is the attribute Key conforming to the "faas.execution" + // semantic conventions. It represents the execution ID of the current + // function execution. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSExecution returns an attribute KeyValue conforming to the +// "faas.execution" semantic conventions. It represents the execution ID of the +// current function execution. +func FaaSExecution(val string) attribute.KeyValue { + return FaaSExecutionKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// Contains additional attributes for outgoing FaaS spans. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. It represents the transport protocol used. See + // note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + + // NetAppProtocolNameKey is the attribute Key conforming to the + // "net.app.protocol.name" semantic conventions. It represents the + // application layer protocol used. The value SHOULD be normalized to + // lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") + + // NetAppProtocolVersionKey is the attribute Key conforming to the + // "net.app.protocol.version" semantic conventions. It represents the + // version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.app.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client used has a version of `0.27.2`, but sends HTTP version + // `1.1`, this attribute should be set to `1.1`. + NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. It represents the remote + // socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from + // `net.peer.name` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. It represents the remote + // socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, + // [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. It represents the remote + // socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. It represents the protocol + // [address + // family](https://man7.org/linux/man-pages/man7/address_families.7.html) + // which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if + // any of `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers + // of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. It represents the logical remote hostname, see + // note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an + // extra DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. It represents the logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. It represents the logical local hostname or + // similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. It represents the logical local port number, + // preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. It represents the local + // socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. It represents the local + // socket port number. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.host.port` and if `net.sock.host.addr` is set.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetHostConnectionTypeKey is the attribute Key conforming to the + // "net.host.connection.type" semantic conventions. It represents the + // internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + + // NetHostConnectionSubtypeKey is the attribute Key conforming to the + // "net.host.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + + // NetHostCarrierNameKey is the attribute Key conforming to the + // "net.host.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + + // NetHostCarrierMccKey is the attribute Key conforming to the + // "net.host.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + + // NetHostCarrierMncKey is the attribute Key conforming to the + // "net.host.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + + // NetHostCarrierIccKey is the attribute Key conforming to the + // "net.host.carrier.icc" semantic conventions. It represents the ISO + // 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// NetAppProtocolName returns an attribute KeyValue conforming to the +// "net.app.protocol.name" semantic conventions. It represents the application +// layer protocol used. The value SHOULD be normalized to lowercase. +func NetAppProtocolName(val string) attribute.KeyValue { + return NetAppProtocolNameKey.String(val) +} + +// NetAppProtocolVersion returns an attribute KeyValue conforming to the +// "net.app.protocol.version" semantic conventions. It represents the version +// of the application layer protocol used. See note below. +func NetAppProtocolVersion(val string) attribute.KeyValue { + return NetAppProtocolVersionKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. It represents the remote socket +// peer name. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. It represents the remote socket +// peer address: IPv4 or IPv6 for internet protocols, path for local +// communication, +// [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. It represents the remote socket +// peer port. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. It represents the logical remote +// hostname, see note below. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. It represents the logical remote port +// number +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. It represents the logical local +// hostname or similar, see note below. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. It represents the logical local port +// number, preferably the one that the peer used to connect +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. It represents the local socket +// address. Useful in case of a multi-IP host. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. It represents the local socket +// port number. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetHostCarrierName returns an attribute KeyValue conforming to the +// "net.host.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetHostCarrierName(val string) attribute.KeyValue { + return NetHostCarrierNameKey.String(val) +} + +// NetHostCarrierMcc returns an attribute KeyValue conforming to the +// "net.host.carrier.mcc" semantic conventions. It represents the mobile +// carrier country code. +func NetHostCarrierMcc(val string) attribute.KeyValue { + return NetHostCarrierMccKey.String(val) +} + +// NetHostCarrierMnc returns an attribute KeyValue conforming to the +// "net.host.carrier.mnc" semantic conventions. It represents the mobile +// carrier network code. +func NetHostCarrierMnc(val string) attribute.KeyValue { + return NetHostCarrierMncKey.String(val) +} + +// NetHostCarrierIcc returns an attribute KeyValue conforming to the +// "net.host.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetHostCarrierIcc(val string) attribute.KeyValue { + return NetHostCarrierIccKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](../../resource/semantic_conventions/README.md#service) + // of the remote service. SHOULD be equal to the actual `service.name` + // resource attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](../../resource/semantic_conventions/README.md#service) of +// the remote service. SHOULD be equal to the actual `service.name` resource +// attribute of the remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") +) + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// Semantic conventions for HTTP client and server Spans. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. It represents the hTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. It represents the [HTTP + // response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was + // received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPFlavorKey is the attribute Key conforming to the "http.flavor" + // semantic conventions. It represents the kind of HTTP protocol used. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be + // `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is + // assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + + // HTTPUserAgentKey is the attribute Key conforming to the + // "http.user_agent" semantic conventions. It represents the value of the + // [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. It represents the + // size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. It represents the + // size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. It represents the hTTP request method. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. It represents the [HTTP response +// status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPUserAgent returns an attribute KeyValue conforming to the +// "http.user_agent" semantic conventions. It represents the value of the [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func HTTPUserAgent(val string) attribute.KeyValue { + return HTTPUserAgentKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. It represents the size +// of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. It represents the size +// of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// Semantic Convention for HTTP Client +const ( + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. It represents the full HTTP request URL in the form + // `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is + // not transmitted over HTTP, but if it is known, it should be included + // nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the + // attribute's value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + + // HTTPResendCountKey is the attribute Key conforming to the + // "http.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. It represents the full HTTP request URL in the form +// `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not +// transmitted over HTTP, but if it is known, it should be included +// nevertheless. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPResendCount returns an attribute KeyValue conforming to the +// "http.resend_count" semantic conventions. It represents the ordinal number +// of request resending attempt (for any reason, including redirects). +func HTTPResendCount(val int) attribute.KeyValue { + return HTTPResendCountKey.Int(val) +} + +// Semantic Convention for HTTP Server +const ( + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. It represents the URI scheme identifying the used + // protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. It represents the full request target as passed in + // a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/path/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: 'http.route' MUST NOT be populated when this is not supported by + // the HTTP server framework as the route attribute should have + // low-cardinality and the URI path can NOT substitute it. + HTTPRouteKey = attribute.Key("http.route") + + // HTTPClientIPKey is the attribute Key conforming to the "http.client_ip" + // semantic conventions. It represents the IP address of the original + // client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which + // would + // identify the network-level peer, which may be a proxy. + // + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that + // other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. It represents the URI scheme identifying the used +// protocol. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. It represents the full request target as passed in a +// HTTP request line or equivalent. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// HTTPClientIP returns an attribute KeyValue conforming to the +// "http.client_ip" semantic conventions. It represents the IP address of the +// original client behind all proxies, if known (e.g. from +// [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). +func HTTPClientIP(val string) attribute.KeyValue { + return HTTPClientIPKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. +const ( + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to + // the "messaging.message.payload_size_bytes" semantic conventions. It + // represents the (uncompressed) size of the message payload in bytes. Also + // use this attribute if it is unknown whether the compressed or + // uncompressed payload size is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") + + // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key + // conforming to the "messaging.message.payload_compressed_size_bytes" + // semantic conventions. It represents the compressed size of the message + // payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") +) + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming +// to the "messaging.message.payload_size_bytes" semantic conventions. It +// represents the (uncompressed) size of the message payload in bytes. Also use +// this attribute if it is unknown whether the compressed or uncompressed +// payload size is reported. +func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadSizeBytesKey.Int(val) +} + +// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue +// conforming to the "messaging.message.payload_compressed_size_bytes" semantic +// conventions. It represents the compressed size of the message payload in +// bytes. +func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker +const ( + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationKindKey is the attribute Key conforming to the + // "messaging.destination.kind" semantic conventions. It represents the + // kind of message destination + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination.kind") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// Semantic convention for attributes that describe messaging source on broker +const ( + // MessagingSourceNameKey is the attribute Key conforming to the + // "messaging.source.name" semantic conventions. It represents the message + // source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Source name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker does not have such notion, the source name SHOULD uniquely + // identify the broker. + MessagingSourceNameKey = attribute.Key("messaging.source.name") + + // MessagingSourceKindKey is the attribute Key conforming to the + // "messaging.source.kind" semantic conventions. It represents the kind of + // message source + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingSourceKindKey = attribute.Key("messaging.source.kind") + + // MessagingSourceTemplateKey is the attribute Key conforming to the + // "messaging.source.template" semantic conventions. It represents the low + // cardinality representation of the messaging source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Source names could be constructed from templates. An example would + // be a source name involving a user name or product id. Although the + // source name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and + // aggregation. + MessagingSourceTemplateKey = attribute.Key("messaging.source.template") + + // MessagingSourceTemporaryKey is the attribute Key conforming to the + // "messaging.source.temporary" semantic conventions. It represents a + // boolean that is true if the message source is temporary and might not + // exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") + + // MessagingSourceAnonymousKey is the attribute Key conforming to the + // "messaging.source.anonymous" semantic conventions. It represents a + // boolean that is true if the message source is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceAnonymousKey = attribute.Key("messaging.source.anonymous") +) + +var ( + // A message received from a queue + MessagingSourceKindQueue = MessagingSourceKindKey.String("queue") + // A message received from a topic + MessagingSourceKindTopic = MessagingSourceKindKey.String("topic") +) + +// MessagingSourceName returns an attribute KeyValue conforming to the +// "messaging.source.name" semantic conventions. It represents the message +// source name +func MessagingSourceName(val string) attribute.KeyValue { + return MessagingSourceNameKey.String(val) +} + +// MessagingSourceTemplate returns an attribute KeyValue conforming to the +// "messaging.source.template" semantic conventions. It represents the low +// cardinality representation of the messaging source name +func MessagingSourceTemplate(val string) attribute.KeyValue { + return MessagingSourceTemplateKey.String(val) +} + +// MessagingSourceTemporary returns an attribute KeyValue conforming to the +// "messaging.source.temporary" semantic conventions. It represents a boolean +// that is true if the message source is temporary and might not exist anymore +// after messages are processed. +func MessagingSourceTemporary(val bool) attribute.KeyValue { + return MessagingSourceTemporaryKey.Bool(val) +} + +// MessagingSourceAnonymous returns an attribute KeyValue conforming to the +// "messaging.source.anonymous" semantic conventions. It represents a boolean +// that is true if the message source is anonymous (could be unnamed or have +// auto-generated name). +func MessagingSourceAnonymous(val bool) attribute.KeyValue { + return MessagingSourceAnonymousKey.Bool(val) +} + +// General attributes used in messaging systems. +const ( + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation as defined in the [Operation + // names](#operation-names) section above. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the span describes an + // operation on a batch of messages.) + // Stability: stable + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") +) + +var ( + // publish + MessagingOperationPublish = MessagingOperationKey.String("publish") + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// Semantic convention for a consumer of messages received from a messaging +// system +const ( + // MessagingConsumerIDKey is the attribute Key conforming to the + // "messaging.consumer.id" semantic conventions. It represents the + // identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if + // both are present, or only `messaging.kafka.consumer.group`. For brokers, + // such as RabbitMQ and Artemis, set it to the `client_id` of the client + // consuming the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") +) + +// MessagingConsumerID returns an attribute KeyValue conforming to the +// "messaging.consumer.id" semantic conventions. It represents the identifier +// for the consumer receiving a message. For Kafka, set it to +// `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both +// are present, or only `messaging.kafka.consumer.group`. For brokers, such as +// RabbitMQ and Artemis, set it to the `client_id` of the client consuming the +// message. +func MessagingConsumerID(val string) attribute.KeyValue { + return MessagingConsumerIDKey.String(val) +} + +// Attributes for RabbitMQ +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// Attributes for Apache Kafka +const ( + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaClientIDKey is the attribute Key conforming to the + // "messaging.kafka.client_id" semantic conventions. It represents the + // client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaSourcePartitionKey is the attribute Key conforming to the + // "messaging.kafka.source.partition" semantic conventions. It represents + // the partition the message is received from. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) + // Stability: stable + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaClientID returns an attribute KeyValue conforming to the +// "messaging.kafka.client_id" semantic conventions. It represents the client +// ID for the Consumer or Producer that is handling the message. +func MessagingKafkaClientID(val string) attribute.KeyValue { + return MessagingKafkaClientIDKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaSourcePartition returns an attribute KeyValue conforming to +// the "messaging.kafka.source.partition" semantic conventions. It represents +// the partition the message is received from. +func MessagingKafkaSourcePartition(val int) attribute.KeyValue { + return MessagingKafkaSourcePartitionKey.Int(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// Attributes for Apache RocketMQ +const ( + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqClientIDKey is the attribute Key conforming to the + // "messaging.rocketmq.client_id" semantic conventions. It represents the + // unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqClientID returns an attribute KeyValue conforming to the +// "messaging.rocketmq.client_id" semantic conventions. It represents the +// unique identifier for each client. +func MessagingRocketmqClientID(val string) attribute.KeyValue { + return MessagingRocketmqClientIDKey.String(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// Semantic conventions for remote procedure calls. +const ( + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// Tech-specific attributes for gRPC. +const ( + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default + // version (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// does not specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/attribute_group.go new file mode 100644 index 000000000..e6cf89510 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/attribute_group.go @@ -0,0 +1,1877 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +import "go.opentelemetry.io/otel/attribute" + +// These attributes may be used to describe the client in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API does not expose a +// clear notion of client and server). This also covers UDP network +// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) +// and DNS. +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - unix domain + // socket name, IPv4 or IPv6 address. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/tmp/my.sock', '10.1.2.80' + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.address` SHOULD represent client address behind + // any intermediaries (e.g. proxies) if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" + // semantic conventions. It represents the client port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.port` SHOULD represent client port behind any + // intermediaries (e.g. proxies) if it's available. + ClientPortKey = attribute.Key("client.port") + + // ClientSocketAddressKey is the attribute Key conforming to the + // "client.socket.address" semantic conventions. It represents the + // immediate client peer address - unix domain socket name, IPv4 or IPv6 + // address. + // + // Type: string + // RequirementLevel: Recommended (If different than `client.address`.) + // Stability: stable + // Examples: '/tmp/my.sock', '127.0.0.1' + ClientSocketAddressKey = attribute.Key("client.socket.address") + + // ClientSocketPortKey is the attribute Key conforming to the + // "client.socket.port" semantic conventions. It represents the immediate + // client peer port number + // + // Type: int + // RequirementLevel: Recommended (If different than `client.port`.) + // Stability: stable + // Examples: 35555 + ClientSocketPortKey = attribute.Key("client.socket.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the +// "client.address" semantic conventions. It represents the client address - +// unix domain socket name, IPv4 or IPv6 address. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// ClientSocketAddress returns an attribute KeyValue conforming to the +// "client.socket.address" semantic conventions. It represents the immediate +// client peer address - unix domain socket name, IPv4 or IPv6 address. +func ClientSocketAddress(val string) attribute.KeyValue { + return ClientSocketAddressKey.String(val) +} + +// ClientSocketPort returns an attribute KeyValue conforming to the +// "client.socket.port" semantic conventions. It represents the immediate +// client peer port number +func ClientSocketPort(val int) attribute.KeyValue { + return ClientSocketPortKey.Int(val) +} + +// Describes deprecated HTTP attributes. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. It represents the deprecated, use + // `http.request.method` instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. It represents the deprecated, + // use `http.response.status_code` instead. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. It represents the deprecated, use `url.scheme` + // instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. It represents the deprecated, use `url.full` instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + HTTPURLKey = attribute.Key("http.url") + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. It represents the deprecated, use `url.path` and + // `url.query` instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/search?q=OpenTelemetry#SemConv' + HTTPTargetKey = attribute.Key("http.target") + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. It represents the + // deprecated, use `http.request.body.size` instead. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. It represents the + // deprecated, use `http.response.body.size` instead. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. It represents the deprecated, use +// `http.request.method` instead. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. It represents the deprecated, use +// `http.response.status_code` instead. +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. It represents the deprecated, use `url.scheme` +// instead. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. It represents the deprecated, use `url.full` instead. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. It represents the deprecated, use `url.path` and +// `url.query` instead. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. It represents the +// deprecated, use `http.request.body.size` instead. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. It represents the +// deprecated, use `http.response.body.size` instead. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. It represents the deprecated, + // use `server.socket.domain` on client spans. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. It represents the deprecated, + // use `server.socket.address` on client spans and `client.socket.address` + // on server spans. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '192.168.0.1' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. It represents the deprecated, + // use `server.socket.port` on client spans and `client.socket.port` on + // server spans. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 65531 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. It represents the deprecated, use `server.address` + // on client spans and `client.address` on server spans. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. It represents the deprecated, use `server.port` on + // client spans and `client.port` on server spans. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. It represents the deprecated, use + // `server.address`. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. It represents the deprecated, use `server.port`. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. It represents the deprecated, + // use `server.socket.address`. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. It represents the deprecated, + // use `server.socket.port`. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. It represents the deprecated, use + // `network.transport`. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + NetTransportKey = attribute.Key("net.transport") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. It represents the deprecated, + // use `network.protocol.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'amqp', 'http', 'mqtt' + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. It represents the + // deprecated, use `network.protocol.version`. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '3.1.1' + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. It represents the deprecated, + // use `network.transport` and `network.type`. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + NetSockFamilyKey = attribute.Key("net.sock.family") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. It represents the deprecated, use +// `server.socket.domain` on client spans. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. It represents the deprecated, use +// `server.socket.address` on client spans and `client.socket.address` on +// server spans. +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. It represents the deprecated, use +// `server.socket.port` on client spans and `client.socket.port` on server +// spans. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. It represents the deprecated, use +// `server.address` on client spans and `client.address` on server spans. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. It represents the deprecated, use +// `server.port` on client spans and `client.port` on server spans. +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. It represents the deprecated, use +// `server.address`. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. It represents the deprecated, use +// `server.port`. +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. It represents the deprecated, use +// `server.socket.address`. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. It represents the deprecated, use +// `server.socket.port`. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. It represents the deprecated, use +// `network.protocol.name`. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. It represents the deprecated, +// use `network.protocol.version`. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// These attributes may be used to describe the receiver of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API does not expose a clear notion +// of client and server. +const ( + // DestinationDomainKey is the attribute Key conforming to the + // "destination.domain" semantic conventions. It represents the domain name + // of the destination system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'foo.example.com' + // Note: This value may be a host name, a fully qualified domain name, or + // another host naming format. + DestinationDomainKey = attribute.Key("destination.domain") + + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the peer + // address, for example IP address or UNIX socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.5.3.2' + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the + // "destination.port" semantic conventions. It represents the peer port + // number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationDomain returns an attribute KeyValue conforming to the +// "destination.domain" semantic conventions. It represents the domain name of +// the destination system. +func DestinationDomain(val string) attribute.KeyValue { + return DestinationDomainKey.String(val) +} + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the peer address, +// for example IP address or UNIX socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the peer port number +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// Describes HTTP attributes. +const ( + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the hTTP + // request method. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + // Note: HTTP request method value SHOULD be "known" to the + // instrumentation. + // By default, this convention defines "known" methods as the ones listed + // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + // and the PATCH method defined in + // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + // + // If the HTTP request method is not known to instrumentation, it MUST set + // the `http.request.method` attribute to `_OTHER` and, except if reporting + // a metric, MUST + // set the exact method received in the request line as value of the + // `http.request.method_original` attribute. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated + // list of case-sensitive known HTTP methods + // (this list MUST be a full override of the default known method, it is + // not a list of known methods in addition to the defaults). + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods + // to be case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status + // code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was + // received/sent.) + // Stability: stable + // Examples: 200 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") +) + +var ( + // CONNECT method + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // Any HTTP method that the instrumentation has no prior knowledge of + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the [HTTP +// response status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTP Server attributes +const ( + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/docs/http/http-spans.md#http-server-definitions) if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Describes Log attributes +const ( + // LogIostreamKey is the attribute Key conforming to the "log.iostream" + // semantic conventions. It represents the stream associated with the log. + // See below for a list of well-known values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + LogIostreamKey = attribute.Key("log.iostream") +) + +var ( + // Logs from stdout stream + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// A file to which log was emitted. +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'audit.log' + LogFileNameKey = attribute.Key("log.file.name") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/var/log/mysql/audit.log' + LogFilePathKey = attribute.Key("log.file.path") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the + // basename of the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'uuid.log' + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full + // path to the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/var/lib/docker/uuid.log' + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") +) + +// LogFileName returns an attribute KeyValue conforming to the +// "log.file.name" semantic conventions. It represents the basename of the +// file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the +// "log.file.path" semantic conventions. It represents the full path to the +// file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path +// to the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// Describes JVM memory metric attributes. +const ( + // TypeKey is the attribute Key conforming to the "type" semantic + // conventions. It represents the type of memory. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'heap', 'non_heap' + TypeKey = attribute.Key("type") + + // PoolKey is the attribute Key conforming to the "pool" semantic + // conventions. It represents the name of the memory pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' + // Note: Pool names are generally obtained via + // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). + PoolKey = attribute.Key("pool") +) + +var ( + // Heap memory + TypeHeap = TypeKey.String("heap") + // Non-heap memory + TypeNonHeap = TypeKey.String("non_heap") +) + +// Pool returns an attribute KeyValue conforming to the "pool" semantic +// conventions. It represents the name of the memory pool. +func Pool(val string) attribute.KeyValue { + return PoolKey.String(val) +} + +// These attributes may be used to describe the server in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API does not expose a +// clear notion of client and server). This also covers UDP network +// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) +// and DNS. +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the logical server hostname, matches + // server FQDN if available, and IP or socket address if FQDN is not known. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" + // semantic conventions. It represents the logical server port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + ServerPortKey = attribute.Key("server.port") + + // ServerSocketDomainKey is the attribute Key conforming to the + // "server.socket.domain" semantic conventions. It represents the domain + // name of an immediate peer. + // + // Type: string + // RequirementLevel: Recommended (If different than `server.address`.) + // Stability: stable + // Examples: 'proxy.example.com' + // Note: Typically observed from the client side, and represents a proxy or + // other intermediary domain name. + ServerSocketDomainKey = attribute.Key("server.socket.domain") + + // ServerSocketAddressKey is the attribute Key conforming to the + // "server.socket.address" semantic conventions. It represents the physical + // server IP address or Unix socket address. If set from the client, should + // simply use the socket's peer address, and not attempt to find any actual + // server IP (i.e., if set from client, this may represent some proxy + // server instead of the logical server). + // + // Type: string + // RequirementLevel: Recommended (If different than `server.address`.) + // Stability: stable + // Examples: '10.5.3.2' + ServerSocketAddressKey = attribute.Key("server.socket.address") + + // ServerSocketPortKey is the attribute Key conforming to the + // "server.socket.port" semantic conventions. It represents the physical + // server port. + // + // Type: int + // RequirementLevel: Recommended (If different than `server.port`.) + // Stability: stable + // Examples: 16456 + ServerSocketPortKey = attribute.Key("server.socket.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the +// "server.address" semantic conventions. It represents the logical server +// hostname, matches server FQDN if available, and IP or socket address if FQDN +// is not known. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the logical server port number +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// ServerSocketDomain returns an attribute KeyValue conforming to the +// "server.socket.domain" semantic conventions. It represents the domain name +// of an immediate peer. +func ServerSocketDomain(val string) attribute.KeyValue { + return ServerSocketDomainKey.String(val) +} + +// ServerSocketAddress returns an attribute KeyValue conforming to the +// "server.socket.address" semantic conventions. It represents the physical +// server IP address or Unix socket address. If set from the client, should +// simply use the socket's peer address, and not attempt to find any actual +// server IP (i.e., if set from client, this may represent some proxy server +// instead of the logical server). +func ServerSocketAddress(val string) attribute.KeyValue { + return ServerSocketAddressKey.String(val) +} + +// ServerSocketPort returns an attribute KeyValue conforming to the +// "server.socket.port" semantic conventions. It represents the physical server +// port. +func ServerSocketPort(val int) attribute.KeyValue { + return ServerSocketPortKey.Int(val) +} + +// These attributes may be used to describe the sender of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API does not expose a clear notion +// of client and server. +const ( + // SourceDomainKey is the attribute Key conforming to the "source.domain" + // semantic conventions. It represents the domain name of the source + // system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'foo.example.com' + // Note: This value may be a host name, a fully qualified domain name, or + // another host naming format. + SourceDomainKey = attribute.Key("source.domain") + + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address, for example IP + // address or Unix socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.5.3.2' + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" + // semantic conventions. It represents the source port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceDomain returns an attribute KeyValue conforming to the +// "source.domain" semantic conventions. It represents the domain name of the +// source system. +func SourceDomain(val string) attribute.KeyValue { + return SourceDomainKey.String(val) +} + +// SourceAddress returns an attribute KeyValue conforming to the +// "source.address" semantic conventions. It represents the source address, for +// example IP address or Unix socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the [OSI + // Transport Layer](https://osi-model.com/transport-layer/) or + // [Inter-process Communication + // method](https://en.wikipedia.org/wiki/Inter-process_communication). The + // value SHOULD be normalized to lowercase. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tcp', 'udp' + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" + // semantic conventions. It represents the [OSI Network + // Layer](https://osi-model.com/network-layer/) or non-OSI equivalent. The + // value SHOULD be normalized to lowercase. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ipv4', 'ipv6' + NetworkTypeKey = attribute.Key("network.type") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the [OSI + // Application Layer](https://osi-model.com/application-layer/) or non-OSI + // equivalent. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the + // version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `network.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client used has a version of `0.27.2`, but sends HTTP version + // `1.1`, this attribute should be set to `1.1`. + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") +) + +var ( + // TCP + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe. See note below + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + NetworkTransportUnix = NetworkTransportKey.String("unix") +) + +var ( + // IPv4 + NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") + // IPv6 + NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") +) + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the [OSI +// Application Layer](https://osi-model.com/application-layer/) or non-OSI +// equivalent. The value SHOULD be normalized to lowercase. +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the version +// of the application layer protocol used. See note below. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the + // internet connection type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetworkConnectionTypeKey = attribute.Key("network.connection.type") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkCarrierMccKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMncKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierIccKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier + // network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetworkCarrierIccKey = attribute.Key("network.carrier.icc") +) + +var ( + // wifi + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// NetworkCarrierMcc returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMcc(val string) attribute.KeyValue { + return NetworkCarrierMccKey.String(val) +} + +// NetworkCarrierMnc returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMnc(val string) attribute.KeyValue { + return NetworkCarrierMncKey.String(val) +} + +// NetworkCarrierIcc returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierIcc(val string) attribute.KeyValue { + return NetworkCarrierIccKey.String(val) +} + +// Semantic conventions for HTTP client and server Spans. +const ( + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's different + // than `http.request.method`.) + // Stability: stable + // Examples: 'GeT', 'ACL', 'foo' + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of + // the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size + // of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") +) + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of +// the response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. +const ( + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to + // the "messaging.message.payload_size_bytes" semantic conventions. It + // represents the (uncompressed) size of the message payload in bytes. Also + // use this attribute if it is unknown whether the compressed or + // uncompressed payload size is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") + + // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key + // conforming to the "messaging.message.payload_compressed_size_bytes" + // semantic conventions. It represents the compressed size of the message + // payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") +) + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming +// to the "messaging.message.payload_size_bytes" semantic conventions. It +// represents the (uncompressed) size of the message payload in bytes. Also use +// this attribute if it is unknown whether the compressed or uncompressed +// payload size is reported. +func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadSizeBytesKey.Int(val) +} + +// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue +// conforming to the "messaging.message.payload_compressed_size_bytes" semantic +// conventions. It represents the compressed size of the message payload in +// bytes. +func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker +const ( + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") +) + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// Attributes for RabbitMQ +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// Attributes for Apache Kafka +const ( + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) + // Stability: stable + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// Attributes for Apache RocketMQ +const ( + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// Attributes describing URL. +const ( + // URLSchemeKey is the attribute Key conforming to the "url.scheme" + // semantic conventions. It represents the [URI + // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component + // identifying the used protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https', 'ftp', 'telnet' + URLSchemeKey = attribute.Key("url.scheme") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network + // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', + // '//localhost' + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the + // fragment is not transmitted over HTTP, but if it is known, it should be + // included nevertheless. + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case username and + // password should be redacted and attribute's value should be + // `https://REDACTED:REDACTED@www.example.com/`. + // `url.full` SHOULD capture the absolute URL when it is available (or can + // be reconstructed) and SHOULD NOT be validated or modified except for + // sanitizing purposes. + URLFullKey = attribute.Key("url.full") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI + // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/search' + // Note: When missing, the value is assumed to be `/` + URLPathKey = attribute.Key("url.path") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI + // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'q=OpenTelemetry' + // Note: Sensitive content provided in query string SHOULD be scrubbed when + // instrumentations can identify it. + URLQueryKey = attribute.Key("url.query") + + // URLFragmentKey is the attribute Key conforming to the "url.fragment" + // semantic conventions. It represents the [URI + // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'SemConv' + URLFragmentKey = attribute.Key("url.fragment") +) + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI +// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component +// identifying the used protocol. +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" +// semantic conventions. It represents the absolute URL describing a network +// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" +// semantic conventions. It represents the [URI +// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" +// semantic conventions. It represents the [URI +// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLFragment returns an attribute KeyValue conforming to the +// "url.fragment" semantic conventions. It represents the [URI +// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/doc.go new file mode 100644 index 000000000..7cf424855 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.21.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/event.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/event.go new file mode 100644 index 000000000..30ae34fe4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/event.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +import "go.opentelemetry.io/otel/attribute" + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/exception.go new file mode 100644 index 000000000..93d3c1760 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/resource.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/resource.go new file mode 100644 index 000000000..b6d8935cf --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/resource.go @@ -0,0 +1,2310 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Bare Metal Solution (BMS) + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) +// on Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// Resource used by Google Cloud Run. +const ( + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the + // name of the Cloud Run + // [execution](https://cloud.google.com/run/docs/managing/job-executions) + // being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'job-name-xxxx', 'sample-job-mdw84' + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the + // index for a task within an execution as provided by the + // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 1 + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") +) + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name +// of the Cloud Run +// [execution](https://cloud.google.com/run/docs/managing/job-executions) being +// run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the +// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// Resources used by Google Compute Engine (GCE). +const ( + // GCPGceInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance + // name of a GCE instance. This is the value provided by `host.name`, the + // visible name of the instance in the Cloud Console UI, and the prefix for + // the default hostname of the instance as defined by the [default internal + // DNS + // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'instance-1', 'my-vm-name' + GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") + + // GCPGceInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the + // hostname of a GCE instance. This is the full value of the default or + // [custom + // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-host1234.example.com', + // 'sample-vm.us-west1-b.c.my-project.internal' + GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") +) + +// GCPGceInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance +// name of a GCE instance. This is the value provided by `host.name`, the +// visible name of the instance in the Cloud Console UI, and the prefix for the +// default hostname of the instance as defined by the [default internal DNS +// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). +func GCPGceInstanceName(val string) attribute.KeyValue { + return GCPGceInstanceNameKey.String(val) +} + +// GCPGceInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom +// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). +func GCPGceInstanceHostname(val string) attribute.KeyValue { + return GCPGceInstanceHostnameKey.String(val) +} + +// Heroku dyno metadata +const ( + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") +) + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// A container instance. +const ( + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageTagKey is the attribute Key conforming to the + // "container.image.tag" semantic conventions. It represents the container + // image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime + // specific image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect + // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) + // endpoint. + // K8S defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io + // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. + // OCI defines a digest of manifest. + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used + // to run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'otelcontribcol' + // Note: If using embedded credentials or sensitive data, it is recommended + // to remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full + // command run by the container as a single string representing the full + // command. [2] + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'otelcontribcol --config config.yaml' + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. [2] + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'otelcontribcol, --config, config.yaml' + ContainerCommandArgsKey = attribute.Key("container.command_args") +) + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageTag returns an attribute KeyValue conforming to the +// "container.image.tag" semantic conventions. It represents the container +// image tag. +func ContainerImageTag(val string) attribute.KeyValue { + return ContainerImageTagKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime +// specific image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full +// command run by the container as a single string representing the full +// command. [2] +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. [2] +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment +// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka +// deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// A serverless instance. +const ( + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](/docs/general/general-attributes.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run (Services):** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// A host is defined as a computing instance. For example, physical servers, +// virtual machines, switches or disk array. +const ( + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID or host OS image ID. + // For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image or host OS as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID or host +// OS image ID. For Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image or host OS as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the + // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for + // the cluster, set to the UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' + // Note: K8S does not have support for obtaining a cluster ID. If this is + // ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8S cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8S ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T + // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // different from all other UUIDs generated before 3603 A.D., or is + // extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. The format is not defined by these + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0', 'a01dbef8a' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. The format is not defined by these +// conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-k8s-pod-deployment-1', + // '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") +) + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'opentelemetry' + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute + // to `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is + // used, this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module + // name of this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this + // case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetryAutoVersionKey is the attribute Key conforming to the + // "telemetry.auto.version" semantic conventions. It represents the version + // string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +// TelemetryAutoVersion returns an attribute KeyValue conforming to the +// "telemetry.auto.version" semantic conventions. It represents the version +// string of the auto instrumentation agent, if used. +func TelemetryAutoVersion(val string) attribute.KeyValue { + return TelemetryAutoVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. It represents the deprecated, + // use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. It represents the + // deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. It represents the deprecated, use +// the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. It represents the deprecated, +// use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/schema.go new file mode 100644 index 000000000..66ffd5989 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.21.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/trace.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/trace.go new file mode 100644 index 000000000..b5a91450d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/trace.go @@ -0,0 +1,2495 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: Recommended (Should be collected by default only if + // there is sanitization that excludes sensitive information.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + DBStatementKey = attribute.Key("db.statement") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `server.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Call-level attributes for Cosmos DB. +const ( + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (when performing one of the + // operations in this list) + // Stability: stable + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (if not `direct` (or pick gw as + // default)) + // Stability: stable + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBContainerKey is the attribute Key conforming to the + // "db.cosmosdb.container" semantic conventions. It represents the cosmos + // DB container name. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if available) + // Stability: stable + // Examples: 'anystring' + DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (if response was received) + // Stability: stable + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (when response was received and + // contained sub-code.) + // Stability: stable + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: ConditionallyRequired (when available) + // Stability: stable + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBContainer returns an attribute KeyValue conforming to the +// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB +// container name. +func DBCosmosDBContainer(val string) attribute.KeyValue { + return DBCosmosDBContainerKey.String(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + // + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// Contains additional attributes for outgoing FaaS spans. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](/docs/resource/README.md#service) of the remote + // service. SHOULD be equal to the actual `service.name` resource attribute + // of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](/docs/resource/README.md#service) of the remote service. +// SHOULD be equal to the actual `service.name` resource attribute of the +// remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") +) + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// Semantic Convention for HTTP Client +const ( + // HTTPResendCountKey is the attribute Key conforming to the + // "http.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// HTTPResendCount returns an attribute KeyValue conforming to the +// "http.resend_count" semantic conventions. It represents the ordinal number +// of request resending attempt (for any reason, including redirects). +func HTTPResendCount(val int) attribute.KeyValue { + return HTTPResendCountKey.Int(val) +} + +// The `aws` conventions apply to operations using the AWS SDK. They map +// request or response parameters in AWS SDK API calls to attributes on a Span. +// The conventions have been collected over time based on feedback from AWS +// users of tracing and will continue to evolve as new interesting conventions +// are found. +// Some descriptions are also provided for populating general OpenTelemetry +// semantic conventions based on these APIs. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Attributes that exist for S3 request types. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// General attributes used in messaging systems. +const ( + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation as defined in the [Operation + // names](#operation-names) section above. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the span describes an + // operation on a batch of messages.) + // Stability: stable + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client_id" semantic conventions. It represents a unique + // identifier for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Recommended (If a client id is available) + // Stability: stable + // Examples: 'client-5', 'myhost@8742@s8083jm' + MessagingClientIDKey = attribute.Key("messaging.client_id") +) + +var ( + // publish + MessagingOperationPublish = MessagingOperationKey.String("publish") + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client_id" semantic conventions. It represents a unique +// identifier for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// Semantic conventions for remote procedure calls. +const ( + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// Tech-specific attributes for gRPC. +const ( + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default + // version (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// does not specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// Tech-specific attributes for Connect RPC. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If response is not successful + // and if error code available.) + // Stability: stable + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) diff --git a/vendor/go.opentelemetry.io/otel/trace/config.go b/vendor/go.opentelemetry.io/otel/trace/config.go index f058cc781..3aadc66cf 100644 --- a/vendor/go.opentelemetry.io/otel/trace/config.go +++ b/vendor/go.opentelemetry.io/otel/trace/config.go @@ -25,6 +25,7 @@ type TracerConfig struct { instrumentationVersion string // Schema URL of the telemetry emitted by the Tracer. schemaURL string + attrs attribute.Set } // InstrumentationVersion returns the version of the library providing instrumentation. @@ -32,6 +33,12 @@ func (t *TracerConfig) InstrumentationVersion() string { return t.instrumentationVersion } +// InstrumentationAttributes returns the attributes associated with the library +// providing instrumentation. +func (t *TracerConfig) InstrumentationAttributes() attribute.Set { + return t.attrs +} + // SchemaURL returns the Schema URL of the telemetry emitted by the Tracer. func (t *TracerConfig) SchemaURL() string { return t.schemaURL @@ -261,6 +268,7 @@ func (o stackTraceOption) applyEvent(c EventConfig) EventConfig { c.stackTrace = bool(o) return c } + func (o stackTraceOption) applySpan(c SpanConfig) SpanConfig { c.stackTrace = bool(o) return c @@ -307,6 +315,16 @@ func WithInstrumentationVersion(version string) TracerOption { }) } +// WithInstrumentationAttributes sets the instrumentation attributes. +// +// The passed attributes will be de-duplicated. +func WithInstrumentationAttributes(attr ...attribute.KeyValue) TracerOption { + return tracerOptionFunc(func(config TracerConfig) TracerConfig { + config.attrs = attribute.NewSet(attr...) + return config + }) +} + // WithSchemaURL sets the schema URL for the Tracer. func WithSchemaURL(schemaURL string) TracerOption { return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { diff --git a/vendor/go.opentelemetry.io/otel/trace/doc.go b/vendor/go.opentelemetry.io/otel/trace/doc.go index 391417718..440f3d756 100644 --- a/vendor/go.opentelemetry.io/otel/trace/doc.go +++ b/vendor/go.opentelemetry.io/otel/trace/doc.go @@ -17,7 +17,7 @@ Package trace provides an implementation of the tracing part of the OpenTelemetry API. To participate in distributed traces a Span needs to be created for the -operation being performed as part of a traced workflow. It its simplest form: +operation being performed as part of a traced workflow. In its simplest form: var tracer trace.Tracer @@ -62,5 +62,69 @@ a default. defer span.End() // ... } + +# API Implementations + +This package does not conform to the standard Go versioning policy; all of its +interfaces may have methods added to them without a package major version bump. +This non-standard API evolution could surprise an uninformed implementation +author. They could unknowingly build their implementation in a way that would +result in a runtime panic for their users that update to the new API. + +The API is designed to help inform an instrumentation author about this +non-standard API evolution. It requires them to choose a default behavior for +unimplemented interface methods. There are three behavior choices they can +make: + + - Compilation failure + - Panic + - Default to another implementation + +All interfaces in this API embed a corresponding interface from +[go.opentelemetry.io/otel/trace/embedded]. If an author wants the default +behavior of their implementations to be a compilation failure, signaling to +their users they need to update to the latest version of that implementation, +they need to embed the corresponding interface from +[go.opentelemetry.io/otel/trace/embedded] in their implementation. For +example, + + import "go.opentelemetry.io/otel/trace/embedded" + + type TracerProvider struct { + embedded.TracerProvider + // ... + } + +If an author wants the default behavior of their implementations to panic, they +can embed the API interface directly. + + import "go.opentelemetry.io/otel/trace" + + type TracerProvider struct { + trace.TracerProvider + // ... + } + +This option is not recommended. It will lead to publishing packages that +contain runtime panics when users update to newer versions of +[go.opentelemetry.io/otel/trace], which may be done with a trasitive +dependency. + +Finally, an author can embed another implementation in theirs. The embedded +implementation will be used for methods not defined by the author. For example, +an author who wants to default to silently dropping the call can use +[go.opentelemetry.io/otel/trace/noop]: + + import "go.opentelemetry.io/otel/trace/noop" + + type TracerProvider struct { + noop.TracerProvider + // ... + } + +It is strongly recommended that authors only embed +[go.opentelemetry.io/otel/trace/noop] if they choose this default behavior. +That implementation is the only one OpenTelemetry authors can guarantee will +fully implement all the API interfaces when a user updates their API. */ package trace // import "go.opentelemetry.io/otel/trace" diff --git a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go new file mode 100644 index 000000000..898db5a75 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package embedded provides interfaces embedded within the [OpenTelemetry +// trace API]. +// +// Implementers of the [OpenTelemetry trace API] can embed the relevant type +// from this package into their implementation directly. Doing so will result +// in a compilation error for users when the [OpenTelemetry trace API] is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [OpenTelemetry trace API]: https://pkg.go.dev/go.opentelemetry.io/otel/trace +package embedded // import "go.opentelemetry.io/otel/trace/embedded" + +// TracerProvider is embedded in +// [go.opentelemetry.io/otel/trace.TracerProvider]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.TracerProvider] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.TracerProvider] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type TracerProvider interface{ tracerProvider() } + +// Tracer is embedded in [go.opentelemetry.io/otel/trace.Tracer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.Tracer] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.Tracer] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Tracer interface{ tracer() } + +// Span is embedded in [go.opentelemetry.io/otel/trace.Span]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.Span] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.Span] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Span interface{ span() } diff --git a/vendor/go.opentelemetry.io/otel/trace/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop.go index 73950f207..c125491ca 100644 --- a/vendor/go.opentelemetry.io/otel/trace/noop.go +++ b/vendor/go.opentelemetry.io/otel/trace/noop.go @@ -19,16 +19,20 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" ) // NewNoopTracerProvider returns an implementation of TracerProvider that // performs no operations. The Tracer and Spans created from the returned // TracerProvider also perform no operations. +// +// Deprecated: Use [go.opentelemetry.io/otel/trace/noop.NewTracerProvider] +// instead. func NewNoopTracerProvider() TracerProvider { return noopTracerProvider{} } -type noopTracerProvider struct{} +type noopTracerProvider struct{ embedded.TracerProvider } var _ TracerProvider = noopTracerProvider{} @@ -37,8 +41,8 @@ func (p noopTracerProvider) Tracer(string, ...TracerOption) Tracer { return noopTracer{} } -// noopTracer is an implementation of Tracer that preforms no operations. -type noopTracer struct{} +// noopTracer is an implementation of Tracer that performs no operations. +type noopTracer struct{ embedded.Tracer } var _ Tracer = noopTracer{} @@ -53,8 +57,8 @@ func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption return ContextWithSpan(ctx, span), span } -// noopSpan is an implementation of Span that preforms no operations. -type noopSpan struct{} +// noopSpan is an implementation of Span that performs no operations. +type noopSpan struct{ embedded.Span } var _ Span = noopSpan{} diff --git a/vendor/go.opentelemetry.io/otel/trace/noop/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go new file mode 100644 index 000000000..7f485543c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go @@ -0,0 +1,118 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package noop provides an implementation of the OpenTelemetry trace API that +// produces no telemetry and minimizes used computation resources. +// +// Using this package to implement the OpenTelemetry trace API will effectively +// disable OpenTelemetry. +// +// This implementation can be embedded in other implementations of the +// OpenTelemetry trace API. Doing so will mean the implementation defaults to +// no operation for methods it does not implement. +package noop // import "go.opentelemetry.io/otel/trace/noop" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" +) + +var ( + // Compile-time check this implements the OpenTelemetry API. + + _ trace.TracerProvider = TracerProvider{} + _ trace.Tracer = Tracer{} + _ trace.Span = Span{} +) + +// TracerProvider is an OpenTelemetry No-Op TracerProvider. +type TracerProvider struct{ embedded.TracerProvider } + +// NewTracerProvider returns a TracerProvider that does not record any telemetry. +func NewTracerProvider() TracerProvider { + return TracerProvider{} +} + +// Tracer returns an OpenTelemetry Tracer that does not record any telemetry. +func (TracerProvider) Tracer(string, ...trace.TracerOption) trace.Tracer { + return Tracer{} +} + +// Tracer is an OpenTelemetry No-Op Tracer. +type Tracer struct{ embedded.Tracer } + +// Start creates a span. The created span will be set in a child context of ctx +// and returned with the span. +// +// If ctx contains a span context, the returned span will also contain that +// span context. If the span context in ctx is for a non-recording span, that +// span instance will be returned directly. +func (t Tracer) Start(ctx context.Context, _ string, _ ...trace.SpanStartOption) (context.Context, trace.Span) { + span := trace.SpanFromContext(ctx) + + // If the parent context contains a non-zero span context, that span + // context needs to be returned as a non-recording span + // (https://github.com/open-telemetry/opentelemetry-specification/blob/3a1dde966a4ce87cce5adf464359fe369741bbea/specification/trace/api.md#behavior-of-the-api-in-the-absence-of-an-installed-sdk). + var zeroSC trace.SpanContext + if sc := span.SpanContext(); !sc.Equal(zeroSC) { + if !span.IsRecording() { + // If the span is not recording return it directly. + return ctx, span + } + // Otherwise, return the span context needs in a non-recording span. + span = Span{sc: sc} + } else { + // No parent, return a No-Op span with an empty span context. + span = Span{} + } + return trace.ContextWithSpan(ctx, span), span +} + +// Span is an OpenTelemetry No-Op Span. +type Span struct { + embedded.Span + + sc trace.SpanContext +} + +// SpanContext returns an empty span context. +func (s Span) SpanContext() trace.SpanContext { return s.sc } + +// IsRecording always returns false. +func (Span) IsRecording() bool { return false } + +// SetStatus does nothing. +func (Span) SetStatus(codes.Code, string) {} + +// SetAttributes does nothing. +func (Span) SetAttributes(...attribute.KeyValue) {} + +// End does nothing. +func (Span) End(...trace.SpanEndOption) {} + +// RecordError does nothing. +func (Span) RecordError(error, ...trace.EventOption) {} + +// AddEvent does nothing. +func (Span) AddEvent(string, ...trace.EventOption) {} + +// SetName does nothing. +func (Span) SetName(string) {} + +// TracerProvider returns a No-Op TracerProvider. +func (Span) TracerProvider() trace.TracerProvider { return TracerProvider{} } diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go index 97f3d8385..26a4b2260 100644 --- a/vendor/go.opentelemetry.io/otel/trace/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace/trace.go @@ -22,6 +22,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" ) const ( @@ -48,8 +49,10 @@ func (e errorConst) Error() string { // nolint:revive // revive complains about stutter of `trace.TraceID`. type TraceID [16]byte -var nilTraceID TraceID -var _ json.Marshaler = nilTraceID +var ( + nilTraceID TraceID + _ json.Marshaler = nilTraceID +) // IsValid checks whether the trace TraceID is valid. A valid trace ID does // not consist of zeros only. @@ -71,8 +74,10 @@ func (t TraceID) String() string { // SpanID is a unique identity of a span in a trace. type SpanID [8]byte -var nilSpanID SpanID -var _ json.Marshaler = nilSpanID +var ( + nilSpanID SpanID + _ json.Marshaler = nilSpanID +) // IsValid checks whether the SpanID is valid. A valid SpanID does not consist // of zeros only. @@ -338,8 +343,15 @@ func (sc SpanContext) MarshalJSON() ([]byte, error) { // create a Span and it is then up to the operation the Span represents to // properly end the Span when the operation itself ends. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Span interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Span + // End completes the Span. The Span is considered complete and ready to be // delivered through the rest of the telemetry pipeline after this method // is called. Therefore, updates to the Span are not allowed after this @@ -364,8 +376,9 @@ type Span interface { SpanContext() SpanContext // SetStatus sets the status of the Span in the form of a code and a - // description, overriding previous values set. The description is only - // included in a status when the code is for an error. + // description, provided the status hasn't already been set to a higher + // value before (OK > Error > Unset). The description is only included in a + // status when the code is for an error. SetStatus(code codes.Code, description string) // SetName sets the Span name. @@ -485,8 +498,15 @@ func (sk SpanKind) String() string { // Tracer is the creator of Spans. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Tracer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Tracer + // Start creates a span and a context.Context containing the newly-created span. // // If the context.Context provided in `ctx` contains a Span then the newly-created @@ -517,8 +537,15 @@ type Tracer interface { // at runtime from its users or it can simply use the globally registered one // (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type TracerProvider interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.TracerProvider + // Tracer returns a unique Tracer scoped to be used by instrumentation code // to trace computational workflows. The scope and identity of that // instrumentation code is uniquely defined by the name and options passed. diff --git a/vendor/go.opentelemetry.io/otel/trace/tracestate.go b/vendor/go.opentelemetry.io/otel/trace/tracestate.go index ca68a82e5..d1e47ca2f 100644 --- a/vendor/go.opentelemetry.io/otel/trace/tracestate.go +++ b/vendor/go.opentelemetry.io/otel/trace/tracestate.go @@ -28,9 +28,9 @@ const ( // based on the W3C Trace Context specification, see // https://www.w3.org/TR/trace-context-1/#tracestate-header - noTenantKeyFormat = `[a-z][_0-9a-z\-\*\/]{0,255}` - withTenantKeyFormat = `[a-z0-9][_0-9a-z\-\*\/]{0,240}@[a-z][_0-9a-z\-\*\/]{0,13}` - valueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]` + noTenantKeyFormat = `[a-z][_0-9a-z\-\*\/]*` + withTenantKeyFormat = `[a-z0-9][_0-9a-z\-\*\/]*@[a-z][_0-9a-z\-\*\/]*` + valueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]*[\x21-\x2b\x2d-\x3c\x3e-\x7e]` errInvalidKey errorConst = "invalid tracestate key" errInvalidValue errorConst = "invalid tracestate value" @@ -40,9 +40,10 @@ const ( ) var ( - keyRe = regexp.MustCompile(`^((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))$`) - valueRe = regexp.MustCompile(`^(` + valueFormat + `)$`) - memberRe = regexp.MustCompile(`^\s*((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`) + noTenantKeyRe = regexp.MustCompile(`^` + noTenantKeyFormat + `$`) + withTenantKeyRe = regexp.MustCompile(`^` + withTenantKeyFormat + `$`) + valueRe = regexp.MustCompile(`^` + valueFormat + `$`) + memberRe = regexp.MustCompile(`^\s*((?:` + noTenantKeyFormat + `)|(?:` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`) ) type member struct { @@ -51,10 +52,19 @@ type member struct { } func newMember(key, value string) (member, error) { - if !keyRe.MatchString(key) { + if len(key) > 256 { return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) } - if !valueRe.MatchString(value) { + if !noTenantKeyRe.MatchString(key) { + if !withTenantKeyRe.MatchString(key) { + return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) + } + atIndex := strings.LastIndex(key, "@") + if atIndex > 241 || len(key)-1-atIndex > 14 { + return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) + } + } + if len(value) > 256 || !valueRe.MatchString(value) { return member{}, fmt.Errorf("%w: %s", errInvalidValue, value) } return member{Key: key, Value: value}, nil @@ -62,14 +72,14 @@ func newMember(key, value string) (member, error) { func parseMember(m string) (member, error) { matches := memberRe.FindStringSubmatch(m) - if len(matches) != 5 { + if len(matches) != 3 { return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) } - - return member{ - Key: matches[1], - Value: matches[4], - }, nil + result, e := newMember(matches[1], matches[2]) + if e != nil { + return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) + } + return result, nil } // String encodes member into a string compliant with the W3C Trace Context diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go index 806db41c5..5a92f1d4b 100644 --- a/vendor/go.opentelemetry.io/otel/version.go +++ b/vendor/go.opentelemetry.io/otel/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.10.0" + return "1.20.0" } diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml index ec2ca16d2..82366e799 100644 --- a/vendor/go.opentelemetry.io/otel/versions.yaml +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -14,45 +14,42 @@ module-sets: stable-v1: - version: v1.10.0 + version: v1.20.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing + - go.opentelemetry.io/otel/bridge/opentracing/test + - go.opentelemetry.io/otel/example/dice - go.opentelemetry.io/otel/example/fib - - go.opentelemetry.io/otel/example/jaeger - go.opentelemetry.io/otel/example/namedtracer - go.opentelemetry.io/otel/example/otel-collector - go.opentelemetry.io/otel/example/passthrough - go.opentelemetry.io/otel/example/zipkin - - go.opentelemetry.io/otel/exporters/jaeger - - go.opentelemetry.io/otel/exporters/zipkin - go.opentelemetry.io/otel/exporters/otlp/otlptrace - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp - - go.opentelemetry.io/otel/exporters/otlp/internal/retry - go.opentelemetry.io/otel/exporters/stdout/stdouttrace - - go.opentelemetry.io/otel/trace + - go.opentelemetry.io/otel/exporters/zipkin + - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk + - go.opentelemetry.io/otel/sdk/metric + - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.31.0 + version: v0.43.0 modules: + - go.opentelemetry.io/otel/bridge/opencensus + - go.opentelemetry.io/otel/bridge/opencensus/test + - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus + - go.opentelemetry.io/otel/example/view - go.opentelemetry.io/otel/exporters/otlp/otlpmetric - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - - go.opentelemetry.io/otel/metric - - go.opentelemetry.io/otel/sdk/metric experimental-schema: - version: v0.0.3 + version: v0.0.7 modules: - go.opentelemetry.io/otel/schema - bridge: - version: v0.31.0 - modules: - - go.opentelemetry.io/otel/bridge/opencensus - - go.opentelemetry.io/otel/bridge/opencensus/test - - go.opentelemetry.io/otel/example/opencensus excluded-modules: - go.opentelemetry.io/otel/internal/tools diff --git a/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.go b/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.go index fc285c089..c1af04e84 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.17.3 +// protoc v3.21.6 // source: opentelemetry/proto/collector/trace/v1/trace_service.proto package v1 diff --git a/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.gw.go b/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.gw.go index d142c2a44..bb1bd261e 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.gw.go +++ b/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service.pb.gw.go @@ -77,20 +77,22 @@ func RegisterTraceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", runtime.WithHTTPPathPattern("/v1/trace")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", runtime.WithHTTPPathPattern("/v1/traces")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TraceService_Export_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TraceService_Export_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_TraceService_Export_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_TraceService_Export_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -139,19 +141,21 @@ func RegisterTraceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", runtime.WithHTTPPathPattern("/v1/trace")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", runtime.WithHTTPPathPattern("/v1/traces")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TraceService_Export_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_TraceService_Export_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_TraceService_Export_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_TraceService_Export_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -159,7 +163,7 @@ func RegisterTraceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu } var ( - pattern_TraceService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "trace"}, "")) + pattern_TraceService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "traces"}, "")) ) var ( diff --git a/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go b/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go index c21f2cb47..dd1b73f1e 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.1.0 -// - protoc v3.17.3 +// - protoc v3.21.6 // source: opentelemetry/proto/collector/trace/v1/trace_service.proto package v1 diff --git a/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go b/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go index 8502e607b..852209b09 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.17.3 +// protoc v3.21.6 // source: opentelemetry/proto/common/v1/common.proto package v1 @@ -361,8 +361,11 @@ type InstrumentationScope struct { unknownFields protoimpl.UnknownFields // An empty instrumentation scope name means the name is unknown. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // Additional attributes that describe the scope. [Optional]. + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). Attributes []*KeyValue `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` DroppedAttributesCount uint32 `protobuf:"varint,4,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` } diff --git a/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go b/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go index bcc1060e3..b7545b03b 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.17.3 +// protoc v3.21.6 // source: opentelemetry/proto/resource/v1/resource.proto package v1 diff --git a/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go b/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go index 499a43d77..51a499816 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.17.3 +// protoc v3.21.6 // source: opentelemetry/proto/trace/v1/trace.proto package v1 @@ -117,8 +117,8 @@ type Status_StatusCode int32 const ( // The default status. Status_STATUS_CODE_UNSET Status_StatusCode = 0 - // The Span has been validated by an Application developers or Operator to have - // completed successfully. + // The Span has been validated by an Application developer or Operator to + // have completed successfully. Status_STATUS_CODE_OK Status_StatusCode = 1 // The Span contains an error. Status_STATUS_CODE_ERROR Status_StatusCode = 2 @@ -374,20 +374,16 @@ type Span struct { unknownFields protoimpl.UnknownFields // A unique identifier for a trace. All spans from the same trace share - // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes - // is considered invalid. - // - // This field is semantically required. Receiver should generate new - // random trace_id if empty or invalid trace_id was received. + // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR + // of length other than 16 bytes is considered invalid (empty string in OTLP/JSON + // is zero-length and thus is also invalid). // // This field is required. TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` // A unique identifier for a span within a trace, assigned when the span - // is created. The ID is an 8-byte array. An ID with all zeroes is considered - // invalid. - // - // This field is semantically required. Receiver should generate new - // random span_id if empty or invalid span_id was received. + // is created. The ID is an 8-byte array. An ID with all zeroes OR of length + // other than 8 bytes is considered invalid (empty string in OTLP/JSON + // is zero-length and thus is also invalid). // // This field is required. SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` @@ -433,8 +429,8 @@ type Span struct { // // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" // "/http/server_latency": 300 - // "abc.com/myattribute": true - // "abc.com/score": 10.239 + // "example.com/myattribute": true + // "example.com/score": 10.239 // // The OpenTelemetry API specification further restricts the allowed value types: // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.go b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.go index 5dfacbb98..661ea132e 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.go +++ b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package chacha20 diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s index f1f66230d..7dd2638e8 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s +++ b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go b/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go index 02ff3d05e..db42e6676 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go +++ b/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (!arm64 && !s390x && !ppc64le) || !gc || purego -// +build !arm64,!s390x,!ppc64le !gc purego package chacha20 diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.go b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.go index da420b2e9..3a4287f99 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.go +++ b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package chacha20 diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s index 5c0fed26f..66aebae25 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s +++ b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s @@ -20,7 +20,6 @@ // due to the calling conventions and initialization of constants. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.go b/vendor/golang.org/x/crypto/chacha20/chacha_s390x.go index 4652247b8..683ccfd1c 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.go +++ b/vendor/golang.org/x/crypto/chacha20/chacha_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package chacha20 diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s b/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s index f3ef5a019..1eda91a3d 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s +++ b/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "go_asm.h" #include "textflag.h" diff --git a/vendor/golang.org/x/crypto/cryptobyte/asn1.go b/vendor/golang.org/x/crypto/cryptobyte/asn1.go index 6fc2838a3..2492f796a 100644 --- a/vendor/golang.org/x/crypto/cryptobyte/asn1.go +++ b/vendor/golang.org/x/crypto/cryptobyte/asn1.go @@ -733,13 +733,14 @@ func (s *String) ReadOptionalASN1OctetString(out *[]byte, outPresent *bool, tag return true } -// ReadOptionalASN1Boolean sets *out to the value of the next ASN.1 BOOLEAN or, -// if the next bytes are not an ASN.1 BOOLEAN, to the value of defaultValue. -// It reports whether the operation was successful. -func (s *String) ReadOptionalASN1Boolean(out *bool, defaultValue bool) bool { +// ReadOptionalASN1Boolean attempts to read an optional ASN.1 BOOLEAN +// explicitly tagged with tag into out and advances. If no element with a +// matching tag is present, it sets "out" to defaultValue instead. It reports +// whether the read was successful. +func (s *String) ReadOptionalASN1Boolean(out *bool, tag asn1.Tag, defaultValue bool) bool { var present bool var child String - if !s.ReadOptionalASN1(&child, &present, asn1.BOOLEAN) { + if !s.ReadOptionalASN1(&child, &present, tag) { return false } @@ -748,7 +749,7 @@ func (s *String) ReadOptionalASN1Boolean(out *bool, defaultValue bool) bool { return true } - return s.ReadASN1Boolean(out) + return child.ReadASN1Boolean(out) } func (s *String) readASN1(out *String, outTag *asn1.Tag, skipHeader bool) bool { diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go index edcf163c4..70c541692 100644 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go +++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go @@ -1,7 +1,6 @@ // Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego package field diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s index 293f013c9..60817acc4 100644 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s +++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s @@ -1,7 +1,6 @@ // Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego #include "textflag.h" diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go index ddb6c9b8f..9da280d1d 100644 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go +++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !amd64 || !gc || purego -// +build !amd64 !gc purego package field diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go index af459ef51..075fe9b92 100644 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go +++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && gc && !purego -// +build arm64,gc,!purego package field diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s index 5c91e4589..3126a4341 100644 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s +++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && gc && !purego -// +build arm64,gc,!purego #include "textflag.h" diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go index 234a5b2e5..fc029ac12 100644 --- a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go +++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !arm64 || !gc || purego -// +build !arm64 !gc purego package field diff --git a/vendor/golang.org/x/crypto/hkdf/hkdf.go b/vendor/golang.org/x/crypto/hkdf/hkdf.go index dda3f143b..f4ded5fee 100644 --- a/vendor/golang.org/x/crypto/hkdf/hkdf.go +++ b/vendor/golang.org/x/crypto/hkdf/hkdf.go @@ -56,7 +56,9 @@ func (f *hkdf) Read(p []byte) (int, error) { // Fill the rest of the buffer for len(p) > 0 { - f.expander.Reset() + if f.counter > 1 { + f.expander.Reset() + } f.expander.Write(f.prev) f.expander.Write(f.info) f.expander.Write([]byte{f.counter}) diff --git a/vendor/golang.org/x/crypto/internal/alias/alias.go b/vendor/golang.org/x/crypto/internal/alias/alias.go index 69c17f822..551ff0c35 100644 --- a/vendor/golang.org/x/crypto/internal/alias/alias.go +++ b/vendor/golang.org/x/crypto/internal/alias/alias.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !purego -// +build !purego // Package alias implements memory aliasing tests. package alias diff --git a/vendor/golang.org/x/crypto/internal/alias/alias_purego.go b/vendor/golang.org/x/crypto/internal/alias/alias_purego.go index 4775b0a43..6fe61b5c6 100644 --- a/vendor/golang.org/x/crypto/internal/alias/alias_purego.go +++ b/vendor/golang.org/x/crypto/internal/alias/alias_purego.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build purego -// +build purego // Package alias implements memory aliasing tests. package alias diff --git a/vendor/golang.org/x/crypto/internal/poly1305/bits_compat.go b/vendor/golang.org/x/crypto/internal/poly1305/bits_compat.go index 45b5c966b..d33c8890f 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/bits_compat.go +++ b/vendor/golang.org/x/crypto/internal/poly1305/bits_compat.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.13 -// +build !go1.13 package poly1305 diff --git a/vendor/golang.org/x/crypto/internal/poly1305/bits_go1.13.go b/vendor/golang.org/x/crypto/internal/poly1305/bits_go1.13.go index ed52b3418..495c1fa69 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/bits_go1.13.go +++ b/vendor/golang.org/x/crypto/internal/poly1305/bits_go1.13.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.13 -// +build go1.13 package poly1305 diff --git a/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go b/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go index f184b67d9..333da285b 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go +++ b/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (!amd64 && !ppc64le && !s390x) || !gc || purego -// +build !amd64,!ppc64le,!s390x !gc purego package poly1305 diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go index 6d522333f..164cd47d3 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go +++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package poly1305 diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s index 1d74f0f88..e0d3c6475 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s +++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.go index 4a069941a..4aec4874b 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.go +++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package poly1305 diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s index 58422aad2..d2ca5deeb 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s +++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go index ec9596688..e1d033a49 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go +++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package poly1305 diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s index aa9e0494c..0fe3a7c21 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s +++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go index c400dfcf7..e76b44fe5 100644 --- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go +++ b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && !purego && gc -// +build amd64,!purego,gc package salsa diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s index c08927720..fcce0234b 100644 --- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s +++ b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && !purego && gc -// +build amd64,!purego,gc // This code was translated into a form compatible with 6a from the public // domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_noasm.go b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_noasm.go index 4392cc1ac..9448760f2 100644 --- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_noasm.go +++ b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !amd64 || purego || !gc -// +build !amd64 purego !gc package salsa diff --git a/vendor/golang.org/x/crypto/ssh/client_auth.go b/vendor/golang.org/x/crypto/ssh/client_auth.go index 5c3bc2572..34bf089d0 100644 --- a/vendor/golang.org/x/crypto/ssh/client_auth.go +++ b/vendor/golang.org/x/crypto/ssh/client_auth.go @@ -307,7 +307,10 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand } var methods []string var errSigAlgo error - for _, signer := range signers { + + origSignersLen := len(signers) + for idx := 0; idx < len(signers); idx++ { + signer := signers[idx] pub := signer.PublicKey() as, algo, err := pickSignatureAlgorithm(signer, extensions) if err != nil && errSigAlgo == nil { @@ -321,6 +324,21 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand if err != nil { return authFailure, nil, err } + // OpenSSH 7.2-7.7 advertises support for rsa-sha2-256 and rsa-sha2-512 + // in the "server-sig-algs" extension but doesn't support these + // algorithms for certificate authentication, so if the server rejects + // the key try to use the obtained algorithm as if "server-sig-algs" had + // not been implemented if supported from the algorithm signer. + if !ok && idx < origSignersLen && isRSACert(algo) && algo != CertAlgoRSAv01 { + if contains(as.Algorithms(), KeyAlgoRSA) { + // We retry using the compat algorithm after all signers have + // been tried normally. + signers = append(signers, &multiAlgorithmSigner{ + AlgorithmSigner: as, + supportedAlgorithms: []string{KeyAlgoRSA}, + }) + } + } if !ok { continue } diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go index b419c761e..7e9c2cbc6 100644 --- a/vendor/golang.org/x/crypto/ssh/common.go +++ b/vendor/golang.org/x/crypto/ssh/common.go @@ -10,7 +10,6 @@ import ( "fmt" "io" "math" - "strings" "sync" _ "crypto/sha1" @@ -128,6 +127,14 @@ func isRSA(algo string) bool { return contains(algos, underlyingAlgo(algo)) } +func isRSACert(algo string) bool { + _, ok := certKeyAlgoNames[algo] + if !ok { + return false + } + return isRSA(algo) +} + // supportedPubKeyAuthAlgos specifies the supported client public key // authentication algorithms. Note that this doesn't include certificate types // since those use the underlying algorithm. This list is sent to the client if @@ -140,8 +147,6 @@ var supportedPubKeyAuthAlgos = []string{ KeyAlgoDSA, } -var supportedPubKeyAuthAlgosList = strings.Join(supportedPubKeyAuthAlgos, ",") - // unexpectedMessageError results when the SSH message that we received didn't // match what we wanted. func unexpectedMessageError(expected, got uint8) error { diff --git a/vendor/golang.org/x/crypto/ssh/handshake.go b/vendor/golang.org/x/crypto/ssh/handshake.go index 70a7369ff..49bbba769 100644 --- a/vendor/golang.org/x/crypto/ssh/handshake.go +++ b/vendor/golang.org/x/crypto/ssh/handshake.go @@ -11,6 +11,7 @@ import ( "io" "log" "net" + "strings" "sync" ) @@ -50,6 +51,10 @@ type handshakeTransport struct { // connection. hostKeys []Signer + // publicKeyAuthAlgorithms is non-empty if we are the server. In that case, + // it contains the supported client public key authentication algorithms. + publicKeyAuthAlgorithms []string + // hostKeyAlgorithms is non-empty if we are the client. In that case, // we accept these key types from the server as host key. hostKeyAlgorithms []string @@ -141,6 +146,7 @@ func newClientTransport(conn keyingTransport, clientVersion, serverVersion []byt func newServerTransport(conn keyingTransport, clientVersion, serverVersion []byte, config *ServerConfig) *handshakeTransport { t := newHandshakeTransport(conn, &config.Config, clientVersion, serverVersion) t.hostKeys = config.hostKeys + t.publicKeyAuthAlgorithms = config.PublicKeyAuthAlgorithms go t.readLoop() go t.kexLoop() return t @@ -649,6 +655,7 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { // message with the server-sig-algs extension if the client supports it. See // RFC 8308, Sections 2.4 and 3.1, and [PROTOCOL], Section 1.9. if !isClient && firstKeyExchange && contains(clientInit.KexAlgos, "ext-info-c") { + supportedPubKeyAuthAlgosList := strings.Join(t.publicKeyAuthAlgorithms, ",") extInfo := &extInfoMsg{ NumExtensions: 2, Payload: make([]byte, 0, 4+15+4+len(supportedPubKeyAuthAlgosList)+4+16+4+1), diff --git a/vendor/golang.org/x/crypto/ssh/keys.go b/vendor/golang.org/x/crypto/ssh/keys.go index ef1bad731..df4ebdada 100644 --- a/vendor/golang.org/x/crypto/ssh/keys.go +++ b/vendor/golang.org/x/crypto/ssh/keys.go @@ -1232,16 +1232,27 @@ func ParseRawPrivateKeyWithPassphrase(pemBytes, passphrase []byte) (interface{}, return nil, fmt.Errorf("ssh: cannot decode encrypted private keys: %v", err) } + var result interface{} + switch block.Type { case "RSA PRIVATE KEY": - return x509.ParsePKCS1PrivateKey(buf) + result, err = x509.ParsePKCS1PrivateKey(buf) case "EC PRIVATE KEY": - return x509.ParseECPrivateKey(buf) + result, err = x509.ParseECPrivateKey(buf) case "DSA PRIVATE KEY": - return ParseDSAPrivateKey(buf) + result, err = ParseDSAPrivateKey(buf) default: - return nil, fmt.Errorf("ssh: unsupported key type %q", block.Type) + err = fmt.Errorf("ssh: unsupported key type %q", block.Type) } + // Because of deficiencies in the format, DecryptPEMBlock does not always + // detect an incorrect password. In these cases decrypted DER bytes is + // random noise. If the parsing of the key returns an asn1.StructuralError + // we return x509.IncorrectPasswordError. + if _, ok := err.(asn1.StructuralError); ok { + return nil, x509.IncorrectPasswordError + } + + return result, err } // ParseDSAPrivateKey returns a DSA private key from its ASN.1 DER encoding, as diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index 727c71b9c..7f0c236a9 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -64,6 +64,13 @@ type ServerConfig struct { // Config contains configuration shared between client and server. Config + // PublicKeyAuthAlgorithms specifies the supported client public key + // authentication algorithms. Note that this should not include certificate + // types since those use the underlying algorithm. This list is sent to the + // client if it supports the server-sig-algs extension. Order is irrelevant. + // If unspecified then a default set of algorithms is used. + PublicKeyAuthAlgorithms []string + hostKeys []Signer // NoClientAuth is true if clients are allowed to connect without @@ -201,6 +208,15 @@ func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewCha if fullConf.MaxAuthTries == 0 { fullConf.MaxAuthTries = 6 } + if len(fullConf.PublicKeyAuthAlgorithms) == 0 { + fullConf.PublicKeyAuthAlgorithms = supportedPubKeyAuthAlgos + } else { + for _, algo := range fullConf.PublicKeyAuthAlgorithms { + if !contains(supportedPubKeyAuthAlgos, algo) { + return nil, nil, nil, fmt.Errorf("ssh: unsupported public key authentication algorithm %s", algo) + } + } + } // Check if the config contains any unsupported key exchanges for _, kex := range fullConf.KeyExchanges { if _, ok := serverForbiddenKexAlgos[kex]; ok { @@ -321,7 +337,7 @@ func checkSourceAddress(addr net.Addr, sourceAddrs string) error { return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr) } -func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *connection, +func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, token []byte, s *connection, sessionID []byte, userAuthReq userAuthRequestMsg) (authErr error, perms *Permissions, err error) { gssAPIServer := gssapiConfig.Server defer gssAPIServer.DeleteSecContext() @@ -331,7 +347,7 @@ func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *c outToken []byte needContinue bool ) - outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(firstToken) + outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(token) if err != nil { return err, nil, nil } @@ -353,6 +369,7 @@ func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *c if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil { return nil, nil, err } + token = userAuthGSSAPITokenReq.Token } packet, err := s.transport.readPacket() if err != nil { @@ -524,7 +541,7 @@ userAuthLoop: return nil, parseError(msgUserAuthRequest) } algo := string(algoBytes) - if !contains(supportedPubKeyAuthAlgos, underlyingAlgo(algo)) { + if !contains(config.PublicKeyAuthAlgorithms, underlyingAlgo(algo)) { authErr = fmt.Errorf("ssh: algorithm %q not accepted", algo) break } @@ -591,7 +608,7 @@ userAuthLoop: // algorithm name that corresponds to algo with // sig.Format. This is usually the same, but // for certs, the names differ. - if !contains(supportedPubKeyAuthAlgos, sig.Format) { + if !contains(config.PublicKeyAuthAlgorithms, sig.Format) { authErr = fmt.Errorf("ssh: algorithm %q not accepted", sig.Format) break } diff --git a/vendor/golang.org/x/crypto/ssh/tcpip.go b/vendor/golang.org/x/crypto/ssh/tcpip.go index 80d35f5ec..ef5059a11 100644 --- a/vendor/golang.org/x/crypto/ssh/tcpip.go +++ b/vendor/golang.org/x/crypto/ssh/tcpip.go @@ -5,6 +5,7 @@ package ssh import ( + "context" "errors" "fmt" "io" @@ -332,6 +333,40 @@ func (l *tcpListener) Addr() net.Addr { return l.laddr } +// DialContext initiates a connection to the addr from the remote host. +// +// The provided Context must be non-nil. If the context expires before the +// connection is complete, an error is returned. Once successfully connected, +// any expiration of the context will not affect the connection. +// +// See func Dial for additional information. +func (c *Client) DialContext(ctx context.Context, n, addr string) (net.Conn, error) { + if err := ctx.Err(); err != nil { + return nil, err + } + type connErr struct { + conn net.Conn + err error + } + ch := make(chan connErr) + go func() { + conn, err := c.Dial(n, addr) + select { + case ch <- connErr{conn, err}: + case <-ctx.Done(): + if conn != nil { + conn.Close() + } + } + }() + select { + case res := <-ch: + return res.conn, res.err + case <-ctx.Done(): + return nil, ctx.Err() + } +} + // Dial initiates a connection to the addr from the remote host. // The resulting connection has a zero LocalAddr() and RemoteAddr(). func (c *Client) Dial(n, addr string) (net.Conn, error) { diff --git a/vendor/golang.org/x/net/context/go17.go b/vendor/golang.org/x/net/context/go17.go index 2cb9c408f..0c1b86793 100644 --- a/vendor/golang.org/x/net/context/go17.go +++ b/vendor/golang.org/x/net/context/go17.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.7 -// +build go1.7 package context diff --git a/vendor/golang.org/x/net/context/go19.go b/vendor/golang.org/x/net/context/go19.go index 64d31ecc3..e31e35a90 100644 --- a/vendor/golang.org/x/net/context/go19.go +++ b/vendor/golang.org/x/net/context/go19.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.9 -// +build go1.9 package context diff --git a/vendor/golang.org/x/net/context/pre_go17.go b/vendor/golang.org/x/net/context/pre_go17.go index 7b6b68511..065ff3dfa 100644 --- a/vendor/golang.org/x/net/context/pre_go17.go +++ b/vendor/golang.org/x/net/context/pre_go17.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.7 -// +build !go1.7 package context diff --git a/vendor/golang.org/x/net/context/pre_go19.go b/vendor/golang.org/x/net/context/pre_go19.go index 1f9715341..ec5a63803 100644 --- a/vendor/golang.org/x/net/context/pre_go19.go +++ b/vendor/golang.org/x/net/context/pre_go19.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.9 -// +build !go1.9 package context diff --git a/vendor/golang.org/x/net/http2/databuffer.go b/vendor/golang.org/x/net/http2/databuffer.go index a3067f8de..e6f55cbd1 100644 --- a/vendor/golang.org/x/net/http2/databuffer.go +++ b/vendor/golang.org/x/net/http2/databuffer.go @@ -20,41 +20,44 @@ import ( // TODO: Benchmark to determine if the pools are necessary. The GC may have // improved enough that we can instead allocate chunks like this: // make([]byte, max(16<<10, expectedBytesRemaining)) -var ( - dataChunkSizeClasses = []int{ - 1 << 10, - 2 << 10, - 4 << 10, - 8 << 10, - 16 << 10, - } - dataChunkPools = [...]sync.Pool{ - {New: func() interface{} { return make([]byte, 1<<10) }}, - {New: func() interface{} { return make([]byte, 2<<10) }}, - {New: func() interface{} { return make([]byte, 4<<10) }}, - {New: func() interface{} { return make([]byte, 8<<10) }}, - {New: func() interface{} { return make([]byte, 16<<10) }}, - } -) +var dataChunkPools = [...]sync.Pool{ + {New: func() interface{} { return new([1 << 10]byte) }}, + {New: func() interface{} { return new([2 << 10]byte) }}, + {New: func() interface{} { return new([4 << 10]byte) }}, + {New: func() interface{} { return new([8 << 10]byte) }}, + {New: func() interface{} { return new([16 << 10]byte) }}, +} func getDataBufferChunk(size int64) []byte { - i := 0 - for ; i < len(dataChunkSizeClasses)-1; i++ { - if size <= int64(dataChunkSizeClasses[i]) { - break - } + switch { + case size <= 1<<10: + return dataChunkPools[0].Get().(*[1 << 10]byte)[:] + case size <= 2<<10: + return dataChunkPools[1].Get().(*[2 << 10]byte)[:] + case size <= 4<<10: + return dataChunkPools[2].Get().(*[4 << 10]byte)[:] + case size <= 8<<10: + return dataChunkPools[3].Get().(*[8 << 10]byte)[:] + default: + return dataChunkPools[4].Get().(*[16 << 10]byte)[:] } - return dataChunkPools[i].Get().([]byte) } func putDataBufferChunk(p []byte) { - for i, n := range dataChunkSizeClasses { - if len(p) == n { - dataChunkPools[i].Put(p) - return - } + switch len(p) { + case 1 << 10: + dataChunkPools[0].Put((*[1 << 10]byte)(p)) + case 2 << 10: + dataChunkPools[1].Put((*[2 << 10]byte)(p)) + case 4 << 10: + dataChunkPools[2].Put((*[4 << 10]byte)(p)) + case 8 << 10: + dataChunkPools[3].Put((*[8 << 10]byte)(p)) + case 16 << 10: + dataChunkPools[4].Put((*[16 << 10]byte)(p)) + default: + panic(fmt.Sprintf("unexpected buffer len=%v", len(p))) } - panic(fmt.Sprintf("unexpected buffer len=%v", len(p))) } // dataBuffer is an io.ReadWriter backed by a list of data chunks. diff --git a/vendor/golang.org/x/net/http2/go111.go b/vendor/golang.org/x/net/http2/go111.go deleted file mode 100644 index 5bf62b032..000000000 --- a/vendor/golang.org/x/net/http2/go111.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.11 -// +build go1.11 - -package http2 - -import ( - "net/http/httptrace" - "net/textproto" -) - -func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { - return trace != nil && trace.WroteHeaderField != nil -} - -func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) { - if trace != nil && trace.WroteHeaderField != nil { - trace.WroteHeaderField(k, []string{v}) - } -} - -func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { - if trace != nil { - return trace.Got1xxResponse - } - return nil -} diff --git a/vendor/golang.org/x/net/http2/go115.go b/vendor/golang.org/x/net/http2/go115.go deleted file mode 100644 index 908af1ab9..000000000 --- a/vendor/golang.org/x/net/http2/go115.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.15 -// +build go1.15 - -package http2 - -import ( - "context" - "crypto/tls" -) - -// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS -// connection. -func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { - dialer := &tls.Dialer{ - Config: cfg, - } - cn, err := dialer.DialContext(ctx, network, addr) - if err != nil { - return nil, err - } - tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed - return tlsCn, nil -} diff --git a/vendor/golang.org/x/net/http2/go118.go b/vendor/golang.org/x/net/http2/go118.go deleted file mode 100644 index aca4b2b31..000000000 --- a/vendor/golang.org/x/net/http2/go118.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.18 -// +build go1.18 - -package http2 - -import ( - "crypto/tls" - "net" -) - -func tlsUnderlyingConn(tc *tls.Conn) net.Conn { - return tc.NetConn() -} diff --git a/vendor/golang.org/x/net/http2/not_go111.go b/vendor/golang.org/x/net/http2/not_go111.go deleted file mode 100644 index cc0baa819..000000000 --- a/vendor/golang.org/x/net/http2/not_go111.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.11 -// +build !go1.11 - -package http2 - -import ( - "net/http/httptrace" - "net/textproto" -) - -func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { return false } - -func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {} - -func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { - return nil -} diff --git a/vendor/golang.org/x/net/http2/not_go115.go b/vendor/golang.org/x/net/http2/not_go115.go deleted file mode 100644 index e6c04cf7a..000000000 --- a/vendor/golang.org/x/net/http2/not_go115.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.15 -// +build !go1.15 - -package http2 - -import ( - "context" - "crypto/tls" -) - -// dialTLSWithContext opens a TLS connection. -func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { - cn, err := tls.Dial(network, addr, cfg) - if err != nil { - return nil, err - } - if err := cn.Handshake(); err != nil { - return nil, err - } - if cfg.InsecureSkipVerify { - return cn, nil - } - if err := cn.VerifyHostname(cfg.ServerName); err != nil { - return nil, err - } - return cn, nil -} diff --git a/vendor/golang.org/x/net/http2/not_go118.go b/vendor/golang.org/x/net/http2/not_go118.go deleted file mode 100644 index eab532c96..000000000 --- a/vendor/golang.org/x/net/http2/not_go118.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.18 -// +build !go1.18 - -package http2 - -import ( - "crypto/tls" - "net" -) - -func tlsUnderlyingConn(tc *tls.Conn) net.Conn { - return nil -} diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index 02c88b6b3..ae94c6408 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -2549,7 +2549,6 @@ type responseWriterState struct { wroteHeader bool // WriteHeader called (explicitly or implicitly). Not necessarily sent to user yet. sentHeader bool // have we sent the header frame? handlerDone bool // handler has finished - dirty bool // a Write failed; don't reuse this responseWriterState sentContentLen int64 // non-zero if handler set a Content-Length header wroteBytes int64 @@ -2669,7 +2668,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { date: date, }) if err != nil { - rws.dirty = true return 0, err } if endStream { @@ -2690,7 +2688,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { if len(p) > 0 || endStream { // only send a 0 byte DATA frame if we're ending the stream. if err := rws.conn.writeDataFromHandler(rws.stream, p, endStream); err != nil { - rws.dirty = true return 0, err } } @@ -2702,9 +2699,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { trailers: rws.trailers, endStream: true, }) - if err != nil { - rws.dirty = true - } return len(p), err } return len(p), nil @@ -2920,14 +2914,12 @@ func (rws *responseWriterState) writeHeader(code int) { h.Del("Transfer-Encoding") } - if rws.conn.writeHeaders(rws.stream, &writeResHeaders{ + rws.conn.writeHeaders(rws.stream, &writeResHeaders{ streamID: rws.stream.id, httpResCode: code, h: h, endStream: rws.handlerDone && !rws.hasTrailers(), - }) != nil { - rws.dirty = true - } + }) return } @@ -2992,19 +2984,10 @@ func (w *responseWriter) write(lenData int, dataB []byte, dataS string) (n int, func (w *responseWriter) handlerDone() { rws := w.rws - dirty := rws.dirty rws.handlerDone = true w.Flush() w.rws = nil - if !dirty { - // Only recycle the pool if all prior Write calls to - // the serverConn goroutine completed successfully. If - // they returned earlier due to resets from the peer - // there might still be write goroutines outstanding - // from the serverConn referencing the rws memory. See - // issue 20704. - responseWriterStatePool.Put(rws) - } + responseWriterStatePool.Put(rws) } // Push errors. @@ -3187,6 +3170,7 @@ func (sc *serverConn) startPush(msg *startPushRequest) { panic(fmt.Sprintf("newWriterAndRequestNoBody(%+v): %v", msg.url, err)) } + sc.curHandlers++ go sc.runHandler(rw, req, sc.handler.ServeHTTP) return promisedID, nil } diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 4515b22c4..df578b86c 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -1018,7 +1018,7 @@ func (cc *ClientConn) forceCloseConn() { if !ok { return } - if nc := tlsUnderlyingConn(tc); nc != nil { + if nc := tc.NetConn(); nc != nil { nc.Close() } } @@ -3201,3 +3201,34 @@ func traceFirstResponseByte(trace *httptrace.ClientTrace) { trace.GotFirstResponseByte() } } + +func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { + return trace != nil && trace.WroteHeaderField != nil +} + +func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) { + if trace != nil && trace.WroteHeaderField != nil { + trace.WroteHeaderField(k, []string{v}) + } +} + +func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { + if trace != nil { + return trace.Got1xxResponse + } + return nil +} + +// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS +// connection. +func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { + dialer := &tls.Dialer{ + Config: cfg, + } + cn, err := dialer.DialContext(ctx, network, addr) + if err != nil { + return nil, err + } + tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed + return tlsCn, nil +} diff --git a/vendor/golang.org/x/net/idna/go118.go b/vendor/golang.org/x/net/idna/go118.go index c5c4338db..712f1ad83 100644 --- a/vendor/golang.org/x/net/idna/go118.go +++ b/vendor/golang.org/x/net/idna/go118.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build go1.18 -// +build go1.18 package idna diff --git a/vendor/golang.org/x/net/idna/idna10.0.0.go b/vendor/golang.org/x/net/idna/idna10.0.0.go index 64ccf85fe..7b3717884 100644 --- a/vendor/golang.org/x/net/idna/idna10.0.0.go +++ b/vendor/golang.org/x/net/idna/idna10.0.0.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build go1.10 -// +build go1.10 // Package idna implements IDNA2008 using the compatibility processing // defined by UTS (Unicode Technical Standard) #46, which defines a standard to diff --git a/vendor/golang.org/x/net/idna/idna9.0.0.go b/vendor/golang.org/x/net/idna/idna9.0.0.go index ee1698cef..cc6a892a4 100644 --- a/vendor/golang.org/x/net/idna/idna9.0.0.go +++ b/vendor/golang.org/x/net/idna/idna9.0.0.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build !go1.10 -// +build !go1.10 // Package idna implements IDNA2008 using the compatibility processing // defined by UTS (Unicode Technical Standard) #46, which defines a standard to diff --git a/vendor/golang.org/x/net/idna/pre_go118.go b/vendor/golang.org/x/net/idna/pre_go118.go index 3aaccab1c..40e74bb3d 100644 --- a/vendor/golang.org/x/net/idna/pre_go118.go +++ b/vendor/golang.org/x/net/idna/pre_go118.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build !go1.18 -// +build !go1.18 package idna diff --git a/vendor/golang.org/x/net/idna/tables10.0.0.go b/vendor/golang.org/x/net/idna/tables10.0.0.go index d1d62ef45..c6c2bf10a 100644 --- a/vendor/golang.org/x/net/idna/tables10.0.0.go +++ b/vendor/golang.org/x/net/idna/tables10.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.10 && !go1.13 -// +build go1.10,!go1.13 package idna diff --git a/vendor/golang.org/x/net/idna/tables11.0.0.go b/vendor/golang.org/x/net/idna/tables11.0.0.go index 167efba71..76789393c 100644 --- a/vendor/golang.org/x/net/idna/tables11.0.0.go +++ b/vendor/golang.org/x/net/idna/tables11.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.13 && !go1.14 -// +build go1.13,!go1.14 package idna diff --git a/vendor/golang.org/x/net/idna/tables12.0.0.go b/vendor/golang.org/x/net/idna/tables12.0.0.go index ab40f7bcc..0600cd2ae 100644 --- a/vendor/golang.org/x/net/idna/tables12.0.0.go +++ b/vendor/golang.org/x/net/idna/tables12.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.14 && !go1.16 -// +build go1.14,!go1.16 package idna diff --git a/vendor/golang.org/x/net/idna/tables13.0.0.go b/vendor/golang.org/x/net/idna/tables13.0.0.go index 66701eadf..2fb768ef6 100644 --- a/vendor/golang.org/x/net/idna/tables13.0.0.go +++ b/vendor/golang.org/x/net/idna/tables13.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.16 && !go1.21 -// +build go1.16,!go1.21 package idna diff --git a/vendor/golang.org/x/net/idna/tables15.0.0.go b/vendor/golang.org/x/net/idna/tables15.0.0.go index 40033778f..5ff05fe1a 100644 --- a/vendor/golang.org/x/net/idna/tables15.0.0.go +++ b/vendor/golang.org/x/net/idna/tables15.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.21 -// +build go1.21 package idna diff --git a/vendor/golang.org/x/net/idna/tables9.0.0.go b/vendor/golang.org/x/net/idna/tables9.0.0.go index 4074b5332..0f25e84ca 100644 --- a/vendor/golang.org/x/net/idna/tables9.0.0.go +++ b/vendor/golang.org/x/net/idna/tables9.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build !go1.10 -// +build !go1.10 package idna diff --git a/vendor/golang.org/x/net/idna/trie12.0.0.go b/vendor/golang.org/x/net/idna/trie12.0.0.go index bb63f904b..8a75b9667 100644 --- a/vendor/golang.org/x/net/idna/trie12.0.0.go +++ b/vendor/golang.org/x/net/idna/trie12.0.0.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build !go1.16 -// +build !go1.16 package idna diff --git a/vendor/golang.org/x/net/idna/trie13.0.0.go b/vendor/golang.org/x/net/idna/trie13.0.0.go index 7d68a8dc1..fa45bb907 100644 --- a/vendor/golang.org/x/net/idna/trie13.0.0.go +++ b/vendor/golang.org/x/net/idna/trie13.0.0.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build go1.16 -// +build go1.16 package idna diff --git a/vendor/golang.org/x/oauth2/internal/client_appengine.go b/vendor/golang.org/x/oauth2/internal/client_appengine.go index e1755d1d9..d28140f78 100644 --- a/vendor/golang.org/x/oauth2/internal/client_appengine.go +++ b/vendor/golang.org/x/oauth2/internal/client_appengine.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build appengine -// +build appengine package internal diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go new file mode 100644 index 000000000..b18efb743 --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -0,0 +1,132 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package errgroup provides synchronization, error propagation, and Context +// cancelation for groups of goroutines working on subtasks of a common task. +package errgroup + +import ( + "context" + "fmt" + "sync" +) + +type token struct{} + +// A Group is a collection of goroutines working on subtasks that are part of +// the same overall task. +// +// A zero Group is valid, has no limit on the number of active goroutines, +// and does not cancel on error. +type Group struct { + cancel func(error) + + wg sync.WaitGroup + + sem chan token + + errOnce sync.Once + err error +} + +func (g *Group) done() { + if g.sem != nil { + <-g.sem + } + g.wg.Done() +} + +// WithContext returns a new Group and an associated Context derived from ctx. +// +// The derived Context is canceled the first time a function passed to Go +// returns a non-nil error or the first time Wait returns, whichever occurs +// first. +func WithContext(ctx context.Context) (*Group, context.Context) { + ctx, cancel := withCancelCause(ctx) + return &Group{cancel: cancel}, ctx +} + +// Wait blocks until all function calls from the Go method have returned, then +// returns the first non-nil error (if any) from them. +func (g *Group) Wait() error { + g.wg.Wait() + if g.cancel != nil { + g.cancel(g.err) + } + return g.err +} + +// Go calls the given function in a new goroutine. +// It blocks until the new goroutine can be added without the number of +// active goroutines in the group exceeding the configured limit. +// +// The first call to return a non-nil error cancels the group's context, if the +// group was created by calling WithContext. The error will be returned by Wait. +func (g *Group) Go(f func() error) { + if g.sem != nil { + g.sem <- token{} + } + + g.wg.Add(1) + go func() { + defer g.done() + + if err := f(); err != nil { + g.errOnce.Do(func() { + g.err = err + if g.cancel != nil { + g.cancel(g.err) + } + }) + } + }() +} + +// TryGo calls the given function in a new goroutine only if the number of +// active goroutines in the group is currently below the configured limit. +// +// The return value reports whether the goroutine was started. +func (g *Group) TryGo(f func() error) bool { + if g.sem != nil { + select { + case g.sem <- token{}: + // Note: this allows barging iff channels in general allow barging. + default: + return false + } + } + + g.wg.Add(1) + go func() { + defer g.done() + + if err := f(); err != nil { + g.errOnce.Do(func() { + g.err = err + if g.cancel != nil { + g.cancel(g.err) + } + }) + } + }() + return true +} + +// SetLimit limits the number of active goroutines in this group to at most n. +// A negative value indicates no limit. +// +// Any subsequent call to the Go method will block until it can add an active +// goroutine without exceeding the configured limit. +// +// The limit must not be modified while any goroutines in the group are active. +func (g *Group) SetLimit(n int) { + if n < 0 { + g.sem = nil + return + } + if len(g.sem) != 0 { + panic(fmt.Errorf("errgroup: modify limit while %v goroutines in the group are still active", len(g.sem))) + } + g.sem = make(chan token, n) +} diff --git a/vendor/golang.org/x/sync/errgroup/go120.go b/vendor/golang.org/x/sync/errgroup/go120.go new file mode 100644 index 000000000..f93c740b6 --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/go120.go @@ -0,0 +1,13 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.20 + +package errgroup + +import "context" + +func withCancelCause(parent context.Context) (context.Context, func(error)) { + return context.WithCancelCause(parent) +} diff --git a/vendor/golang.org/x/sync/errgroup/pre_go120.go b/vendor/golang.org/x/sync/errgroup/pre_go120.go new file mode 100644 index 000000000..88ce33434 --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/pre_go120.go @@ -0,0 +1,14 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.20 + +package errgroup + +import "context" + +func withCancelCause(parent context.Context) (context.Context, func(error)) { + ctx, cancel := context.WithCancel(parent) + return ctx, func(error) { cancel() } +} diff --git a/vendor/golang.org/x/sync/singleflight/singleflight.go b/vendor/golang.org/x/sync/singleflight/singleflight.go index 8473fb792..405183098 100644 --- a/vendor/golang.org/x/sync/singleflight/singleflight.go +++ b/vendor/golang.org/x/sync/singleflight/singleflight.go @@ -31,6 +31,15 @@ func (p *panicError) Error() string { return fmt.Sprintf("%v\n\n%s", p.value, p.stack) } +func (p *panicError) Unwrap() error { + err, ok := p.value.(error) + if !ok { + return nil + } + + return err +} + func newPanicError(v interface{}) error { stack := debug.Stack() diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s index db9171c2e..269e173ca 100644 --- a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s +++ b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/cpu/cpu_aix.go b/vendor/golang.org/x/sys/cpu/cpu_aix.go index 8aaeef545..9bf0c32eb 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_aix.go +++ b/vendor/golang.org/x/sys/cpu/cpu_aix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix -// +build aix package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_arm64.s index c61f95a05..fcb9a3888 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.s +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go index ccf542a73..a8acd3e32 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go index 0af2f2484..c8ae6ddc1 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go index fa7cdb9bc..910728fb1 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gc -// +build 386 amd64 amd64p32 -// +build gc package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go index 2aff31891..7f1946780 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo -// +build gccgo package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go index 4bfbda619..9526d2ce3 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo -// +build gccgo package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c index 6cc73109f..3f73a05dc 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gccgo -// +build 386 amd64 amd64p32 -// +build gccgo #include #include diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go index 863d415ab..99c60fe9f 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gccgo -// +build 386 amd64 amd64p32 -// +build gccgo package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux.go b/vendor/golang.org/x/sys/cpu/cpu_linux.go index 159a686f6..743eb5435 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !386 && !amd64 && !amd64p32 && !arm64 -// +build !386,!amd64,!amd64p32,!arm64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go index 6000db4cd..4686c1d54 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) -// +build linux -// +build mips64 mips64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go index f4992b1a5..cd63e7335 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x -// +build linux,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le,!s390x package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go index 021356d6d..197188e67 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) -// +build linux -// +build ppc64 ppc64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_loong64.go b/vendor/golang.org/x/sys/cpu/cpu_loong64.go index 0f57b05bd..558635850 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_loong64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_loong64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build loong64 -// +build loong64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go index f4063c664..fedb00cc4 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build mips64 || mips64le -// +build mips64 mips64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go index 07c4e36d8..ffb4ec7eb 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go +++ b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build mips || mipsle -// +build mips mipsle package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm.go index d7b4fb4cc..e9ecf2a45 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && arm -// +build !linux,arm package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go index f3cde129b..5341e7f88 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && !netbsd && !openbsd && arm64 -// +build !linux,!netbsd,!openbsd,arm64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go index 0dafe9644..5f8f2419a 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && (mips64 || mips64le) -// +build !linux -// +build mips64 mips64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go index 060d46b6e..89608fba2 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !linux && (ppc64 || ppc64le) -// +build !aix -// +build !linux -// +build ppc64 ppc64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go index dd10eb79f..5ab87808f 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && riscv64 -// +build !linux,riscv64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go index 4e8acd165..c14f12b14 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build ppc64 || ppc64le -// +build ppc64 ppc64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go index ff7da60eb..7f0c79c00 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 -// +build riscv64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_s390x.s b/vendor/golang.org/x/sys/cpu/cpu_s390x.s index 96f81e209..1fb4b7013 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_s390x.s +++ b/vendor/golang.org/x/sys/cpu/cpu_s390x.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/cpu/cpu_wasm.go b/vendor/golang.org/x/sys/cpu/cpu_wasm.go index 7747d888a..384787ea3 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_wasm.go +++ b/vendor/golang.org/x/sys/cpu/cpu_wasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build wasm -// +build wasm package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go index 2dcde8285..c29f5e4c5 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 || amd64 || amd64p32 -// +build 386 amd64 amd64p32 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.s b/vendor/golang.org/x/sys/cpu/cpu_x86.s index 39acab2ff..7d7ba33ef 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.s +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gc -// +build 386 amd64 amd64p32 -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/cpu/endian_big.go b/vendor/golang.org/x/sys/cpu/endian_big.go index 93ce03a34..7fe04b0a1 100644 --- a/vendor/golang.org/x/sys/cpu/endian_big.go +++ b/vendor/golang.org/x/sys/cpu/endian_big.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 -// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/endian_little.go b/vendor/golang.org/x/sys/cpu/endian_little.go index 55db853ef..48eccc4c7 100644 --- a/vendor/golang.org/x/sys/cpu/endian_little.go +++ b/vendor/golang.org/x/sys/cpu/endian_little.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh || wasm -// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh wasm package cpu diff --git a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go index d87bd6b3e..4cd64c704 100644 --- a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go +++ b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && arm64 -// +build linux,arm64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go b/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go index b975ea2a0..4c9788ea8 100644 --- a/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go +++ b/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.21 -// +build go1.21 package cpu diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go b/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go index 96134157a..1b9ccb091 100644 --- a/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go +++ b/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go @@ -9,7 +9,6 @@ // gccgo's libgo and thus must not used a CGo method. //go:build aix && gccgo -// +build aix,gccgo package cpu diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go index 904be42ff..e8b6cdbe9 100644 --- a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go +++ b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go @@ -7,7 +7,6 @@ // (See golang.org/issue/32102) //go:build aix && ppc64 && gc -// +build aix,ppc64,gc package cpu diff --git a/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go b/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go index c9b69937a..73687de74 100644 --- a/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go +++ b/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.5 -// +build go1.5 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/pwd_plan9.go b/vendor/golang.org/x/sys/plan9/pwd_plan9.go index 98bf56b73..fb9458218 100644 --- a/vendor/golang.org/x/sys/plan9/pwd_plan9.go +++ b/vendor/golang.org/x/sys/plan9/pwd_plan9.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.5 -// +build !go1.5 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/race.go b/vendor/golang.org/x/sys/plan9/race.go index 62377d2ff..c02d9ed33 100644 --- a/vendor/golang.org/x/sys/plan9/race.go +++ b/vendor/golang.org/x/sys/plan9/race.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build plan9 && race -// +build plan9,race package plan9 diff --git a/vendor/golang.org/x/sys/plan9/race0.go b/vendor/golang.org/x/sys/plan9/race0.go index f8da30876..7b15e15f6 100644 --- a/vendor/golang.org/x/sys/plan9/race0.go +++ b/vendor/golang.org/x/sys/plan9/race0.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build plan9 && !race -// +build plan9,!race package plan9 diff --git a/vendor/golang.org/x/sys/plan9/str.go b/vendor/golang.org/x/sys/plan9/str.go index 55fa8d025..ba3e8ff8a 100644 --- a/vendor/golang.org/x/sys/plan9/str.go +++ b/vendor/golang.org/x/sys/plan9/str.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build plan9 -// +build plan9 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/syscall.go b/vendor/golang.org/x/sys/plan9/syscall.go index 67e5b0115..d631fd664 100644 --- a/vendor/golang.org/x/sys/plan9/syscall.go +++ b/vendor/golang.org/x/sys/plan9/syscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build plan9 -// +build plan9 // Package plan9 contains an interface to the low-level operating system // primitives. OS details vary depending on the underlying system, and diff --git a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go index 3f40b9bd7..f780d5c80 100644 --- a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go +++ b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build plan9 && 386 -// +build plan9,386 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go index 0e6a96aa4..7de61065f 100644 --- a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go +++ b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build plan9 && amd64 -// +build plan9,amd64 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go index 244c501b7..ea85780f0 100644 --- a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go +++ b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build plan9 && arm -// +build plan9,arm package plan9 diff --git a/vendor/golang.org/x/sys/unix/aliases.go b/vendor/golang.org/x/sys/unix/aliases.go index abc89c104..e7d3df4bd 100644 --- a/vendor/golang.org/x/sys/unix/aliases.go +++ b/vendor/golang.org/x/sys/unix/aliases.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9 -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos -// +build go1.9 package unix diff --git a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s index db9171c2e..269e173ca 100644 --- a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s +++ b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_386.s b/vendor/golang.org/x/sys/unix/asm_bsd_386.s index e0fcd9b3d..a4fcef0e0 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_386.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_386.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (freebsd || netbsd || openbsd) && gc -// +build freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s index 2b99c349a..1e63615c5 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc -// +build darwin dragonfly freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_arm.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s index d702d4adc..6496c3100 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (freebsd || netbsd || openbsd) && gc -// +build freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s index fe36a7391..4fd1f54da 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s b/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s index e5b9a8489..42f7eb9e4 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s b/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s index d560019ea..f8902667e 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s index 8fd101d07..3b4734870 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_386.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_386.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s index 7ed38e43c..67e29f317 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s index 8ef1d5140..d6ae269ce 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_arm.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s index 98ae02760..01e5e253c 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && arm64 && gc -// +build linux -// +build arm64 -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_loong64.s b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s index 565357288..2abf12f6e 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_loong64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && loong64 && gc -// +build linux -// +build loong64 -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s index 21231d2ce..f84bae712 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) && gc -// +build linux -// +build mips64 mips64le -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s index 6783b26c6..f08f62807 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips || mipsle) && gc -// +build linux -// +build mips mipsle -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s index 19d498934..bdfc024d2 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) && gc -// +build linux -// +build ppc64 ppc64le -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s index e42eb81d5..2e8c99612 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && gc -// +build riscv64 -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s index c46aab339..2c394b11e 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && s390x && gc -// +build linux -// +build s390x -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s index 5e7a1169c..fab586a2c 100644 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s index f8c5394c1..f949ec547 100644 --- a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s index 3b54e1858..2f67ba86d 100644 --- a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s +++ b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x && gc -// +build zos -// +build s390x -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/cap_freebsd.go b/vendor/golang.org/x/sys/unix/cap_freebsd.go index 0b7c6adb8..a08657890 100644 --- a/vendor/golang.org/x/sys/unix/cap_freebsd.go +++ b/vendor/golang.org/x/sys/unix/cap_freebsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build freebsd -// +build freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go index 394a3965b..6fb7cb77d 100644 --- a/vendor/golang.org/x/sys/unix/constants.go +++ b/vendor/golang.org/x/sys/unix/constants.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go index 65a998508..d78513461 100644 --- a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc -// +build aix,ppc // Functions to access/create device major and minor numbers matching the // encoding used by AIX. diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go index 8fc08ad0a..623a5e697 100644 --- a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc64 -// +build aix,ppc64 // Functions to access/create device major and minor numbers matching the // encoding used AIX. diff --git a/vendor/golang.org/x/sys/unix/dev_zos.go b/vendor/golang.org/x/sys/unix/dev_zos.go index a388e59a0..bb6a64fe9 100644 --- a/vendor/golang.org/x/sys/unix/dev_zos.go +++ b/vendor/golang.org/x/sys/unix/dev_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x // Functions to access/create device major and minor numbers matching the // encoding used by z/OS. diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go index 2499f977b..1ebf11782 100644 --- a/vendor/golang.org/x/sys/unix/dirent.go +++ b/vendor/golang.org/x/sys/unix/dirent.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/endian_big.go b/vendor/golang.org/x/sys/unix/endian_big.go index a52026557..1095fd31d 100644 --- a/vendor/golang.org/x/sys/unix/endian_big.go +++ b/vendor/golang.org/x/sys/unix/endian_big.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 -// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 package unix diff --git a/vendor/golang.org/x/sys/unix/endian_little.go b/vendor/golang.org/x/sys/unix/endian_little.go index b0f2bc4ae..b9f0e277b 100644 --- a/vendor/golang.org/x/sys/unix/endian_little.go +++ b/vendor/golang.org/x/sys/unix/endian_little.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // //go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh -// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh package unix diff --git a/vendor/golang.org/x/sys/unix/env_unix.go b/vendor/golang.org/x/sys/unix/env_unix.go index 29ccc4d13..a96da71f4 100644 --- a/vendor/golang.org/x/sys/unix/env_unix.go +++ b/vendor/golang.org/x/sys/unix/env_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Unix environment variables. diff --git a/vendor/golang.org/x/sys/unix/epoll_zos.go b/vendor/golang.org/x/sys/unix/epoll_zos.go index cedaf7e02..7753fddea 100644 --- a/vendor/golang.org/x/sys/unix/epoll_zos.go +++ b/vendor/golang.org/x/sys/unix/epoll_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/fcntl.go b/vendor/golang.org/x/sys/unix/fcntl.go index e9b991258..6200876fb 100644 --- a/vendor/golang.org/x/sys/unix/fcntl.go +++ b/vendor/golang.org/x/sys/unix/fcntl.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build dragonfly || freebsd || linux || netbsd || openbsd -// +build dragonfly freebsd linux netbsd openbsd +//go:build dragonfly || freebsd || linux || netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go index 29d44808b..13b4acd5c 100644 --- a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go +++ b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc) -// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/fdset.go b/vendor/golang.org/x/sys/unix/fdset.go index a8068f94f..9e83d18cd 100644 --- a/vendor/golang.org/x/sys/unix/fdset.go +++ b/vendor/golang.org/x/sys/unix/fdset.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/fstatfs_zos.go b/vendor/golang.org/x/sys/unix/fstatfs_zos.go index e377cc9f4..c8bde601e 100644 --- a/vendor/golang.org/x/sys/unix/fstatfs_zos.go +++ b/vendor/golang.org/x/sys/unix/fstatfs_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go index b06f52d74..aca5721dd 100644 --- a/vendor/golang.org/x/sys/unix/gccgo.go +++ b/vendor/golang.org/x/sys/unix/gccgo.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo && !aix && !hurd -// +build gccgo,!aix,!hurd package unix diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c index f98a1c542..d468b7b47 100644 --- a/vendor/golang.org/x/sys/unix/gccgo_c.c +++ b/vendor/golang.org/x/sys/unix/gccgo_c.c @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo && !aix && !hurd -// +build gccgo,!aix,!hurd #include #include diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go index e60e49a3d..972d61bd7 100644 --- a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo && linux && amd64 -// +build gccgo,linux,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/ifreq_linux.go b/vendor/golang.org/x/sys/unix/ifreq_linux.go index 15721a510..848840ae4 100644 --- a/vendor/golang.org/x/sys/unix/ifreq_linux.go +++ b/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux -// +build linux package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_linux.go b/vendor/golang.org/x/sys/unix/ioctl_linux.go index 0d12c0851..dbe680eab 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_linux.go +++ b/vendor/golang.org/x/sys/unix/ioctl_linux.go @@ -231,3 +231,8 @@ func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) { func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error { return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value)) } + +// IoctlLoopConfigure configures all loop device parameters in a single step +func IoctlLoopConfigure(fd int, value *LoopConfig) error { + return ioctlPtr(fd, LOOP_CONFIGURE, unsafe.Pointer(value)) +} diff --git a/vendor/golang.org/x/sys/unix/ioctl_signed.go b/vendor/golang.org/x/sys/unix/ioctl_signed.go index 7def9580e..5b0759bd8 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_signed.go +++ b/vendor/golang.org/x/sys/unix/ioctl_signed.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || solaris -// +build aix solaris package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_unsigned.go b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go index 649913d1e..20f470b9d 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_unsigned.go +++ b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd -// +build darwin dragonfly freebsd hurd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_zos.go b/vendor/golang.org/x/sys/unix/ioctl_zos.go index cdc21bf76..c8b2a750f 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_zos.go +++ b/vendor/golang.org/x/sys/unix/ioctl_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 47fa6a7eb..6202638ba 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -519,6 +519,7 @@ ccflags="$@" $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LO_(KEY|NAME)_SIZE$/ || $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || + $2 == "LOOP_CONFIGURE" || $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ || $2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ || $2 ~ /^NFC_.*_(MAX)?SIZE$/ || @@ -560,7 +561,7 @@ ccflags="$@" $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ || $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ || $2 ~ /^CLONE_[A-Z_]+/ || - $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ && + $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+|BPF_F_LINK)$/ && $2 ~ /^(BPF|DLT)_/ || $2 ~ /^AUDIT_/ || $2 ~ /^(CLOCK|TIMER)_/ || @@ -663,7 +664,6 @@ echo '// mkerrors.sh' "$@" echo '// Code generated by the command above; see README.md. DO NOT EDIT.' echo echo "//go:build ${GOARCH} && ${GOOS}" -echo "// +build ${GOARCH},${GOOS}" echo go tool cgo -godefs -- "$@" _const.go >_error.out cat _error.out | grep -vf _error.grep | grep -vf _signal.grep diff --git a/vendor/golang.org/x/sys/unix/mmap_nomremap.go b/vendor/golang.org/x/sys/unix/mmap_nomremap.go index ca0513632..4b68e5978 100644 --- a/vendor/golang.org/x/sys/unix/mmap_nomremap.go +++ b/vendor/golang.org/x/sys/unix/mmap_nomremap.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || openbsd || solaris -// +build aix darwin dragonfly freebsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/mremap.go b/vendor/golang.org/x/sys/unix/mremap.go index fa93d0aa9..fd45fe529 100644 --- a/vendor/golang.org/x/sys/unix/mremap.go +++ b/vendor/golang.org/x/sys/unix/mremap.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux || netbsd -// +build linux netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/pagesize_unix.go b/vendor/golang.org/x/sys/unix/pagesize_unix.go index 53f1b4c5b..4d0a3430e 100644 --- a/vendor/golang.org/x/sys/unix/pagesize_unix.go +++ b/vendor/golang.org/x/sys/unix/pagesize_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris // For Unix, get the pagesize from the runtime. diff --git a/vendor/golang.org/x/sys/unix/pledge_openbsd.go b/vendor/golang.org/x/sys/unix/pledge_openbsd.go index eb48294b2..6a09af53e 100644 --- a/vendor/golang.org/x/sys/unix/pledge_openbsd.go +++ b/vendor/golang.org/x/sys/unix/pledge_openbsd.go @@ -8,54 +8,31 @@ import ( "errors" "fmt" "strconv" - "syscall" - "unsafe" ) // Pledge implements the pledge syscall. // -// The pledge syscall does not accept execpromises on OpenBSD releases -// before 6.3. -// -// execpromises must be empty when Pledge is called on OpenBSD -// releases predating 6.3, otherwise an error will be returned. +// This changes both the promises and execpromises; use PledgePromises or +// PledgeExecpromises to only change the promises or execpromises +// respectively. // // For more information see pledge(2). func Pledge(promises, execpromises string) error { - maj, min, err := majmin() - if err != nil { + if err := pledgeAvailable(); err != nil { return err } - err = pledgeAvailable(maj, min, execpromises) + pptr, err := BytePtrFromString(promises) if err != nil { return err } - pptr, err := syscall.BytePtrFromString(promises) + exptr, err := BytePtrFromString(execpromises) if err != nil { return err } - // This variable will hold either a nil unsafe.Pointer or - // an unsafe.Pointer to a string (execpromises). - var expr unsafe.Pointer - - // If we're running on OpenBSD > 6.2, pass execpromises to the syscall. - if maj > 6 || (maj == 6 && min > 2) { - exptr, err := syscall.BytePtrFromString(execpromises) - if err != nil { - return err - } - expr = unsafe.Pointer(exptr) - } - - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0) - if e != 0 { - return e - } - - return nil + return pledge(pptr, exptr) } // PledgePromises implements the pledge syscall. @@ -64,30 +41,16 @@ func Pledge(promises, execpromises string) error { // // For more information see pledge(2). func PledgePromises(promises string) error { - maj, min, err := majmin() - if err != nil { - return err - } - - err = pledgeAvailable(maj, min, "") - if err != nil { + if err := pledgeAvailable(); err != nil { return err } - // This variable holds the execpromises and is always nil. - var expr unsafe.Pointer - - pptr, err := syscall.BytePtrFromString(promises) + pptr, err := BytePtrFromString(promises) if err != nil { return err } - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0) - if e != 0 { - return e - } - - return nil + return pledge(pptr, nil) } // PledgeExecpromises implements the pledge syscall. @@ -96,30 +59,16 @@ func PledgePromises(promises string) error { // // For more information see pledge(2). func PledgeExecpromises(execpromises string) error { - maj, min, err := majmin() - if err != nil { + if err := pledgeAvailable(); err != nil { return err } - err = pledgeAvailable(maj, min, execpromises) + exptr, err := BytePtrFromString(execpromises) if err != nil { return err } - // This variable holds the promises and is always nil. - var pptr unsafe.Pointer - - exptr, err := syscall.BytePtrFromString(execpromises) - if err != nil { - return err - } - - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(pptr), uintptr(unsafe.Pointer(exptr)), 0) - if e != 0 { - return e - } - - return nil + return pledge(nil, exptr) } // majmin returns major and minor version number for an OpenBSD system. @@ -147,16 +96,15 @@ func majmin() (major int, minor int, err error) { // pledgeAvailable checks for availability of the pledge(2) syscall // based on the running OpenBSD version. -func pledgeAvailable(maj, min int, execpromises string) error { - // If OpenBSD <= 5.9, pledge is not available. - if (maj == 5 && min != 9) || maj < 5 { - return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min) +func pledgeAvailable() error { + maj, min, err := majmin() + if err != nil { + return err } - // If OpenBSD <= 6.2 and execpromises is not empty, - // return an error - execpromises is not available before 6.3 - if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" { - return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min) + // Require OpenBSD 6.4 as a minimum. + if maj < 6 || (maj == 6 && min <= 3) { + return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj, min) } return nil diff --git a/vendor/golang.org/x/sys/unix/ptrace_darwin.go b/vendor/golang.org/x/sys/unix/ptrace_darwin.go index 463c3eff7..3f0975f3d 100644 --- a/vendor/golang.org/x/sys/unix/ptrace_darwin.go +++ b/vendor/golang.org/x/sys/unix/ptrace_darwin.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin && !ios -// +build darwin,!ios package unix diff --git a/vendor/golang.org/x/sys/unix/ptrace_ios.go b/vendor/golang.org/x/sys/unix/ptrace_ios.go index ed0509a01..a4d35db5d 100644 --- a/vendor/golang.org/x/sys/unix/ptrace_ios.go +++ b/vendor/golang.org/x/sys/unix/ptrace_ios.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build ios -// +build ios package unix diff --git a/vendor/golang.org/x/sys/unix/race.go b/vendor/golang.org/x/sys/unix/race.go index 6f6c5fec5..714d2aae7 100644 --- a/vendor/golang.org/x/sys/unix/race.go +++ b/vendor/golang.org/x/sys/unix/race.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin && race) || (linux && race) || (freebsd && race) -// +build darwin,race linux,race freebsd,race package unix diff --git a/vendor/golang.org/x/sys/unix/race0.go b/vendor/golang.org/x/sys/unix/race0.go index 706e1322a..4a9f6634c 100644 --- a/vendor/golang.org/x/sys/unix/race0.go +++ b/vendor/golang.org/x/sys/unix/race0.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos -// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos package unix diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdents.go b/vendor/golang.org/x/sys/unix/readdirent_getdents.go index 4d6257569..dbd2b6ccb 100644 --- a/vendor/golang.org/x/sys/unix/readdirent_getdents.go +++ b/vendor/golang.org/x/sys/unix/readdirent_getdents.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || dragonfly || freebsd || linux || netbsd || openbsd -// +build aix dragonfly freebsd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go index 2a4ba47c4..130398b6b 100644 --- a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go +++ b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin -// +build darwin package unix diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go index 3865943f6..c3a62dbb1 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Socket control messages diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go index 0840fe4a5..4a1eab37e 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go index 63e8c8383..5ea74da98 100644 --- a/vendor/golang.org/x/sys/unix/syscall.go +++ b/vendor/golang.org/x/sys/unix/syscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Package unix contains an interface to the low-level operating system // primitives. OS details vary depending on the underlying system, and diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index e94e6cdac..67ce6cef2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix -// +build aix // Aix system calls. // This file is compiled as ordinary Go code, @@ -107,7 +106,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { if n > 0 { sl += _Socklen(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go index f2871fa95..1fdaa4760 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc -// +build aix,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go index 75718ec0f..c87f9a9f4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc64 -// +build aix,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index 4217de518..a00c3e545 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || netbsd || openbsd -// +build darwin dragonfly freebsd netbsd openbsd // BSD system call wrappers shared by *BSD based systems // including OS X (Darwin) and FreeBSD. Like the other @@ -317,7 +316,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { if err != nil { return "", err } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go index b37310ce9..0eaecf5fc 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && darwin -// +build amd64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go index d51ec9963..f36c6707c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && darwin -// +build arm64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go index 53c96641f..16dc69937 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin && go1.12 -// +build darwin,go1.12 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go index 4e2d32120..14bab6b2d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && dragonfly -// +build amd64,dragonfly package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go index b8da51004..3967bca77 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && freebsd -// +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go index 47155c483..eff19ada2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && freebsd -// +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go index 08932093f..4f24b517a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && freebsd -// +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go index d151a0d0e..ac30759ec 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && freebsd -// +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go index d5cd64b37..aab725ca7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && freebsd -// +build riscv64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd.go b/vendor/golang.org/x/sys/unix/syscall_hurd.go index 381fd4673..ba46651f8 100644 --- a/vendor/golang.org/x/sys/unix/syscall_hurd.go +++ b/vendor/golang.org/x/sys/unix/syscall_hurd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build hurd -// +build hurd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd_386.go b/vendor/golang.org/x/sys/unix/syscall_hurd_386.go index 7cf54a3e4..df89f9e6b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_hurd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_hurd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && hurd -// +build 386,hurd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_illumos.go b/vendor/golang.org/x/sys/unix/syscall_illumos.go index 87db5a6a8..a863f7052 100644 --- a/vendor/golang.org/x/sys/unix/syscall_illumos.go +++ b/vendor/golang.org/x/sys/unix/syscall_illumos.go @@ -5,7 +5,6 @@ // illumos system calls not present on Solaris. //go:build amd64 && illumos -// +build amd64,illumos package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index fb4e50224..0f85e29e6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -61,15 +61,23 @@ func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) ( } //sys fchmodat(dirfd int, path string, mode uint32) (err error) - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - // Linux fchmodat doesn't support the flags parameter. Mimick glibc's behavior - // and check the flags. Otherwise the mode would be applied to the symlink - // destination which is not what the user expects. - if flags&^AT_SYMLINK_NOFOLLOW != 0 { - return EINVAL - } else if flags&AT_SYMLINK_NOFOLLOW != 0 { - return EOPNOTSUPP +//sys fchmodat2(dirfd int, path string, mode uint32, flags int) (err error) + +func Fchmodat(dirfd int, path string, mode uint32, flags int) error { + // Linux fchmodat doesn't support the flags parameter, but fchmodat2 does. + // Try fchmodat2 if flags are specified. + if flags != 0 { + err := fchmodat2(dirfd, path, mode, flags) + if err == ENOSYS { + // fchmodat2 isn't available. If the flags are known to be valid, + // return EOPNOTSUPP to indicate that fchmodat doesn't support them. + if flags&^(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 { + return EINVAL + } else if flags&(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 { + return EOPNOTSUPP + } + } + return err } return fchmodat(dirfd, path, mode) } @@ -417,7 +425,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { if n > 0 { sl += _Socklen(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- @@ -1301,7 +1310,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { return "", err } } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) { @@ -2482,3 +2491,5 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) { } return attr, nil } + +//sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index c7d9945ea..506dafa7b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && linux -// +build 386,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go b/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go index 08086ac6a..38d55641b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64) -// +build linux -// +build 386 amd64 mips mipsle mips64 mipsle ppc64 ppc64le ppc s390x sparc64 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 70601ce36..d557cf8de 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && linux -// +build amd64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go index 8b0f0f3aa..facdb83b2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && linux && gc -// +build amd64,linux,gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index da2986415..cd2dd797f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && linux -// +build arm,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index f5266689a..cf2ee6c75 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && linux -// +build arm64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go index 2b1168d7d..ffc4c2b63 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gc -// +build linux,gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go index 9843fb489..9ebfdcf44 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gc && 386 -// +build linux,gc,386 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go index a6008fccd..5f2b57c4c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && gc && linux -// +build arm,gc,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go index 7740af242..d1a3ad826 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gccgo && 386 -// +build linux,gccgo,386 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go index e16a12299..f2f67423e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gccgo && arm -// +build linux,gccgo,arm package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go index f6ab02ec1..3d0e98451 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build loong64 && linux -// +build loong64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index 93fe59d25..70963a95a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) -// +build linux -// +build mips64 mips64le package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index aae7f0ffd..c218ebd28 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips || mipsle) -// +build linux -// +build mips mipsle package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go index 66eff19a3..e6c48500c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && ppc -// +build linux,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 806aa2574..7286a9aa8 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) -// +build linux -// +build ppc64 ppc64le package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index 5e6ceee12..6f5a28894 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && linux -// +build riscv64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index 2f89e8f5d..66f31210d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build s390x && linux -// +build s390x,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index 7ca064ae7..11d1f1698 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build sparc64 && linux -// +build sparc64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go index 5199d282f..7a5eb5743 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && netbsd -// +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go index 70a9c52e9..62d8957ae 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && netbsd -// +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go index 3eb5942f9..ce6a06885 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && netbsd -// +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go index fc6ccfd81..d46d689d1 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && netbsd -// +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 6f34479b5..b25343c71 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -137,18 +137,13 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { - var _p0 unsafe.Pointer + var bufptr *Statfs_t var bufsize uintptr if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) + bufptr = &buf[0] bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) } - r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = e1 - } - return + return getfsstat(bufptr, bufsize, flags) } //sysnb getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) @@ -171,6 +166,20 @@ func Getresgid() (rgid, egid, sgid int) { //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys fcntl(fd int, cmd int, arg int) (n int, err error) +//sys fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) = SYS_FCNTL + +// FcntlInt performs a fcntl syscall on fd with the provided command and argument. +func FcntlInt(fd uintptr, cmd, arg int) (int, error) { + return fcntl(int(fd), cmd, arg) +} + +// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. +func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { + _, err := fcntlPtr(int(fd), cmd, unsafe.Pointer(lk)) + return err +} + //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { @@ -326,4 +335,7 @@ func Uname(uname *Utsname) error { //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys munmap(addr uintptr, length uintptr) (err error) +//sys getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) +//sys pledge(promises *byte, execpromises *byte) (err error) +//sys unveil(path *byte, flags *byte) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go index 6baabcdcb..9ddc89f4f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go index bab25360e..70a3c96ee 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go index 8eed3c4d4..265caa87f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go index 483dde99d..ac4fda171 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go index 04aa43f41..0a451e6dd 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build openbsd -// +build openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go index c2796139c..30a308cbb 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go index 23199a7ff..ea954330f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index b99cfa134..21974af06 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -128,7 +128,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { if n > 0 { sl += _Socklen(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- @@ -157,7 +158,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { if err != nil { return "", err } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } const ImplementsGetwd = true diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go index 0bd25ef81..e02d8ceae 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && solaris -// +build amd64,solaris package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index f6eda2705..77081de8c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go index b6919ca58..05c95bccf 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc -// +build darwin dragonfly freebsd linux,!ppc64,!ppc64le netbsd openbsd solaris -// +build gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go index f6f707acf..23f39b7af 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64le || ppc64) && gc -// +build linux -// +build ppc64le ppc64 -// +build gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index 4596d041c..b473038c6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix @@ -1105,7 +1104,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { return "", err } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { diff --git a/vendor/golang.org/x/sys/unix/sysvshm_linux.go b/vendor/golang.org/x/sys/unix/sysvshm_linux.go index 2c3a4437f..4fcd38de2 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_linux.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux -// +build linux package unix diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go index 5bb41d17b..79a84f18b 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_unix.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin && !ios) || linux -// +build darwin,!ios linux package unix diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go index 71bddefdb..9eb0db664 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin && !ios -// +build darwin,!ios package unix diff --git a/vendor/golang.org/x/sys/unix/timestruct.go b/vendor/golang.org/x/sys/unix/timestruct.go index 616b1b284..7997b1902 100644 --- a/vendor/golang.org/x/sys/unix/timestruct.go +++ b/vendor/golang.org/x/sys/unix/timestruct.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/unveil_openbsd.go b/vendor/golang.org/x/sys/unix/unveil_openbsd.go index 168d5ae77..cb7e598ce 100644 --- a/vendor/golang.org/x/sys/unix/unveil_openbsd.go +++ b/vendor/golang.org/x/sys/unix/unveil_openbsd.go @@ -4,39 +4,48 @@ package unix -import ( - "syscall" - "unsafe" -) +import "fmt" // Unveil implements the unveil syscall. // For more information see unveil(2). // Note that the special case of blocking further // unveil calls is handled by UnveilBlock. func Unveil(path string, flags string) error { - pathPtr, err := syscall.BytePtrFromString(path) - if err != nil { + if err := supportsUnveil(); err != nil { return err } - flagsPtr, err := syscall.BytePtrFromString(flags) + pathPtr, err := BytePtrFromString(path) if err != nil { return err } - _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) - if e != 0 { - return e + flagsPtr, err := BytePtrFromString(flags) + if err != nil { + return err } - return nil + return unveil(pathPtr, flagsPtr) } // UnveilBlock blocks future unveil calls. // For more information see unveil(2). func UnveilBlock() error { - // Both pointers must be nil. - var pathUnsafe, flagsUnsafe unsafe.Pointer - _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) - if e != 0 { - return e + if err := supportsUnveil(); err != nil { + return err } + return unveil(nil, nil) +} + +// supportsUnveil checks for availability of the unveil(2) system call based +// on the running OpenBSD version. +func supportsUnveil() error { + maj, min, err := majmin() + if err != nil { + return err + } + + // unveil is not available before 6.4 + if maj < 6 || (maj == 6 && min <= 3) { + return fmt.Errorf("cannot call Unveil on OpenBSD %d.%d", maj, min) + } + return nil } diff --git a/vendor/golang.org/x/sys/unix/xattr_bsd.go b/vendor/golang.org/x/sys/unix/xattr_bsd.go index f5f8e9f36..e16879396 100644 --- a/vendor/golang.org/x/sys/unix/xattr_bsd.go +++ b/vendor/golang.org/x/sys/unix/xattr_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build freebsd || netbsd -// +build freebsd netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go index ca9799b79..2fb219d78 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && aix -// +build ppc,aix // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -maix32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go index 200c8c26f..b0e6f5c85 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && aix -// +build ppc64,aix // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -maix64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 143007627..e40fa8524 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && darwin -// +build amd64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index ab044a742..bb02aa6c0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && darwin -// +build arm64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go index 17bba0e44..c0e0f8694 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && dragonfly -// +build amd64,dragonfly // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go index f8c2c5138..6c6923906 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd -// +build 386,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go index 96310c3be..dd9163f8e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd -// +build amd64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go index 777b69def..493a2a793 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd -// +build arm,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go index c557ac2db..8b437b307 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd -// +build arm64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go index 341b4d962..67c02dd57 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && freebsd -// +build riscv64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index f9c7f479b..c73cfe2f1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -1,7 +1,6 @@ // Code generated by mkmerge; DO NOT EDIT. //go:build linux -// +build linux package unix @@ -481,10 +480,13 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_AFTER = 0x10 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_KPROBE_MULTI_RETURN = 0x1 + BPF_F_BEFORE = 0x8 + BPF_F_ID = 0x20 + BPF_F_NETFILTER_IP_DEFRAG = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_REPLACE = 0x4 BPF_F_SLEEPABLE = 0x10 @@ -521,6 +523,7 @@ const ( BPF_MAJOR_VERSION = 0x1 BPF_MAXINSNS = 0x1000 BPF_MEM = 0x60 + BPF_MEMSX = 0x80 BPF_MEMWORDS = 0x10 BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 @@ -776,6 +779,8 @@ const ( DEVLINK_GENL_MCGRP_CONFIG_NAME = "config" DEVLINK_GENL_NAME = "devlink" DEVLINK_GENL_VERSION = 0x1 + DEVLINK_PORT_FN_CAP_IPSEC_CRYPTO = 0x4 + DEVLINK_PORT_FN_CAP_IPSEC_PACKET = 0x8 DEVLINK_PORT_FN_CAP_MIGRATABLE = 0x2 DEVLINK_PORT_FN_CAP_ROCE = 0x1 DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14 @@ -1698,6 +1703,7 @@ const ( KEXEC_ON_CRASH = 0x1 KEXEC_PRESERVE_CONTEXT = 0x2 KEXEC_SEGMENT_MAX = 0x10 + KEXEC_UPDATE_ELFCOREHDR = 0x4 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CAPABILITIES = 0x1f KEYCTL_CAPS0_BIG_KEY = 0x10 @@ -1795,6 +1801,7 @@ const ( LOCK_SH = 0x1 LOCK_UN = 0x8 LOOP_CLR_FD = 0x4c01 + LOOP_CONFIGURE = 0x4c0a LOOP_CTL_ADD = 0x4c80 LOOP_CTL_GET_FREE = 0x4c82 LOOP_CTL_REMOVE = 0x4c81 @@ -2275,6 +2282,7 @@ const ( PERF_MEM_LVLNUM_PMEM = 0xe PERF_MEM_LVLNUM_RAM = 0xd PERF_MEM_LVLNUM_SHIFT = 0x21 + PERF_MEM_LVLNUM_UNC = 0x8 PERF_MEM_LVL_HIT = 0x2 PERF_MEM_LVL_IO = 0x1000 PERF_MEM_LVL_L1 = 0x8 @@ -3461,6 +3469,7 @@ const ( XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 + XDP_PKT_CONTD = 0x1 XDP_RING_NEED_WAKEUP = 0x1 XDP_RX_RING = 0x2 XDP_SHARED_UMEM = 0x1 @@ -3473,6 +3482,7 @@ const ( XDP_UMEM_REG = 0x4 XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1 XDP_USE_NEED_WAKEUP = 0x8 + XDP_USE_SG = 0x10 XDP_ZEROCOPY = 0x4 XENFS_SUPER_MAGIC = 0xabba1974 XFS_SUPER_MAGIC = 0x58465342 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 30aee00a5..4920821cf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux -// +build 386,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/386/include -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 8ebfa5127..a0c1e4112 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux -// +build amd64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/amd64/include -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 271a21cdc..c63985560 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux -// +build arm,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/arm/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 910c330a3..47cc62e25 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux -// +build arm64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/arm64/include -fsigned-char _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index a640798c9..27ac4a09e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux -// +build loong64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/loong64/include _const.go @@ -119,6 +118,7 @@ const ( IXOFF = 0x1000 IXON = 0x400 LASX_CTX_MAGIC = 0x41535801 + LBT_CTX_MAGIC = 0x42540001 LSX_CTX_MAGIC = 0x53580001 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 0d5925d34..54694642a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux -// +build mips,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mips/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index d72a00e0b..3adb81d75 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux -// +build mips64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mips64/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 02ba129f8..2dfe98f0d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux -// +build mips64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mips64le/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 8daa6dd96..f5398f84f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux -// +build mipsle,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mipsle/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 63c8fa2f7..c54f152d6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux -// +build ppc,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/ppc/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 930799ec1..76057dc72 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux -// +build ppc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 8605a7dd7..e0c3725e2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux -// +build ppc64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64le/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 95a016f1c..18f2813ed 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux -// +build riscv64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/riscv64/include _const.go @@ -228,6 +227,9 @@ const ( PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffffffffffff + PTRACE_GETFDPIC = 0x21 + PTRACE_GETFDPIC_EXEC = 0x0 + PTRACE_GETFDPIC_INTERP = 0x1 RLIMIT_AS = 0x9 RLIMIT_MEMLOCK = 0x8 RLIMIT_NOFILE = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 1ae0108f5..11619d4ec 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux -// +build s390x,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/s390x/include -fsigned-char _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 1bb7c6333..396d994da 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux -// +build sparc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/sparc64/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go index 72f7420d2..130085df4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && netbsd -// +build 386,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go index 8d4eb0c08..84769a1a3 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && netbsd -// +build amd64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go index 9eef9749f..602ded003 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && netbsd -// +build arm,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -marm _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go index 3b62ba192..efc0406ee 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && netbsd -// +build arm64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index af20e474b..5a6500f83 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index 6015fcb2b..a5aeeb979 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go index 8d44955e4..0e9748a72 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go index ae16fe754..4f4449abc 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go index 03d90fe35..76a363f0f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go index 8e2c51b1e..43ca0cdfd 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go index 13d403031..b1b8bb200 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go index 1afee6a08..d2ddd3176 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && solaris -// +build amd64,solaris // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go index fc7d0506f..4dfd2e051 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x // Hand edited based on zerrors_linux_s390x.go // TODO: auto-generate. diff --git a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go index 97f20ca28..586317c78 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("arm", "arm64"). DO NOT EDIT. //go:build linux && (arm || arm64) -// +build linux -// +build arm arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go index 0b5f79430..d7c881be7 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mips", "mips64"). DO NOT EDIT. //go:build linux && (mips || mips64) -// +build linux -// +build mips mips64 package unix diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go index 2807f7e64..2d2de5d29 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mipsle", "mips64le"). DO NOT EDIT. //go:build linux && (mipsle || mips64le) -// +build linux -// +build mipsle mips64le package unix diff --git a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go index 281ea64e3..5adc79fb5 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("386", "amd64"). DO NOT EDIT. //go:build linux && (386 || amd64) -// +build linux -// +build 386 amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index d1d1d2331..6ea64a3c0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc -// +build aix,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index f99a18adc..99ee4399a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc64 -// +build aix,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index c4d50ae50..b68a78362 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc64 && gc -// +build aix,ppc64,gc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index 6903d3b09..0a87450bf 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc64 && gccgo -// +build aix,ppc64,gccgo package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 1cad561e9..ccb02f240 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build darwin && amd64 -// +build darwin,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index b18edbd0e..1b40b997b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build darwin && arm64 -// +build darwin,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index 0c67df64a..aad65fc79 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build dragonfly && amd64 -// +build dragonfly,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index e6e05d145..c0096391a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && 386 -// +build freebsd,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 7508accac..7664df749 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && amd64 -// +build freebsd,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index 7b56aead4..ae099182c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && arm -// +build freebsd,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index cc623dcaa..11fd5d45b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && arm64 -// +build freebsd,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go index 581849197..c3d2d6530 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && riscv64 -// +build freebsd,riscv64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go index 6be25cd19..c698cbc01 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build illumos && amd64 -// +build illumos,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 1ff3aec74..1488d2712 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -1,7 +1,6 @@ // Code generated by mkmerge; DO NOT EDIT. //go:build linux -// +build linux package unix @@ -38,6 +37,21 @@ func fchmodat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fchmodat2(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHMODAT2, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -2195,3 +2209,13 @@ func schedGetattr(pid int, attr *SchedAttr, size uint, flags uint) (err error) { } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) { + _, _, e1 := Syscall6(SYS_CACHESTAT, uintptr(fd), uintptr(unsafe.Pointer(crange)), uintptr(unsafe.Pointer(cstat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 07b549cc2..4def3e9fc 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && 386 -// +build linux,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 5f481bf83..fef2bc8ba 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && amd64 -// +build linux,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 824cd52c7..a9fd76a88 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && arm -// +build linux,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index e77aecfe9..460065028 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && arm64 -// +build linux,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go index 806ffd1e1..c8987d264 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && loong64 -// +build linux,loong64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 961a3afb7..921f43061 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mips -// +build linux,mips package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index ed05005e9..44f067829 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mips64 -// +build linux,mips64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index d365b718f..e7fa0abf0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mips64le -// +build linux,mips64le package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index c3f1b8bbd..8c5125675 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mipsle -// +build linux,mipsle package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go index a6574cf98..7392fd45e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && ppc -// +build linux,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index f40990264..41180434e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && ppc64 -// +build linux,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 9dfcc2997..40c6ce7ae 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && ppc64le -// +build linux,ppc64le package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index 0ab4f2ed7..2cfe34adb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && riscv64 -// +build linux,riscv64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index 6cde32237..61e6f0709 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && s390x -// +build linux,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index 5253d65bf..834b84204 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && sparc64 -// +build linux,sparc64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 2df3c5bac..e91ebc14a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && 386 -// +build netbsd,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index a60556bab..be28babbc 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && amd64 -// +build netbsd,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 9f788917a..fb587e826 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && arm -// +build netbsd,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index 82a4cb2dc..d576438bb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && arm64 -// +build netbsd,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 66b3b6456..a1d061597 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && 386 -// +build openbsd,386 package unix @@ -585,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2213,6 +2238,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s index 3dcacd30d..41b561731 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4 DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4 @@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $4 DATA ·libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getfsstat_trampoline_addr(SB)/4, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $4 DATA ·libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pledge_trampoline_addr(SB)/4, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unveil_trampoline_addr(SB)/4, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index c5c4cc112..5b2a74097 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && amd64 -// +build openbsd,amd64 package unix @@ -585,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2213,6 +2238,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s index 2763620b0..4019a656f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 @@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index 93bfbb328..f6eda1344 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && arm -// +build openbsd,arm package unix @@ -585,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2213,6 +2238,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s index c92231404..ac4af24f9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4 DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4 @@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $4 DATA ·libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getfsstat_trampoline_addr(SB)/4, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $4 DATA ·libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pledge_trampoline_addr(SB)/4, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unveil_trampoline_addr(SB)/4, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index a107b8fda..55df20ae9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && arm64 -// +build openbsd,arm64 package unix @@ -585,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2213,6 +2238,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s index a6bc32c92..f77d53212 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 @@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index c427de509..8c1155cbc 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && mips64 -// +build openbsd,mips64 package unix @@ -585,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2213,6 +2238,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s index b4e7bceab..fae140b62 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 @@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go index 60c1a99ae..7cc80c58d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && ppc64 -// +build openbsd,ppc64 package unix @@ -585,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2213,6 +2238,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s index ca3f76600..9d1e0ff06 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -213,6 +213,12 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fcntl(SB) + RET +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_ppoll(SB) RET @@ -801,8 +807,26 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getfsstat(SB) + RET +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_utimensat(SB) RET GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_pledge(SB) + RET +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_unveil(SB) + RET +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go index 52eba360f..0688737f4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && riscv64 -// +build openbsd,riscv64 package unix @@ -585,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2213,6 +2238,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s index 477a7d5b2..da115f9a4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 @@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index b40189464..829b87feb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build solaris && amd64 -// +build solaris,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go index 1d8fe1d4b..94f011238 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go index 55e048471..3a58ae819 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index d2243cf83..dcb7a0eb7 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go index 82dc51bd8..db5a7bf13 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go index cbdda1a4a..7be575a77 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go index f55eae1a8..d6e3174c6 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go index e44054470..ee97157d0 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go index a0db82fce..35c3b91d0 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go index f8298ff9b..5edda7687 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && darwin -// +build amd64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go index 5eb433bbf..0dc9e8b4d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && darwin -// +build arm64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index 703675c0c..308ddf3a1 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && dragonfly -// +build amd64,dragonfly package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index 4e0d96107..418664e3d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd -// +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index 01636b838..34d0b86d7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd -// +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index ad99bc106..b71cf45e2 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd -// +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go index 89dcc4274..e32df1c1e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd -// +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go index ee37aaa0c..15ad6111f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && freebsd -// +build riscv64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 9862853d3..fcf3ecbdd 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux -// +build 386,linux package unix @@ -448,4 +447,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 8901f0f4e..f56dc2504 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux -// +build amd64,linux package unix @@ -370,4 +369,6 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 6902c37ee..974bf2467 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux -// +build arm,linux package unix @@ -412,4 +411,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index a6d3dff81..39a2739e2 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux -// +build arm64,linux package unix @@ -315,4 +314,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index b18f3f710..cf9c9d77e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux -// +build loong64,linux package unix @@ -309,4 +308,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 0302e5e3d..10b7362ef 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux -// +build mips,linux package unix @@ -432,4 +431,5 @@ const ( SYS_FUTEX_WAITV = 4449 SYS_SET_MEMPOLICY_HOME_NODE = 4450 SYS_CACHESTAT = 4451 + SYS_FCHMODAT2 = 4452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 6693ba4a0..cd4d8b4fd 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux -// +build mips64,linux package unix @@ -362,4 +361,5 @@ const ( SYS_FUTEX_WAITV = 5449 SYS_SET_MEMPOLICY_HOME_NODE = 5450 SYS_CACHESTAT = 5451 + SYS_FCHMODAT2 = 5452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index fd93f4987..2c0efca81 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux -// +build mips64le,linux package unix @@ -362,4 +361,5 @@ const ( SYS_FUTEX_WAITV = 5449 SYS_SET_MEMPOLICY_HOME_NODE = 5450 SYS_CACHESTAT = 5451 + SYS_FCHMODAT2 = 5452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 760ddcadc..a72e31d39 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux -// +build mipsle,linux package unix @@ -432,4 +431,5 @@ const ( SYS_FUTEX_WAITV = 4449 SYS_SET_MEMPOLICY_HOME_NODE = 4450 SYS_CACHESTAT = 4451 + SYS_FCHMODAT2 = 4452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index cff2b2555..c7d1e3747 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux -// +build ppc,linux package unix @@ -439,4 +438,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index a4b2405d0..f4d4838c8 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux -// +build ppc64,linux package unix @@ -411,4 +410,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index aca54b4e3..b64f0e591 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux -// +build ppc64le,linux package unix @@ -411,4 +410,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 9d1738d64..95711195a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux -// +build riscv64,linux package unix @@ -316,4 +315,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 022878dc8..f94e943bc 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux -// +build s390x,linux package unix @@ -377,4 +376,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 4100a761c..ba0c2bc51 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux -// +build sparc64,linux package unix @@ -390,4 +389,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go index 3a6699eba..b2aa8cd49 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && netbsd -// +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go index 5677cd4f1..524a1b1c9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && netbsd -// +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go index e784cb6db..d59b943ac 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && netbsd -// +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go index bd4952efa..31e771d53 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build arm64 && netbsd -// +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go index 597733813..9fd77c6cb 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index 16af29189..af10af28c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go index f59b18a97..cc2028af4 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go index 721ef5910..c06dd4415 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go index 01c43a01f..9ddbf3e08 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go index f258cfa24..19a6ee413 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go index 07919e0ec..05192a782 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go index 073daad43..b2e308581 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go index 7a8161c1d..3e6d57cae 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && aix -// +build ppc,aix package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go index 07ed733c5..3a219bdce 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && aix -// +build ppc64,aix package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 690cefc3d..091d107f3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && darwin -// +build amd64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 5bffc10ea..28ff4ef74 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && darwin -// +build arm64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index d0ba8e9b8..30e405bb4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && dragonfly -// +build amd64,dragonfly package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 29dc48337..6cbd094a3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd -// +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index 0a89b2890..7c03b6ee7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd -// +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index c8666bb15..422107ee8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd -// +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index 88fb48a88..505a12acf 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd -// +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go index 698dc975e..cc986c790 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && freebsd -// +build riscv64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 18aa70b42..bbf8399ff 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -1,7 +1,6 @@ // Code generated by mkmerge; DO NOT EDIT. //go:build linux -// +build linux package unix @@ -2672,6 +2671,7 @@ const ( BPF_PROG_TYPE_LSM = 0x1d BPF_PROG_TYPE_SK_LOOKUP = 0x1e BPF_PROG_TYPE_SYSCALL = 0x1f + BPF_PROG_TYPE_NETFILTER = 0x20 BPF_CGROUP_INET_INGRESS = 0x0 BPF_CGROUP_INET_EGRESS = 0x1 BPF_CGROUP_INET_SOCK_CREATE = 0x2 @@ -2716,6 +2716,11 @@ const ( BPF_PERF_EVENT = 0x29 BPF_TRACE_KPROBE_MULTI = 0x2a BPF_LSM_CGROUP = 0x2b + BPF_STRUCT_OPS = 0x2c + BPF_NETFILTER = 0x2d + BPF_TCX_INGRESS = 0x2e + BPF_TCX_EGRESS = 0x2f + BPF_TRACE_UPROBE_MULTI = 0x30 BPF_LINK_TYPE_UNSPEC = 0x0 BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1 BPF_LINK_TYPE_TRACING = 0x2 @@ -2726,6 +2731,18 @@ const ( BPF_LINK_TYPE_PERF_EVENT = 0x7 BPF_LINK_TYPE_KPROBE_MULTI = 0x8 BPF_LINK_TYPE_STRUCT_OPS = 0x9 + BPF_LINK_TYPE_NETFILTER = 0xa + BPF_LINK_TYPE_TCX = 0xb + BPF_LINK_TYPE_UPROBE_MULTI = 0xc + BPF_PERF_EVENT_UNSPEC = 0x0 + BPF_PERF_EVENT_UPROBE = 0x1 + BPF_PERF_EVENT_URETPROBE = 0x2 + BPF_PERF_EVENT_KPROBE = 0x3 + BPF_PERF_EVENT_KRETPROBE = 0x4 + BPF_PERF_EVENT_TRACEPOINT = 0x5 + BPF_PERF_EVENT_EVENT = 0x6 + BPF_F_KPROBE_MULTI_RETURN = 0x1 + BPF_F_UPROBE_MULTI_RETURN = 0x1 BPF_ANY = 0x0 BPF_NOEXIST = 0x1 BPF_EXIST = 0x2 @@ -2743,6 +2760,8 @@ const ( BPF_F_MMAPABLE = 0x400 BPF_F_PRESERVE_ELEMS = 0x800 BPF_F_INNER_MAP = 0x1000 + BPF_F_LINK = 0x2000 + BPF_F_PATH_FD = 0x4000 BPF_STATS_RUN_TIME = 0x0 BPF_STACK_BUILD_ID_EMPTY = 0x0 BPF_STACK_BUILD_ID_VALID = 0x1 @@ -2763,6 +2782,7 @@ const ( BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_DONT_FRAGMENT = 0x4 BPF_F_SEQ_NUMBER = 0x8 + BPF_F_NO_TUNNEL_KEY = 0x10 BPF_F_TUNINFO_FLAGS = 0x10 BPF_F_INDEX_MASK = 0xffffffff BPF_F_CURRENT_CPU = 0xffffffff @@ -2779,6 +2799,8 @@ const ( BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20 BPF_F_ADJ_ROOM_ENCAP_L2_ETH = 0x40 + BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = 0x80 + BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = 0x100 BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_F_SYSCTL_BASE_NAME = 0x1 @@ -2867,6 +2889,8 @@ const ( BPF_DEVCG_DEV_CHAR = 0x2 BPF_FIB_LOOKUP_DIRECT = 0x1 BPF_FIB_LOOKUP_OUTPUT = 0x2 + BPF_FIB_LOOKUP_SKIP_NEIGH = 0x4 + BPF_FIB_LOOKUP_TBID = 0x8 BPF_FIB_LKUP_RET_SUCCESS = 0x0 BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 @@ -2902,6 +2926,7 @@ const ( BPF_CORE_ENUMVAL_EXISTS = 0xa BPF_CORE_ENUMVAL_VALUE = 0xb BPF_CORE_TYPE_MATCHES = 0xc + BPF_F_TIMER_ABS = 0x1 ) const ( @@ -2980,6 +3005,12 @@ type LoopInfo64 struct { Encrypt_key [32]uint8 Init [2]uint64 } +type LoopConfig struct { + Fd uint32 + Size uint32 + Info LoopInfo64 + _ [8]uint64 +} type TIPCSocketAddr struct { Ref uint32 @@ -5883,3 +5914,15 @@ type SchedAttr struct { } const SizeofSchedAttr = 0x38 + +type Cachestat_t struct { + Cache uint64 + Dirty uint64 + Writeback uint64 + Evicted uint64 + Recently_evicted uint64 +} +type CachestatRange struct { + Off uint64 + Len uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 6d8acbcc5..438a30aff 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux -// +build 386,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 59293c688..adceca355 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux -// +build amd64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 40cfa38c2..eeaa00a37 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux -// +build arm,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 055bc4216..6739aa91d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux -// +build arm64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go index f28affbc6..9920ef631 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux -// +build loong64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 9d71e7ccd..2923b799a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux -// +build mips,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index fd5ccd332..ce2750ee4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux -// +build mips64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 7704de77a..3038811d7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux -// +build mips64le,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index df00b8757..efc6fed18 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux -// +build mipsle,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 0942840db..9a654b75a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux -// +build ppc,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 034874395..40d358e33 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux -// +build ppc64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index bad067047..148c6ceb8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux -// +build ppc64le,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 1b4c97c32..72ba81543 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux -// +build riscv64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index aa268d025..71e765508 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux -// +build s390x,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 444045b6c..4abbdb9de 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux -// +build sparc64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index 9bc4c8f9d..f22e7947d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && netbsd -// +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index bb05f655d..066a7d83d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && netbsd -// +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index db40e3a19..439548ec9 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && netbsd -// +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go index 11121151c..16085d3bb 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && netbsd -// +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index 26eba23b7..afd13a3af 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index 5a5479886..5d97f1f9b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index be58c4e1f..34871cdc1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go index 52338266c..5911bceb3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go index 605cfdb12..e4f24f3bc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go index d6724c010..ca50a7930 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go index ddfd27a43..d7d7f7902 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index 0400747c6..14160576d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && solaris -// +build amd64,solaris package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go index aec1efcb3..54f31be63 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x // Hand edited based on ztypes_linux_s390x.go // TODO: auto-generate. diff --git a/vendor/golang.org/x/sys/windows/aliases.go b/vendor/golang.org/x/sys/windows/aliases.go index a20ebea63..ce2d713d6 100644 --- a/vendor/golang.org/x/sys/windows/aliases.go +++ b/vendor/golang.org/x/sys/windows/aliases.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows && go1.9 -// +build windows,go1.9 package windows diff --git a/vendor/golang.org/x/sys/windows/empty.s b/vendor/golang.org/x/sys/windows/empty.s index fdbbbcd31..ba64caca5 100644 --- a/vendor/golang.org/x/sys/windows/empty.s +++ b/vendor/golang.org/x/sys/windows/empty.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.12 -// +build !go1.12 // This file is here to allow bodyless functions with go:linkname for Go 1.11 // and earlier (see https://golang.org/issue/23311). diff --git a/vendor/golang.org/x/sys/windows/eventlog.go b/vendor/golang.org/x/sys/windows/eventlog.go index 2cd60645e..6c366955d 100644 --- a/vendor/golang.org/x/sys/windows/eventlog.go +++ b/vendor/golang.org/x/sys/windows/eventlog.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package windows diff --git a/vendor/golang.org/x/sys/windows/mksyscall.go b/vendor/golang.org/x/sys/windows/mksyscall.go index 8563f79c5..dbcdb090c 100644 --- a/vendor/golang.org/x/sys/windows/mksyscall.go +++ b/vendor/golang.org/x/sys/windows/mksyscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build generate -// +build generate package windows diff --git a/vendor/golang.org/x/sys/windows/race.go b/vendor/golang.org/x/sys/windows/race.go index 9196b089c..0f1bdc386 100644 --- a/vendor/golang.org/x/sys/windows/race.go +++ b/vendor/golang.org/x/sys/windows/race.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows && race -// +build windows,race package windows diff --git a/vendor/golang.org/x/sys/windows/race0.go b/vendor/golang.org/x/sys/windows/race0.go index 7bae4817a..0c78da78b 100644 --- a/vendor/golang.org/x/sys/windows/race0.go +++ b/vendor/golang.org/x/sys/windows/race0.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows && !race -// +build windows,!race package windows diff --git a/vendor/golang.org/x/sys/windows/registry/key.go b/vendor/golang.org/x/sys/windows/registry/key.go index 6c8d97b6a..fd8632444 100644 --- a/vendor/golang.org/x/sys/windows/registry/key.go +++ b/vendor/golang.org/x/sys/windows/registry/key.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows // Package registry provides access to the Windows registry. // diff --git a/vendor/golang.org/x/sys/windows/registry/mksyscall.go b/vendor/golang.org/x/sys/windows/registry/mksyscall.go index ee74927d3..bbf86ccf0 100644 --- a/vendor/golang.org/x/sys/windows/registry/mksyscall.go +++ b/vendor/golang.org/x/sys/windows/registry/mksyscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build generate -// +build generate package registry diff --git a/vendor/golang.org/x/sys/windows/registry/syscall.go b/vendor/golang.org/x/sys/windows/registry/syscall.go index 417335123..f533091c1 100644 --- a/vendor/golang.org/x/sys/windows/registry/syscall.go +++ b/vendor/golang.org/x/sys/windows/registry/syscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package registry diff --git a/vendor/golang.org/x/sys/windows/registry/value.go b/vendor/golang.org/x/sys/windows/registry/value.go index 2789f6f18..74db26b94 100644 --- a/vendor/golang.org/x/sys/windows/registry/value.go +++ b/vendor/golang.org/x/sys/windows/registry/value.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package registry diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go index c44a1b963..a9dc6308d 100644 --- a/vendor/golang.org/x/sys/windows/service.go +++ b/vendor/golang.org/x/sys/windows/service.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package windows diff --git a/vendor/golang.org/x/sys/windows/str.go b/vendor/golang.org/x/sys/windows/str.go index 4fc01434e..6a4f9ce6a 100644 --- a/vendor/golang.org/x/sys/windows/str.go +++ b/vendor/golang.org/x/sys/windows/str.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package windows diff --git a/vendor/golang.org/x/sys/windows/syscall.go b/vendor/golang.org/x/sys/windows/syscall.go index 8732cdb95..e85ed6b9c 100644 --- a/vendor/golang.org/x/sys/windows/syscall.go +++ b/vendor/golang.org/x/sys/windows/syscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows // Package windows contains an interface to the low-level operating system // primitives. OS details vary depending on the underlying system, and diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 35cfc57ca..47dc57967 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -155,6 +155,8 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) = kernel32.GetModuleFileNameW //sys GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) = kernel32.GetModuleHandleExW //sys SetDefaultDllDirectories(directoryFlags uint32) (err error) +//sys AddDllDirectory(path *uint16) (cookie uintptr, err error) = kernel32.AddDllDirectory +//sys RemoveDllDirectory(cookie uintptr) (err error) = kernel32.RemoveDllDirectory //sys SetDllDirectory(path string) (err error) = kernel32.SetDllDirectoryW //sys GetVersion() (ver uint32, err error) //sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW @@ -233,6 +235,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) = userenv.CreateEnvironmentBlock //sys DestroyEnvironmentBlock(block *uint16) (err error) = userenv.DestroyEnvironmentBlock //sys getTickCount64() (ms uint64) = kernel32.GetTickCount64 +//sys GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) //sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) //sys GetFileAttributes(name *uint16) (attrs uint32, err error) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW //sys SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW @@ -969,7 +972,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) { if n > 0 { sl += int32(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index b88dc7c85..359780f6a 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -1094,7 +1094,33 @@ const ( SOMAXCONN = 0x7fffffff - TCP_NODELAY = 1 + TCP_NODELAY = 1 + TCP_EXPEDITED_1122 = 2 + TCP_KEEPALIVE = 3 + TCP_MAXSEG = 4 + TCP_MAXRT = 5 + TCP_STDURG = 6 + TCP_NOURG = 7 + TCP_ATMARK = 8 + TCP_NOSYNRETRIES = 9 + TCP_TIMESTAMPS = 10 + TCP_OFFLOAD_PREFERENCE = 11 + TCP_CONGESTION_ALGORITHM = 12 + TCP_DELAY_FIN_ACK = 13 + TCP_MAXRTMS = 14 + TCP_FASTOPEN = 15 + TCP_KEEPCNT = 16 + TCP_KEEPIDLE = TCP_KEEPALIVE + TCP_KEEPINTVL = 17 + TCP_FAIL_CONNECT_ON_ICMP_ERROR = 18 + TCP_ICMP_ERROR_INFO = 19 + + UDP_NOCHECKSUM = 1 + UDP_SEND_MSG_SIZE = 2 + UDP_RECV_MAX_COALESCED_SIZE = 3 + UDP_CHECKSUM_COVERAGE = 20 + + UDP_COALESCED_INFO = 3 SHUT_RD = 0 SHUT_WR = 1 diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 8b1688de4..146a1f019 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -184,6 +184,7 @@ var ( procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo") procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx") procGetIfEntry = modiphlpapi.NewProc("GetIfEntry") + procAddDllDirectory = modkernel32.NewProc("AddDllDirectory") procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") procCancelIo = modkernel32.NewProc("CancelIo") procCancelIoEx = modkernel32.NewProc("CancelIoEx") @@ -253,6 +254,7 @@ var ( procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW") procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle") procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx") + procGetFileTime = modkernel32.NewProc("GetFileTime") procGetFileType = modkernel32.NewProc("GetFileType") procGetFinalPathNameByHandleW = modkernel32.NewProc("GetFinalPathNameByHandleW") procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW") @@ -329,6 +331,7 @@ var ( procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory") procReleaseMutex = modkernel32.NewProc("ReleaseMutex") procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW") + procRemoveDllDirectory = modkernel32.NewProc("RemoveDllDirectory") procResetEvent = modkernel32.NewProc("ResetEvent") procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole") procResumeThread = modkernel32.NewProc("ResumeThread") @@ -1604,6 +1607,15 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) { return } +func AddDllDirectory(path *uint16) (cookie uintptr, err error) { + r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + cookie = uintptr(r0) + if cookie == 0 { + err = errnoErr(e1) + } + return +} + func AssignProcessToJobObject(job Handle, process Handle) (err error) { r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) if r1 == 0 { @@ -2185,6 +2197,14 @@ func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, return } +func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { + r1, _, e1 := syscall.Syscall6(procGetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func GetFileType(filehandle Handle) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) n = uint32(r0) @@ -2870,6 +2890,14 @@ func RemoveDirectory(path *uint16) (err error) { return } +func RemoveDllDirectory(cookie uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procRemoveDllDirectory.Addr(), 1, uintptr(cookie), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func ResetEvent(event Handle) (err error) { r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { diff --git a/vendor/golang.org/x/term/term_unix.go b/vendor/golang.org/x/term/term_unix.go index 62c2b3f41..1ad0ddfe3 100644 --- a/vendor/golang.org/x/term/term_unix.go +++ b/vendor/golang.org/x/term/term_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package term diff --git a/vendor/golang.org/x/term/term_unix_bsd.go b/vendor/golang.org/x/term/term_unix_bsd.go index 853b3d698..9dbf54629 100644 --- a/vendor/golang.org/x/term/term_unix_bsd.go +++ b/vendor/golang.org/x/term/term_unix_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || netbsd || openbsd -// +build darwin dragonfly freebsd netbsd openbsd package term diff --git a/vendor/golang.org/x/term/term_unix_other.go b/vendor/golang.org/x/term/term_unix_other.go index 1e8955c93..1b36de799 100644 --- a/vendor/golang.org/x/term/term_unix_other.go +++ b/vendor/golang.org/x/term/term_unix_other.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || linux || solaris || zos -// +build aix linux solaris zos package term diff --git a/vendor/golang.org/x/term/term_unsupported.go b/vendor/golang.org/x/term/term_unsupported.go index f1df85065..3c409e588 100644 --- a/vendor/golang.org/x/term/term_unsupported.go +++ b/vendor/golang.org/x/term/term_unsupported.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !zos && !windows && !solaris && !plan9 -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!zos,!windows,!solaris,!plan9 package term diff --git a/vendor/golang.org/x/text/message/catalog/go19.go b/vendor/golang.org/x/text/message/catalog/go19.go index 4e5e87f8f..291a4df94 100644 --- a/vendor/golang.org/x/text/message/catalog/go19.go +++ b/vendor/golang.org/x/text/message/catalog/go19.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.9 -// +build go1.9 package catalog diff --git a/vendor/golang.org/x/text/message/catalog/gopre19.go b/vendor/golang.org/x/text/message/catalog/gopre19.go index 9e14685a5..da44ebb8b 100644 --- a/vendor/golang.org/x/text/message/catalog/gopre19.go +++ b/vendor/golang.org/x/text/message/catalog/gopre19.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.9 -// +build !go1.9 package catalog diff --git a/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go b/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go index 8a7392c4a..784bb8808 100644 --- a/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go +++ b/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.10 -// +build go1.10 package bidirule diff --git a/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go b/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go index bb0a92001..8e1e94395 100644 --- a/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go +++ b/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.10 -// +build !go1.10 package bidirule diff --git a/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go index 42fa8d72c..d2bd71181 100644 --- a/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go +++ b/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.10 && !go1.13 -// +build go1.10,!go1.13 package bidi diff --git a/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go index 56a0e1ea2..f76bdca27 100644 --- a/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go +++ b/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.13 && !go1.14 -// +build go1.13,!go1.14 package bidi diff --git a/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go index baacf32b4..3aa2c3bdf 100644 --- a/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go +++ b/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.14 && !go1.16 -// +build go1.14,!go1.16 package bidi diff --git a/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go index ffadb7beb..a71375790 100644 --- a/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go +++ b/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.16 && !go1.21 -// +build go1.16,!go1.21 package bidi diff --git a/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go index 92cce5802..f15746f7d 100644 --- a/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go +++ b/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.21 -// +build go1.21 package bidi diff --git a/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go index f517fdb20..c164d3791 100644 --- a/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go +++ b/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build !go1.10 -// +build !go1.10 package bidi diff --git a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go index f5a078827..1af161c75 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.10 && !go1.13 -// +build go1.10,!go1.13 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go index cb7239c43..eb73ecc37 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.13 && !go1.14 -// +build go1.13,!go1.14 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go index 11b273300..276cb8d8c 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.14 && !go1.16 -// +build go1.14,!go1.16 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go index f65785e8a..0cceffd73 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.16 && !go1.21 -// +build go1.16,!go1.21 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go index e1858b879..b0819e42d 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.21 -// +build go1.21 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go index 0175eae50..bf65457d9 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build !go1.10 -// +build !go1.10 package norm diff --git a/vendor/golang.org/x/text/width/tables10.0.0.go b/vendor/golang.org/x/text/width/tables10.0.0.go index cd9d91caf..07c1cb17a 100644 --- a/vendor/golang.org/x/text/width/tables10.0.0.go +++ b/vendor/golang.org/x/text/width/tables10.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.10 && !go1.13 -// +build go1.10,!go1.13 package width diff --git a/vendor/golang.org/x/text/width/tables11.0.0.go b/vendor/golang.org/x/text/width/tables11.0.0.go index 327eaef9b..89288b3da 100644 --- a/vendor/golang.org/x/text/width/tables11.0.0.go +++ b/vendor/golang.org/x/text/width/tables11.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.13 && !go1.14 -// +build go1.13,!go1.14 package width diff --git a/vendor/golang.org/x/text/width/tables12.0.0.go b/vendor/golang.org/x/text/width/tables12.0.0.go index 5c14ade6d..755ee9122 100644 --- a/vendor/golang.org/x/text/width/tables12.0.0.go +++ b/vendor/golang.org/x/text/width/tables12.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.14 && !go1.16 -// +build go1.14,!go1.16 package width diff --git a/vendor/golang.org/x/text/width/tables13.0.0.go b/vendor/golang.org/x/text/width/tables13.0.0.go index b1fcb522c..40c169edf 100644 --- a/vendor/golang.org/x/text/width/tables13.0.0.go +++ b/vendor/golang.org/x/text/width/tables13.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.16 && !go1.21 -// +build go1.16,!go1.21 package width diff --git a/vendor/golang.org/x/text/width/tables15.0.0.go b/vendor/golang.org/x/text/width/tables15.0.0.go index 4b91e3384..2b8528967 100644 --- a/vendor/golang.org/x/text/width/tables15.0.0.go +++ b/vendor/golang.org/x/text/width/tables15.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.21 -// +build go1.21 package width diff --git a/vendor/golang.org/x/text/width/tables9.0.0.go b/vendor/golang.org/x/text/width/tables9.0.0.go index 6781f3d96..d981330a9 100644 --- a/vendor/golang.org/x/text/width/tables9.0.0.go +++ b/vendor/golang.org/x/text/width/tables9.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build !go1.10 -// +build !go1.10 package width diff --git a/vendor/golang.org/x/time/rate/rate.go b/vendor/golang.org/x/time/rate/rate.go index f0e0cf3cb..8f6c7f493 100644 --- a/vendor/golang.org/x/time/rate/rate.go +++ b/vendor/golang.org/x/time/rate/rate.go @@ -52,6 +52,8 @@ func Every(interval time.Duration) Limit { // or its associated context.Context is canceled. // // The methods AllowN, ReserveN, and WaitN consume n tokens. +// +// Limiter is safe for simultaneous use by multiple goroutines. type Limiter struct { mu sync.Mutex limit Limit diff --git a/vendor/golang.org/x/tools/internal/typeparams/coretype.go b/vendor/golang.org/x/tools/internal/typeparams/coretype.go index 993135ec9..71248209e 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/coretype.go +++ b/vendor/golang.org/x/tools/internal/typeparams/coretype.go @@ -81,13 +81,13 @@ func CoreType(T types.Type) types.Type { // restrictions may be arbitrarily complex. For example, consider the // following: // -// type A interface{ ~string|~[]byte } +// type A interface{ ~string|~[]byte } // -// type B interface{ int|string } +// type B interface{ int|string } // -// type C interface { ~string|~int } +// type C interface { ~string|~int } // -// type T[P interface{ A|B; C }] int +// type T[P interface{ A|B; C }] int // // In this example, the structural type restriction of P is ~string|int: A|B // expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int, diff --git a/vendor/golang.org/x/tools/internal/typeparams/termlist.go b/vendor/golang.org/x/tools/internal/typeparams/termlist.go index 933106a23..cbd12f801 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/termlist.go +++ b/vendor/golang.org/x/tools/internal/typeparams/termlist.go @@ -30,7 +30,7 @@ func (xl termlist) String() string { var buf bytes.Buffer for i, x := range xl { if i > 0 { - buf.WriteString(" ∪ ") + buf.WriteString(" | ") } buf.WriteString(x.String()) } diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeterm.go b/vendor/golang.org/x/tools/internal/typeparams/typeterm.go index 7ddee28d9..7350bb702 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/typeterm.go +++ b/vendor/golang.org/x/tools/internal/typeparams/typeterm.go @@ -10,11 +10,10 @@ import "go/types" // A term describes elementary type sets: // -// ∅: (*term)(nil) == ∅ // set of no types (empty set) -// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse) -// T: &term{false, T} == {T} // set of type T -// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t -// +// ∅: (*term)(nil) == ∅ // set of no types (empty set) +// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse) +// T: &term{false, T} == {T} // set of type T +// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t type term struct { tilde bool // valid if typ != nil typ types.Type diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go index dbe2e2d0c..6ce01ac9a 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.21.9 +// protoc v3.21.12 // source: google/api/field_behavior.proto package annotations @@ -78,6 +78,19 @@ const ( // a non-empty value will be returned. The user will not be aware of what // non-empty value to expect. FieldBehavior_NON_EMPTY_DEFAULT FieldBehavior = 7 + // Denotes that the field in a resource (a message annotated with + // google.api.resource) is used in the resource name to uniquely identify the + // resource. For AIP-compliant APIs, this should only be applied to the + // `name` field on the resource. + // + // This behavior should not be applied to references to other resources within + // the message. + // + // The identifier field of resources often have different field behavior + // depending on the request it is embedded in (e.g. for Create methods name + // is optional and unused, while for Update methods it is required). Instead + // of method-specific annotations, only `IDENTIFIER` is required. + FieldBehavior_IDENTIFIER FieldBehavior = 8 ) // Enum value maps for FieldBehavior. @@ -91,6 +104,7 @@ var ( 5: "IMMUTABLE", 6: "UNORDERED_LIST", 7: "NON_EMPTY_DEFAULT", + 8: "IDENTIFIER", } FieldBehavior_value = map[string]int32{ "FIELD_BEHAVIOR_UNSPECIFIED": 0, @@ -101,6 +115,7 @@ var ( "IMMUTABLE": 5, "UNORDERED_LIST": 6, "NON_EMPTY_DEFAULT": 7, + "IDENTIFIER": 8, } ) @@ -169,7 +184,7 @@ var file_google_api_field_behavior_proto_rawDesc = []byte{ 0x6f, 0x12, 0x0a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2a, - 0xa6, 0x01, 0x0a, 0x0d, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, + 0xb6, 0x01, 0x0a, 0x0d, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x1a, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x42, 0x45, 0x48, 0x41, 0x56, 0x49, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, @@ -179,7 +194,8 @@ var file_google_api_field_behavior_proto_rawDesc = []byte{ 0x0a, 0x09, 0x49, 0x4d, 0x4d, 0x55, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x45, 0x44, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x10, 0x06, 0x12, 0x15, 0x0a, 0x11, 0x4e, 0x4f, 0x4e, 0x5f, 0x45, 0x4d, 0x50, 0x54, 0x59, 0x5f, 0x44, - 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x07, 0x3a, 0x60, 0x0a, 0x0e, 0x66, 0x69, 0x65, 0x6c, + 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4e, + 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x10, 0x08, 0x3a, 0x60, 0x0a, 0x0e, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x9c, 0x08, 0x20, 0x03, 0x28, 0x0e, diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/field_info.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_info.pb.go new file mode 100644 index 000000000..d02e6bbc8 --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_info.pb.go @@ -0,0 +1,295 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.21.12 +// source: google/api/field_info.proto + +package annotations + +import ( + reflect "reflect" + sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The standard format of a field value. The supported formats are all backed +// by either an RFC defined by the IETF or a Google-defined AIP. +type FieldInfo_Format int32 + +const ( + // Default, unspecified value. + FieldInfo_FORMAT_UNSPECIFIED FieldInfo_Format = 0 + // Universally Unique Identifier, version 4, value as defined by + // https://datatracker.ietf.org/doc/html/rfc4122. The value may be + // normalized to entirely lowercase letters. For example, the value + // `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to + // `f47ac10b-58cc-0372-8567-0e02b2c3d479`. + FieldInfo_UUID4 FieldInfo_Format = 1 + // Internet Protocol v4 value as defined by [RFC + // 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be + // condensed, with leading zeros in each octet stripped. For example, + // `001.022.233.040` would be condensed to `1.22.233.40`. + FieldInfo_IPV4 FieldInfo_Format = 2 + // Internet Protocol v6 value as defined by [RFC + // 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be + // normalized to entirely lowercase letters, and zero-padded partial and + // empty octets. For example, the value `2001:DB8::` would be normalized to + // `2001:0db8:0:0`. + FieldInfo_IPV6 FieldInfo_Format = 3 + // An IP address in either v4 or v6 format as described by the individual + // values defined herein. See the comments on the IPV4 and IPV6 types for + // allowed normalizations of each. + FieldInfo_IPV4_OR_IPV6 FieldInfo_Format = 4 +) + +// Enum value maps for FieldInfo_Format. +var ( + FieldInfo_Format_name = map[int32]string{ + 0: "FORMAT_UNSPECIFIED", + 1: "UUID4", + 2: "IPV4", + 3: "IPV6", + 4: "IPV4_OR_IPV6", + } + FieldInfo_Format_value = map[string]int32{ + "FORMAT_UNSPECIFIED": 0, + "UUID4": 1, + "IPV4": 2, + "IPV6": 3, + "IPV4_OR_IPV6": 4, + } +) + +func (x FieldInfo_Format) Enum() *FieldInfo_Format { + p := new(FieldInfo_Format) + *p = x + return p +} + +func (x FieldInfo_Format) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FieldInfo_Format) Descriptor() protoreflect.EnumDescriptor { + return file_google_api_field_info_proto_enumTypes[0].Descriptor() +} + +func (FieldInfo_Format) Type() protoreflect.EnumType { + return &file_google_api_field_info_proto_enumTypes[0] +} + +func (x FieldInfo_Format) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use FieldInfo_Format.Descriptor instead. +func (FieldInfo_Format) EnumDescriptor() ([]byte, []int) { + return file_google_api_field_info_proto_rawDescGZIP(), []int{0, 0} +} + +// Rich semantic information of an API field beyond basic typing. +type FieldInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The standard format of a field value. This does not explicitly configure + // any API consumer, just documents the API's format for the field it is + // applied to. + Format FieldInfo_Format `protobuf:"varint,1,opt,name=format,proto3,enum=google.api.FieldInfo_Format" json:"format,omitempty"` +} + +func (x *FieldInfo) Reset() { + *x = FieldInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_google_api_field_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FieldInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldInfo) ProtoMessage() {} + +func (x *FieldInfo) ProtoReflect() protoreflect.Message { + mi := &file_google_api_field_info_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldInfo.ProtoReflect.Descriptor instead. +func (*FieldInfo) Descriptor() ([]byte, []int) { + return file_google_api_field_info_proto_rawDescGZIP(), []int{0} +} + +func (x *FieldInfo) GetFormat() FieldInfo_Format { + if x != nil { + return x.Format + } + return FieldInfo_FORMAT_UNSPECIFIED +} + +var file_google_api_field_info_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*FieldInfo)(nil), + Field: 291403980, + Name: "google.api.field_info", + Tag: "bytes,291403980,opt,name=field_info", + Filename: "google/api/field_info.proto", + }, +} + +// Extension fields to descriptorpb.FieldOptions. +var ( + // Rich semantic descriptor of an API field beyond the basic typing. + // + // Examples: + // + // string request_id = 1 [(google.api.field_info).format = UUID4]; + // string old_ip_address = 2 [(google.api.field_info).format = IPV4]; + // string new_ip_address = 3 [(google.api.field_info).format = IPV6]; + // string actual_ip_address = 4 [ + // (google.api.field_info).format = IPV4_OR_IPV6 + // ]; + // + // optional google.api.FieldInfo field_info = 291403980; + E_FieldInfo = &file_google_api_field_info_proto_extTypes[0] +) + +var File_google_api_field_info_proto protoreflect.FileDescriptor + +var file_google_api_field_info_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x94, 0x01, 0x0a, 0x09, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x34, 0x0a, 0x06, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, + 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, + 0x51, 0x0a, 0x06, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x16, 0x0a, 0x12, 0x46, 0x4f, 0x52, + 0x4d, 0x41, 0x54, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x55, 0x49, 0x44, 0x34, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, + 0x49, 0x50, 0x56, 0x34, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x50, 0x56, 0x36, 0x10, 0x03, + 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x50, 0x56, 0x34, 0x5f, 0x4f, 0x52, 0x5f, 0x49, 0x50, 0x56, 0x36, + 0x10, 0x04, 0x3a, 0x57, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x69, 0x6e, 0x66, 0x6f, + 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0xcc, 0xf1, 0xf9, 0x8a, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x6c, 0x0a, 0x0e, 0x63, + 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x0e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x41, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, + 0x72, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0xa2, 0x02, 0x04, 0x47, 0x41, 0x50, 0x49, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_google_api_field_info_proto_rawDescOnce sync.Once + file_google_api_field_info_proto_rawDescData = file_google_api_field_info_proto_rawDesc +) + +func file_google_api_field_info_proto_rawDescGZIP() []byte { + file_google_api_field_info_proto_rawDescOnce.Do(func() { + file_google_api_field_info_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_api_field_info_proto_rawDescData) + }) + return file_google_api_field_info_proto_rawDescData +} + +var file_google_api_field_info_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_google_api_field_info_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_google_api_field_info_proto_goTypes = []interface{}{ + (FieldInfo_Format)(0), // 0: google.api.FieldInfo.Format + (*FieldInfo)(nil), // 1: google.api.FieldInfo + (*descriptorpb.FieldOptions)(nil), // 2: google.protobuf.FieldOptions +} +var file_google_api_field_info_proto_depIdxs = []int32{ + 0, // 0: google.api.FieldInfo.format:type_name -> google.api.FieldInfo.Format + 2, // 1: google.api.field_info:extendee -> google.protobuf.FieldOptions + 1, // 2: google.api.field_info:type_name -> google.api.FieldInfo + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 2, // [2:3] is the sub-list for extension type_name + 1, // [1:2] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_google_api_field_info_proto_init() } +func file_google_api_field_info_proto_init() { + if File_google_api_field_info_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_google_api_field_info_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FieldInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_google_api_field_info_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 1, + NumServices: 0, + }, + GoTypes: file_google_api_field_info_proto_goTypes, + DependencyIndexes: file_google_api_field_info_proto_depIdxs, + EnumInfos: file_google_api_field_info_proto_enumTypes, + MessageInfos: file_google_api_field_info_proto_msgTypes, + ExtensionInfos: file_google_api_field_info_proto_extTypes, + }.Build() + File_google_api_field_info_proto = out.File + file_google_api_field_info_proto_rawDesc = nil + file_google_api_field_info_proto_goTypes = nil + file_google_api_field_info_proto_depIdxs = nil +} diff --git a/vendor/google.golang.org/grpc/README.md b/vendor/google.golang.org/grpc/README.md index 1bc92248c..ab0fbb79b 100644 --- a/vendor/google.golang.org/grpc/README.md +++ b/vendor/google.golang.org/grpc/README.md @@ -1,8 +1,8 @@ # gRPC-Go -[![Build Status](https://travis-ci.org/grpc/grpc-go.svg)](https://travis-ci.org/grpc/grpc-go) [![GoDoc](https://pkg.go.dev/badge/google.golang.org/grpc)][API] [![GoReportCard](https://goreportcard.com/badge/grpc/grpc-go)](https://goreportcard.com/report/github.com/grpc/grpc-go) +[![codecov](https://codecov.io/gh/grpc/grpc-go/graph/badge.svg)](https://codecov.io/gh/grpc/grpc-go) The [Go][] implementation of [gRPC][]: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the diff --git a/vendor/google.golang.org/grpc/attributes/attributes.go b/vendor/google.golang.org/grpc/attributes/attributes.go index 712fef4d0..52d530d7a 100644 --- a/vendor/google.golang.org/grpc/attributes/attributes.go +++ b/vendor/google.golang.org/grpc/attributes/attributes.go @@ -121,9 +121,9 @@ func (a *Attributes) String() string { return sb.String() } -func str(x any) string { +func str(x any) (s string) { if v, ok := x.(fmt.Stringer); ok { - return v.String() + return fmt.Sprint(v) } else if v, ok := x.(string); ok { return v } diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index b6377f445..d79560a2e 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -30,6 +30,7 @@ import ( "google.golang.org/grpc/channelz" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" "google.golang.org/grpc/metadata" "google.golang.org/grpc/resolver" @@ -39,6 +40,8 @@ import ( var ( // m is a map from name to balancer builder. m = make(map[string]Builder) + + logger = grpclog.Component("balancer") ) // Register registers the balancer builder to the balancer map. b.Name @@ -51,6 +54,12 @@ var ( // an init() function), and is not thread-safe. If multiple Balancers are // registered with the same name, the one registered last will take effect. func Register(b Builder) { + if strings.ToLower(b.Name()) != b.Name() { + // TODO: Skip the use of strings.ToLower() to index the map after v1.59 + // is released to switch to case sensitive balancer registry. Also, + // remove this warning and update the docstrings for Register and Get. + logger.Warningf("Balancer registered with name %q. grpc-go will be switching to case sensitive balancer registries soon", b.Name()) + } m[strings.ToLower(b.Name())] = b } @@ -70,6 +79,12 @@ func init() { // Note that the compare is done in a case-insensitive fashion. // If no builder is register with the name, nil will be returned. func Get(name string) Builder { + if strings.ToLower(name) != name { + // TODO: Skip the use of strings.ToLower() to index the map after v1.59 + // is released to switch to case sensitive balancer registry. Also, + // remove this warning and update the docstrings for Register and Get. + logger.Warningf("Balancer retrieved for name %q. grpc-go will be switching to case sensitive balancer registries soon", name) + } if b, ok := m[strings.ToLower(name)]; ok { return b } diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index ff7fea102..429c389e4 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -337,8 +337,8 @@ func (cc *ClientConn) exitIdleMode() error { return errConnClosing } if cc.idlenessState != ccIdlenessStateIdle { - cc.mu.Unlock() channelz.Infof(logger, cc.channelzID, "ClientConn asked to exit idle mode, current mode is %v", cc.idlenessState) + cc.mu.Unlock() return nil } @@ -404,13 +404,13 @@ func (cc *ClientConn) exitIdleMode() error { // name resolver, load balancer and any subchannels. func (cc *ClientConn) enterIdleMode() error { cc.mu.Lock() + defer cc.mu.Unlock() + if cc.conns == nil { - cc.mu.Unlock() return ErrClientConnClosing } if cc.idlenessState != ccIdlenessStateActive { - channelz.Errorf(logger, cc.channelzID, "ClientConn asked to enter idle mode, current mode is %v", cc.idlenessState) - cc.mu.Unlock() + channelz.Warningf(logger, cc.channelzID, "ClientConn asked to enter idle mode, current mode is %v", cc.idlenessState) return nil } @@ -431,14 +431,14 @@ func (cc *ClientConn) enterIdleMode() error { cc.balancerWrapper.enterIdleMode() cc.csMgr.updateState(connectivity.Idle) cc.idlenessState = ccIdlenessStateIdle - cc.mu.Unlock() + cc.addTraceEvent("entering idle mode") go func() { - cc.addTraceEvent("entering idle mode") for ac := range conns { ac.tearDown(errConnIdling) } }() + return nil } @@ -804,6 +804,12 @@ func init() { internal.SubscribeToConnectivityStateChanges = func(cc *ClientConn, s grpcsync.Subscriber) func() { return cc.csMgr.pubSub.Subscribe(s) } + internal.EnterIdleModeForTesting = func(cc *ClientConn) error { + return cc.enterIdleMode() + } + internal.ExitIdleModeForTesting = func(cc *ClientConn) error { + return cc.exitIdleMode() + } } func (cc *ClientConn) maybeApplyDefaultServiceConfig(addrs []resolver.Address) { diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index 1fd0d5c12..cfc9fd85e 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -644,6 +644,7 @@ func defaultDialOptions() dialOptions { UseProxy: true, }, recvBufferPool: nopBufferPool{}, + idleTimeout: 30 * time.Minute, } } @@ -680,8 +681,8 @@ func WithResolvers(rs ...resolver.Builder) DialOption { // channel will exit idle mode when the Connect() method is called or when an // RPC is initiated. // -// By default this feature is disabled, which can also be explicitly configured -// by passing zero to this function. +// A default timeout of 30 minutes will be used if this dial option is not set +// at dial time and idleness can be disabled by passing a timeout of zero. // // # Experimental // diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index 69d5580b6..5ebf88d71 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -38,6 +38,10 @@ const Identity = "identity" // Compressor is used for compressing and decompressing when sending or // receiving messages. +// +// If a Compressor implements `DecompressedSize(compressedBytes []byte) int`, +// gRPC will invoke it to determine the size of the buffer allocated for the +// result of decompression. A return value of -1 indicates unknown size. type Compressor interface { // Compress writes the data written to wc to w after compressing it. If an // error occurs while initializing the compressor, that error is returned @@ -51,15 +55,6 @@ type Compressor interface { // coding header. The result must be static; the result cannot change // between calls. Name() string - // If a Compressor implements - // DecompressedSize(compressedBytes []byte) int, gRPC will call it - // to determine the size of the buffer allocated for the result of decompression. - // Return -1 to indicate unknown size. - // - // Experimental - // - // Notice: This API is EXPERIMENTAL and may be changed or removed in a - // later release. } var registeredCompressor = make(map[string]Compressor) diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go new file mode 100644 index 000000000..24299efd6 --- /dev/null +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go @@ -0,0 +1,308 @@ +// Copyright 2015 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.22.0 +// source: grpc/health/v1/health.proto + +package grpc_health_v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type HealthCheckResponse_ServingStatus int32 + +const ( + HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 + HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 + HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 + HealthCheckResponse_SERVICE_UNKNOWN HealthCheckResponse_ServingStatus = 3 // Used only by the Watch method. +) + +// Enum value maps for HealthCheckResponse_ServingStatus. +var ( + HealthCheckResponse_ServingStatus_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SERVING", + 2: "NOT_SERVING", + 3: "SERVICE_UNKNOWN", + } + HealthCheckResponse_ServingStatus_value = map[string]int32{ + "UNKNOWN": 0, + "SERVING": 1, + "NOT_SERVING": 2, + "SERVICE_UNKNOWN": 3, + } +) + +func (x HealthCheckResponse_ServingStatus) Enum() *HealthCheckResponse_ServingStatus { + p := new(HealthCheckResponse_ServingStatus) + *p = x + return p +} + +func (x HealthCheckResponse_ServingStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor { + return file_grpc_health_v1_health_proto_enumTypes[0].Descriptor() +} + +func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType { + return &file_grpc_health_v1_health_proto_enumTypes[0] +} + +func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use HealthCheckResponse_ServingStatus.Descriptor instead. +func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { + return file_grpc_health_v1_health_proto_rawDescGZIP(), []int{1, 0} +} + +type HealthCheckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` +} + +func (x *HealthCheckRequest) Reset() { + *x = HealthCheckRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_grpc_health_v1_health_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthCheckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckRequest) ProtoMessage() {} + +func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_health_v1_health_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead. +func (*HealthCheckRequest) Descriptor() ([]byte, []int) { + return file_grpc_health_v1_health_proto_rawDescGZIP(), []int{0} +} + +func (x *HealthCheckRequest) GetService() string { + if x != nil { + return x.Service + } + return "" +} + +type HealthCheckResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` +} + +func (x *HealthCheckResponse) Reset() { + *x = HealthCheckResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_grpc_health_v1_health_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthCheckResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckResponse) ProtoMessage() {} + +func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_health_v1_health_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead. +func (*HealthCheckResponse) Descriptor() ([]byte, []int) { + return file_grpc_health_v1_health_proto_rawDescGZIP(), []int{1} +} + +func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { + if x != nil { + return x.Status + } + return HealthCheckResponse_UNKNOWN +} + +var File_grpc_health_v1_health_proto protoreflect.FileDescriptor + +var file_grpc_health_v1_health_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2f, 0x76, 0x31, + 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x22, 0x2e, 0x0a, + 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0xb1, 0x01, + 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0x4f, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, + 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, + 0x4f, 0x54, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, + 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x03, 0x32, 0xae, 0x01, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x50, 0x0a, 0x05, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, + 0x0a, 0x05, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, + 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x30, 0x01, 0x42, 0x61, 0x0a, 0x11, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, + 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, + 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x68, + 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x5f, 0x76, 0x31, 0xaa, 0x02, 0x0e, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x2e, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_grpc_health_v1_health_proto_rawDescOnce sync.Once + file_grpc_health_v1_health_proto_rawDescData = file_grpc_health_v1_health_proto_rawDesc +) + +func file_grpc_health_v1_health_proto_rawDescGZIP() []byte { + file_grpc_health_v1_health_proto_rawDescOnce.Do(func() { + file_grpc_health_v1_health_proto_rawDescData = protoimpl.X.CompressGZIP(file_grpc_health_v1_health_proto_rawDescData) + }) + return file_grpc_health_v1_health_proto_rawDescData +} + +var file_grpc_health_v1_health_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_grpc_health_v1_health_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_grpc_health_v1_health_proto_goTypes = []interface{}{ + (HealthCheckResponse_ServingStatus)(0), // 0: grpc.health.v1.HealthCheckResponse.ServingStatus + (*HealthCheckRequest)(nil), // 1: grpc.health.v1.HealthCheckRequest + (*HealthCheckResponse)(nil), // 2: grpc.health.v1.HealthCheckResponse +} +var file_grpc_health_v1_health_proto_depIdxs = []int32{ + 0, // 0: grpc.health.v1.HealthCheckResponse.status:type_name -> grpc.health.v1.HealthCheckResponse.ServingStatus + 1, // 1: grpc.health.v1.Health.Check:input_type -> grpc.health.v1.HealthCheckRequest + 1, // 2: grpc.health.v1.Health.Watch:input_type -> grpc.health.v1.HealthCheckRequest + 2, // 3: grpc.health.v1.Health.Check:output_type -> grpc.health.v1.HealthCheckResponse + 2, // 4: grpc.health.v1.Health.Watch:output_type -> grpc.health.v1.HealthCheckResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_grpc_health_v1_health_proto_init() } +func file_grpc_health_v1_health_proto_init() { + if File_grpc_health_v1_health_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_grpc_health_v1_health_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheckRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_grpc_health_v1_health_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheckResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_grpc_health_v1_health_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_grpc_health_v1_health_proto_goTypes, + DependencyIndexes: file_grpc_health_v1_health_proto_depIdxs, + EnumInfos: file_grpc_health_v1_health_proto_enumTypes, + MessageInfos: file_grpc_health_v1_health_proto_msgTypes, + }.Build() + File_grpc_health_v1_health_proto = out.File + file_grpc_health_v1_health_proto_rawDesc = nil + file_grpc_health_v1_health_proto_goTypes = nil + file_grpc_health_v1_health_proto_depIdxs = nil +} diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go new file mode 100644 index 000000000..4439cda0f --- /dev/null +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go @@ -0,0 +1,237 @@ +// Copyright 2015 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.22.0 +// source: grpc/health/v1/health.proto + +package grpc_health_v1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Health_Check_FullMethodName = "/grpc.health.v1.Health/Check" + Health_Watch_FullMethodName = "/grpc.health.v1.Health/Watch" +) + +// HealthClient is the client API for Health service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type HealthClient interface { + // Check gets the health of the specified service. If the requested service + // is unknown, the call will fail with status NOT_FOUND. If the caller does + // not specify a service name, the server should respond with its overall + // health status. + // + // Clients should set a deadline when calling Check, and can declare the + // server unhealthy if they do not receive a timely response. + // + // Check implementations should be idempotent and side effect free. + Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) + // Performs a watch for the serving status of the requested service. + // The server will immediately send back a message indicating the current + // serving status. It will then subsequently send a new message whenever + // the service's serving status changes. + // + // If the requested service is unknown when the call is received, the + // server will send a message setting the serving status to + // SERVICE_UNKNOWN but will *not* terminate the call. If at some + // future point, the serving status of the service becomes known, the + // server will send a new message with the service's serving status. + // + // If the call terminates with status UNIMPLEMENTED, then clients + // should assume this method is not supported and should not retry the + // call. If the call terminates with any other status (including OK), + // clients should retry the call with appropriate exponential backoff. + Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) +} + +type healthClient struct { + cc grpc.ClientConnInterface +} + +func NewHealthClient(cc grpc.ClientConnInterface) HealthClient { + return &healthClient{cc} +} + +func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { + out := new(HealthCheckResponse) + err := c.cc.Invoke(ctx, Health_Check_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) { + stream, err := c.cc.NewStream(ctx, &Health_ServiceDesc.Streams[0], Health_Watch_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &healthWatchClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Health_WatchClient interface { + Recv() (*HealthCheckResponse, error) + grpc.ClientStream +} + +type healthWatchClient struct { + grpc.ClientStream +} + +func (x *healthWatchClient) Recv() (*HealthCheckResponse, error) { + m := new(HealthCheckResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// HealthServer is the server API for Health service. +// All implementations should embed UnimplementedHealthServer +// for forward compatibility +type HealthServer interface { + // Check gets the health of the specified service. If the requested service + // is unknown, the call will fail with status NOT_FOUND. If the caller does + // not specify a service name, the server should respond with its overall + // health status. + // + // Clients should set a deadline when calling Check, and can declare the + // server unhealthy if they do not receive a timely response. + // + // Check implementations should be idempotent and side effect free. + Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) + // Performs a watch for the serving status of the requested service. + // The server will immediately send back a message indicating the current + // serving status. It will then subsequently send a new message whenever + // the service's serving status changes. + // + // If the requested service is unknown when the call is received, the + // server will send a message setting the serving status to + // SERVICE_UNKNOWN but will *not* terminate the call. If at some + // future point, the serving status of the service becomes known, the + // server will send a new message with the service's serving status. + // + // If the call terminates with status UNIMPLEMENTED, then clients + // should assume this method is not supported and should not retry the + // call. If the call terminates with any other status (including OK), + // clients should retry the call with appropriate exponential backoff. + Watch(*HealthCheckRequest, Health_WatchServer) error +} + +// UnimplementedHealthServer should be embedded to have forward compatible implementations. +type UnimplementedHealthServer struct { +} + +func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Check not implemented") +} +func (UnimplementedHealthServer) Watch(*HealthCheckRequest, Health_WatchServer) error { + return status.Errorf(codes.Unimplemented, "method Watch not implemented") +} + +// UnsafeHealthServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to HealthServer will +// result in compilation errors. +type UnsafeHealthServer interface { + mustEmbedUnimplementedHealthServer() +} + +func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer) { + s.RegisterService(&Health_ServiceDesc, srv) +} + +func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HealthServer).Check(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Health_Check_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Health_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(HealthCheckRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(HealthServer).Watch(m, &healthWatchServer{stream}) +} + +type Health_WatchServer interface { + Send(*HealthCheckResponse) error + grpc.ServerStream +} + +type healthWatchServer struct { + grpc.ServerStream +} + +func (x *healthWatchServer) Send(m *HealthCheckResponse) error { + return x.ServerStream.SendMsg(m) +} + +// Health_ServiceDesc is the grpc.ServiceDesc for Health service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Health_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.health.v1.Health", + HandlerType: (*HealthServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Check", + Handler: _Health_Check_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Watch", + Handler: _Health_Watch_Handler, + ServerStreams: true, + }, + }, + Metadata: "grpc/health/v1/health.proto", +} diff --git a/vendor/google.golang.org/grpc/internal/backoff/backoff.go b/vendor/google.golang.org/grpc/internal/backoff/backoff.go index 5fc0ee3da..fed1c011a 100644 --- a/vendor/google.golang.org/grpc/internal/backoff/backoff.go +++ b/vendor/google.golang.org/grpc/internal/backoff/backoff.go @@ -23,6 +23,8 @@ package backoff import ( + "context" + "errors" "time" grpcbackoff "google.golang.org/grpc/backoff" @@ -71,3 +73,37 @@ func (bc Exponential) Backoff(retries int) time.Duration { } return time.Duration(backoff) } + +// ErrResetBackoff is the error to be returned by the function executed by RunF, +// to instruct the latter to reset its backoff state. +var ErrResetBackoff = errors.New("reset backoff state") + +// RunF provides a convenient way to run a function f repeatedly until the +// context expires or f returns a non-nil error that is not ErrResetBackoff. +// When f returns ErrResetBackoff, RunF continues to run f, but resets its +// backoff state before doing so. backoff accepts an integer representing the +// number of retries, and returns the amount of time to backoff. +func RunF(ctx context.Context, f func() error, backoff func(int) time.Duration) { + attempt := 0 + timer := time.NewTimer(0) + for ctx.Err() == nil { + select { + case <-timer.C: + case <-ctx.Done(): + timer.Stop() + return + } + + err := f() + if errors.Is(err, ErrResetBackoff) { + timer.Reset(0) + attempt = 0 + continue + } + if err != nil { + return + } + timer.Reset(backoff(attempt)) + attempt++ + } +} diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index c8a8c76d6..0d94c63e0 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -175,6 +175,12 @@ var ( // GRPCResolverSchemeExtraMetadata determines when gRPC will add extra // metadata to RPCs. GRPCResolverSchemeExtraMetadata string = "xds" + + // EnterIdleModeForTesting gets the ClientConn to enter IDLE mode. + EnterIdleModeForTesting any // func(*grpc.ClientConn) error + + // ExitIdleModeForTesting gets the ClientConn to exit IDLE mode. + ExitIdleModeForTesting any // func(*grpc.ClientConn) error ) // HealthChecker defines the signature of the client-side LB channel health checking function. diff --git a/vendor/google.golang.org/grpc/internal/status/status.go b/vendor/google.golang.org/grpc/internal/status/status.go index 4cf85cad9..03ef2fedd 100644 --- a/vendor/google.golang.org/grpc/internal/status/status.go +++ b/vendor/google.golang.org/grpc/internal/status/status.go @@ -43,6 +43,34 @@ type Status struct { s *spb.Status } +// NewWithProto returns a new status including details from statusProto. This +// is meant to be used by the gRPC library only. +func NewWithProto(code codes.Code, message string, statusProto []string) *Status { + if len(statusProto) != 1 { + // No grpc-status-details bin header, or multiple; just ignore. + return &Status{s: &spb.Status{Code: int32(code), Message: message}} + } + st := &spb.Status{} + if err := proto.Unmarshal([]byte(statusProto[0]), st); err != nil { + // Probably not a google.rpc.Status proto; do not provide details. + return &Status{s: &spb.Status{Code: int32(code), Message: message}} + } + if st.Code == int32(code) { + // The codes match between the grpc-status header and the + // grpc-status-details-bin header; use the full details proto. + return &Status{s: st} + } + return &Status{ + s: &spb.Status{ + Code: int32(codes.Internal), + Message: fmt.Sprintf( + "grpc-status-details-bin mismatch: grpc-status=%v, grpc-message=%q, grpc-status-details-bin=%+v", + code, message, st, + ), + }, + } +} + // New returns a Status representing c and msg. func New(c codes.Code, msg string) *Status { return &Status{s: &spb.Status{Code: int32(c), Message: msg}} diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index 98f80e3fa..17f7a21b5 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -220,18 +220,20 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro h.Set("Grpc-Message", encodeGrpcMessage(m)) } + s.hdrMu.Lock() if p := st.Proto(); p != nil && len(p.Details) > 0 { + delete(s.trailer, grpcStatusDetailsBinHeader) stBytes, err := proto.Marshal(p) if err != nil { // TODO: return error instead, when callers are able to handle it. panic(err) } - h.Set("Grpc-Status-Details-Bin", encodeBinHeader(stBytes)) + h.Set(grpcStatusDetailsBinHeader, encodeBinHeader(stBytes)) } - if md := s.Trailer(); len(md) > 0 { - for k, vv := range md { + if len(s.trailer) > 0 { + for k, vv := range s.trailer { // Clients don't tolerate reading restricted headers after some non restricted ones were sent. if isReservedHeader(k) { continue @@ -243,6 +245,7 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro } } } + s.hdrMu.Unlock() }) if err == nil { // transport has not been closed @@ -287,7 +290,7 @@ func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) { } // writeCustomHeaders sets custom headers set on the stream via SetHeader -// on the first write call (Write, WriteHeader, or WriteStatus). +// on the first write call (Write, WriteHeader, or WriteStatus) func (ht *serverHandlerTransport) writeCustomHeaders(s *Stream) { h := ht.rw.Header() @@ -344,7 +347,7 @@ func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { return err } -func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) { +func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream)) { // With this transport type there will be exactly 1 stream: this HTTP request. ctx := ht.req.Context() diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index badab8acf..d6f5c4935 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -1399,7 +1399,6 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { mdata = make(map[string][]string) contentTypeErr = "malformed header: missing HTTP content-type" grpcMessage string - statusGen *status.Status recvCompress string httpStatusCode *int httpStatusErr string @@ -1434,12 +1433,6 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { rawStatusCode = codes.Code(uint32(code)) case "grpc-message": grpcMessage = decodeGrpcMessage(hf.Value) - case "grpc-status-details-bin": - var err error - statusGen, err = decodeGRPCStatusDetails(hf.Value) - if err != nil { - headerError = fmt.Sprintf("transport: malformed grpc-status-details-bin: %v", err) - } case ":status": if hf.Value == "200" { httpStatusErr = "" @@ -1548,14 +1541,12 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { return } - if statusGen == nil { - statusGen = status.New(rawStatusCode, grpcMessage) - } + status := istatus.NewWithProto(rawStatusCode, grpcMessage, mdata[grpcStatusDetailsBinHeader]) // If client received END_STREAM from server while stream was still active, // send RST_STREAM. rstStream := s.getState() == streamActive - t.closeStream(s, io.EOF, rstStream, http2.ErrCodeNo, statusGen, mdata, true) + t.closeStream(s, io.EOF, rstStream, http2.ErrCodeNo, status, mdata, true) } // readServerPreface reads and handles the initial settings frame from the diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index c06db679d..6fa1eb419 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -342,7 +342,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, // operateHeaders takes action on the decoded headers. Returns an error if fatal // error encountered and transport needs to close, otherwise returns nil. -func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) error { +func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream)) error { // Acquire max stream ID lock for entire duration t.maxStreamMu.Lock() defer t.maxStreamMu.Unlock() @@ -561,7 +561,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( } if t.inTapHandle != nil { var err error - if s.ctx, err = t.inTapHandle(s.ctx, &tap.Info{FullMethodName: s.method}); err != nil { + if s.ctx, err = t.inTapHandle(s.ctx, &tap.Info{FullMethodName: s.method, Header: mdata}); err != nil { t.mu.Unlock() if t.logger.V(logLevel) { t.logger.Infof("Aborting the stream early due to InTapHandle failure: %v", err) @@ -592,7 +592,6 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( s.requestRead = func(n int) { t.adjustWindow(s, uint32(n)) } - s.ctx = traceCtx(s.ctx, s.method) for _, sh := range t.stats { s.ctx = sh.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) inHeader := &stats.InHeader{ @@ -630,7 +629,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( // HandleStreams receives incoming streams using the given handler. This is // typically run in a separate goroutine. // traceCtx attaches trace to ctx and returns the new context. -func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) { +func (t *http2Server) HandleStreams(handle func(*Stream)) { defer close(t.readerDone) for { t.controlBuf.throttle() @@ -665,7 +664,7 @@ func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context. } switch frame := frame.(type) { case *http2.MetaHeadersFrame: - if err := t.operateHeaders(frame, handle, traceCtx); err != nil { + if err := t.operateHeaders(frame, handle); err != nil { t.Close(err) break } @@ -1053,12 +1052,15 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) if p := st.Proto(); p != nil && len(p.Details) > 0 { + // Do not use the user's grpc-status-details-bin (if present) if we are + // even attempting to set our own. + delete(s.trailer, grpcStatusDetailsBinHeader) stBytes, err := proto.Marshal(p) if err != nil { // TODO: return error instead, when callers are able to handle it. t.logger.Errorf("Failed to marshal rpc status: %s, error: %v", pretty.ToJSON(p), err) } else { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status-details-bin", Value: encodeBinHeader(stBytes)}) + headerFields = append(headerFields, hpack.HeaderField{Name: grpcStatusDetailsBinHeader, Value: encodeBinHeader(stBytes)}) } } diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index 195814008..dc29d590e 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -34,12 +34,9 @@ import ( "time" "unicode/utf8" - "github.com/golang/protobuf/proto" "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" - spb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) const ( @@ -88,6 +85,8 @@ var ( } ) +var grpcStatusDetailsBinHeader = "grpc-status-details-bin" + // isReservedHeader checks whether hdr belongs to HTTP2 headers // reserved by gRPC protocol. Any other headers are classified as the // user-specified metadata. @@ -103,7 +102,6 @@ func isReservedHeader(hdr string) bool { "grpc-message", "grpc-status", "grpc-timeout", - "grpc-status-details-bin", // Intentionally exclude grpc-previous-rpc-attempts and // grpc-retry-pushback-ms, which are "reserved", but their API // intentionally works via metadata. @@ -154,18 +152,6 @@ func decodeMetadataHeader(k, v string) (string, error) { return v, nil } -func decodeGRPCStatusDetails(rawDetails string) (*status.Status, error) { - v, err := decodeBinHeader(rawDetails) - if err != nil { - return nil, err - } - st := &spb.Status{} - if err = proto.Unmarshal(v, st); err != nil { - return nil, err - } - return status.FromProto(st), nil -} - type timeoutUnit uint8 const ( diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index 74a811fc0..aac056e72 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -698,7 +698,7 @@ type ClientTransport interface { // Write methods for a given Stream will be called serially. type ServerTransport interface { // HandleStreams receives incoming streams using the given handler. - HandleStreams(func(*Stream), func(context.Context, string) context.Context) + HandleStreams(func(*Stream)) // WriteHeader sends the header metadata for the given stream. // WriteHeader may not be called on all streams. diff --git a/vendor/google.golang.org/grpc/resolver/manual/manual.go b/vendor/google.golang.org/grpc/resolver/manual/manual.go index e6b0f14cd..0a4262342 100644 --- a/vendor/google.golang.org/grpc/resolver/manual/manual.go +++ b/vendor/google.golang.org/grpc/resolver/manual/manual.go @@ -26,7 +26,9 @@ import ( "google.golang.org/grpc/resolver" ) -// NewBuilderWithScheme creates a new test resolver builder with the given scheme. +// NewBuilderWithScheme creates a new manual resolver builder with the given +// scheme. Every instance of the manual resolver may only ever be used with a +// single grpc.ClientConn. Otherwise, bad things will happen. func NewBuilderWithScheme(scheme string) *Resolver { return &Resolver{ BuildCallback: func(resolver.Target, resolver.ClientConn, resolver.BuildOptions) {}, @@ -58,30 +60,34 @@ type Resolver struct { scheme string // Fields actually belong to the resolver. - mu sync.Mutex // Guards access to CC. - CC resolver.ClientConn - bootstrapState *resolver.State + // Guards access to below fields. + mu sync.Mutex + CC resolver.ClientConn + // Storing the most recent state update makes this resolver resilient to + // restarts, which is possible with channel idleness. + lastSeenState *resolver.State } // InitialState adds initial state to the resolver so that UpdateState doesn't // need to be explicitly called after Dial. func (r *Resolver) InitialState(s resolver.State) { - r.bootstrapState = &s + r.lastSeenState = &s } // Build returns itself for Resolver, because it's both a builder and a resolver. func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { + r.BuildCallback(target, cc, opts) r.mu.Lock() r.CC = cc - r.mu.Unlock() - r.BuildCallback(target, cc, opts) - if r.bootstrapState != nil { - r.UpdateState(*r.bootstrapState) + if r.lastSeenState != nil { + err := r.CC.UpdateState(*r.lastSeenState) + go r.UpdateStateCallback(err) } + r.mu.Unlock() return r, nil } -// Scheme returns the test scheme. +// Scheme returns the manual resolver's scheme. func (r *Resolver) Scheme() string { return r.scheme } @@ -100,6 +106,7 @@ func (r *Resolver) Close() { func (r *Resolver) UpdateState(s resolver.State) { r.mu.Lock() err := r.CC.UpdateState(s) + r.lastSeenState = &s r.mu.Unlock() r.UpdateStateCallback(err) } diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index eeae92fbe..8f60d4214 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -983,7 +983,7 @@ func (s *Server) serveStreams(st transport.ServerTransport) { f := func() { defer streamQuota.release() defer wg.Done() - s.handleStream(st, stream, s.traceInfo(st, stream)) + s.handleStream(st, stream) } if s.opts.numServerWorkers > 0 { @@ -995,12 +995,6 @@ func (s *Server) serveStreams(st transport.ServerTransport) { } } go f() - }, func(ctx context.Context, method string) context.Context { - if !EnableTracing { - return ctx - } - tr := trace.New("grpc.Recv."+methodFamily(method), method) - return trace.NewContext(ctx, tr) }) wg.Wait() } @@ -1049,30 +1043,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { s.serveStreams(st) } -// traceInfo returns a traceInfo and associates it with stream, if tracing is enabled. -// If tracing is not enabled, it returns nil. -func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Stream) (trInfo *traceInfo) { - if !EnableTracing { - return nil - } - tr, ok := trace.FromContext(stream.Context()) - if !ok { - return nil - } - - trInfo = &traceInfo{ - tr: tr, - firstLine: firstLine{ - client: false, - remoteAddr: st.RemoteAddr(), - }, - } - if dl, ok := stream.Context().Deadline(); ok { - trInfo.firstLine.deadline = time.Until(dl) - } - return trInfo -} - func (s *Server) addConn(addr string, st transport.ServerTransport) bool { s.mu.Lock() defer s.mu.Unlock() @@ -1133,7 +1103,7 @@ func (s *Server) incrCallsFailed() { atomic.AddInt64(&s.czData.callsFailed, 1) } -func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg any, cp Compressor, opts *transport.Options, comp encoding.Compressor) error { +func (s *Server) sendResponse(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, msg any, cp Compressor, opts *transport.Options, comp encoding.Compressor) error { data, err := encode(s.getCodec(stream.ContentSubtype()), msg) if err != nil { channelz.Error(logger, s.channelzID, "grpc: server failed to encode response: ", err) @@ -1152,7 +1122,7 @@ func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Str err = t.Write(stream, hdr, payload, opts) if err == nil { for _, sh := range s.opts.statsHandlers { - sh.HandleRPC(stream.Context(), outPayload(false, msg, data, payload, time.Now())) + sh.HandleRPC(ctx, outPayload(false, msg, data, payload, time.Now())) } } return err @@ -1194,7 +1164,7 @@ func getChainUnaryHandler(interceptors []UnaryServerInterceptor, curr int, info } } -func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, md *MethodDesc, trInfo *traceInfo) (err error) { +func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, md *MethodDesc, trInfo *traceInfo) (err error) { shs := s.opts.statsHandlers if len(shs) != 0 || trInfo != nil || channelz.IsOn() { if channelz.IsOn() { @@ -1208,7 +1178,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. IsClientStream: false, IsServerStream: false, } - sh.HandleRPC(stream.Context(), statsBegin) + sh.HandleRPC(ctx, statsBegin) } if trInfo != nil { trInfo.tr.LazyLog(&trInfo.firstLine, false) @@ -1240,7 +1210,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if err != nil && err != io.EOF { end.Error = toRPCErr(err) } - sh.HandleRPC(stream.Context(), end) + sh.HandleRPC(ctx, end) } if channelz.IsOn() { @@ -1262,7 +1232,6 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } } if len(binlogs) != 0 { - ctx := stream.Context() md, _ := metadata.FromIncomingContext(ctx) logEntry := &binarylog.ClientHeader{ Header: md, @@ -1348,7 +1317,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err) } for _, sh := range shs { - sh.HandleRPC(stream.Context(), &stats.InPayload{ + sh.HandleRPC(ctx, &stats.InPayload{ RecvTime: time.Now(), Payload: v, Length: len(d), @@ -1362,7 +1331,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Message: d, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), cm) + binlog.Log(ctx, cm) } } if trInfo != nil { @@ -1370,7 +1339,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } return nil } - ctx := NewContextWithServerTransportStream(stream.Context(), stream) + ctx = NewContextWithServerTransportStream(ctx, stream) reply, appErr := md.Handler(info.serviceImpl, ctx, df, s.opts.unaryInt) if appErr != nil { appStatus, ok := status.FromError(appErr) @@ -1395,7 +1364,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Header: h, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), sh) + binlog.Log(ctx, sh) } } st := &binarylog.ServerTrailer{ @@ -1403,7 +1372,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Err: appErr, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), st) + binlog.Log(ctx, st) } } return appErr @@ -1418,7 +1387,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if stream.SendCompress() != sendCompressorName { comp = encoding.GetCompressor(stream.SendCompress()) } - if err := s.sendResponse(t, stream, reply, cp, opts, comp); err != nil { + if err := s.sendResponse(ctx, t, stream, reply, cp, opts, comp); err != nil { if err == io.EOF { // The entire stream is done (for unary RPC only). return err @@ -1445,8 +1414,8 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Err: appErr, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), sh) - binlog.Log(stream.Context(), st) + binlog.Log(ctx, sh) + binlog.Log(ctx, st) } } return err @@ -1460,8 +1429,8 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Message: reply, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), sh) - binlog.Log(stream.Context(), sm) + binlog.Log(ctx, sh) + binlog.Log(ctx, sm) } } if channelz.IsOn() { @@ -1479,7 +1448,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Err: appErr, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), st) + binlog.Log(ctx, st) } } return t.WriteStatus(stream, statusOK) @@ -1521,7 +1490,7 @@ func getChainStreamHandler(interceptors []StreamServerInterceptor, curr int, inf } } -func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, sd *StreamDesc, trInfo *traceInfo) (err error) { +func (s *Server) processStreamingRPC(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, sd *StreamDesc, trInfo *traceInfo) (err error) { if channelz.IsOn() { s.incrCallsStarted() } @@ -1535,10 +1504,10 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp IsServerStream: sd.ServerStreams, } for _, sh := range shs { - sh.HandleRPC(stream.Context(), statsBegin) + sh.HandleRPC(ctx, statsBegin) } } - ctx := NewContextWithServerTransportStream(stream.Context(), stream) + ctx = NewContextWithServerTransportStream(ctx, stream) ss := &serverStream{ ctx: ctx, t: t, @@ -1574,7 +1543,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp end.Error = toRPCErr(err) } for _, sh := range shs { - sh.HandleRPC(stream.Context(), end) + sh.HandleRPC(ctx, end) } } @@ -1616,7 +1585,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp logEntry.PeerAddr = peer.Addr } for _, binlog := range ss.binlogs { - binlog.Log(stream.Context(), logEntry) + binlog.Log(ctx, logEntry) } } @@ -1694,7 +1663,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp Err: appErr, } for _, binlog := range ss.binlogs { - binlog.Log(stream.Context(), st) + binlog.Log(ctx, st) } } t.WriteStatus(ss.s, appStatus) @@ -1712,33 +1681,50 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp Err: appErr, } for _, binlog := range ss.binlogs { - binlog.Log(stream.Context(), st) + binlog.Log(ctx, st) } } return t.WriteStatus(ss.s, statusOK) } -func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream, trInfo *traceInfo) { +func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream) { + ctx := stream.Context() + var ti *traceInfo + if EnableTracing { + tr := trace.New("grpc.Recv."+methodFamily(stream.Method()), stream.Method()) + ctx = trace.NewContext(ctx, tr) + ti = &traceInfo{ + tr: tr, + firstLine: firstLine{ + client: false, + remoteAddr: t.RemoteAddr(), + }, + } + if dl, ok := ctx.Deadline(); ok { + ti.firstLine.deadline = time.Until(dl) + } + } + sm := stream.Method() if sm != "" && sm[0] == '/' { sm = sm[1:] } pos := strings.LastIndex(sm, "/") if pos == -1 { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"Malformed method name %q", []any{sm}}, true) - trInfo.tr.SetError() + if ti != nil { + ti.tr.LazyLog(&fmtStringer{"Malformed method name %q", []any{sm}}, true) + ti.tr.SetError() } errDesc := fmt.Sprintf("malformed method name: %q", stream.Method()) if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) - trInfo.tr.SetError() + if ti != nil { + ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) + ti.tr.SetError() } channelz.Warningf(logger, s.channelzID, "grpc: Server.handleStream failed to write status: %v", err) } - if trInfo != nil { - trInfo.tr.Finish() + if ti != nil { + ti.tr.Finish() } return } @@ -1748,17 +1734,17 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str srv, knownService := s.services[service] if knownService { if md, ok := srv.methods[method]; ok { - s.processUnaryRPC(t, stream, srv, md, trInfo) + s.processUnaryRPC(ctx, t, stream, srv, md, ti) return } if sd, ok := srv.streams[method]; ok { - s.processStreamingRPC(t, stream, srv, sd, trInfo) + s.processStreamingRPC(ctx, t, stream, srv, sd, ti) return } } // Unknown service, or known server unknown method. if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil { - s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) + s.processStreamingRPC(ctx, t, stream, nil, unknownDesc, ti) return } var errDesc string @@ -1767,19 +1753,19 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str } else { errDesc = fmt.Sprintf("unknown method %v for service %v", method, service) } - if trInfo != nil { - trInfo.tr.LazyPrintf("%s", errDesc) - trInfo.tr.SetError() + if ti != nil { + ti.tr.LazyPrintf("%s", errDesc) + ti.tr.SetError() } if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) - trInfo.tr.SetError() + if ti != nil { + ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) + ti.tr.SetError() } channelz.Warningf(logger, s.channelzID, "grpc: Server.handleStream failed to write status: %v", err) } - if trInfo != nil { - trInfo.tr.Finish() + if ti != nil { + ti.tr.Finish() } } diff --git a/vendor/google.golang.org/grpc/tap/tap.go b/vendor/google.golang.org/grpc/tap/tap.go index bfa5dfa40..07f012576 100644 --- a/vendor/google.golang.org/grpc/tap/tap.go +++ b/vendor/google.golang.org/grpc/tap/tap.go @@ -27,6 +27,8 @@ package tap import ( "context" + + "google.golang.org/grpc/metadata" ) // Info defines the relevant information needed by the handles. @@ -34,6 +36,10 @@ type Info struct { // FullMethodName is the string of grpc method (in the format of // /package.service/method). FullMethodName string + + // Header contains the header metadata received. + Header metadata.MD + // TODO: More to be added. } diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 724ad2102..6d2cadd79 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.58.3" +const Version = "1.59.0" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh index bbc9e2e3c..bb480f1f9 100644 --- a/vendor/google.golang.org/grpc/vet.sh +++ b/vendor/google.golang.org/grpc/vet.sh @@ -93,6 +93,9 @@ git grep -l -e 'grpclog.I' --or -e 'grpclog.W' --or -e 'grpclog.E' --or -e 'grpc # - Ensure all ptypes proto packages are renamed when importing. not git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go" +# - Ensure all usages of grpc_testing package are renamed when importing. +not git grep "\(import \|^\s*\)\"google.golang.org/grpc/interop/grpc_testing" -- "*.go" + # - Ensure all xds proto imports are renamed to *pb or *grpc. git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' ':(exclude)*.pb.go' | not grep -v 'pb "\|grpc "' diff --git a/vendor/k8s.io/api/batch/v1/generated.proto b/vendor/k8s.io/api/batch/v1/generated.proto index e1bef3a46..4f0822440 100644 --- a/vendor/k8s.io/api/batch/v1/generated.proto +++ b/vendor/k8s.io/api/batch/v1/generated.proto @@ -530,6 +530,7 @@ message PodFailurePolicyRule { // as a list of pod condition patterns. The requirement is satisfied if at // least one pattern matches an actual pod condition. At most 20 elements are allowed. // +listType=atomic + // +optional repeated PodFailurePolicyOnPodConditionsPattern onPodConditions = 3; } diff --git a/vendor/k8s.io/api/batch/v1/types.go b/vendor/k8s.io/api/batch/v1/types.go index 883d193aa..8a28614c0 100644 --- a/vendor/k8s.io/api/batch/v1/types.go +++ b/vendor/k8s.io/api/batch/v1/types.go @@ -236,6 +236,7 @@ type PodFailurePolicyRule struct { // as a list of pod condition patterns. The requirement is satisfied if at // least one pattern matches an actual pod condition. At most 20 elements are allowed. // +listType=atomic + // +optional OnPodConditions []PodFailurePolicyOnPodConditionsPattern `json:"onPodConditions" protobuf:"bytes,3,opt,name=onPodConditions"` } diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go index d738725ca..3674914f7 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go +++ b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go @@ -126,14 +126,17 @@ type rudimentaryErrorBackoff struct { // OnError will block if it is called more often than the embedded period time. // This will prevent overly tight hot error loops. func (r *rudimentaryErrorBackoff) OnError(error) { + now := time.Now() // start the timer before acquiring the lock r.lastErrorTimeLock.Lock() - defer r.lastErrorTimeLock.Unlock() - d := time.Since(r.lastErrorTime) - if d < r.minPeriod { - // If the time moves backwards for any reason, do nothing - time.Sleep(r.minPeriod - d) - } + d := now.Sub(r.lastErrorTime) r.lastErrorTime = time.Now() + r.lastErrorTimeLock.Unlock() + + // Do not sleep with the lock held because that causes all callers of HandleError to block. + // We only want the current goroutine to block. + // A negative or zero duration causes time.Sleep to return immediately. + // If the time moves backwards for any reason, do nothing. + time.Sleep(r.minPeriod - d) } // GetCaller returns the caller of the function that calls it. diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go index af237ae0c..437e53dc9 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go @@ -20,6 +20,7 @@ package mutating import ( "context" + "errors" "fmt" "time" @@ -168,13 +169,12 @@ func (a *mutatingDispatcher) Dispatch(ctx context.Context, attr admission.Attrib if err != nil { switch err := err.(type) { case *webhookutil.ErrCallingWebhook: - if ctx.Err() == context.Canceled { - klog.Warningf("Context Canceled when calling webhook %v", hook.Name) - return err - } if !ignoreClientCallFailures { rejected = true - admissionmetrics.Metrics.ObserveWebhookRejection(ctx, hook.Name, "admit", string(versionedAttr.Attributes.GetOperation()), admissionmetrics.WebhookRejectionCallingWebhookError, int(err.Status.ErrStatus.Code)) + // Ignore context cancelled from webhook metrics + if !errors.Is(err.Reason, context.Canceled) { + admissionmetrics.Metrics.ObserveWebhookRejection(ctx, hook.Name, "admit", string(versionedAttr.Attributes.GetOperation()), admissionmetrics.WebhookRejectionCallingWebhookError, int(err.Status.ErrStatus.Code)) + } } admissionmetrics.Metrics.ObserveWebhook(ctx, hook.Name, time.Since(t), rejected, versionedAttr.Attributes, "admit", int(err.Status.ErrStatus.Code)) case *webhookutil.ErrWebhookRejection: @@ -203,10 +203,14 @@ func (a *mutatingDispatcher) Dispatch(ctx context.Context, attr admission.Attrib if callErr, ok := err.(*webhookutil.ErrCallingWebhook); ok { if ignoreClientCallFailures { - klog.Warningf("Failed calling webhook, failing open %v: %v", hook.Name, callErr) - admissionmetrics.Metrics.ObserveWebhookFailOpen(ctx, hook.Name, "admit") - annotator.addFailedOpenAnnotation() - + // Ignore context cancelled from webhook metrics + if errors.Is(callErr.Reason, context.Canceled) { + klog.Warningf("Context canceled when calling webhook %v", hook.Name) + } else { + klog.Warningf("Failed calling webhook, failing open %v: %v", hook.Name, callErr) + admissionmetrics.Metrics.ObserveWebhookFailOpen(ctx, hook.Name, "admit") + annotator.addFailedOpenAnnotation() + } utilruntime.HandleError(callErr) select { diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/dispatcher.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/dispatcher.go index af435649b..1a633d241 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/dispatcher.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/dispatcher.go @@ -18,6 +18,7 @@ package validating import ( "context" + "errors" "fmt" "sync" "time" @@ -173,13 +174,12 @@ func (d *validatingDispatcher) Dispatch(ctx context.Context, attr admission.Attr if err != nil { switch err := err.(type) { case *webhookutil.ErrCallingWebhook: - if ctx.Err() == context.Canceled { - klog.Warningf("Context Canceled when calling webhook %v", hook.Name) - return - } if !ignoreClientCallFailures { rejected = true - admissionmetrics.Metrics.ObserveWebhookRejection(ctx, hook.Name, "validating", string(versionedAttr.Attributes.GetOperation()), admissionmetrics.WebhookRejectionCallingWebhookError, int(err.Status.ErrStatus.Code)) + // Ignore context cancelled from webhook metrics + if !errors.Is(err.Reason, context.Canceled) { + admissionmetrics.Metrics.ObserveWebhookRejection(ctx, hook.Name, "validating", string(versionedAttr.Attributes.GetOperation()), admissionmetrics.WebhookRejectionCallingWebhookError, int(err.Status.ErrStatus.Code)) + } } admissionmetrics.Metrics.ObserveWebhook(ctx, hook.Name, time.Since(t), rejected, versionedAttr.Attributes, "validating", int(err.Status.ErrStatus.Code)) case *webhookutil.ErrWebhookRejection: @@ -198,12 +198,17 @@ func (d *validatingDispatcher) Dispatch(ctx context.Context, attr admission.Attr if callErr, ok := err.(*webhookutil.ErrCallingWebhook); ok { if ignoreClientCallFailures { - klog.Warningf("Failed calling webhook, failing open %v: %v", hook.Name, callErr) - admissionmetrics.Metrics.ObserveWebhookFailOpen(ctx, hook.Name, "validating") - key := fmt.Sprintf("%sround_0_index_%d", ValidatingAuditAnnotationFailedOpenKeyPrefix, idx) - value := hook.Name - if err := versionedAttr.Attributes.AddAnnotation(key, value); err != nil { - klog.Warningf("Failed to set admission audit annotation %s to %s for validating webhook %s: %v", key, value, hook.Name, err) + // Ignore context cancelled from webhook metrics + if errors.Is(callErr.Reason, context.Canceled) { + klog.Warningf("Context canceled when calling webhook %v", hook.Name) + } else { + klog.Warningf("Failed calling webhook, failing open %v: %v", hook.Name, callErr) + admissionmetrics.Metrics.ObserveWebhookFailOpen(ctx, hook.Name, "validating") + key := fmt.Sprintf("%sround_0_index_%d", ValidatingAuditAnnotationFailedOpenKeyPrefix, idx) + value := hook.Name + if err := versionedAttr.Attributes.AddAnnotation(key, value); err != nil { + klog.Warningf("Failed to set admission audit annotation %s to %s for validating webhook %s: %v", key, value, hook.Name, err) + } } utilruntime.HandleError(callErr) return diff --git a/vendor/k8s.io/apiserver/pkg/cel/library/cost.go b/vendor/k8s.io/apiserver/pkg/cel/library/cost.go index 5201d187b..3d1b3fbb2 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/library/cost.go +++ b/vendor/k8s.io/apiserver/pkg/cel/library/cost.go @@ -126,13 +126,51 @@ func (l *CostEstimator) EstimateCallCost(function, overloadId string, target *ch sz := l.sizeEstimate(*target) toReplaceSz := l.sizeEstimate(args[0]) replaceWithSz := l.sizeEstimate(args[1]) - // smallest possible result: smallest input size composed of the largest possible substrings being replaced by smallest possible replacement - minSz := uint64(math.Ceil(float64(sz.Min)/float64(toReplaceSz.Max))) * replaceWithSz.Min - // largest possible result: largest input size composed of the smallest possible substrings being replaced by largest possible replacement - maxSz := uint64(math.Ceil(float64(sz.Max)/float64(toReplaceSz.Min))) * replaceWithSz.Max + + var replaceCount, retainedSz checker.SizeEstimate + // find the longest replacement: + if toReplaceSz.Min == 0 { + // if the string being replaced is empty, replace surrounds all characters in the input string with the replacement. + if sz.Max < math.MaxUint64 { + replaceCount.Max = sz.Max + 1 + } else { + replaceCount.Max = sz.Max + } + // Include the length of the longest possible original string length. + retainedSz.Max = sz.Max + } else if replaceWithSz.Max <= toReplaceSz.Min { + // If the replacement does not make the result longer, use the original string length. + replaceCount.Max = 0 + retainedSz.Max = sz.Max + } else { + // Replace the smallest possible substrings with the largest possible replacement + // as many times as possible. + replaceCount.Max = uint64(math.Ceil(float64(sz.Max) / float64(toReplaceSz.Min))) + } + + // find the shortest replacement: + if toReplaceSz.Max == 0 { + // if the string being replaced is empty, replace surrounds all characters in the input string with the replacement. + if sz.Min < math.MaxUint64 { + replaceCount.Min = sz.Min + 1 + } else { + replaceCount.Min = sz.Min + } + // Include the length of the shortest possible original string length. + retainedSz.Min = sz.Min + } else if toReplaceSz.Max <= replaceWithSz.Min { + // If the replacement does not make the result shorter, use the original string length. + replaceCount.Min = 0 + retainedSz.Min = sz.Min + } else { + // Replace the largest possible substrings being with the smallest possible replacement + // as many times as possible. + replaceCount.Min = uint64(math.Ceil(float64(sz.Min) / float64(toReplaceSz.Max))) + } + size := replaceCount.Multiply(replaceWithSz).Add(retainedSz) // cost is the traversal plus the construction of the result - return &checker.CallEstimate{CostEstimate: sz.MultiplyByCostFactor(2 * common.StringTraversalCostFactor), ResultSize: &checker.SizeEstimate{Min: minSz, Max: maxSz}} + return &checker.CallEstimate{CostEstimate: sz.MultiplyByCostFactor(2 * common.StringTraversalCostFactor), ResultSize: &size} } case "split": if target != nil { diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/authentication.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/authentication.go index 277bdcdfe..64b3569d0 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/authentication.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/authentication.go @@ -29,8 +29,11 @@ import ( "k8s.io/apiserver/pkg/authentication/authenticator" "k8s.io/apiserver/pkg/authentication/authenticatorfactory" "k8s.io/apiserver/pkg/authentication/request/headerrequest" + "k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/endpoints/handlers/responsewriters" genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + genericfeatures "k8s.io/apiserver/pkg/features" + utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/klog/v2" ) @@ -101,6 +104,18 @@ func withAuthentication(handler http.Handler, auth authenticator.Request, failed ) } + // http2 is an expensive protocol that is prone to abuse, + // see CVE-2023-44487 and CVE-2023-39325 for an example. + // Do not allow unauthenticated clients to keep these + // connections open (i.e. basically degrade them to the + // performance of http1 with keep-alive disabled). + if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.UnauthenticatedHTTP2DOSMitigation) && req.ProtoMajor == 2 && isAnonymousUser(resp.User) { + // limit this connection to just this request, + // and then send a GOAWAY and tear down the TCP connection + // https://github.com/golang/net/commit/97aa3a539ec716117a9d15a4659a911f50d13c3c + w.Header().Set("Connection", "close") + } + req = req.WithContext(genericapirequest.WithUser(req.Context(), resp.User)) handler.ServeHTTP(w, req) }) @@ -108,6 +123,17 @@ func withAuthentication(handler http.Handler, auth authenticator.Request, failed func Unauthorized(s runtime.NegotiatedSerializer) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + // http2 is an expensive protocol that is prone to abuse, + // see CVE-2023-44487 and CVE-2023-39325 for an example. + // Do not allow unauthenticated clients to keep these + // connections open (i.e. basically degrade them to the + // performance of http1 with keep-alive disabled). + if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.UnauthenticatedHTTP2DOSMitigation) && req.ProtoMajor == 2 { + // limit this connection to just this request, + // and then send a GOAWAY and tear down the TCP connection + // https://github.com/golang/net/commit/97aa3a539ec716117a9d15a4659a911f50d13c3c + w.Header().Set("Connection", "close") + } ctx := req.Context() requestInfo, found := genericapirequest.RequestInfoFrom(ctx) if !found { @@ -127,3 +153,15 @@ func audiencesAreAcceptable(apiAuds, responseAudiences authenticator.Audiences) return len(apiAuds.Intersect(responseAudiences)) > 0 } + +func isAnonymousUser(u user.Info) bool { + if u.GetName() == user.Anonymous { + return true + } + for _, group := range u.GetGroups() { + if group == user.AllUnauthenticated { + return true + } + } + return false +} diff --git a/vendor/k8s.io/apiserver/pkg/features/kube_features.go b/vendor/k8s.io/apiserver/pkg/features/kube_features.go index f1d1879ec..2276e2daf 100644 --- a/vendor/k8s.io/apiserver/pkg/features/kube_features.go +++ b/vendor/k8s.io/apiserver/pkg/features/kube_features.go @@ -182,6 +182,24 @@ const ( // Enables server-side field validation. ServerSideFieldValidation featuregate.Feature = "ServerSideFieldValidation" + // owner: @enj + // beta: v1.29 + // + // Enables http2 DOS mitigations for unauthenticated clients. + // + // Some known reasons to disable these mitigations: + // + // An API server that is fronted by an L7 load balancer that is set up + // to mitigate http2 attacks may opt to disable this protection to prevent + // unauthenticated clients from disabling connection reuse between the load + // balancer and the API server (many incoming connections could share the + // same backend connection). + // + // An API server that is on a private network may opt to disable this + // protection to prevent performance regressions for unauthenticated + // clients. + UnauthenticatedHTTP2DOSMitigation featuregate.Feature = "UnauthenticatedHTTP2DOSMitigation" + // owner: @caesarxuchao @roycaihw // alpha: v1.20 // @@ -276,6 +294,8 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS StorageVersionHash: {Default: true, PreRelease: featuregate.Beta}, + UnauthenticatedHTTP2DOSMitigation: {Default: false, PreRelease: featuregate.Beta}, + WatchBookmark: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, InPlacePodVerticalScaling: {Default: false, PreRelease: featuregate.Alpha}, diff --git a/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/config.go b/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/config.go index 13819bf90..fcb41942f 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/config.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/config.go @@ -43,12 +43,13 @@ import ( "k8s.io/apiserver/pkg/apis/config/validation" "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/server/healthz" + "k8s.io/apiserver/pkg/server/options/encryptionconfig/metrics" storagevalue "k8s.io/apiserver/pkg/storage/value" aestransformer "k8s.io/apiserver/pkg/storage/value/encrypt/aes" "k8s.io/apiserver/pkg/storage/value/encrypt/envelope" envelopekmsv2 "k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2" kmstypes "k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2" - "k8s.io/apiserver/pkg/storage/value/encrypt/envelope/metrics" + envelopemetrics "k8s.io/apiserver/pkg/storage/value/encrypt/envelope/metrics" "k8s.io/apiserver/pkg/storage/value/encrypt/identity" "k8s.io/apiserver/pkg/storage/value/encrypt/secretbox" utilfeature "k8s.io/apiserver/pkg/util/feature" @@ -104,6 +105,12 @@ const ( kmsReloadHealthCheckName = "kms-providers" ) +func init() { + metrics.RegisterMetrics() + storagevalue.RegisterMetrics() + envelopemetrics.RegisterMetrics() +} + type kmsPluginHealthzResponse struct { err error received time.Time @@ -445,10 +452,10 @@ func (h *kmsv2PluginProbe) isKMSv2ProviderHealthyAndMaybeRotateDEK(ctx context.C } if errCode, err := envelopekmsv2.ValidateKeyID(response.KeyID); err != nil { - metrics.RecordInvalidKeyIDFromStatus(h.name, string(errCode)) + envelopemetrics.RecordInvalidKeyIDFromStatus(h.name, string(errCode)) errs = append(errs, fmt.Errorf("got invalid KMSv2 KeyID hash %q: %w", envelopekmsv2.GetHashIfNotEmpty(response.KeyID), err)) } else { - metrics.RecordKeyIDFromStatus(h.name, response.KeyID) + envelopemetrics.RecordKeyIDFromStatus(h.name, response.KeyID) // unconditionally append as we filter out nil errors below errs = append(errs, h.rotateDEKOnKeyIDChange(ctx, response.KeyID, string(uuid.NewUUID()))) } diff --git a/vendor/k8s.io/apiserver/pkg/server/secure_serving.go b/vendor/k8s.io/apiserver/pkg/server/secure_serving.go index 64bcc87eb..0a4fdc693 100644 --- a/vendor/k8s.io/apiserver/pkg/server/secure_serving.go +++ b/vendor/k8s.io/apiserver/pkg/server/secure_serving.go @@ -189,7 +189,10 @@ func (s *SecureServingInfo) Serve(handler http.Handler, shutdownTimeout time.Dur if s.HTTP2MaxStreamsPerConnection > 0 { http2Options.MaxConcurrentStreams = uint32(s.HTTP2MaxStreamsPerConnection) } else { - http2Options.MaxConcurrentStreams = 250 + // match http2.initialMaxConcurrentStreams used by clients + // this makes it so that a malicious client can only open 400 streams before we forcibly close the connection + // https://github.com/golang/net/commit/b225e7ca6dde1ef5a5ae5ce922861bda011cfabd + http2Options.MaxConcurrentStreams = 100 } // increase the connection buffer size from the 1MB default to handle the specified number of concurrent streams diff --git a/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go b/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go index 5736abf63..94cb3710b 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go +++ b/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go @@ -157,10 +157,10 @@ func newETCD3Check(c storagebackend.Config, timeout time.Duration, stopCh <-chan var prober *etcd3ProberMonitor clientErr := fmt.Errorf("etcd client connection not yet established") - go wait.PollUntil(time.Second, func() (bool, error) { - newProber, err := newETCD3ProberMonitor(c) + go wait.PollImmediateUntil(time.Second, func() (bool, error) { lock.Lock() defer lock.Unlock() + newProber, err := newETCD3ProberMonitor(c) // Ensure that server is already not shutting down. select { case <-stopCh: diff --git a/vendor/k8s.io/client-go/discovery/discovery_client.go b/vendor/k8s.io/client-go/discovery/discovery_client.go index a4f083a1a..102ce49bf 100644 --- a/vendor/k8s.io/client-go/discovery/discovery_client.go +++ b/vendor/k8s.io/client-go/discovery/discovery_client.go @@ -67,6 +67,9 @@ const ( acceptDiscoveryFormats = AcceptV2Beta1 + "," + AcceptV1 ) +// Aggregated discovery content-type GVK. +var v2Beta1GVK = schema.GroupVersionKind{Group: "apidiscovery.k8s.io", Version: "v2beta1", Kind: "APIGroupDiscoveryList"} + // DiscoveryInterface holds the methods that discover server-supported API groups, // versions and resources. type DiscoveryInterface interface { @@ -260,16 +263,15 @@ func (d *DiscoveryClient) downloadLegacy() ( } var resourcesByGV map[schema.GroupVersion]*metav1.APIResourceList - // Switch on content-type server responded with: aggregated or unaggregated. - switch { - case isV2Beta1ContentType(responseContentType): + // Based on the content-type server responded with: aggregated or unaggregated. + if isGVK, _ := ContentTypeIsGVK(responseContentType, v2Beta1GVK); isGVK { var aggregatedDiscovery apidiscovery.APIGroupDiscoveryList err = json.Unmarshal(body, &aggregatedDiscovery) if err != nil { return nil, nil, nil, err } apiGroupList, resourcesByGV, failedGVs = SplitGroupsAndResources(aggregatedDiscovery) - default: + } else { // Default is unaggregated discovery v1. var v metav1.APIVersions err = json.Unmarshal(body, &v) @@ -313,16 +315,15 @@ func (d *DiscoveryClient) downloadAPIs() ( apiGroupList := &metav1.APIGroupList{} failedGVs := map[schema.GroupVersion]error{} var resourcesByGV map[schema.GroupVersion]*metav1.APIResourceList - // Switch on content-type server responded with: aggregated or unaggregated. - switch { - case isV2Beta1ContentType(responseContentType): + // Based on the content-type server responded with: aggregated or unaggregated. + if isGVK, _ := ContentTypeIsGVK(responseContentType, v2Beta1GVK); isGVK { var aggregatedDiscovery apidiscovery.APIGroupDiscoveryList err = json.Unmarshal(body, &aggregatedDiscovery) if err != nil { return nil, nil, nil, err } apiGroupList, resourcesByGV, failedGVs = SplitGroupsAndResources(aggregatedDiscovery) - default: + } else { // Default is unaggregated discovery v1. err = json.Unmarshal(body, apiGroupList) if err != nil { @@ -333,26 +334,29 @@ func (d *DiscoveryClient) downloadAPIs() ( return apiGroupList, resourcesByGV, failedGVs, nil } -// isV2Beta1ContentType checks of the content-type string is both -// "application/json" and contains the v2beta1 content-type params. +// ContentTypeIsGVK checks of the content-type string is both +// "application/json" and matches the provided GVK. An error +// is returned if the content type string is malformed. // NOTE: This function is resilient to the ordering of the // content-type parameters, as well as parameters added by // intermediaries such as proxies or gateways. Examples: // -// "application/json; g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList" = true -// "application/json; as=APIGroupDiscoveryList;v=v2beta1;g=apidiscovery.k8s.io" = true -// "application/json; as=APIGroupDiscoveryList;v=v2beta1;g=apidiscovery.k8s.io;charset=utf-8" = true -// "application/json" = false -// "application/json; charset=UTF-8" = false -func isV2Beta1ContentType(contentType string) bool { +// ("application/json; g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList", {apidiscovery.k8s.io, v2beta1, APIGroupDiscoveryList}) = (true, nil) +// ("application/json; as=APIGroupDiscoveryList;v=v2beta1;g=apidiscovery.k8s.io", {apidiscovery.k8s.io, v2beta1, APIGroupDiscoveryList}) = (true, nil) +// ("application/json; as=APIGroupDiscoveryList;v=v2beta1;g=apidiscovery.k8s.io;charset=utf-8", {apidiscovery.k8s.io, v2beta1, APIGroupDiscoveryList}) = (true, nil) +// ("application/json", any GVK) = (false, nil) +// ("application/json; charset=UTF-8", any GVK) = (false, nil) +// ("malformed content type string", any GVK) = (false, error) +func ContentTypeIsGVK(contentType string, gvk schema.GroupVersionKind) (bool, error) { base, params, err := mime.ParseMediaType(contentType) if err != nil { - return false + return false, err } - return runtime.ContentTypeJSON == base && - params["g"] == "apidiscovery.k8s.io" && - params["v"] == "v2beta1" && - params["as"] == "APIGroupDiscoveryList" + gvkMatch := runtime.ContentTypeJSON == base && + params["g"] == gvk.Group && + params["v"] == gvk.Version && + params["as"] == gvk.Kind + return gvkMatch, nil } // ServerGroups returns the supported groups, with information like supported versions and the diff --git a/vendor/k8s.io/klog/v2/.golangci.yaml b/vendor/k8s.io/klog/v2/.golangci.yaml new file mode 100644 index 000000000..0d77d65f0 --- /dev/null +++ b/vendor/k8s.io/klog/v2/.golangci.yaml @@ -0,0 +1,6 @@ +linters: + disable-all: true + enable: # sorted alphabetical + - gofmt + - misspell + - revive diff --git a/vendor/k8s.io/klog/v2/internal/buffer/buffer.go b/vendor/k8s.io/klog/v2/internal/buffer/buffer.go index f325ded5e..46de00fb0 100644 --- a/vendor/k8s.io/klog/v2/internal/buffer/buffer.go +++ b/vendor/k8s.io/klog/v2/internal/buffer/buffer.go @@ -30,14 +30,16 @@ import ( var ( // Pid is inserted into log headers. Can be overridden for tests. Pid = os.Getpid() + + // Time, if set, will be used instead of the actual current time. + Time *time.Time ) // Buffer holds a single byte.Buffer for reuse. The zero value is ready for // use. It also provides some helper methods for output formatting. type Buffer struct { bytes.Buffer - Tmp [64]byte // temporary byte array for creating headers. - next *Buffer + Tmp [64]byte // temporary byte array for creating headers. } var buffers = sync.Pool{ @@ -122,6 +124,9 @@ func (buf *Buffer) FormatHeader(s severity.Severity, file string, line int, now // Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand. // It's worth about 3X. Fprintf is hard. + if Time != nil { + now = *Time + } _, month, day := now.Date() hour, minute, second := now.Clock() // Lmmdd hh:mm:ss.uuuuuu threadid file:line] @@ -157,6 +162,9 @@ func (buf *Buffer) SprintHeader(s severity.Severity, now time.Time) string { // Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand. // It's worth about 3X. Fprintf is hard. + if Time != nil { + now = *Time + } _, month, day := now.Date() hour, minute, second := now.Clock() // Lmmdd hh:mm:ss.uuuuuu threadid file:line] diff --git a/vendor/k8s.io/klog/v2/internal/clock/clock.go b/vendor/k8s.io/klog/v2/internal/clock/clock.go index b8b6af5c8..cc11bb480 100644 --- a/vendor/k8s.io/klog/v2/internal/clock/clock.go +++ b/vendor/k8s.io/klog/v2/internal/clock/clock.go @@ -39,16 +39,6 @@ type Clock interface { // Sleep sleeps for the provided duration d. // Consider making the sleep interruptible by using 'select' on a context channel and a timer channel. Sleep(d time.Duration) - // Tick returns the channel of a new Ticker. - // This method does not allow to free/GC the backing ticker. Use - // NewTicker from WithTicker instead. - Tick(d time.Duration) <-chan time.Time -} - -// WithTicker allows for injecting fake or real clocks into code that -// needs to do arbitrary things based on time. -type WithTicker interface { - Clock // NewTicker returns a new Ticker. NewTicker(time.Duration) Ticker } @@ -66,7 +56,7 @@ type WithDelayedExecution interface { // WithTickerAndDelayedExecution allows for injecting fake or real clocks // into code that needs Ticker and AfterFunc functionality type WithTickerAndDelayedExecution interface { - WithTicker + Clock // AfterFunc executes f in its own goroutine after waiting // for d duration and returns a Timer whose channel can be // closed by calling Stop() on the Timer. @@ -79,7 +69,7 @@ type Ticker interface { Stop() } -var _ = WithTicker(RealClock{}) +var _ Clock = RealClock{} // RealClock really calls time.Now() type RealClock struct{} @@ -115,13 +105,6 @@ func (RealClock) AfterFunc(d time.Duration, f func()) Timer { } } -// Tick is the same as time.Tick(d) -// This method does not allow to free/GC the backing ticker. Use -// NewTicker instead. -func (RealClock) Tick(d time.Duration) <-chan time.Time { - return time.Tick(d) -} - // NewTicker returns a new Ticker. func (RealClock) NewTicker(d time.Duration) Ticker { return &realTicker{ diff --git a/vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go index bcdf5f8ee..d1a4751c9 100644 --- a/vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go +++ b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go @@ -172,73 +172,6 @@ func KVListFormat(b *bytes.Buffer, keysAndValues ...interface{}) { Formatter{}.KVListFormat(b, keysAndValues...) } -// KVFormat serializes one key/value pair into the provided buffer. -// A space gets inserted before the pair. -func (f Formatter) KVFormat(b *bytes.Buffer, k, v interface{}) { - b.WriteByte(' ') - // Keys are assumed to be well-formed according to - // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments - // for the sake of performance. Keys with spaces, - // special characters, etc. will break parsing. - if sK, ok := k.(string); ok { - // Avoid one allocation when the key is a string, which - // normally it should be. - b.WriteString(sK) - } else { - b.WriteString(fmt.Sprintf("%s", k)) - } - - // The type checks are sorted so that more frequently used ones - // come first because that is then faster in the common - // cases. In Kubernetes, ObjectRef (a Stringer) is more common - // than plain strings - // (https://github.com/kubernetes/kubernetes/pull/106594#issuecomment-975526235). - switch v := v.(type) { - case textWriter: - writeTextWriterValue(b, v) - case fmt.Stringer: - writeStringValue(b, StringerToString(v)) - case string: - writeStringValue(b, v) - case error: - writeStringValue(b, ErrorToString(v)) - case logr.Marshaler: - value := MarshalerToValue(v) - // A marshaler that returns a string is useful for - // delayed formatting of complex values. We treat this - // case like a normal string. This is useful for - // multi-line support. - // - // We could do this by recursively formatting a value, - // but that comes with the risk of infinite recursion - // if a marshaler returns itself. Instead we call it - // only once and rely on it returning the intended - // value directly. - switch value := value.(type) { - case string: - writeStringValue(b, value) - default: - f.formatAny(b, value) - } - case []byte: - // In https://github.com/kubernetes/klog/pull/237 it was decided - // to format byte slices with "%+q". The advantages of that are: - // - readable output if the bytes happen to be printable - // - non-printable bytes get represented as unicode escape - // sequences (\uxxxx) - // - // The downsides are that we cannot use the faster - // strconv.Quote here and that multi-line output is not - // supported. If developers know that a byte array is - // printable and they want multi-line output, they can - // convert the value to string before logging it. - b.WriteByte('=') - b.WriteString(fmt.Sprintf("%+q", v)) - default: - f.formatAny(b, v) - } -} - func KVFormat(b *bytes.Buffer, k, v interface{}) { Formatter{}.KVFormat(b, k, v) } @@ -251,6 +184,10 @@ func (f Formatter) formatAny(b *bytes.Buffer, v interface{}) { b.WriteString(f.AnyToStringHook(v)) return } + formatAsJSON(b, v) +} + +func formatAsJSON(b *bytes.Buffer, v interface{}) { encoder := json.NewEncoder(b) l := b.Len() if err := encoder.Encode(v); err != nil { diff --git a/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_no_slog.go b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_no_slog.go new file mode 100644 index 000000000..d9c7d1546 --- /dev/null +++ b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_no_slog.go @@ -0,0 +1,97 @@ +//go:build !go1.21 +// +build !go1.21 + +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package serialize + +import ( + "bytes" + "fmt" + + "github.com/go-logr/logr" +) + +// KVFormat serializes one key/value pair into the provided buffer. +// A space gets inserted before the pair. +func (f Formatter) KVFormat(b *bytes.Buffer, k, v interface{}) { + // This is the version without slog support. Must be kept in sync with + // the version in keyvalues_slog.go. + + b.WriteByte(' ') + // Keys are assumed to be well-formed according to + // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments + // for the sake of performance. Keys with spaces, + // special characters, etc. will break parsing. + if sK, ok := k.(string); ok { + // Avoid one allocation when the key is a string, which + // normally it should be. + b.WriteString(sK) + } else { + b.WriteString(fmt.Sprintf("%s", k)) + } + + // The type checks are sorted so that more frequently used ones + // come first because that is then faster in the common + // cases. In Kubernetes, ObjectRef (a Stringer) is more common + // than plain strings + // (https://github.com/kubernetes/kubernetes/pull/106594#issuecomment-975526235). + switch v := v.(type) { + case textWriter: + writeTextWriterValue(b, v) + case fmt.Stringer: + writeStringValue(b, StringerToString(v)) + case string: + writeStringValue(b, v) + case error: + writeStringValue(b, ErrorToString(v)) + case logr.Marshaler: + value := MarshalerToValue(v) + // A marshaler that returns a string is useful for + // delayed formatting of complex values. We treat this + // case like a normal string. This is useful for + // multi-line support. + // + // We could do this by recursively formatting a value, + // but that comes with the risk of infinite recursion + // if a marshaler returns itself. Instead we call it + // only once and rely on it returning the intended + // value directly. + switch value := value.(type) { + case string: + writeStringValue(b, value) + default: + f.formatAny(b, value) + } + case []byte: + // In https://github.com/kubernetes/klog/pull/237 it was decided + // to format byte slices with "%+q". The advantages of that are: + // - readable output if the bytes happen to be printable + // - non-printable bytes get represented as unicode escape + // sequences (\uxxxx) + // + // The downsides are that we cannot use the faster + // strconv.Quote here and that multi-line output is not + // supported. If developers know that a byte array is + // printable and they want multi-line output, they can + // convert the value to string before logging it. + b.WriteByte('=') + b.WriteString(fmt.Sprintf("%+q", v)) + default: + f.formatAny(b, v) + } +} diff --git a/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_slog.go b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_slog.go new file mode 100644 index 000000000..89acf9772 --- /dev/null +++ b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_slog.go @@ -0,0 +1,155 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package serialize + +import ( + "bytes" + "fmt" + "log/slog" + "strconv" + + "github.com/go-logr/logr" +) + +// KVFormat serializes one key/value pair into the provided buffer. +// A space gets inserted before the pair. +func (f Formatter) KVFormat(b *bytes.Buffer, k, v interface{}) { + // This is the version without slog support. Must be kept in sync with + // the version in keyvalues_slog.go. + + b.WriteByte(' ') + // Keys are assumed to be well-formed according to + // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments + // for the sake of performance. Keys with spaces, + // special characters, etc. will break parsing. + if sK, ok := k.(string); ok { + // Avoid one allocation when the key is a string, which + // normally it should be. + b.WriteString(sK) + } else { + b.WriteString(fmt.Sprintf("%s", k)) + } + + // The type checks are sorted so that more frequently used ones + // come first because that is then faster in the common + // cases. In Kubernetes, ObjectRef (a Stringer) is more common + // than plain strings + // (https://github.com/kubernetes/kubernetes/pull/106594#issuecomment-975526235). + // + // slog.LogValuer does not need to be handled here because the handler will + // already have resolved such special values to the final value for logging. + switch v := v.(type) { + case textWriter: + writeTextWriterValue(b, v) + case slog.Value: + // This must come before fmt.Stringer because slog.Value implements + // fmt.Stringer, but does not produce the output that we want. + b.WriteByte('=') + generateJSON(b, v) + case fmt.Stringer: + writeStringValue(b, StringerToString(v)) + case string: + writeStringValue(b, v) + case error: + writeStringValue(b, ErrorToString(v)) + case logr.Marshaler: + value := MarshalerToValue(v) + // A marshaler that returns a string is useful for + // delayed formatting of complex values. We treat this + // case like a normal string. This is useful for + // multi-line support. + // + // We could do this by recursively formatting a value, + // but that comes with the risk of infinite recursion + // if a marshaler returns itself. Instead we call it + // only once and rely on it returning the intended + // value directly. + switch value := value.(type) { + case string: + writeStringValue(b, value) + default: + f.formatAny(b, value) + } + case slog.LogValuer: + value := slog.AnyValue(v).Resolve() + if value.Kind() == slog.KindString { + writeStringValue(b, value.String()) + } else { + b.WriteByte('=') + generateJSON(b, value) + } + case []byte: + // In https://github.com/kubernetes/klog/pull/237 it was decided + // to format byte slices with "%+q". The advantages of that are: + // - readable output if the bytes happen to be printable + // - non-printable bytes get represented as unicode escape + // sequences (\uxxxx) + // + // The downsides are that we cannot use the faster + // strconv.Quote here and that multi-line output is not + // supported. If developers know that a byte array is + // printable and they want multi-line output, they can + // convert the value to string before logging it. + b.WriteByte('=') + b.WriteString(fmt.Sprintf("%+q", v)) + default: + f.formatAny(b, v) + } +} + +// generateJSON has the same preference for plain strings as KVFormat. +// In contrast to KVFormat it always produces valid JSON with no line breaks. +func generateJSON(b *bytes.Buffer, v interface{}) { + switch v := v.(type) { + case slog.Value: + switch v.Kind() { + case slog.KindGroup: + // Format as a JSON group. We must not involve f.AnyToStringHook (if there is any), + // because there is no guarantee that it produces valid JSON. + b.WriteByte('{') + for i, attr := range v.Group() { + if i > 0 { + b.WriteByte(',') + } + b.WriteString(strconv.Quote(attr.Key)) + b.WriteByte(':') + generateJSON(b, attr.Value) + } + b.WriteByte('}') + case slog.KindLogValuer: + generateJSON(b, v.Resolve()) + default: + // Peel off the slog.Value wrapper and format the actual value. + generateJSON(b, v.Any()) + } + case fmt.Stringer: + b.WriteString(strconv.Quote(StringerToString(v))) + case logr.Marshaler: + generateJSON(b, MarshalerToValue(v)) + case slog.LogValuer: + generateJSON(b, slog.AnyValue(v).Resolve().Any()) + case string: + b.WriteString(strconv.Quote(v)) + case error: + b.WriteString(strconv.Quote(v.Error())) + default: + formatAsJSON(b, v) + } +} diff --git a/vendor/k8s.io/klog/v2/internal/sloghandler/sloghandler_slog.go b/vendor/k8s.io/klog/v2/internal/sloghandler/sloghandler_slog.go new file mode 100644 index 000000000..21f1697d0 --- /dev/null +++ b/vendor/k8s.io/klog/v2/internal/sloghandler/sloghandler_slog.go @@ -0,0 +1,96 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package sloghandler + +import ( + "context" + "log/slog" + "runtime" + "strings" + "time" + + "k8s.io/klog/v2/internal/severity" +) + +func Handle(_ context.Context, record slog.Record, groups string, printWithInfos func(file string, line int, now time.Time, err error, s severity.Severity, msg string, kvList []interface{})) error { + now := record.Time + if now.IsZero() { + // This format doesn't support printing entries without a time. + now = time.Now() + } + + // slog has numeric severity levels, with 0 as default "info", negative for debugging, and + // positive with some pre-defined levels for more important. Those ranges get mapped to + // the corresponding klog levels where possible, with "info" the default that is used + // also for negative debug levels. + level := record.Level + s := severity.InfoLog + switch { + case level >= slog.LevelError: + s = severity.ErrorLog + case level >= slog.LevelWarn: + s = severity.WarningLog + } + + var file string + var line int + if record.PC != 0 { + // Same as https://cs.opensource.google/go/x/exp/+/642cacee:slog/record.go;drc=642cacee5cc05231f45555a333d07f1005ffc287;l=70 + fs := runtime.CallersFrames([]uintptr{record.PC}) + f, _ := fs.Next() + if f.File != "" { + file = f.File + if slash := strings.LastIndex(file, "/"); slash >= 0 { + file = file[slash+1:] + } + line = f.Line + } + } else { + file = "???" + line = 1 + } + + kvList := make([]interface{}, 0, 2*record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + kvList = appendAttr(groups, kvList, attr) + return true + }) + + printWithInfos(file, line, now, nil, s, record.Message, kvList) + return nil +} + +func Attrs2KVList(groups string, attrs []slog.Attr) []interface{} { + kvList := make([]interface{}, 0, 2*len(attrs)) + for _, attr := range attrs { + kvList = appendAttr(groups, kvList, attr) + } + return kvList +} + +func appendAttr(groups string, kvList []interface{}, attr slog.Attr) []interface{} { + var key string + if groups != "" { + key = groups + "." + attr.Key + } else { + key = attr.Key + } + return append(kvList, key, attr.Value) +} diff --git a/vendor/k8s.io/klog/v2/k8s_references_slog.go b/vendor/k8s.io/klog/v2/k8s_references_slog.go new file mode 100644 index 000000000..5522c84c7 --- /dev/null +++ b/vendor/k8s.io/klog/v2/k8s_references_slog.go @@ -0,0 +1,39 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package klog + +import ( + "log/slog" +) + +func (ref ObjectRef) LogValue() slog.Value { + if ref.Namespace != "" { + return slog.GroupValue(slog.String("name", ref.Name), slog.String("namespace", ref.Namespace)) + } + return slog.GroupValue(slog.String("name", ref.Name)) +} + +var _ slog.LogValuer = ObjectRef{} + +func (ks kobjSlice) LogValue() slog.Value { + return slog.AnyValue(ks.MarshalLog()) +} + +var _ slog.LogValuer = kobjSlice{} diff --git a/vendor/k8s.io/klog/v2/klog.go b/vendor/k8s.io/klog/v2/klog.go index 152f8a6bd..72502db3a 100644 --- a/vendor/k8s.io/klog/v2/klog.go +++ b/vendor/k8s.io/klog/v2/klog.go @@ -415,7 +415,7 @@ func init() { logging.stderrThreshold = severityValue{ Severity: severity.ErrorLog, // Default stderrThreshold is ERROR. } - commandLine.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr when writing to files and stderr (no effect when -logtostderr=true or -alsologtostderr=false)") + commandLine.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr when writing to files and stderr (no effect when -logtostderr=true or -alsologtostderr=true)") commandLine.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging") commandLine.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace") @@ -518,9 +518,7 @@ type settings struct { func (s settings) deepCopy() settings { // vmodule is a slice and would be shared, so we have copy it. filter := make([]modulePat, len(s.vmodule.filter)) - for i := range s.vmodule.filter { - filter[i] = s.vmodule.filter[i] - } + copy(filter, s.vmodule.filter) s.vmodule.filter = filter if s.logger != nil { @@ -657,16 +655,15 @@ func (l *loggingT) header(s severity.Severity, depth int) (*buffer.Buffer, strin } } } - return l.formatHeader(s, file, line), file, line + return l.formatHeader(s, file, line, timeNow()), file, line } // formatHeader formats a log header using the provided file name and line number. -func (l *loggingT) formatHeader(s severity.Severity, file string, line int) *buffer.Buffer { +func (l *loggingT) formatHeader(s severity.Severity, file string, line int, now time.Time) *buffer.Buffer { buf := buffer.GetBuffer() if l.skipHeaders { return buf } - now := timeNow() buf.FormatHeader(s, file, line, now) return buf } @@ -676,6 +673,10 @@ func (l *loggingT) println(s severity.Severity, logger *logWriter, filter LogFil } func (l *loggingT) printlnDepth(s severity.Severity, logger *logWriter, filter LogFilter, depth int, args ...interface{}) { + if false { + _ = fmt.Sprintln(args...) // cause vet to treat this function like fmt.Println + } + buf, file, line := l.header(s, depth) // If a logger is set and doesn't support writing a formatted buffer, // we clear the generated header as we rely on the backing @@ -696,7 +697,15 @@ func (l *loggingT) print(s severity.Severity, logger *logWriter, filter LogFilte } func (l *loggingT) printDepth(s severity.Severity, logger *logWriter, filter LogFilter, depth int, args ...interface{}) { + if false { + _ = fmt.Sprint(args...) // // cause vet to treat this function like fmt.Print + } + buf, file, line := l.header(s, depth) + l.printWithInfos(buf, file, line, s, logger, filter, depth+1, args...) +} + +func (l *loggingT) printWithInfos(buf *buffer.Buffer, file string, line int, s severity.Severity, logger *logWriter, filter LogFilter, depth int, args ...interface{}) { // If a logger is set and doesn't support writing a formatted buffer, // we clear the generated header as we rely on the backing // logger implementation to print headers. @@ -719,6 +728,10 @@ func (l *loggingT) printf(s severity.Severity, logger *logWriter, filter LogFilt } func (l *loggingT) printfDepth(s severity.Severity, logger *logWriter, filter LogFilter, depth int, format string, args ...interface{}) { + if false { + _ = fmt.Sprintf(format, args...) // cause vet to treat this function like fmt.Printf + } + buf, file, line := l.header(s, depth) // If a logger is set and doesn't support writing a formatted buffer, // we clear the generated header as we rely on the backing @@ -741,7 +754,7 @@ func (l *loggingT) printfDepth(s severity.Severity, logger *logWriter, filter Lo // alsoLogToStderr is true, the log message always appears on standard error; it // will also appear in the log file unless --logtostderr is set. func (l *loggingT) printWithFileLine(s severity.Severity, logger *logWriter, filter LogFilter, file string, line int, alsoToStderr bool, args ...interface{}) { - buf := l.formatHeader(s, file, line) + buf := l.formatHeader(s, file, line, timeNow()) // If a logger is set and doesn't support writing a formatted buffer, // we clear the generated header as we rely on the backing // logger implementation to print headers. @@ -759,7 +772,7 @@ func (l *loggingT) printWithFileLine(s severity.Severity, logger *logWriter, fil l.output(s, logger, buf, 2 /* depth */, file, line, alsoToStderr) } -// if loggr is specified, will call loggr.Error, otherwise output with logging module. +// if logger is specified, will call logger.Error, otherwise output with logging module. func (l *loggingT) errorS(err error, logger *logWriter, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) { if filter != nil { msg, keysAndValues = filter.FilterS(msg, keysAndValues) @@ -771,7 +784,7 @@ func (l *loggingT) errorS(err error, logger *logWriter, filter LogFilter, depth l.printS(err, severity.ErrorLog, depth+1, msg, keysAndValues...) } -// if loggr is specified, will call loggr.Info, otherwise output with logging module. +// if logger is specified, will call logger.Info, otherwise output with logging module. func (l *loggingT) infoS(logger *logWriter, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) { if filter != nil { msg, keysAndValues = filter.FilterS(msg, keysAndValues) @@ -783,7 +796,7 @@ func (l *loggingT) infoS(logger *logWriter, filter LogFilter, depth int, msg str l.printS(nil, severity.InfoLog, depth+1, msg, keysAndValues...) } -// printS is called from infoS and errorS if loggr is not specified. +// printS is called from infoS and errorS if logger is not specified. // set log severity by s func (l *loggingT) printS(err error, s severity.Severity, depth int, msg string, keysAndValues ...interface{}) { // Only create a new buffer if we don't have one cached. @@ -796,7 +809,7 @@ func (l *loggingT) printS(err error, s severity.Severity, depth int, msg string, serialize.KVListFormat(&b.Buffer, "err", err) } serialize.KVListFormat(&b.Buffer, keysAndValues...) - l.printDepth(s, logging.logger, nil, depth+1, &b.Buffer) + l.printDepth(s, nil, nil, depth+1, &b.Buffer) // Make the buffer available for reuse. buffer.PutBuffer(b) } @@ -873,6 +886,9 @@ func (l *loggingT) output(s severity.Severity, logger *logWriter, buf *buffer.Bu if logger.writeKlogBuffer != nil { logger.writeKlogBuffer(data) } else { + if len(data) > 0 && data[len(data)-1] == '\n' { + data = data[:len(data)-1] + } // TODO: set 'severity' and caller information as structured log info // keysAndValues := []interface{}{"severity", severityName[s], "file", file, "line", line} if s == severity.ErrorLog { @@ -897,7 +913,7 @@ func (l *loggingT) output(s severity.Severity, logger *logWriter, buf *buffer.Bu l.exit(err) } } - l.file[severity.InfoLog].Write(data) + _, _ = l.file[severity.InfoLog].Write(data) } else { if l.file[s] == nil { if err := l.createFiles(s); err != nil { @@ -907,20 +923,20 @@ func (l *loggingT) output(s severity.Severity, logger *logWriter, buf *buffer.Bu } if l.oneOutput { - l.file[s].Write(data) + _, _ = l.file[s].Write(data) } else { switch s { case severity.FatalLog: - l.file[severity.FatalLog].Write(data) + _, _ = l.file[severity.FatalLog].Write(data) fallthrough case severity.ErrorLog: - l.file[severity.ErrorLog].Write(data) + _, _ = l.file[severity.ErrorLog].Write(data) fallthrough case severity.WarningLog: - l.file[severity.WarningLog].Write(data) + _, _ = l.file[severity.WarningLog].Write(data) fallthrough case severity.InfoLog: - l.file[severity.InfoLog].Write(data) + _, _ = l.file[severity.InfoLog].Write(data) } } } @@ -946,7 +962,7 @@ func (l *loggingT) output(s severity.Severity, logger *logWriter, buf *buffer.Bu logExitFunc = func(error) {} // If we get a write error, we'll still exit below. for log := severity.FatalLog; log >= severity.InfoLog; log-- { if f := l.file[log]; f != nil { // Can be nil if -logtostderr is set. - f.Write(trace) + _, _ = f.Write(trace) } } l.mu.Unlock() @@ -1102,7 +1118,7 @@ const flushInterval = 5 * time.Second // flushDaemon periodically flushes the log file buffers. type flushDaemon struct { mu sync.Mutex - clock clock.WithTicker + clock clock.Clock flush func() stopC chan struct{} stopDone chan struct{} @@ -1110,7 +1126,7 @@ type flushDaemon struct { // newFlushDaemon returns a new flushDaemon. If the passed clock is nil, a // clock.RealClock is used. -func newFlushDaemon(flush func(), tickClock clock.WithTicker) *flushDaemon { +func newFlushDaemon(flush func(), tickClock clock.Clock) *flushDaemon { if tickClock == nil { tickClock = clock.RealClock{} } @@ -1201,8 +1217,8 @@ func (l *loggingT) flushAll() { for s := severity.FatalLog; s >= severity.InfoLog; s-- { file := l.file[s] if file != nil { - file.Flush() // ignore error - file.Sync() // ignore error + _ = file.Flush() // ignore error + _ = file.Sync() // ignore error } } if logging.loggerOptions.flush != nil { @@ -1281,9 +1297,7 @@ func (l *loggingT) setV(pc uintptr) Level { fn := runtime.FuncForPC(pc) file, _ := fn.FileLine(pc) // The file is something like /a/b/c/d.go. We want just the d. - if strings.HasSuffix(file, ".go") { - file = file[:len(file)-3] - } + file = strings.TrimSuffix(file, ".go") if slash := strings.LastIndex(file, "/"); slash >= 0 { file = file[slash+1:] } diff --git a/vendor/k8s.io/klog/v2/klog_file.go b/vendor/k8s.io/klog/v2/klog_file.go index 1025d644f..8bee16204 100644 --- a/vendor/k8s.io/klog/v2/klog_file.go +++ b/vendor/k8s.io/klog/v2/klog_file.go @@ -109,8 +109,8 @@ func create(tag string, t time.Time, startup bool) (f *os.File, filename string, f, err := openOrCreate(fname, startup) if err == nil { symlink := filepath.Join(dir, link) - os.Remove(symlink) // ignore err - os.Symlink(name, symlink) // ignore err + _ = os.Remove(symlink) // ignore err + _ = os.Symlink(name, symlink) // ignore err return f, fname, nil } lastErr = err diff --git a/vendor/k8s.io/klog/v2/klogr.go b/vendor/k8s.io/klog/v2/klogr.go index 15de00e21..efec96fd4 100644 --- a/vendor/k8s.io/klog/v2/klogr.go +++ b/vendor/k8s.io/klog/v2/klogr.go @@ -22,6 +22,11 @@ import ( "k8s.io/klog/v2/internal/serialize" ) +const ( + // nameKey is used to log the `WithName` values as an additional attribute. + nameKey = "logger" +) + // NewKlogr returns a logger that is functionally identical to // klogr.NewWithOptions(klogr.FormatKlog), i.e. it passes through to klog. The // difference is that it uses a simpler implementation. @@ -32,10 +37,15 @@ func NewKlogr() Logger { // klogger is a subset of klogr/klogr.go. It had to be copied to break an // import cycle (klogr wants to use klog, and klog wants to use klogr). type klogger struct { - level int callDepth int - prefix string - values []interface{} + + // hasPrefix is true if the first entry in values is the special + // nameKey key/value. Such an entry gets added and later updated in + // WithName. + hasPrefix bool + + values []interface{} + groups string } func (l *klogger) Init(info logr.RuntimeInfo) { @@ -44,34 +54,40 @@ func (l *klogger) Init(info logr.RuntimeInfo) { func (l *klogger) Info(level int, msg string, kvList ...interface{}) { merged := serialize.MergeKVs(l.values, kvList) - if l.prefix != "" { - msg = l.prefix + ": " + msg - } // Skip this function. VDepth(l.callDepth+1, Level(level)).InfoSDepth(l.callDepth+1, msg, merged...) } func (l *klogger) Enabled(level int) bool { - // Skip this function and logr.Logger.Info where Enabled is called. - return VDepth(l.callDepth+2, Level(level)).Enabled() + return VDepth(l.callDepth+1, Level(level)).Enabled() } func (l *klogger) Error(err error, msg string, kvList ...interface{}) { merged := serialize.MergeKVs(l.values, kvList) - if l.prefix != "" { - msg = l.prefix + ": " + msg - } ErrorSDepth(l.callDepth+1, err, msg, merged...) } // WithName returns a new logr.Logger with the specified name appended. klogr -// uses '/' characters to separate name elements. Callers should not pass '/' +// uses '.' characters to separate name elements. Callers should not pass '.' // in the provided name string, but this library does not actually enforce that. func (l klogger) WithName(name string) logr.LogSink { - if len(l.prefix) > 0 { - l.prefix = l.prefix + "/" + if l.hasPrefix { + // Copy slice and modify value. No length checks and type + // assertions are needed because hasPrefix is only true if the + // first two elements exist and are key/value strings. + v := make([]interface{}, 0, len(l.values)) + v = append(v, l.values...) + prefix, _ := v[1].(string) + v[1] = prefix + "." + name + l.values = v + } else { + // Preprend new key/value pair. + v := make([]interface{}, 0, 2+len(l.values)) + v = append(v, nameKey, name) + v = append(v, l.values...) + l.values = v + l.hasPrefix = true } - l.prefix += name return &l } diff --git a/vendor/k8s.io/klog/v2/klogr_slog.go b/vendor/k8s.io/klog/v2/klogr_slog.go new file mode 100644 index 000000000..f7bf74030 --- /dev/null +++ b/vendor/k8s.io/klog/v2/klogr_slog.go @@ -0,0 +1,96 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package klog + +import ( + "context" + "log/slog" + "strconv" + "time" + + "github.com/go-logr/logr/slogr" + + "k8s.io/klog/v2/internal/buffer" + "k8s.io/klog/v2/internal/serialize" + "k8s.io/klog/v2/internal/severity" + "k8s.io/klog/v2/internal/sloghandler" +) + +func (l *klogger) Handle(ctx context.Context, record slog.Record) error { + if logging.logger != nil { + if slogSink, ok := logging.logger.GetSink().(slogr.SlogSink); ok { + // Let that logger do the work. + return slogSink.Handle(ctx, record) + } + } + + return sloghandler.Handle(ctx, record, l.groups, slogOutput) +} + +// slogOutput corresponds to several different functions in klog.go. +// It goes through some of the same checks and formatting steps before +// it ultimately converges by calling logging.printWithInfos. +func slogOutput(file string, line int, now time.Time, err error, s severity.Severity, msg string, kvList []interface{}) { + // See infoS. + if logging.logger != nil { + // Taking this path happens when klog has a logger installed + // as backend which doesn't support slog. Not good, we have to + // guess about the call depth and drop the actual location. + logger := logging.logger.WithCallDepth(2) + if s > severity.ErrorLog { + logger.Error(err, msg, kvList...) + } else { + logger.Info(msg, kvList...) + } + return + } + + // See printS. + b := buffer.GetBuffer() + b.WriteString(strconv.Quote(msg)) + if err != nil { + serialize.KVListFormat(&b.Buffer, "err", err) + } + serialize.KVListFormat(&b.Buffer, kvList...) + + // See print + header. + buf := logging.formatHeader(s, file, line, now) + logging.printWithInfos(buf, file, line, s, nil, nil, 0, &b.Buffer) + + buffer.PutBuffer(b) +} + +func (l *klogger) WithAttrs(attrs []slog.Attr) slogr.SlogSink { + clone := *l + clone.values = serialize.WithValues(l.values, sloghandler.Attrs2KVList(l.groups, attrs)) + return &clone +} + +func (l *klogger) WithGroup(name string) slogr.SlogSink { + clone := *l + if clone.groups != "" { + clone.groups += "." + name + } else { + clone.groups = name + } + return &clone +} + +var _ slogr.SlogSink = &klogger{} diff --git a/vendor/k8s.io/kubernetes/pkg/features/kube_features.go b/vendor/k8s.io/kubernetes/pkg/features/kube_features.go index 8b27be3f3..56791b47c 100644 --- a/vendor/k8s.io/kubernetes/pkg/features/kube_features.go +++ b/vendor/k8s.io/kubernetes/pkg/features/kube_features.go @@ -1210,6 +1210,8 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS genericfeatures.ServerSideFieldValidation: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.29 + genericfeatures.UnauthenticatedHTTP2DOSMitigation: {Default: false, PreRelease: featuregate.Beta}, + // inherited features from apiextensions-apiserver, relisted here to get a conflict if it is changed // unintentionally on either side: diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/wait.go b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/wait.go index 5b019cce1..6aa1b1be3 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/wait.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/wait.go @@ -581,10 +581,11 @@ func WaitForPodsResponding(ctx context.Context, c clientset.Interface, ns string if err != nil { // We may encounter errors here because of a race between the pod readiness and apiserver - // proxy. So, we log the error and retry if this occurs. - return nil, fmt.Errorf("Controller %s: failed to Get from replica pod %s:\n%s\nPod status:\n%s", + // proxy or because of temporary failures. The error gets wrapped for framework.HandleRetry. + // Gomega+Ginkgo will handle logging. + return nil, fmt.Errorf("controller %s: failed to Get from replica pod %s:\n%w\nPod status:\n%s", controllerName, pod.Name, - format.Object(err, 1), format.Object(pod.Status, 1)) + err, format.Object(pod.Status, 1)) } responses = append(responses, response{podName: pod.Name, response: string(body)}) } diff --git a/vendor/k8s.io/mount-utils/mount_windows.go b/vendor/k8s.io/mount-utils/mount_windows.go index 02a963b1b..be714646e 100644 --- a/vendor/k8s.io/mount-utils/mount_windows.go +++ b/vendor/k8s.io/mount-utils/mount_windows.go @@ -150,12 +150,12 @@ func (mounter *Mounter) MountSensitive(source string, target string, fstype stri mklinkSource = mklinkSource + "\\" } - output, err := exec.Command("cmd", "/c", "mklink", "/D", target, mklinkSource).CombinedOutput() + err := os.Symlink(mklinkSource, target) if err != nil { - klog.Errorf("mklink failed: %v, source(%q) target(%q) output: %q", err, mklinkSource, target, string(output)) + klog.Errorf("symlink failed: %v, source(%q) target(%q)", err, mklinkSource, target) return err } - klog.V(2).Infof("mklink source(%q) on target(%q) successfully, output: %q", mklinkSource, target, string(output)) + klog.V(2).Infof("symlink source(%q) on target(%q) successfully", mklinkSource, target) return nil } @@ -219,8 +219,9 @@ func removeSMBMapping(remotepath string) (string, error) { func (mounter *Mounter) Unmount(target string) error { klog.V(4).Infof("Unmount target (%q)", target) target = NormalizeWindowsPath(target) - if output, err := exec.Command("cmd", "/c", "rmdir", target).CombinedOutput(); err != nil { - klog.Errorf("rmdir failed: %v, output: %q", err, string(output)) + + if err := os.Remove(target); err != nil { + klog.Errorf("removing directory %s failed: %v", target, err) return err } return nil diff --git a/vendor/modules.txt b/vendor/modules.txt index 28ae9c485..3e4e75b27 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -9,11 +9,10 @@ github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization github.com/Azure/azure-sdk-for-go/services/privatedns/mgmt/2018-09-01/privatedns github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources -github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage github.com/Azure/azure-sdk-for-go/storage github.com/Azure/azure-sdk-for-go/version -# github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 +# github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/azcore github.com/Azure/azure-sdk-for-go/sdk/azcore/arm @@ -26,6 +25,7 @@ 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/fake 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 @@ -35,10 +35,10 @@ 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/azcore/tracing -# github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 +# github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/azidentity -# github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 +# github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/internal/diag github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo @@ -47,9 +47,30 @@ github.com/Azure/azure-sdk-for-go/sdk/internal/log github.com/Azure/azure-sdk-for-go/sdk/internal/poller 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/keyvault/armkeyvault v1.2.0 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.3.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.2.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.6.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.4.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.2.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.2.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.5.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage # github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.6.1 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob @@ -92,7 +113,7 @@ 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 v1.0.0 +# github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 ## explicit; go 1.18 github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential @@ -153,26 +174,27 @@ github.com/davecgh/go-spew/spew ## explicit github.com/docker/distribution/digestset github.com/docker/distribution/reference -# github.com/emicklei/go-restful/v3 v3.9.0 +# github.com/emicklei/go-restful/v3 v3.10.2 ## explicit; go 1.13 github.com/emicklei/go-restful/v3 github.com/emicklei/go-restful/v3/log -# github.com/evanphx/json-patch v5.6.0+incompatible +# github.com/evanphx/json-patch v5.7.0+incompatible ## explicit github.com/evanphx/json-patch -# github.com/felixge/httpsnoop v1.0.3 +# github.com/felixge/httpsnoop v1.0.4 ## explicit; go 1.13 github.com/felixge/httpsnoop -# github.com/fsnotify/fsnotify v1.6.0 -## explicit; go 1.16 +# github.com/fsnotify/fsnotify v1.7.0 +## explicit; go 1.17 github.com/fsnotify/fsnotify # github.com/go-ini/ini v1.67.0 ## explicit github.com/go-ini/ini -# github.com/go-logr/logr v1.2.4 -## explicit; go 1.16 +# github.com/go-logr/logr v1.3.0 +## explicit; go 1.18 github.com/go-logr/logr github.com/go-logr/logr/funcr +github.com/go-logr/logr/slogr # github.com/go-logr/stdr v1.2.2 ## explicit; go 1.16 github.com/go-logr/stdr @@ -183,7 +205,7 @@ github.com/go-openapi/jsonpointer ## explicit; go 1.13 github.com/go-openapi/jsonreference github.com/go-openapi/jsonreference/internal -# github.com/go-openapi/swag v0.22.3 +# github.com/go-openapi/swag v0.22.4 ## explicit; go 1.18 github.com/go-openapi/swag # github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 @@ -201,6 +223,9 @@ github.com/gogo/protobuf/sortkeys # github.com/golang-jwt/jwt/v4 v4.5.0 ## explicit; go 1.16 github.com/golang-jwt/jwt/v4 +# github.com/golang-jwt/jwt/v5 v5.0.0 +## explicit; go 1.18 +github.com/golang-jwt/jwt/v5 # github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da ## explicit github.com/golang/groupcache/lru @@ -245,7 +270,7 @@ github.com/google/gnostic-models/extensions github.com/google/gnostic-models/jsonschema github.com/google/gnostic-models/openapiv2 github.com/google/gnostic-models/openapiv3 -# github.com/google/go-cmp v0.5.9 +# github.com/google/go-cmp v0.6.0 ## explicit; go 1.13 github.com/google/go-cmp/cmp github.com/google/go-cmp/cmp/internal/diff @@ -256,17 +281,17 @@ github.com/google/go-cmp/cmp/internal/value ## explicit; go 1.12 github.com/google/gofuzz github.com/google/gofuzz/bytesource -# github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 -## explicit; go 1.14 +# github.com/google/pprof v0.0.0-20230602010524-ada837c32108 +## explicit; go 1.19 github.com/google/pprof/profile -# github.com/google/uuid v1.3.0 +# github.com/google/uuid v1.4.0 ## explicit github.com/google/uuid # github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 ## explicit github.com/grpc-ecosystem/go-grpc-prometheus -# github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 -## explicit; go 1.14 +# github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 +## explicit; go 1.17 github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule github.com/grpc-ecosystem/grpc-gateway/v2/runtime github.com/grpc-ecosystem/grpc-gateway/v2/utilities @@ -276,16 +301,13 @@ github.com/imdario/mergo # github.com/inconshreveable/mousetrap v1.1.0 ## explicit; go 1.18 github.com/inconshreveable/mousetrap -# github.com/jongio/azidext/go/azidext v0.5.0 -## explicit; go 1.18 -github.com/jongio/azidext/go/azidext # github.com/josharian/intern v1.0.0 ## explicit; go 1.5 github.com/josharian/intern # github.com/json-iterator/go v1.1.12 ## explicit; go 1.12 github.com/json-iterator/go -# github.com/kubernetes-csi/csi-lib-utils v0.13.0 +# github.com/kubernetes-csi/csi-lib-utils v0.16.0 ## explicit; go 1.18 github.com/kubernetes-csi/csi-lib-utils/protosanitizer # github.com/kylelemons/godebug v1.1.0 @@ -316,7 +338,7 @@ github.com/modern-go/reflect2 # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/onsi/ginkgo/v2 v2.13.0 +# github.com/onsi/ginkgo/v2 v2.13.2 ## explicit; go 1.18 github.com/onsi/ginkgo/v2 github.com/onsi/ginkgo/v2/config @@ -338,7 +360,7 @@ github.com/onsi/ginkgo/v2/internal/parallel_support github.com/onsi/ginkgo/v2/internal/testingtproxy github.com/onsi/ginkgo/v2/reporters github.com/onsi/ginkgo/v2/types -# github.com/onsi/gomega v1.27.10 +# github.com/onsi/gomega v1.30.0 ## explicit; go 1.18 github.com/onsi/gomega github.com/onsi/gomega/format @@ -399,7 +421,7 @@ github.com/prometheus/procfs/internal/util # github.com/satori/go.uuid v1.2.0 ## explicit github.com/satori/go.uuid -# github.com/spf13/cobra v1.7.0 +# github.com/spf13/cobra v1.8.0 ## explicit; go 1.15 github.com/spf13/cobra # github.com/spf13/pflag v1.0.5 @@ -434,61 +456,59 @@ go.etcd.io/etcd/client/v3 go.etcd.io/etcd/client/v3/credentials go.etcd.io/etcd/client/v3/internal/endpoint go.etcd.io/etcd/client/v3/internal/resolver -# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0 -## explicit; go 1.17 +# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 +## explicit; go 1.20 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal -# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1 -## explicit; go 1.17 +# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 +## explicit; go 1.20 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp -# go.opentelemetry.io/otel v1.10.0 -## explicit; go 1.17 +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil +# go.opentelemetry.io/otel v1.20.0 +## explicit; go 1.20 go.opentelemetry.io/otel go.opentelemetry.io/otel/attribute go.opentelemetry.io/otel/baggage go.opentelemetry.io/otel/codes -go.opentelemetry.io/otel/exporters/otlp/internal -go.opentelemetry.io/otel/exporters/otlp/internal/envconfig go.opentelemetry.io/otel/internal +go.opentelemetry.io/otel/internal/attribute go.opentelemetry.io/otel/internal/baggage go.opentelemetry.io/otel/internal/global go.opentelemetry.io/otel/propagation go.opentelemetry.io/otel/semconv/internal go.opentelemetry.io/otel/semconv/v1.12.0 -# go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 -## explicit; go 1.17 -go.opentelemetry.io/otel/exporters/otlp/internal/retry -# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 -## explicit; go 1.17 +go.opentelemetry.io/otel/semconv/v1.17.0 +go.opentelemetry.io/otel/semconv/v1.21.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 +## explicit; go 1.20 go.opentelemetry.io/otel/exporters/otlp/otlptrace -go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform -# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 -## explicit; go 1.17 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 +## explicit; go 1.20 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc -# go.opentelemetry.io/otel/metric v0.31.0 -## explicit; go 1.17 +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry +# go.opentelemetry.io/otel/metric v1.20.0 +## explicit; go 1.20 go.opentelemetry.io/otel/metric -go.opentelemetry.io/otel/metric/global -go.opentelemetry.io/otel/metric/instrument -go.opentelemetry.io/otel/metric/instrument/asyncfloat64 -go.opentelemetry.io/otel/metric/instrument/asyncint64 -go.opentelemetry.io/otel/metric/instrument/syncfloat64 -go.opentelemetry.io/otel/metric/instrument/syncint64 -go.opentelemetry.io/otel/metric/internal/global -go.opentelemetry.io/otel/metric/unit -# go.opentelemetry.io/otel/sdk v1.10.0 -## explicit; go 1.17 +go.opentelemetry.io/otel/metric/embedded +# go.opentelemetry.io/otel/sdk v1.20.0 +## explicit; go 1.20 +go.opentelemetry.io/otel/sdk go.opentelemetry.io/otel/sdk/instrumentation go.opentelemetry.io/otel/sdk/internal go.opentelemetry.io/otel/sdk/internal/env go.opentelemetry.io/otel/sdk/resource go.opentelemetry.io/otel/sdk/trace -# go.opentelemetry.io/otel/trace v1.10.0 -## explicit; go 1.17 +# go.opentelemetry.io/otel/trace v1.20.0 +## explicit; go 1.20 go.opentelemetry.io/otel/trace -# go.opentelemetry.io/proto/otlp v0.19.0 -## explicit; go 1.14 +go.opentelemetry.io/otel/trace/embedded +go.opentelemetry.io/otel/trace/noop +# go.opentelemetry.io/proto/otlp v1.0.0 +## explicit; go 1.17 go.opentelemetry.io/proto/otlp/collector/trace/v1 go.opentelemetry.io/proto/otlp/common/v1 go.opentelemetry.io/proto/otlp/resource/v1 @@ -508,8 +528,8 @@ go.uber.org/zap/internal/color go.uber.org/zap/internal/exit go.uber.org/zap/zapcore go.uber.org/zap/zapgrpc -# golang.org/x/crypto v0.14.0 -## explicit; go 1.17 +# golang.org/x/crypto v0.16.0 +## explicit; go 1.18 golang.org/x/crypto/blowfish golang.org/x/crypto/chacha20 golang.org/x/crypto/cryptobyte @@ -530,8 +550,8 @@ golang.org/x/crypto/ssh/internal/bcrypt_pbkdf golang.org/x/exp/constraints golang.org/x/exp/maps golang.org/x/exp/slices -# golang.org/x/net v0.17.0 -## explicit; go 1.17 +# golang.org/x/net v0.18.0 +## explicit; go 1.18 golang.org/x/net/context golang.org/x/net/html golang.org/x/net/html/atom @@ -545,25 +565,26 @@ golang.org/x/net/internal/timeseries golang.org/x/net/proxy golang.org/x/net/trace golang.org/x/net/websocket -# golang.org/x/oauth2 v0.10.0 -## explicit; go 1.17 +# golang.org/x/oauth2 v0.11.0 +## explicit; go 1.18 golang.org/x/oauth2 golang.org/x/oauth2/internal -# golang.org/x/sync v0.3.0 -## explicit; go 1.17 +# golang.org/x/sync v0.5.0 +## explicit; go 1.18 +golang.org/x/sync/errgroup golang.org/x/sync/singleflight -# golang.org/x/sys v0.13.0 -## explicit; go 1.17 +# golang.org/x/sys v0.15.0 +## explicit; go 1.18 golang.org/x/sys/cpu golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows golang.org/x/sys/windows/registry -# golang.org/x/term v0.13.0 -## explicit; go 1.17 +# golang.org/x/term v0.15.0 +## explicit; go 1.18 golang.org/x/term -# golang.org/x/text v0.13.0 -## explicit; go 1.17 +# golang.org/x/text v0.14.0 +## explicit; go 1.18 golang.org/x/text/encoding golang.org/x/text/encoding/charmap golang.org/x/text/encoding/htmlindex @@ -593,10 +614,10 @@ golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/width -# golang.org/x/time v0.3.0 -## explicit +# golang.org/x/time v0.5.0 +## explicit; go 1.18 golang.org/x/time/rate -# golang.org/x/tools v0.12.0 +# golang.org/x/tools v0.14.0 ## explicit; go 1.18 golang.org/x/tools/go/ast/inspector golang.org/x/tools/internal/typeparams @@ -609,21 +630,20 @@ google.golang.org/appengine/internal/log google.golang.org/appengine/internal/remote_api google.golang.org/appengine/internal/urlfetch google.golang.org/appengine/urlfetch -# google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 +# google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 ## explicit; go 1.19 google.golang.org/genproto/internal -google.golang.org/genproto/protobuf/field_mask -# google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 +# google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b ## explicit; go 1.19 google.golang.org/genproto/googleapis/api google.golang.org/genproto/googleapis/api/annotations google.golang.org/genproto/googleapis/api/expr/v1alpha1 google.golang.org/genproto/googleapis/api/httpbody -# google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 ## explicit; go 1.19 google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.58.3 +# google.golang.org/grpc v1.59.0 ## explicit; go 1.19 google.golang.org/grpc google.golang.org/grpc/attributes @@ -642,6 +662,7 @@ google.golang.org/grpc/encoding google.golang.org/grpc/encoding/gzip google.golang.org/grpc/encoding/proto google.golang.org/grpc/grpclog +google.golang.org/grpc/health/grpc_health_v1 google.golang.org/grpc/internal google.golang.org/grpc/internal/backoff google.golang.org/grpc/internal/balancer/gracefulswitch @@ -727,7 +748,7 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/api v0.28.1 => k8s.io/api v0.28.1 +# k8s.io/api v0.28.4 => k8s.io/api v0.28.4 ## explicit; go 1.20 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 @@ -783,12 +804,12 @@ k8s.io/api/scheduling/v1beta1 k8s.io/api/storage/v1 k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1beta1 -# k8s.io/apiextensions-apiserver v0.0.0 => k8s.io/apiextensions-apiserver v0.28.1 +# k8s.io/apiextensions-apiserver v0.0.0 => k8s.io/apiextensions-apiserver v0.28.4 ## explicit; go 1.20 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/features -# k8s.io/apimachinery v0.28.1 => k8s.io/apimachinery v0.28.1 +# k8s.io/apimachinery v0.28.4 => k8s.io/apimachinery v0.28.4 ## explicit; go 1.20 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors @@ -850,7 +871,7 @@ k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/third_party/forked/golang/json k8s.io/apimachinery/third_party/forked/golang/netutil k8s.io/apimachinery/third_party/forked/golang/reflect -# k8s.io/apiserver v0.28.1 => k8s.io/apiserver v0.28.1 +# k8s.io/apiserver v0.28.4 => k8s.io/apiserver v0.28.4 ## explicit; go 1.20 k8s.io/apiserver/pkg/admission k8s.io/apiserver/pkg/admission/cel @@ -995,7 +1016,7 @@ k8s.io/apiserver/plugin/pkg/audit/truncate k8s.io/apiserver/plugin/pkg/audit/webhook k8s.io/apiserver/plugin/pkg/authenticator/token/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook -# k8s.io/client-go v0.28.1 => k8s.io/client-go v0.28.1 +# k8s.io/client-go v0.28.4 => k8s.io/client-go v0.28.4 ## explicit; go 1.20 k8s.io/client-go/applyconfigurations/admissionregistration/v1 k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1 @@ -1316,7 +1337,7 @@ k8s.io/client-go/util/homedir k8s.io/client-go/util/keyutil k8s.io/client-go/util/retry k8s.io/client-go/util/workqueue -# k8s.io/cloud-provider v0.28.1 => k8s.io/cloud-provider v0.28.1 +# k8s.io/cloud-provider v0.28.4 => k8s.io/cloud-provider v0.28.4 ## explicit; go 1.20 k8s.io/cloud-provider k8s.io/cloud-provider/api @@ -1335,7 +1356,7 @@ k8s.io/cloud-provider/service/helpers k8s.io/cloud-provider/volume k8s.io/cloud-provider/volume/errors k8s.io/cloud-provider/volume/helpers -# k8s.io/component-base v0.28.1 => k8s.io/component-base v0.28.1 +# k8s.io/component-base v0.28.4 => k8s.io/component-base v0.28.4 ## explicit; go 1.20 k8s.io/component-base/cli/flag k8s.io/component-base/config @@ -1357,13 +1378,13 @@ k8s.io/component-base/metrics/testutil k8s.io/component-base/tracing k8s.io/component-base/tracing/api/v1 k8s.io/component-base/version -# k8s.io/component-helpers v0.28.1 => k8s.io/component-helpers v0.28.1 +# k8s.io/component-helpers v0.28.4 => k8s.io/component-helpers v0.28.4 ## explicit; go 1.20 k8s.io/component-helpers/node/util k8s.io/component-helpers/scheduling/corev1 k8s.io/component-helpers/scheduling/corev1/nodeaffinity k8s.io/component-helpers/storage/volume -# k8s.io/controller-manager v0.28.1 => k8s.io/controller-manager v0.28.1 +# k8s.io/controller-manager v0.28.4 => k8s.io/controller-manager v0.28.4 ## explicit; go 1.20 k8s.io/controller-manager/config k8s.io/controller-manager/config/v1 @@ -1375,7 +1396,7 @@ k8s.io/controller-manager/pkg/features k8s.io/controller-manager/pkg/features/register k8s.io/controller-manager/pkg/leadermigration/config k8s.io/controller-manager/pkg/leadermigration/options -# k8s.io/klog/v2 v2.100.1 +# k8s.io/klog/v2 v2.110.1 ## explicit; go 1.13 k8s.io/klog/v2 k8s.io/klog/v2/internal/buffer @@ -1383,7 +1404,8 @@ k8s.io/klog/v2/internal/clock k8s.io/klog/v2/internal/dbg k8s.io/klog/v2/internal/serialize k8s.io/klog/v2/internal/severity -# k8s.io/kms v0.28.1 +k8s.io/klog/v2/internal/sloghandler +# k8s.io/kms v0.28.4 ## explicit; go 1.20 k8s.io/kms/apis/v1beta1 k8s.io/kms/apis/v2 @@ -1411,15 +1433,15 @@ k8s.io/kube-openapi/pkg/validation/errors k8s.io/kube-openapi/pkg/validation/spec k8s.io/kube-openapi/pkg/validation/strfmt k8s.io/kube-openapi/pkg/validation/strfmt/bson -# k8s.io/kubectl v0.0.0 => k8s.io/kubectl v0.28.1 +# k8s.io/kubectl v0.0.0 => k8s.io/kubectl v0.28.4 ## explicit; go 1.20 k8s.io/kubectl/pkg/scale k8s.io/kubectl/pkg/util/podutils -# k8s.io/kubelet v0.28.1 => k8s.io/kubelet v0.28.1 +# k8s.io/kubelet v0.28.4 => k8s.io/kubelet v0.28.4 ## explicit; go 1.20 k8s.io/kubelet/pkg/apis k8s.io/kubelet/pkg/apis/stats/v1alpha1 -# k8s.io/kubernetes v1.28.2 +# k8s.io/kubernetes v1.28.4 ## explicit; go 1.20 k8s.io/kubernetes/pkg/api/legacyscheme k8s.io/kubernetes/pkg/api/service @@ -1485,14 +1507,14 @@ k8s.io/kubernetes/test/utils k8s.io/kubernetes/test/utils/format k8s.io/kubernetes/test/utils/image k8s.io/kubernetes/test/utils/kubeconfig -# k8s.io/mount-utils v0.28.1 => k8s.io/mount-utils v0.28.1 +# k8s.io/mount-utils v0.28.4 => k8s.io/mount-utils v0.28.4 ## explicit; go 1.20 k8s.io/mount-utils -# k8s.io/pod-security-admission v0.28.1 => k8s.io/pod-security-admission v0.28.1 +# k8s.io/pod-security-admission v0.28.4 => k8s.io/pod-security-admission v0.28.4 ## explicit; go 1.20 k8s.io/pod-security-admission/api k8s.io/pod-security-admission/policy -# k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 +# k8s.io/utils v0.0.0-20230505201702-9f6742963106 ## explicit; go 1.18 k8s.io/utils/buffer k8s.io/utils/clock @@ -1518,7 +1540,7 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client -# sigs.k8s.io/cloud-provider-azure v1.27.1-0.20230907063607-e9994a5f9c7a +# sigs.k8s.io/cloud-provider-azure v1.27.1-0.20231128114432-f80321a29d3a ## explicit; go 1.20 sigs.k8s.io/cloud-provider-azure/pkg/azureclients sigs.k8s.io/cloud-provider-azure/pkg/azureclients/armclient @@ -1566,11 +1588,53 @@ sigs.k8s.io/cloud-provider-azure/pkg/consts sigs.k8s.io/cloud-provider-azure/pkg/metrics sigs.k8s.io/cloud-provider-azure/pkg/provider sigs.k8s.io/cloud-provider-azure/pkg/provider/config +sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer sigs.k8s.io/cloud-provider-azure/pkg/provider/virtualmachine sigs.k8s.io/cloud-provider-azure/pkg/retry sigs.k8s.io/cloud-provider-azure/pkg/util/deepcopy sigs.k8s.io/cloud-provider-azure/pkg/util/taints sigs.k8s.io/cloud-provider-azure/pkg/version +# sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.0-20231128114432-f80321a29d3a +## explicit; go 1.20 +sigs.k8s.io/cloud-provider-azure/pkg/azclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit +sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol +sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/retryrepectthrottled +sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils +sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer +sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient +# sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.0-20231128114432-f80321a29d3a +## explicit; go 1.20 +sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader # sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd ## explicit; go 1.18 sigs.k8s.io/json @@ -1582,37 +1646,36 @@ sigs.k8s.io/structured-merge-diff/v4/merge sigs.k8s.io/structured-merge-diff/v4/schema sigs.k8s.io/structured-merge-diff/v4/typed sigs.k8s.io/structured-merge-diff/v4/value -# sigs.k8s.io/yaml v1.3.0 +# sigs.k8s.io/yaml v1.4.0 ## explicit; go 1.12 sigs.k8s.io/yaml -# github.com/niemeyer/pretty => github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e -# go.etcd.io/etcd => go.etcd.io/etcd v0.0.0-20200410171415-59f5fb25a533 -# k8s.io/api => k8s.io/api v0.28.1 -# k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.28.1 -# k8s.io/apimachinery => k8s.io/apimachinery v0.28.1 -# k8s.io/apiserver => k8s.io/apiserver v0.28.1 -# k8s.io/cli-runtime => k8s.io/cli-runtime v0.28.1 -# k8s.io/client-go => k8s.io/client-go v0.28.1 -# k8s.io/cloud-provider => k8s.io/cloud-provider v0.28.1 -# k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.28.1 -# k8s.io/code-generator => k8s.io/code-generator v0.28.1 -# k8s.io/component-base => k8s.io/component-base v0.28.1 -# k8s.io/component-helpers => k8s.io/component-helpers v0.28.1 -# k8s.io/controller-manager => k8s.io/controller-manager v0.28.1 -# k8s.io/cri-api => k8s.io/cri-api v0.28.1 -# k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.28.1 -# k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.1 -# k8s.io/endpointslice => k8s.io/endpointslice v0.28.1 -# k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.28.1 -# k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.28.1 -# k8s.io/kube-proxy => k8s.io/kube-proxy v0.28.1 -# k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.1 -# k8s.io/kubectl => k8s.io/kubectl v0.28.1 -# k8s.io/kubelet => k8s.io/kubelet v0.28.1 -# k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.1 -# k8s.io/metrics => k8s.io/metrics v0.28.1 -# k8s.io/mount-utils => k8s.io/mount-utils v0.28.1 -# k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.28.1 -# k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.28.1 -# k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.28.1 -# k8s.io/sample-controller => k8s.io/sample-controller v0.28.1 +sigs.k8s.io/yaml/goyaml.v2 +# k8s.io/api => k8s.io/api v0.28.4 +# k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.28.4 +# k8s.io/apimachinery => k8s.io/apimachinery v0.28.4 +# k8s.io/apiserver => k8s.io/apiserver v0.28.4 +# k8s.io/cli-runtime => k8s.io/cli-runtime v0.28.4 +# k8s.io/client-go => k8s.io/client-go v0.28.4 +# k8s.io/cloud-provider => k8s.io/cloud-provider v0.28.4 +# k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.28.4 +# k8s.io/code-generator => k8s.io/code-generator v0.28.4 +# k8s.io/component-base => k8s.io/component-base v0.28.4 +# k8s.io/component-helpers => k8s.io/component-helpers v0.28.4 +# k8s.io/controller-manager => k8s.io/controller-manager v0.28.4 +# k8s.io/cri-api => k8s.io/cri-api v0.28.4 +# k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.28.4 +# k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.4 +# k8s.io/endpointslice => k8s.io/endpointslice v0.28.4 +# k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.28.4 +# k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.28.4 +# k8s.io/kube-proxy => k8s.io/kube-proxy v0.28.4 +# k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.4 +# k8s.io/kubectl => k8s.io/kubectl v0.28.4 +# k8s.io/kubelet => k8s.io/kubelet v0.28.4 +# k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.4 +# k8s.io/metrics => k8s.io/metrics v0.28.4 +# k8s.io/mount-utils => k8s.io/mount-utils v0.28.4 +# k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.28.4 +# k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.28.4 +# k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.28.4 +# k8s.io/sample-controller => k8s.io/sample-controller v0.28.4 diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/LICENSE b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/LICENSE similarity index 99% rename from vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/LICENSE rename to vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/LICENSE index 261eeb9e9..d64569567 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/LICENSE +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/LICENSE @@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/Makefile b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/Makefile new file mode 100644 index 000000000..44f00b3be --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/Makefile @@ -0,0 +1,146 @@ +# Copyright 2022 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) +ifeq (,$(shell go env GOBIN)) +GOBIN=$(shell go env GOPATH)/bin +else +GOBIN=$(shell go env GOBIN) +endif + +## Location to install dependencies to +LOCALBIN ?= $(shell pwd)/bin +$(LOCALBIN): + mkdir -p $(LOCALBIN) + +# Setting SHELL to bash allows bash commands to be executed by recipes. +# Options are set to exit when a recipe line exits non-zero or a piped command fails. +SHELL = /usr/bin/env bash -o pipefail +.SHELLFLAGS = -ec + +.PHONY: all +all: generate + +##@ General + +# The help target prints out all targets with their descriptions organized +# beneath their categories. The categories are represented by '##@' and the +# target descriptions by '##'. The awk commands is responsible for reading the +# entire set of makefiles included in this invocation, looking for lines of the +# file as xyz: ## something, and then pretty-format the target and help. Then, +# if there's a line with ##@ something, that gets pretty-printed as a category. +# More info on the usage of ANSI control characters for terminal formatting: +# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters +# More info on the awk command: +# http://linuxcommand.org/lc3_adv_awk.php + +.PHONY: help +help: ## Display this help. + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +##@ Development +.PHONY: fmt +fmt: goimports ## Run go fmt against code. + $(GOIMPORTS) -w -local sigs.k8s.io/cloud-provider-azure/pkg/azclient . + +.PHONY: vet +vet: golangci-lint ## Run go vet against code. + pushd client-gen; $(LOCALBIN)/golangci-lint run --timeout 10m ./... ;popd + +##@ Build +.PHONY: build +TYPESCAFFOLD = $(LOCALBIN)/typescaffold +CLIENTGEN = $(LOCALBIN)/client-gen +build: fmt vet ## Build manager binary. + pushd client-gen; CGO_ENABLED=0 go build -o ../bin/client-gen ./cmd/client-gen/ ;popd + pushd client-gen; CGO_ENABLED=0 go build -o ../bin/typescaffold ./cmd/typescaffold/;popd + +.PHONY: generate +generate: install-dependencies build generatecode generateimpl vet-all + +.PHONY: generatecode +generatecode: build ## Generate client + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 --package-alias armcontainerservice --resource ManagedCluster --client-name ManagedClustersClient --ratelimitkey containerServiceRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry --package-alias armcontainerregistry --resource Registry --client-name RegistriesClient --verbs get,delete,listbyrg + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources --package-alias resources --resource Deployment --client-name DeploymentsClient --verbs delete --ratelimitkey deploymentRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources --package-alias resources --resource ResourceGroup --client-name ResourceGroupsClient + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 --package-alias armcompute --resource Disk --client-name DisksClient --ratelimitkey diskRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 --package-alias armcompute --resource AvailabilitySet --client-name AvailabilitySetsClient --verbs get,list --ratelimitkey availabilitySetRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 --package-alias armcompute --resource VirtualMachine --client-name VirtualMachinesClient --verbs createorupdate,delete,list --expand --ratelimitkey virtualMachineRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 --package-alias armcompute --resource VirtualMachineScaleSet --client-name VirtualMachineScaleSetsClient --verbs get,createorupdate,delete,list --ratelimitkey virtualMachineSizesRateLimit --expand + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 --package-alias armcompute --resource VirtualMachineScaleSet --subresource VirtualMachineScaleSetVM --client-name VirtualMachineScaleSetVMsClient --verbs get,delete,list + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 --package-alias armcompute --resource Snapshot --client-name SnapshotsClient --verbs get,createorupdate,delete --ratelimitkey snapshotRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 --package-alias armcompute --resource SSHPublicKeyResource --client-name SSHPublicKeysClient --verbs get,listbyrg + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource VirtualNetwork --subresource Subnet --client-name SubnetsClient --verbs get,createorupdate,delete,list --expand --ratelimitkey subnetsRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource VirtualNetwork --client-name VirtualNetworksClient --verbs get,createorupdate,delete,list --expand + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource Interface --client-name InterfacesClient --verbs get,createorupdate,delete,list --expand --ratelimitkey interfaceRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource LoadBalancer --client-name LoadBalancersClient --verbs get,createorupdate,delete,list --expand --ratelimitkey loadBalancerRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource PrivateEndpoint --client-name PrivateEndpointsClient --verbs get,createorupdate --expand --ratelimitkey privateEndpointRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource PublicIPAddress --client-name PublicIPAddressesClient --verbs get,createorupdate,delete,list --expand --ratelimitkey publicIPAddressRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource PublicIPPrefix --client-name PublicIPPrefixesClient --verbs get,createorupdate,delete,list --expand + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource RouteTable --client-name RouteTablesClient --verbs get,createorupdate,delete,list --ratelimitkey routeTableRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource SecurityGroup --client-name SecurityGroupsClient --verbs get,createorupdate,delete,list --ratelimitkey securityGroupRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource PrivateLinkService --client-name PrivateLinkServicesClient --verbs get,createorupdate,delete,list --expand --ratelimitkey privateLinkServiceRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 --package-alias armnetwork --resource IPGroup --client-name IPGroupsClient --verbs get,createorupdate,delete,listbyrg --expand --ratelimitkey ipGroupRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage --package-alias armstorage --resource Account --client-name AccountsClient --verbs listbyrg --expand + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns --package-alias armprivatedns --resource PrivateZone --client-name PrivateZonesClient --verbs get,createorupdate --ratelimitkey privateDNSRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage --package-alias armstorage --resource Account --subresource FileShare --client-name FileSharesClient --verbs get,createorupdate,delete,list + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage --package-alias armstorage --resource Account --subresource BlobContainer --client-name BlobContainersClient --verbs get,list + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage --package-alias armstorage --resource BlobServiceProperties --client-name BlobServicesClient + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault --package-alias armkeyvault --resource Vault --subresource Secret --client-name SecretsClient --verbs get,createorupdate,delete,list + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault --package-alias armkeyvault --resource Vault --client-name VaultsClient --verbs get,createorupdate,delete,list + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources --package-alias armresources --resource Provider --client-name ProvidersClient + + +.PHONY: generateimpl +generateimpl: build ## Generate client + $(CLIENTGEN) clientgen:headerFile=../../hack/boilerplate/boilerplate.gomock.txt paths=./... + +.PHONY: vet-all +vet-all: golangci-lint ## Run go vet against code. + $(LOCALBIN)/golangci-lint run --timeout 10m ./... + + +ifndef ignore-not-found + ignore-not-found = false +endif +##@ Build Dependencies + +.PHONY: install-dependencies +install-dependencies: golangci-lint goimports mockgen ginkgo## Install all build dependencies. + +GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint +.PHONY: golangci-lint +golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. +$(GOLANGCI_LINT): $(LOCALBIN) + test -s $(LOCALBIN)/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(LOCALBIN) latest + +GOIMPORTS ?= $(LOCALBIN)/goimports +.PHONY: goimports +goimports: $(GOIMPORTS) ## Download goimports locally if necessary. +$(GOIMPORTS): $(LOCALBIN) + test -s $(LOCALBIN)/goimports || GOBIN=$(LOCALBIN) go install golang.org/x/tools/cmd/goimports@latest + +MOCKGEN ?= $(LOCALBIN)/mockgen +.PHONY: mockgen +mockgen: $(MOCKGEN) ## Download mockgen locally if necessary. +$(MOCKGEN): $(LOCALBIN) + test -s $(LOCALBIN)/mockgen || GOBIN=$(LOCALBIN) go install github.com/golang/mock/mockgen@v1.6.0 + +GINKGO ?= $(LOCALBIN)/ginkgo +.PHONY: ginkgo +ginkgo: $(GINKGO) ## Download ginkgo locally if necessary. +$(GINKGO): $(LOCALBIN) + test -s $(LOCALBIN)/ginkgo || GOBIN=$(LOCALBIN) go install github.com/onsi/ginkgo/v2/ginkgo@latest diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/custom.go new file mode 100644 index 000000000..c94acad9a --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/custom.go @@ -0,0 +1,62 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package accountclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +func (client *Client) Create(ctx context.Context, resourceGroupName string, resourceName string, resource *armstorage.AccountCreateParameters) (*armstorage.Account, error) { + if resource == nil { + resource = &armstorage.AccountCreateParameters{} + } + resp, err := utils.NewPollerWrapper(client.AccountsClient.BeginCreate(ctx, resourceGroupName, resourceName, *resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.Account, nil + } + return nil, nil +} + +func (client *Client) GetProperties(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientGetPropertiesOptions) (*armstorage.Account, error) { + resp, err := client.AccountsClient.GetProperties(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.Account, nil +} + +// Delete deletes a Interface by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + _, err := client.AccountsClient.Delete(ctx, resourceGroupName, resourceName, nil) + return err +} + +func (client *Client) ListKeys(ctx context.Context, resourceGroupName string, accountName string) ([]*armstorage.AccountKey, error) { + resp, err := client.AccountsClient.ListKeys(ctx, resourceGroupName, accountName, nil) + if err != nil { + return nil, err + } + return resp.Keys, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface.go new file mode 100644 index 000000000..9cc97b01a --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface.go @@ -0,0 +1,35 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package accountclient + +import ( + "context" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=listbyrg,resource=Account,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage,packageAlias=armstorage,clientName=AccountsClient,expand=true +type Interface interface { + utils.ListFunc[armstorage.Account] + Create(ctx context.Context, resourceGroupName string, accountName string, resource *armstorage.AccountCreateParameters) (*armstorage.Account, error) + GetProperties(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientGetPropertiesOptions) (*armstorage.Account, error) + Delete(ctx context.Context, resourceGroupName string, accountName string) error + ListKeys(ctx context.Context, resourceGroupName string, accountName string) ([]*armstorage.AccountKey, error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/zz_generated_client.go new file mode 100644 index 000000000..119d785f3 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/zz_generated_client.go @@ -0,0 +1,62 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package accountclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armstorage.AccountsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armstorage.NewAccountsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// List gets a list of Account in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armstorage.Account, rerr error) { + ctx = utils.ContextWithClientName(ctx, "AccountsClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.AccountsClient.NewListByResourceGroupPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/arm_conf.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/arm_conf.go new file mode 100644 index 000000000..55ddc722a --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/arm_conf.go @@ -0,0 +1,53 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package azclient + +import ( + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type ARMClientConfig struct { + // The cloud environment identifier. Takes values from https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore@v1.6.0/cloud + Cloud string `json:"cloud,omitempty" yaml:"cloud,omitempty"` + // The user agent for Azure customer usage attribution + UserAgent string `json:"userAgent,omitempty" yaml:"userAgent,omitempty"` + // ResourceManagerEndpoint is the cloud's resource manager endpoint. If set, cloud provider queries this endpoint + // in order to generate an autorest.Environment instance instead of using one of the pre-defined Environments. + ResourceManagerEndpoint string `json:"resourceManagerEndpoint,omitempty" yaml:"resourceManagerEndpoint,omitempty"` +} + +func NewClientOptionFromARMClientConfig(config *ARMClientConfig) (*policy.ClientOptions, error) { + //Get default settings + options := utils.GetDefaultOption() + var err error + if config != nil { + //update user agent header + options.ClientOptions.Telemetry.ApplicationID = strings.TrimSpace(config.UserAgent) + //set cloud + var cloudConfig *cloud.Configuration + cloudConfig, err = GetAzureCloudConfig(config) + options.ClientOptions.Cloud = *cloudConfig + } else { + options.ClientOptions.Cloud = cloud.AzurePublic + } + return options, err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/auth.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/auth.go new file mode 100644 index 000000000..67f12af48 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/auth.go @@ -0,0 +1,242 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package azclient + +import ( + "crypto/rsa" + "crypto/x509" + "fmt" + "os" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "golang.org/x/crypto/pkcs12" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// AzureAuthConfig holds auth related part of cloud config +type AzureAuthConfig struct { + // The AAD Tenant ID for the Subscription that the cluster is deployed in + TenantID string `json:"tenantId,omitempty" yaml:"tenantId,omitempty"` + // The ClientID for an AAD application with RBAC access to talk to Azure RM APIs + AADClientID string `json:"aadClientId,omitempty" yaml:"aadClientId,omitempty"` + // The ClientSecret for an AAD application with RBAC access to talk to Azure RM APIs + AADClientSecret string `json:"aadClientSecret,omitempty" yaml:"aadClientSecret,omitempty" datapolicy:"token"` + // The path of a client certificate for an AAD application with RBAC access to talk to Azure RM APIs + AADClientCertPath string `json:"aadClientCertPath,omitempty" yaml:"aadClientCertPath,omitempty"` + // The password of the client certificate for an AAD application with RBAC access to talk to Azure RM APIs + AADClientCertPassword string `json:"aadClientCertPassword,omitempty" yaml:"aadClientCertPassword,omitempty" datapolicy:"password"` + // Use managed service identity for the virtual machine to access Azure ARM APIs + UseManagedIdentityExtension bool `json:"useManagedIdentityExtension,omitempty" yaml:"useManagedIdentityExtension,omitempty"` + // UserAssignedIdentityID contains the Client ID of the user assigned MSI which is assigned to the underlying VMs. If empty the user assigned identity is not used. + // More details of the user assigned identity can be found at: https://docs.microsoft.com/en-us/azure/active-directory/managed-service-identity/overview + // For the user assigned identity specified here to be used, the UseManagedIdentityExtension has to be set to true. + UserAssignedIdentityID string `json:"userAssignedIdentityID,omitempty" yaml:"userAssignedIdentityID,omitempty"` + // The AAD Tenant ID for the Subscription that the network resources are deployed in. + NetworkResourceTenantID string `json:"networkResourceTenantID,omitempty" yaml:"networkResourceTenantID,omitempty"` + // The AAD federated token file + AADFederatedTokenFile string `json:"aadFederatedTokenFile,omitempty" yaml:"aadFederatedTokenFile,omitempty"` + // Use workload identity federation for the virtual machine to access Azure ARM APIs + UseFederatedWorkloadIdentityExtension bool `json:"useFederatedWorkloadIdentityExtension,omitempty" yaml:"useFederatedWorkloadIdentityExtension,omitempty"` +} + +var ( + // ErrorNoAuth indicates that no credentials are provided. + ErrorNoAuth = fmt.Errorf("no credentials provided for Azure cloud provider") +) + +type AuthProvider struct { + FederatedIdentityCredential azcore.TokenCredential + ManagedIdentityCredential azcore.TokenCredential + ClientSecretCredential azcore.TokenCredential + NetworkClientSecretCredential azcore.TokenCredential + MultiTenantCredential azcore.TokenCredential + ClientCertificateCredential azcore.TokenCredential +} + +func GetDefaultAuthClientOption(armConfig *ARMClientConfig) (*policy.ClientOptions, error) { + //Get default settings + options, err := NewClientOptionFromARMClientConfig(armConfig) + if err != nil { + return nil, err + } + return options, nil +} + +func NewAuthProvider(config AzureAuthConfig, clientOption *policy.ClientOptions) (*AuthProvider, error) { + if clientOption == nil { + clientOption = &policy.ClientOptions{} + } + // these environment variables are injected by workload identity webhook + if tenantID := os.Getenv(utils.AzureTenantID); tenantID != "" { + config.TenantID = tenantID + } + if clientID := os.Getenv(utils.AzureClientID); clientID != "" { + config.AADClientID = clientID + } + var err error + // federatedIdentityCredential is used for workload identity federation + var federatedIdentityCredential azcore.TokenCredential + if federatedTokenFile := os.Getenv(utils.AzureFederatedTokenFile); federatedTokenFile != "" { + config.AADFederatedTokenFile = federatedTokenFile + config.UseFederatedWorkloadIdentityExtension = true + } + if config.UseFederatedWorkloadIdentityExtension { + federatedIdentityCredential, err = azidentity.NewWorkloadIdentityCredential(&azidentity.WorkloadIdentityCredentialOptions{ + ClientOptions: clientOption.ClientOptions, + ClientID: config.AADClientID, + TenantID: config.TenantID, + TokenFilePath: config.AADFederatedTokenFile, + }) + if err != nil { + return nil, err + } + } + + // managedIdentityCredential is used for managed identity extension + var managedIdentityCredential azcore.TokenCredential + if config.UseManagedIdentityExtension { + credOptions := &azidentity.ManagedIdentityCredentialOptions{ + ClientOptions: clientOption.ClientOptions, + } + if len(config.UserAssignedIdentityID) > 0 { + if strings.Contains(strings.ToUpper(config.UserAssignedIdentityID), "/SUBSCRIPTIONS/") { + credOptions.ID = azidentity.ResourceID(config.UserAssignedIdentityID) + } else { + credOptions.ID = azidentity.ClientID(config.UserAssignedIdentityID) + } + } + managedIdentityCredential, err = azidentity.NewManagedIdentityCredential(credOptions) + if err != nil { + return nil, err + } + } + + // ClientSecretCredential is used for client secret + var clientSecretCredential azcore.TokenCredential + var networkClientSecretCredential azcore.TokenCredential + var multiTenantCredential azcore.TokenCredential + if len(config.AADClientSecret) > 0 { + credOptions := &azidentity.ClientSecretCredentialOptions{ + ClientOptions: clientOption.ClientOptions, + } + clientSecretCredential, err = azidentity.NewClientSecretCredential(config.TenantID, config.AADClientID, config.AADClientSecret, credOptions) + if err != nil { + return nil, err + } + if len(config.NetworkResourceTenantID) > 0 && !strings.EqualFold(config.NetworkResourceTenantID, config.TenantID) { + credOptions := &azidentity.ClientSecretCredentialOptions{ + ClientOptions: clientOption.ClientOptions, + } + networkClientSecretCredential, err = azidentity.NewClientSecretCredential(config.NetworkResourceTenantID, config.AADClientID, config.AADClientSecret, credOptions) + if err != nil { + return nil, err + } + + credOptions = &azidentity.ClientSecretCredentialOptions{ + ClientOptions: clientOption.ClientOptions, + AdditionallyAllowedTenants: []string{config.NetworkResourceTenantID}, + } + multiTenantCredential, err = azidentity.NewClientSecretCredential(config.TenantID, config.AADClientID, config.AADClientSecret, credOptions) + if err != nil { + return nil, err + } + + } + } + + // ClientCertificateCredential is used for client certificate + var clientCertificateCredential azcore.TokenCredential + if len(config.AADClientCertPath) > 0 && len(config.AADClientCertPassword) > 0 { + credOptions := &azidentity.ClientCertificateCredentialOptions{ + ClientOptions: clientOption.ClientOptions, + SendCertificateChain: true, + } + certData, err := os.ReadFile(config.AADClientCertPath) + if err != nil { + return nil, fmt.Errorf("reading the client certificate from file %s: %w", config.AADClientCertPath, err) + } + certificate, privateKey, err := decodePkcs12(certData, config.AADClientCertPassword) + if err != nil { + return nil, fmt.Errorf("decoding the client certificate: %w", err) + } + clientCertificateCredential, err = azidentity.NewClientCertificateCredential(config.TenantID, config.AADClientID, []*x509.Certificate{certificate}, privateKey, credOptions) + if err != nil { + return nil, err + } + } + + return &AuthProvider{ + FederatedIdentityCredential: federatedIdentityCredential, + ManagedIdentityCredential: managedIdentityCredential, + ClientSecretCredential: clientSecretCredential, + ClientCertificateCredential: clientCertificateCredential, + NetworkClientSecretCredential: networkClientSecretCredential, + MultiTenantCredential: multiTenantCredential, + }, nil +} + +func (factory *AuthProvider) GetAzIdentity() (azcore.TokenCredential, error) { + switch true { + case factory.FederatedIdentityCredential != nil: + return factory.FederatedIdentityCredential, nil + case factory.ManagedIdentityCredential != nil: + return factory.ManagedIdentityCredential, nil + case factory.ClientSecretCredential != nil: + return factory.ClientSecretCredential, nil + case factory.ClientCertificateCredential != nil: + return factory.ClientCertificateCredential, nil + default: + return nil, ErrorNoAuth + } +} + +// decodePkcs12 decodes a PKCS#12 client certificate by extracting the public certificate and +// the private RSA key +func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error) { + privateKey, certificate, err := pkcs12.Decode(pkcs, password) + if err != nil { + return nil, nil, fmt.Errorf("decoding the PKCS#12 client certificate: %w", err) + } + rsaPrivateKey, isRsaKey := privateKey.(*rsa.PrivateKey) + if !isRsaKey { + return nil, nil, fmt.Errorf("PKCS#12 certificate must contain a RSA private key") + } + + return certificate, rsaPrivateKey, nil +} + +func (factory *AuthProvider) GetNetworkAzIdentity() (azcore.TokenCredential, error) { + if factory.NetworkClientSecretCredential != nil { + return factory.NetworkClientSecretCredential, nil + } + return nil, ErrorNoAuth +} + +func (factory *AuthProvider) GetMultiTenantIdentity() (azcore.TokenCredential, error) { + if factory.MultiTenantCredential != nil { + return factory.MultiTenantCredential, nil + } + return nil, ErrorNoAuth +} + +func (factory *AuthProvider) IsMultiTenantModeEnabled() bool { + return factory.MultiTenantCredential != nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/interface.go new file mode 100644 index 000000000..fe0761358 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/interface.go @@ -0,0 +1,30 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package availabilitysetclient + +import ( + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;list,resource=AvailabilitySet,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5,packageAlias=armcompute,clientName=AvailabilitySetsClient,expand=false,rateLimitKey=availabilitySetRateLimit +type Interface interface { + utils.GetFunc[armcompute.AvailabilitySet] + utils.ListFunc[armcompute.AvailabilitySet] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/zz_generated_client.go new file mode 100644 index 000000000..23c34b5e7 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/zz_generated_client.go @@ -0,0 +1,77 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package availabilitysetclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armcompute.AvailabilitySetsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armcompute.NewAvailabilitySetsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the AvailabilitySet +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcompute.AvailabilitySet, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "AvailabilitySetsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.AvailabilitySetsClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.AvailabilitySet, nil +} + +// List gets a list of AvailabilitySet in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.AvailabilitySet, rerr error) { + ctx = utils.ContextWithClientName(ctx, "AvailabilitySetsClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.AvailabilitySetsClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/custom.go new file mode 100644 index 000000000..f4268df08 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/custom.go @@ -0,0 +1,49 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package blobcontainerclient + +import ( + "context" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" +) + +// List gets a list of BlobContainer in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string, parentResourceName string) (result []*armstorage.ListContainerItem, rerr error) { + pager := client.BlobContainersClient.NewListPager(resourceGroupName, parentResourceName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} + +func (client *Client) CreateContainer(ctx context.Context, resourceGroupName, accountName, containerName string, parameters armstorage.BlobContainer) (*armstorage.BlobContainer, error) { + resp, err := client.BlobContainersClient.Create(ctx, resourceGroupName, accountName, containerName, parameters, nil) + if err != nil { + return nil, err + } + return &resp.BlobContainer, nil +} + +func (client *Client) DeleteContainer(ctx context.Context, resourceGroupName, accountName, containerName string) error { + _, err := client.BlobContainersClient.Delete(ctx, resourceGroupName, accountName, containerName, nil) + return err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/interface.go new file mode 100644 index 000000000..b8fc8ae9d --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/interface.go @@ -0,0 +1,34 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package blobcontainerclient + +import ( + "context" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get,resource=Account,subResource=BlobContainer,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage,packageAlias=armstorage,clientName=BlobContainersClient,expand=false +type Interface interface { + utils.SubResourceGetFunc[armstorage.BlobContainer] + CreateContainer(ctx context.Context, resourceGroupName, accountName, containerName string, parameters armstorage.BlobContainer) (*armstorage.BlobContainer, error) + DeleteContainer(ctx context.Context, resourceGroupName, accountName, containerName string) error + List(ctx context.Context, resourceGroupName string, parentResourceName string) (result []*armstorage.ListContainerItem, rerr error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/zz_generated_client.go new file mode 100644 index 000000000..031ea2ea6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/zz_generated_client.go @@ -0,0 +1,60 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package blobcontainerclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armstorage.BlobContainersClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armstorage.NewBlobContainersClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the BlobContainer +func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armstorage.BlobContainer, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "BlobContainersClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.BlobContainersClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.BlobContainer, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/custom.go new file mode 100644 index 000000000..42a8fab22 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/custom.go @@ -0,0 +1,42 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package blobservicepropertiesclient + +import ( + "context" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" +) + +// Get gets the BlobServiceProperties +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (*armstorage.BlobServiceProperties, error) { + + resp, err := client.BlobServicesClient.GetServiceProperties(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.BlobServiceProperties, nil +} + +func (client *Client) Set(ctx context.Context, resourceGroupName string, resourceName string, parameters armstorage.BlobServiceProperties) (*armstorage.BlobServiceProperties, error) { + resp, err := client.BlobServicesClient.SetServiceProperties(ctx, resourceGroupName, resourceName, parameters, nil) + if err != nil { + return nil, err + } + return &resp.BlobServiceProperties, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/interface.go new file mode 100644 index 000000000..e70b1e8aa --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/interface.go @@ -0,0 +1,30 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package blobservicepropertiesclient + +import ( + "context" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" +) + +// +azure:client:resource=BlobServiceProperties,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage,packageAlias=armstorage,clientName=BlobServicesClient,expand=false +type Interface interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (*armstorage.BlobServiceProperties, error) + Set(ctx context.Context, resourceGroupName string, resourceName string, parameters armstorage.BlobServiceProperties) (*armstorage.BlobServiceProperties, error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/zz_generated_client.go new file mode 100644 index 000000000..0f67ac815 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/zz_generated_client.go @@ -0,0 +1,43 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package blobservicepropertiesclient + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armstorage.BlobServicesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armstorage.NewBlobServicesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go new file mode 100644 index 000000000..dd49602e8 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go @@ -0,0 +1,180 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package azclient + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + "os" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" +) + +var EnvironmentMapping = map[string]*cloud.Configuration{ + "AZURECHINACLOUD": &cloud.AzureChina, + "AZURECLOUD": &cloud.AzurePublic, + "AZUREPUBLICCLOUD": &cloud.AzurePublic, + "AZUREUSGOVERNMENT": &cloud.AzureGovernment, + "AZUREUSGOVERNMENTCLOUD": &cloud.AzureGovernment, //TODO: deprecate +} + +const ( + // EnvironmentFilepathName captures the name of the environment variable containing the path to the file + // to be used while populating the Azure Environment. + EnvironmentFilepathName = "AZURE_ENVIRONMENT_FILEPATH" +) + +func AzureCloudConfigFromName(cloudName string) *cloud.Configuration { + if cloudName == "" { + return &cloud.AzurePublic + } + cloudName = strings.ToUpper(strings.TrimSpace(cloudName)) + if cloudConfig, ok := EnvironmentMapping[cloudName]; ok { + return cloudConfig + } + return nil +} + +// AzureCloudConfigFromURL returns cloud config from url +// track2 sdk will add this one in the near future https://github.com/Azure/azure-sdk-for-go/issues/20959 +func AzureCloudConfigFromURL(endpoint string) (*cloud.Configuration, error) { + managementEndpoint := fmt.Sprintf("%s%s", strings.TrimSuffix(endpoint, "/"), "/metadata/endpoints?api-version=2019-05-01") + res, err := http.Get(managementEndpoint) //nolint + if err != nil { + return nil, err + } + body, err := io.ReadAll(res.Body) + if err != nil { + return nil, err + } + metadata := []struct { + Authentication struct { + Audiences []string + LoginEndpoint string + } + Name, ResourceManager string + }{} + err = json.Unmarshal(body, &metadata) + if err != nil { + return nil, err + } + + if len(metadata) > 0 { + return &cloud.Configuration{ + ActiveDirectoryAuthorityHost: metadata[0].Authentication.LoginEndpoint, + Services: map[cloud.ServiceName]cloud.ServiceConfiguration{ + cloud.ResourceManager: { + Endpoint: metadata[0].ResourceManager, + Audience: metadata[0].Authentication.Audiences[0], + }, + }, + }, nil + } + return nil, nil +} + +func AzureCloudConfigOverrideFromEnv(config *cloud.Configuration) (*cloud.Configuration, error) { + if config == nil { + config = &cloud.AzurePublic + } + envFilePath, ok := os.LookupEnv(EnvironmentFilepathName) + if !ok { + return config, nil + } + content, err := os.ReadFile(envFilePath) + if err != nil { + return nil, err + } + var envConfig Environment + if err = json.Unmarshal(content, &envConfig); err != nil { + return nil, err + } + if len(envConfig.ActiveDirectoryEndpoint) > 0 { + config.ActiveDirectoryAuthorityHost = envConfig.ActiveDirectoryEndpoint + } + if len(envConfig.ResourceManagerEndpoint) > 0 && len(envConfig.TokenAudience) > 0 { + config.Services[cloud.ResourceManager] = cloud.ServiceConfiguration{ + Endpoint: envConfig.ResourceManagerEndpoint, + Audience: envConfig.TokenAudience, + } + } + return config, nil +} + +func GetAzureCloudConfig(armConfig *ARMClientConfig) (*cloud.Configuration, error) { + var config *cloud.Configuration + var err error + if armConfig == nil { + config = &cloud.AzurePublic + } else { + config = AzureCloudConfigFromName(armConfig.Cloud) + if armConfig.ResourceManagerEndpoint != "" { + config, err = AzureCloudConfigFromURL(armConfig.ResourceManagerEndpoint) + if err != nil { + return nil, err + } + } + } + return AzureCloudConfigOverrideFromEnv(config) +} + +// Environment represents a set of endpoints for each of Azure's Clouds. +type Environment struct { + Name string `json:"name"` + ManagementPortalURL string `json:"managementPortalURL"` + PublishSettingsURL string `json:"publishSettingsURL"` + ServiceManagementEndpoint string `json:"serviceManagementEndpoint"` + ResourceManagerEndpoint string `json:"resourceManagerEndpoint"` + ActiveDirectoryEndpoint string `json:"activeDirectoryEndpoint"` + GalleryEndpoint string `json:"galleryEndpoint"` + KeyVaultEndpoint string `json:"keyVaultEndpoint"` + ManagedHSMEndpoint string `json:"managedHSMEndpoint"` + GraphEndpoint string `json:"graphEndpoint"` + ServiceBusEndpoint string `json:"serviceBusEndpoint"` + BatchManagementEndpoint string `json:"batchManagementEndpoint"` + MicrosoftGraphEndpoint string `json:"microsoftGraphEndpoint"` + StorageEndpointSuffix string `json:"storageEndpointSuffix"` + CosmosDBDNSSuffix string `json:"cosmosDBDNSSuffix"` + MariaDBDNSSuffix string `json:"mariaDBDNSSuffix"` + MySQLDatabaseDNSSuffix string `json:"mySqlDatabaseDNSSuffix"` + PostgresqlDatabaseDNSSuffix string `json:"postgresqlDatabaseDNSSuffix"` + SQLDatabaseDNSSuffix string `json:"sqlDatabaseDNSSuffix"` + TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"` + KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"` + ManagedHSMDNSSuffix string `json:"managedHSMDNSSuffix"` + ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"` + ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"` + ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"` + ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"` + TokenAudience string `json:"tokenAudience"` + APIManagementHostNameSuffix string `json:"apiManagementHostNameSuffix"` + SynapseEndpointSuffix string `json:"synapseEndpointSuffix"` + DatalakeSuffix string `json:"datalakeSuffix"` + ResourceIdentifiers ResourceIdentifier `json:"resourceIdentifiers"` +} + +// ResourceIdentifier contains a set of Azure resource IDs. +type ResourceIdentifier struct { + Graph string `json:"graph"` + KeyVault string `json:"keyVault"` + Datalake string `json:"datalake"` + Batch string `json:"batch"` + OperationalInsights string `json:"operationalInsights"` +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/LICENSE b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/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/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/config_loader.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/config_loader.go new file mode 100644 index 000000000..5832ac42c --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/config_loader.go @@ -0,0 +1,25 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package configloader + +import ( + "context" +) + +type configLoader[Type any] interface { + Load(ctx context.Context) (*Type, error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/load.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/load.go new file mode 100644 index 000000000..efa79c52b --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/load.go @@ -0,0 +1,78 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package configloader + +import ( + "context" + "strings" + + clientset "k8s.io/client-go/kubernetes" +) + +type decoderFactory[Type any] func(content []byte, loader configLoader[Type]) configLoader[Type] +type K8sSecretLoaderConfig struct { + K8sSecretConfig + KubeClient clientset.Interface +} + +type FileLoaderConfig struct { + FilePath string +} + +// The config type for Azure cloud provider secret. Supported values are: +// * file : The values are read from local cloud-config file. +// * secret : The values from secret would override all configures from local cloud-config file. +// * merge : The values from secret would override only configurations that are explicitly set in the secret. This is the default value. +type CloudConfigType string + +const ( + CloudConfigTypeFile CloudConfigType = "file" + CloudConfigTypeSecret CloudConfigType = "secret" + CloudConfigTypeMerge CloudConfigType = "merge" +) + +type ConfigMergeConfig struct { + // The cloud configure type for Azure cloud provider. Supported values are file, secret and merge. + CloudConfigType CloudConfigType `json:"cloudConfigType,omitempty" yaml:"cloudConfigType,omitempty"` +} + +func Load[Type any](ctx context.Context, secretLoaderConfig *K8sSecretLoaderConfig, fileLoaderConfig *FileLoaderConfig) (*Type, error) { + configloader := newEmptyLoader[Type](nil) + var loadConfig *ConfigMergeConfig + var err error + if fileLoaderConfig != nil { + loadConfigloader := newEmptyLoader[ConfigMergeConfig](&ConfigMergeConfig{CloudConfigType: CloudConfigTypeMerge}) + loadConfigloader = newFileLoader(fileLoaderConfig.FilePath, loadConfigloader, newYamlByteLoader[ConfigMergeConfig]) + //by default the config load type is merge + loadConfig, err = loadConfigloader.Load(ctx) + if err != nil { + return nil, err + } + configloader = newFileLoader(fileLoaderConfig.FilePath, nil, newYamlByteLoader[Type]) + if strings.EqualFold(string(loadConfig.CloudConfigType), string(CloudConfigTypeFile)) { + return configloader.Load(ctx) + } + } + if secretLoaderConfig != nil { + if loadConfig != nil && strings.EqualFold(string(loadConfig.CloudConfigType), string(CloudConfigTypeSecret)) { + configloader = newK8sSecretLoader(&secretLoaderConfig.K8sSecretConfig, secretLoaderConfig.KubeClient, nil, newYamlByteLoader[Type]) + } else { + configloader = newK8sSecretLoader(&secretLoaderConfig.K8sSecretConfig, secretLoaderConfig.KubeClient, configloader, newYamlByteLoader[Type]) + } + } + return configloader.Load(ctx) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_empty.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_empty.go new file mode 100644 index 000000000..894490bbb --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_empty.go @@ -0,0 +1,38 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package configloader + +import ( + "context" +) + +type emptyLoader[Type any] struct { + Data *Type +} + +func (e *emptyLoader[Type]) Load(ctx context.Context) (*Type, error) { + return e.Data, nil +} + +func newEmptyLoader[Type any](config *Type) configLoader[Type] { + if config == nil { + config = new(Type) + } + return &emptyLoader[Type]{ + Data: config, + } +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_file.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_file.go new file mode 100644 index 000000000..44baddf89 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_file.go @@ -0,0 +1,52 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package configloader + +import ( + "context" + "os" +) + +type FileLoader[Type any] struct { + filePath string + configLoader[Type] + decoderFactory[Type] +} + +// newFileLoader creates a FileLoader with the specified file path and loader. +// decoderFactory is a function that creates a new loader from the content of the file. it should never be nil. +func newFileLoader[Type any](filePath string, loader configLoader[Type], decoder decoderFactory[Type]) configLoader[Type] { + return &FileLoader[Type]{ + filePath: filePath, + configLoader: loader, + decoderFactory: decoder, + } +} + +func (f *FileLoader[Type]) Load(ctx context.Context) (*Type, error) { + if f.configLoader == nil { + f.configLoader = newEmptyLoader[Type](nil) + } + + content, err := os.ReadFile(f.filePath) + if err != nil { + return nil, err + } + + loader := f.decoderFactory(content, f.configLoader) + return loader.Load(ctx) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_secret.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_secret.go new file mode 100644 index 000000000..6e114f14c --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_secret.go @@ -0,0 +1,103 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package configloader + +import ( + "context" + "errors" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + clientset "k8s.io/client-go/kubernetes" +) + +type k8sSecretLoader[Type any] struct { + KubeClient clientset.Interface + configLoader[Type] + *K8sSecretConfig + decoderFactory[Type] +} + +// cloud provider config secret +const ( + DefaultCloudProviderConfigSecName = "azure-cloud-provider" + DefaultCloudProviderConfigSecNamespace = "kube-system" + DefaultCloudProviderConfigSecKey = "cloud-config" +) + +var ( + ErrNoKubeClient = errors.New("no kube client provided") + ErrNoData = errors.New("no data in secret") +) + +type K8sSecretConfig struct { + SecretName string `json:"secretName,omitempty" yaml:"secretName,omitempty"` + SecretNamespace string `json:"secretNamespace,omitempty" yaml:"secretNamespace,omitempty"` + CloudConfigKey string `json:"cloudConfigKey,omitempty" yaml:"cloudConfigKey,omitempty"` +} + +// newK8sSecretLoader returns a config loader which load config from k8s secret. +// If KubeClient is nil, it will return nil. +// decoderFactory is a function that creates a new loader from the content of the secret. it should never be nil. +func newK8sSecretLoader[Type any](config *K8sSecretConfig, KubeClient kubernetes.Interface, loader configLoader[Type], decoder decoderFactory[Type]) configLoader[Type] { + if KubeClient == nil { + return nil + } + if config == nil { + return nil + } + if config.SecretName == "" { + config.SecretName = DefaultCloudProviderConfigSecName + } + if config.SecretNamespace == "" { + config.SecretNamespace = DefaultCloudProviderConfigSecNamespace + } + if config.CloudConfigKey == "" { + config.CloudConfigKey = DefaultCloudProviderConfigSecKey + } + return &k8sSecretLoader[Type]{ + configLoader: loader, + K8sSecretConfig: config, + decoderFactory: decoder, + KubeClient: KubeClient, + } +} + +func (k *k8sSecretLoader[Type]) Load(ctx context.Context) (*Type, error) { + if k.configLoader == nil { + k.configLoader = newEmptyLoader[Type](nil) + } + + if k.KubeClient == nil { + return nil, ErrNoKubeClient + } + + secret, err := k.KubeClient.CoreV1().Secrets(k.SecretNamespace).Get(ctx, k.SecretName, metav1.GetOptions{}) + if err != nil { + return nil, err + } + if len(secret.Data) <= 0 { + return nil, ErrNoData + } + var ok bool + var content []byte + if content, ok = secret.Data[k.CloudConfigKey]; !ok { + return nil, ErrNoData + } + loader := k.decoderFactory([]byte(content), k.configLoader) + return loader.Load(ctx) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_yaml.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_yaml.go new file mode 100644 index 000000000..c5a8a1f30 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_yaml.go @@ -0,0 +1,54 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package configloader + +import ( + "bytes" + "context" + + "sigs.k8s.io/yaml" +) + +// yamlByteLoader is a FactoryConfigLoader that loads a YAML file from a byte array. +type yamlByteLoader[Type any] struct { + content []byte + configLoader[Type] +} + +// Load loads the YAML file from the byte array and returns the client factory config. +func (s *yamlByteLoader[Type]) Load(ctx context.Context) (*Type, error) { + if s.configLoader == nil { + s.configLoader = newEmptyLoader[Type](nil) + } + config, err := s.configLoader.Load(ctx) + if err != nil { + return nil, err + } + s.content = bytes.TrimSpace(s.content) + if err := yaml.Unmarshal(bytes.TrimSpace(s.content), config); err != nil { + return nil, err + } + return config, nil +} + +// newYamlByteLoader creates a YamlByteLoader with the specified content and loader. +func newYamlByteLoader[Type any](content []byte, loader configLoader[Type]) configLoader[Type] { + return &yamlByteLoader[Type]{ + content: content, + configLoader: loader, + } +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/custom.go new file mode 100644 index 000000000..8dd22ddc2 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/custom.go @@ -0,0 +1,59 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package deploymentclient + +import ( + "context" + + resources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// List gets a list of Deployment in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*resources.DeploymentExtended, rerr error) { + pager := client.DeploymentsClient.NewListByResourceGroupPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} + +// Get gets the Deployment +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *resources.DeploymentExtended, rerr error) { + var ops *resources.DeploymentsClientGetOptions + + resp, err := client.DeploymentsClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.DeploymentExtended, nil +} + +// CreateOrUpdate creates or updates a Deployment. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource resources.Deployment) (*resources.DeploymentExtended, error) { + resp, err := utils.NewPollerWrapper(client.DeploymentsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + return &resp.DeploymentExtended, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/interface.go new file mode 100644 index 000000000..9a223dc6c --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/interface.go @@ -0,0 +1,34 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package deploymentclient + +import ( + "context" + + resources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=delete,resource=Deployment,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources,packageAlias=resources,clientName=DeploymentsClient,expand=false,rateLimitKey=deploymentRateLimit +type Interface interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result *resources.DeploymentExtended, rerr error) + List(ctx context.Context, resourceGroupName string) (result []*resources.DeploymentExtended, rerr error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resourceParam resources.Deployment) (*resources.DeploymentExtended, error) + utils.DeleteFunc[resources.Deployment] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/zz_generated_client.go new file mode 100644 index 000000000..7a98a8c49 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/zz_generated_client.go @@ -0,0 +1,55 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package deploymentclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + resources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *resources.DeploymentsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := resources.NewDeploymentsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Delete deletes a Deployment by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "DeploymentsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/interface.go new file mode 100644 index 000000000..41d215c8f --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package diskclient + +import ( + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;listbyrg,resource=Disk,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5,packageAlias=armcompute,clientName=DisksClient,expand=false,rateLimitKey=diskRateLimit +type Interface interface { + utils.GetFunc[armcompute.Disk] + utils.CreateOrUpdateFunc[armcompute.Disk] + utils.DeleteFunc[armcompute.Disk] + utils.ListFunc[armcompute.Disk] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/zz_generated_client.go new file mode 100644 index 000000000..a676d5129 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/zz_generated_client.go @@ -0,0 +1,103 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package diskclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armcompute.DisksClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armcompute.NewDisksClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the Disk +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcompute.Disk, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "DisksClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.DisksClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.Disk, nil +} + +// CreateOrUpdate creates or updates a Disk. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcompute.Disk) (*armcompute.Disk, error) { + ctx = utils.ContextWithClientName(ctx, "DisksClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.DisksClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.Disk, nil + } + return nil, nil +} + +// Delete deletes a Disk by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "DisksClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of Disk in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.Disk, rerr error) { + ctx = utils.ContextWithClientName(ctx, "DisksClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.DisksClient.NewListByResourceGroupPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory.go new file mode 100644 index 000000000..2e7e735be --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory.go @@ -0,0 +1,84 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package azclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient" +) + +type ClientFactory interface { + GetAccountClient() accountclient.Interface + GetAvailabilitySetClient() availabilitysetclient.Interface + GetBlobContainerClient() blobcontainerclient.Interface + GetBlobServicePropertiesClient() blobservicepropertiesclient.Interface + GetDeploymentClient() deploymentclient.Interface + GetDiskClient() diskclient.Interface + GetFileShareClient() fileshareclient.Interface + GetInterfaceClient() interfaceclient.Interface + GetIPGroupClient() ipgroupclient.Interface + GetLoadBalancerClient() loadbalancerclient.Interface + GetManagedClusterClient() managedclusterclient.Interface + GetPrivateEndpointClient() privateendpointclient.Interface + GetPrivateLinkServiceClient() privatelinkserviceclient.Interface + GetPrivateZoneClient() privatezoneclient.Interface + GetProviderClient() providerclient.Interface + GetPublicIPAddressClient() publicipaddressclient.Interface + GetPublicIPPrefixClient() publicipprefixclient.Interface + GetRegistryClient() registryclient.Interface + GetResourceGroupClient() resourcegroupclient.Interface + GetRouteTableClient() routetableclient.Interface + GetSecretClient() secretclient.Interface + GetSecurityGroupClient() securitygroupclient.Interface + GetSnapshotClient() snapshotclient.Interface + GetSSHPublicKeyResourceClient() sshpublickeyresourceclient.Interface + GetSubnetClient() subnetclient.Interface + GetVaultClient() vaultclient.Interface + GetVirtualMachineClient() virtualmachineclient.Interface + GetVirtualMachineScaleSetClient() virtualmachinescalesetclient.Interface + GetVirtualMachineScaleSetVMClient() virtualmachinescalesetvmclient.Interface + GetVirtualNetworkClient() virtualnetworkclient.Interface +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_conf.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_conf.go new file mode 100644 index 000000000..4b12a3cfc --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_conf.go @@ -0,0 +1,69 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package azclient + +import ( + "context" + "net/http" + "sync" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer" +) + +var DefaultResourceClientTransport *http.Client +var once sync.Once + +func init() { + once.Do(func() { + DefaultResourceClientTransport = &http.Client{ + Transport: armbalancer.New(context.Background(), armbalancer.Options{ + Transport: utils.DefaultTransport, + PoolSize: 100, + }), + } + }) +} + +type ClientFactoryConfig struct { + ratelimit.CloudProviderRateLimitConfig + + // Enable exponential backoff to manage resource request retries + CloudProviderBackoff bool `json:"cloudProviderBackoff,omitempty" yaml:"cloudProviderBackoff,omitempty"` + + // The ID of the Azure Subscription that the cluster is deployed in + SubscriptionID string `json:"subscriptionId,omitempty" yaml:"subscriptionId,omitempty"` +} + +func GetDefaultResourceClientOption(armConfig *ARMClientConfig, factoryConfig *ClientFactoryConfig) (*policy.ClientOptions, error) { + //Get default settings + options, err := NewClientOptionFromARMClientConfig(armConfig) + if err != nil { + return nil, err + } + if factoryConfig != nil { + //Set retry + if !factoryConfig.CloudProviderBackoff { + options.Retry.MaxRetries = 0 + } + } + options.Transport = DefaultResourceClientTransport + return options, err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go new file mode 100644 index 000000000..d3808b544 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go @@ -0,0 +1,676 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package azclient + +import ( + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient" +) + +type ClientFactoryImpl struct { + *ClientFactoryConfig + cred azcore.TokenCredential + accountclientInterface accountclient.Interface + availabilitysetclientInterface availabilitysetclient.Interface + blobcontainerclientInterface blobcontainerclient.Interface + blobservicepropertiesclientInterface blobservicepropertiesclient.Interface + deploymentclientInterface deploymentclient.Interface + diskclientInterface diskclient.Interface + fileshareclientInterface fileshareclient.Interface + interfaceclientInterface interfaceclient.Interface + ipgroupclientInterface ipgroupclient.Interface + loadbalancerclientInterface loadbalancerclient.Interface + managedclusterclientInterface managedclusterclient.Interface + privateendpointclientInterface privateendpointclient.Interface + privatelinkserviceclientInterface privatelinkserviceclient.Interface + privatezoneclientInterface privatezoneclient.Interface + providerclientInterface providerclient.Interface + publicipaddressclientInterface publicipaddressclient.Interface + publicipprefixclientInterface publicipprefixclient.Interface + registryclientInterface registryclient.Interface + resourcegroupclientInterface resourcegroupclient.Interface + routetableclientInterface routetableclient.Interface + secretclientInterface secretclient.Interface + securitygroupclientInterface securitygroupclient.Interface + snapshotclientInterface snapshotclient.Interface + sshpublickeyresourceclientInterface sshpublickeyresourceclient.Interface + subnetclientInterface subnetclient.Interface + vaultclientInterface vaultclient.Interface + virtualmachineclientInterface virtualmachineclient.Interface + virtualmachinescalesetclientInterface virtualmachinescalesetclient.Interface + virtualmachinescalesetvmclientInterface virtualmachinescalesetvmclient.Interface + virtualnetworkclientInterface virtualnetworkclient.Interface +} + +func NewClientFactory(config *ClientFactoryConfig, armConfig *ARMClientConfig, cred azcore.TokenCredential) (ClientFactory, error) { + if config == nil { + config = &ClientFactoryConfig{} + } + if cred == nil { + cred = &azidentity.DefaultAzureCredential{} + } + + var options *arm.ClientOptions + var err error + + //initialize {accountclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient Account Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + var ratelimitOption *ratelimit.Config + var rateLimitPolicy policy.Policy + + accountclientInterface, err := accountclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {availabilitysetclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient AvailabilitySet Interface availabilitySetRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("availabilitySetRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + availabilitysetclientInterface, err := availabilitysetclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {blobcontainerclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient Account BlobContainer Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + blobcontainerclientInterface, err := blobcontainerclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {blobservicepropertiesclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient BlobServiceProperties Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + blobservicepropertiesclientInterface, err := blobservicepropertiesclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {deploymentclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient Deployment Interface deploymentRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("deploymentRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + deploymentclientInterface, err := deploymentclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {diskclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient Disk Interface diskRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("diskRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + diskclientInterface, err := diskclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {fileshareclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient Account FileShare Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + fileshareclientInterface, err := fileshareclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {interfaceclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient Interface Interface interfaceRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("interfaceRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + interfaceclientInterface, err := interfaceclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {ipgroupclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient IPGroup Interface ipGroupRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("ipGroupRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + ipgroupclientInterface, err := ipgroupclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {loadbalancerclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient LoadBalancer Interface loadBalancerRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("loadBalancerRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + loadbalancerclientInterface, err := loadbalancerclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {managedclusterclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient ManagedCluster Interface containerServiceRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("containerServiceRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + managedclusterclientInterface, err := managedclusterclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {privateendpointclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient PrivateEndpoint Interface privateEndpointRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("privateEndpointRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + privateendpointclientInterface, err := privateendpointclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {privatelinkserviceclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient PrivateLinkService Interface privateLinkServiceRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("privateLinkServiceRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + privatelinkserviceclientInterface, err := privatelinkserviceclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {privatezoneclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient PrivateZone Interface privateDNSRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("privateDNSRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + privatezoneclientInterface, err := privatezoneclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {providerclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient Provider Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + providerclientInterface, err := providerclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {publicipaddressclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient PublicIPAddress Interface publicIPAddressRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("publicIPAddressRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + publicipaddressclientInterface, err := publicipaddressclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {publicipprefixclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient PublicIPPrefix Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + publicipprefixclientInterface, err := publicipprefixclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {registryclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient Registry Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + registryclientInterface, err := registryclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {resourcegroupclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient ResourceGroup Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + resourcegroupclientInterface, err := resourcegroupclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {routetableclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient RouteTable Interface routeTableRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("routeTableRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + routetableclientInterface, err := routetableclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {secretclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient Vault Secret Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + secretclientInterface, err := secretclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {securitygroupclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient SecurityGroup Interface securityGroupRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("securityGroupRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + securitygroupclientInterface, err := securitygroupclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {snapshotclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient Snapshot Interface snapshotRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("snapshotRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + snapshotclientInterface, err := snapshotclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {sshpublickeyresourceclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient SSHPublicKeyResource Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + sshpublickeyresourceclientInterface, err := sshpublickeyresourceclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {subnetclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient VirtualNetwork Subnet Interface subnetsRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("subnetsRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + subnetclientInterface, err := subnetclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {vaultclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient Vault Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + vaultclientInterface, err := vaultclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {virtualmachineclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient VirtualMachine Interface virtualMachineRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("virtualMachineRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + virtualmachineclientInterface, err := virtualmachineclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {virtualmachinescalesetclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient VirtualMachineScaleSet Interface virtualMachineSizesRateLimit} + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + //add ratelimit policy + ratelimitOption = config.GetRateLimitConfig("virtualMachineSizesRateLimit") + rateLimitPolicy = ratelimit.NewRateLimitPolicy(ratelimitOption) + if rateLimitPolicy != nil { + options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) + } + virtualmachinescalesetclientInterface, err := virtualmachinescalesetclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {virtualmachinescalesetvmclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient VirtualMachineScaleSet VirtualMachineScaleSetVM Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + virtualmachinescalesetvmclientInterface, err := virtualmachinescalesetvmclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + //initialize {virtualnetworkclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient VirtualNetwork Interface } + options, err = GetDefaultResourceClientOption(armConfig, config) + if err != nil { + return nil, err + } + + virtualnetworkclientInterface, err := virtualnetworkclient.New(config.SubscriptionID, cred, options) + if err != nil { + return nil, err + } + + return &ClientFactoryImpl{ + ClientFactoryConfig: config, + cred: cred, accountclientInterface: accountclientInterface, + availabilitysetclientInterface: availabilitysetclientInterface, + blobcontainerclientInterface: blobcontainerclientInterface, + blobservicepropertiesclientInterface: blobservicepropertiesclientInterface, + deploymentclientInterface: deploymentclientInterface, + diskclientInterface: diskclientInterface, + fileshareclientInterface: fileshareclientInterface, + interfaceclientInterface: interfaceclientInterface, + ipgroupclientInterface: ipgroupclientInterface, + loadbalancerclientInterface: loadbalancerclientInterface, + managedclusterclientInterface: managedclusterclientInterface, + privateendpointclientInterface: privateendpointclientInterface, + privatelinkserviceclientInterface: privatelinkserviceclientInterface, + privatezoneclientInterface: privatezoneclientInterface, + providerclientInterface: providerclientInterface, + publicipaddressclientInterface: publicipaddressclientInterface, + publicipprefixclientInterface: publicipprefixclientInterface, + registryclientInterface: registryclientInterface, + resourcegroupclientInterface: resourcegroupclientInterface, + routetableclientInterface: routetableclientInterface, + secretclientInterface: secretclientInterface, + securitygroupclientInterface: securitygroupclientInterface, + snapshotclientInterface: snapshotclientInterface, + sshpublickeyresourceclientInterface: sshpublickeyresourceclientInterface, + subnetclientInterface: subnetclientInterface, + vaultclientInterface: vaultclientInterface, + virtualmachineclientInterface: virtualmachineclientInterface, + virtualmachinescalesetclientInterface: virtualmachinescalesetclientInterface, + virtualmachinescalesetvmclientInterface: virtualmachinescalesetvmclientInterface, + virtualnetworkclientInterface: virtualnetworkclientInterface, + }, nil +} + +func (factory *ClientFactoryImpl) GetAccountClient() accountclient.Interface { + return factory.accountclientInterface +} + +func (factory *ClientFactoryImpl) GetAvailabilitySetClient() availabilitysetclient.Interface { + return factory.availabilitysetclientInterface +} + +func (factory *ClientFactoryImpl) GetBlobContainerClient() blobcontainerclient.Interface { + return factory.blobcontainerclientInterface +} + +func (factory *ClientFactoryImpl) GetBlobServicePropertiesClient() blobservicepropertiesclient.Interface { + return factory.blobservicepropertiesclientInterface +} + +func (factory *ClientFactoryImpl) GetDeploymentClient() deploymentclient.Interface { + return factory.deploymentclientInterface +} + +func (factory *ClientFactoryImpl) GetDiskClient() diskclient.Interface { + return factory.diskclientInterface +} + +func (factory *ClientFactoryImpl) GetFileShareClient() fileshareclient.Interface { + return factory.fileshareclientInterface +} + +func (factory *ClientFactoryImpl) GetInterfaceClient() interfaceclient.Interface { + return factory.interfaceclientInterface +} + +func (factory *ClientFactoryImpl) GetIPGroupClient() ipgroupclient.Interface { + return factory.ipgroupclientInterface +} + +func (factory *ClientFactoryImpl) GetLoadBalancerClient() loadbalancerclient.Interface { + return factory.loadbalancerclientInterface +} + +func (factory *ClientFactoryImpl) GetManagedClusterClient() managedclusterclient.Interface { + return factory.managedclusterclientInterface +} + +func (factory *ClientFactoryImpl) GetPrivateEndpointClient() privateendpointclient.Interface { + return factory.privateendpointclientInterface +} + +func (factory *ClientFactoryImpl) GetPrivateLinkServiceClient() privatelinkserviceclient.Interface { + return factory.privatelinkserviceclientInterface +} + +func (factory *ClientFactoryImpl) GetPrivateZoneClient() privatezoneclient.Interface { + return factory.privatezoneclientInterface +} + +func (factory *ClientFactoryImpl) GetProviderClient() providerclient.Interface { + return factory.providerclientInterface +} + +func (factory *ClientFactoryImpl) GetPublicIPAddressClient() publicipaddressclient.Interface { + return factory.publicipaddressclientInterface +} + +func (factory *ClientFactoryImpl) GetPublicIPPrefixClient() publicipprefixclient.Interface { + return factory.publicipprefixclientInterface +} + +func (factory *ClientFactoryImpl) GetRegistryClient() registryclient.Interface { + return factory.registryclientInterface +} + +func (factory *ClientFactoryImpl) GetResourceGroupClient() resourcegroupclient.Interface { + return factory.resourcegroupclientInterface +} + +func (factory *ClientFactoryImpl) GetRouteTableClient() routetableclient.Interface { + return factory.routetableclientInterface +} + +func (factory *ClientFactoryImpl) GetSecretClient() secretclient.Interface { + return factory.secretclientInterface +} + +func (factory *ClientFactoryImpl) GetSecurityGroupClient() securitygroupclient.Interface { + return factory.securitygroupclientInterface +} + +func (factory *ClientFactoryImpl) GetSnapshotClient() snapshotclient.Interface { + return factory.snapshotclientInterface +} + +func (factory *ClientFactoryImpl) GetSSHPublicKeyResourceClient() sshpublickeyresourceclient.Interface { + return factory.sshpublickeyresourceclientInterface +} + +func (factory *ClientFactoryImpl) GetSubnetClient() subnetclient.Interface { + return factory.subnetclientInterface +} + +func (factory *ClientFactoryImpl) GetVaultClient() vaultclient.Interface { + return factory.vaultclientInterface +} + +func (factory *ClientFactoryImpl) GetVirtualMachineClient() virtualmachineclient.Interface { + return factory.virtualmachineclientInterface +} + +func (factory *ClientFactoryImpl) GetVirtualMachineScaleSetClient() virtualmachinescalesetclient.Interface { + return factory.virtualmachinescalesetclientInterface +} + +func (factory *ClientFactoryImpl) GetVirtualMachineScaleSetVMClient() virtualmachinescalesetvmclient.Interface { + return factory.virtualmachinescalesetvmclientInterface +} + +func (factory *ClientFactoryImpl) GetVirtualNetworkClient() virtualnetworkclient.Interface { + return factory.virtualnetworkclientInterface +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/custom.go new file mode 100644 index 000000000..8b8e4c3b4 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/custom.go @@ -0,0 +1,45 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fileshareclient + +import ( + "context" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" +) + +func (client *Client) Create(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armstorage.FileShare) (*armstorage.FileShare, error) { + resp, err := client.FileSharesClient.Create(ctx, resourceGroupName, resourceName, parentResourceName, resource, nil) + if err != nil { + return nil, err + } + return &resp.FileShare, nil +} + +func (client *Client) Update(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armstorage.FileShare) (*armstorage.FileShare, error) { + resp, err := client.FileSharesClient.Update(ctx, resourceGroupName, resourceName, parentResourceName, resource, nil) + if err != nil { + return nil, err + } + return &resp.FileShare, nil +} + +// Delete deletes a FileShare by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) error { + _, err := client.FileSharesClient.Delete(ctx, resourceGroupName, parentResourceName, resourceName, nil) + return err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface.go new file mode 100644 index 000000000..e040d42ce --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface.go @@ -0,0 +1,34 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package fileshareclient + +import ( + "context" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get,resource=Account,subResource=FileShare,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage,packageAlias=armstorage,clientName=FileSharesClient,expand=false +type Interface interface { + utils.SubResourceGetFunc[armstorage.FileShare] + Create(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armstorage.FileShare) (*armstorage.FileShare, error) + Update(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armstorage.FileShare) (*armstorage.FileShare, error) + Delete(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) error +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go new file mode 100644 index 000000000..3b1c40a54 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go @@ -0,0 +1,60 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package fileshareclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armstorage.FileSharesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armstorage.NewFileSharesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the FileShare +func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armstorage.FileShare, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "FileSharesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.FileSharesClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.FileShare, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/custom.go new file mode 100644 index 000000000..7a59c4a21 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/custom.go @@ -0,0 +1,46 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package interfaceclient + +import ( + "context" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" +) + +// List gets a list of IPGroup in the resource group. +func (client *Client) ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) ([]*armnetwork.Interface, error) { + pager := client.InterfacesClient.NewListVirtualMachineScaleSetNetworkInterfacesPager(resourceGroupName, virtualMachineScaleSetName, nil) + var result []*armnetwork.Interface + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} + +func (client *Client) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string) (*armnetwork.Interface, error) { + resp, err := client.InterfacesClient.GetVirtualMachineScaleSetNetworkInterface(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.Interface, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/interface.go new file mode 100644 index 000000000..ee01a6fa1 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/interface.go @@ -0,0 +1,37 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package interfaceclient + +import ( + "context" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;list,resource=Interface,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=InterfacesClient,expand=true,rateLimitKey=interfaceRateLimit +type Interface interface { + // GetVirtualMachineScaleSetNetworkInterface gets a network.Interface of VMSS VM. + GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string) (*armnetwork.Interface, error) + ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) ([]*armnetwork.Interface, error) + utils.GetWithExpandFunc[armnetwork.Interface] + utils.CreateOrUpdateFunc[armnetwork.Interface] + utils.DeleteFunc[armnetwork.Interface] + utils.ListFunc[armnetwork.Interface] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/zz_generated_client.go new file mode 100644 index 000000000..b653ace2e --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/zz_generated_client.go @@ -0,0 +1,106 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package interfaceclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.InterfacesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewInterfacesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the Interface +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *armnetwork.Interface, rerr error) { + var ops *armnetwork.InterfacesClientGetOptions + if expand != nil { + ops = &armnetwork.InterfacesClientGetOptions{Expand: expand} + } + ctx = utils.ContextWithClientName(ctx, "InterfacesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.InterfacesClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.Interface, nil +} + +// CreateOrUpdate creates or updates a Interface. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.Interface) (*armnetwork.Interface, error) { + ctx = utils.ContextWithClientName(ctx, "InterfacesClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.InterfacesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.Interface, nil + } + return nil, nil +} + +// Delete deletes a Interface by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "InterfacesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of Interface in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.Interface, rerr error) { + ctx = utils.ContextWithClientName(ctx, "InterfacesClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.InterfacesClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/interface.go new file mode 100644 index 000000000..1e6333791 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package ipgroupclient + +import ( + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;listbyrg,resource=IPGroup,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=IPGroupsClient,expand=true,rateLimitKey=ipGroupRateLimit +type Interface interface { + utils.GetWithExpandFunc[armnetwork.IPGroup] + utils.CreateOrUpdateFunc[armnetwork.IPGroup] + utils.DeleteFunc[armnetwork.IPGroup] + utils.ListFunc[armnetwork.IPGroup] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/zz_generated_client.go new file mode 100644 index 000000000..2dd6ec6a5 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/zz_generated_client.go @@ -0,0 +1,106 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package ipgroupclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.IPGroupsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewIPGroupsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the IPGroup +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *armnetwork.IPGroup, rerr error) { + var ops *armnetwork.IPGroupsClientGetOptions + if expand != nil { + ops = &armnetwork.IPGroupsClientGetOptions{Expand: expand} + } + ctx = utils.ContextWithClientName(ctx, "IPGroupsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.IPGroupsClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.IPGroup, nil +} + +// CreateOrUpdate creates or updates a IPGroup. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.IPGroup) (*armnetwork.IPGroup, error) { + ctx = utils.ContextWithClientName(ctx, "IPGroupsClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.IPGroupsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.IPGroup, nil + } + return nil, nil +} + +// Delete deletes a IPGroup by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "IPGroupsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of IPGroup in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.IPGroup, rerr error) { + ctx = utils.ContextWithClientName(ctx, "IPGroupsClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.IPGroupsClient.NewListByResourceGroupPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/interface.go new file mode 100644 index 000000000..232a04c3e --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/interface.go @@ -0,0 +1,35 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package loadbalancerclient + +import ( + "context" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;list,resource=LoadBalancer,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=LoadBalancersClient,expand=true,rateLimitKey=loadBalancerRateLimit +type Interface interface { + utils.GetWithExpandFunc[armnetwork.LoadBalancer] + utils.CreateOrUpdateFunc[armnetwork.LoadBalancer] + utils.DeleteFunc[armnetwork.LoadBalancer] + utils.ListFunc[armnetwork.LoadBalancer] + MigrateToIPBased(ctx context.Context, groupName string, loadBalancerName string, options *armnetwork.LoadBalancersClientMigrateToIPBasedOptions) (armnetwork.LoadBalancersClientMigrateToIPBasedResponse, error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/zz_generated_client.go new file mode 100644 index 000000000..12b23c4b6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/zz_generated_client.go @@ -0,0 +1,106 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package loadbalancerclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.LoadBalancersClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewLoadBalancersClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the LoadBalancer +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *armnetwork.LoadBalancer, rerr error) { + var ops *armnetwork.LoadBalancersClientGetOptions + if expand != nil { + ops = &armnetwork.LoadBalancersClientGetOptions{Expand: expand} + } + ctx = utils.ContextWithClientName(ctx, "LoadBalancersClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.LoadBalancersClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.LoadBalancer, nil +} + +// CreateOrUpdate creates or updates a LoadBalancer. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.LoadBalancer) (*armnetwork.LoadBalancer, error) { + ctx = utils.ContextWithClientName(ctx, "LoadBalancersClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.LoadBalancersClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.LoadBalancer, nil + } + return nil, nil +} + +// Delete deletes a LoadBalancer by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "LoadBalancersClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of LoadBalancer in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.LoadBalancer, rerr error) { + ctx = utils.ContextWithClientName(ctx, "LoadBalancersClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.LoadBalancersClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/interface.go new file mode 100644 index 000000000..5a030aa22 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package managedclusterclient + +import ( + armcontainerservice "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;listbyrg,resource=ManagedCluster,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4,packageAlias=armcontainerservice,clientName=ManagedClustersClient,expand=false,rateLimitKey=containerServiceRateLimit +type Interface interface { + utils.GetFunc[armcontainerservice.ManagedCluster] + utils.CreateOrUpdateFunc[armcontainerservice.ManagedCluster] + utils.DeleteFunc[armcontainerservice.ManagedCluster] + utils.ListFunc[armcontainerservice.ManagedCluster] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/zz_generated_client.go new file mode 100644 index 000000000..c211727a3 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/zz_generated_client.go @@ -0,0 +1,103 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package managedclusterclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armcontainerservice "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armcontainerservice.ManagedClustersClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armcontainerservice.NewManagedClustersClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the ManagedCluster +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcontainerservice.ManagedCluster, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "ManagedClustersClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.ManagedClustersClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.ManagedCluster, nil +} + +// CreateOrUpdate creates or updates a ManagedCluster. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcontainerservice.ManagedCluster) (*armcontainerservice.ManagedCluster, error) { + ctx = utils.ContextWithClientName(ctx, "ManagedClustersClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.ManagedClustersClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.ManagedCluster, nil + } + return nil, nil +} + +// Delete deletes a ManagedCluster by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "ManagedClustersClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of ManagedCluster in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcontainerservice.ManagedCluster, rerr error) { + ctx = utils.ContextWithClientName(ctx, "ManagedClustersClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.ManagedClustersClient.NewListByResourceGroupPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/docs.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/docs.go new file mode 100644 index 000000000..ee96eb6f6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/docs.go @@ -0,0 +1,18 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// flowcontrol is imported from https://github.com/kubernetes/client-go/tree/master/util/flowcontrol +package flowcontrol diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/throttle.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/throttle.go new file mode 100644 index 000000000..b5989aeae --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/throttle.go @@ -0,0 +1,192 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package flowcontrol + +import ( + "context" + "errors" + "sync" + "time" + + "golang.org/x/time/rate" + "k8s.io/utils/clock" +) + +type PassiveRateLimiter interface { + // TryAccept returns true if a token is taken immediately. Otherwise, + // it returns false. + TryAccept() bool + // Stop stops the rate limiter, subsequent calls to CanAccept will return false + Stop() + // QPS returns QPS of this rate limiter + QPS() float32 +} + +type RateLimiter interface { + PassiveRateLimiter + // Accept returns once a token becomes available. + Accept() + // Wait returns nil if a token is taken before the Context is done. + Wait(ctx context.Context) error +} + +type tokenBucketPassiveRateLimiter struct { + limiter *rate.Limiter + qps float32 + clock clock.PassiveClock +} + +type tokenBucketRateLimiter struct { + tokenBucketPassiveRateLimiter + clock Clock +} + +// NewTokenBucketRateLimiter creates a rate limiter which implements a token bucket approach. +// The rate limiter allows bursts of up to 'burst' to exceed the QPS, while still maintaining a +// smoothed qps rate of 'qps'. +// The bucket is initially filled with 'burst' tokens, and refills at a rate of 'qps'. +// The maximum number of tokens in the bucket is capped at 'burst'. +func NewTokenBucketRateLimiter(qps float32, burst int) RateLimiter { + limiter := rate.NewLimiter(rate.Limit(qps), burst) + return newTokenBucketRateLimiterWithClock(limiter, clock.RealClock{}, qps) +} + +// NewTokenBucketPassiveRateLimiter is similar to NewTokenBucketRateLimiter except that it returns +// a PassiveRateLimiter which does not have Accept() and Wait() methods. +func NewTokenBucketPassiveRateLimiter(qps float32, burst int) PassiveRateLimiter { + limiter := rate.NewLimiter(rate.Limit(qps), burst) + return newTokenBucketRateLimiterWithPassiveClock(limiter, clock.RealClock{}, qps) +} + +// An injectable, mockable clock interface. +type Clock interface { + clock.PassiveClock + Sleep(time.Duration) +} + +var _ Clock = (*clock.RealClock)(nil) + +// NewTokenBucketRateLimiterWithClock is identical to NewTokenBucketRateLimiter +// but allows an injectable clock, for testing. +func NewTokenBucketRateLimiterWithClock(qps float32, burst int, c Clock) RateLimiter { + limiter := rate.NewLimiter(rate.Limit(qps), burst) + return newTokenBucketRateLimiterWithClock(limiter, c, qps) +} + +// NewTokenBucketPassiveRateLimiterWithClock is similar to NewTokenBucketRateLimiterWithClock +// except that it returns a PassiveRateLimiter which does not have Accept() and Wait() methods +// and uses a PassiveClock. +func NewTokenBucketPassiveRateLimiterWithClock(qps float32, burst int, c clock.PassiveClock) PassiveRateLimiter { + limiter := rate.NewLimiter(rate.Limit(qps), burst) + return newTokenBucketRateLimiterWithPassiveClock(limiter, c, qps) +} + +func newTokenBucketRateLimiterWithClock(limiter *rate.Limiter, c Clock, qps float32) *tokenBucketRateLimiter { + return &tokenBucketRateLimiter{ + tokenBucketPassiveRateLimiter: *newTokenBucketRateLimiterWithPassiveClock(limiter, c, qps), + clock: c, + } +} + +func newTokenBucketRateLimiterWithPassiveClock(limiter *rate.Limiter, c clock.PassiveClock, qps float32) *tokenBucketPassiveRateLimiter { + return &tokenBucketPassiveRateLimiter{ + limiter: limiter, + qps: qps, + clock: c, + } +} + +func (tbprl *tokenBucketPassiveRateLimiter) Stop() { +} + +func (tbprl *tokenBucketPassiveRateLimiter) QPS() float32 { + return tbprl.qps +} + +func (tbprl *tokenBucketPassiveRateLimiter) TryAccept() bool { + return tbprl.limiter.AllowN(tbprl.clock.Now(), 1) +} + +// Accept will block until a token becomes available +func (tbrl *tokenBucketRateLimiter) Accept() { + now := tbrl.clock.Now() + tbrl.clock.Sleep(tbrl.limiter.ReserveN(now, 1).DelayFrom(now)) +} + +func (tbrl *tokenBucketRateLimiter) Wait(ctx context.Context) error { + return tbrl.limiter.Wait(ctx) +} + +type fakeAlwaysRateLimiter struct{} + +func NewFakeAlwaysRateLimiter() RateLimiter { + return &fakeAlwaysRateLimiter{} +} + +func (t *fakeAlwaysRateLimiter) TryAccept() bool { + return true +} + +func (t *fakeAlwaysRateLimiter) Stop() {} + +func (t *fakeAlwaysRateLimiter) Accept() {} + +func (t *fakeAlwaysRateLimiter) QPS() float32 { + return 1 +} + +func (t *fakeAlwaysRateLimiter) Wait(_ context.Context) error { + return nil +} + +type fakeNeverRateLimiter struct { + wg sync.WaitGroup +} + +func NewFakeNeverRateLimiter() RateLimiter { + rl := fakeNeverRateLimiter{} + rl.wg.Add(1) + return &rl +} + +func (t *fakeNeverRateLimiter) TryAccept() bool { + return false +} + +func (t *fakeNeverRateLimiter) Stop() { + t.wg.Done() +} + +func (t *fakeNeverRateLimiter) Accept() { + t.wg.Wait() +} + +func (t *fakeNeverRateLimiter) QPS() float32 { + return 1 +} + +func (t *fakeNeverRateLimiter) Wait(_ context.Context) error { + return errors.New("can not be accept") +} + +var ( + _ RateLimiter = (*tokenBucketRateLimiter)(nil) + _ RateLimiter = (*fakeAlwaysRateLimiter)(nil) + _ RateLimiter = (*fakeNeverRateLimiter)(nil) +) + +var _ PassiveRateLimiter = (*tokenBucketPassiveRateLimiter)(nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/ratelimit.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/ratelimit.go new file mode 100644 index 000000000..0ed37f258 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/ratelimit.go @@ -0,0 +1,101 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package ratelimit + +import ( + "errors" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol" +) + +// Config indicates the rate limit config options. +type Config struct { + // Enable rate limiting + CloudProviderRateLimit bool `json:"cloudProviderRateLimit,omitempty" yaml:"cloudProviderRateLimit,omitempty"` + // Rate limit QPS (Read) + CloudProviderRateLimitQPS float32 `json:"cloudProviderRateLimitQPS,omitempty" yaml:"cloudProviderRateLimitQPS,omitempty"` + // Rate limit Bucket Size + CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty" yaml:"cloudProviderRateLimitBucket,omitempty"` + // Rate limit QPS (Write) + CloudProviderRateLimitQPSWrite float32 `json:"cloudProviderRateLimitQPSWrite,omitempty" yaml:"cloudProviderRateLimitQPSWrite,omitempty"` + // Rate limit Bucket Size + CloudProviderRateLimitBucketWrite int `json:"cloudProviderRateLimitBucketWrite,omitempty" yaml:"cloudProviderRateLimitBucketWrite,omitempty"` +} + +func NewRateLimitPolicy(config *Config) policy.Policy { + if config != nil && config.CloudProviderRateLimit { + readLimiter := flowcontrol.NewTokenBucketRateLimiter( + config.CloudProviderRateLimitQPS, + config.CloudProviderRateLimitBucket) + + writeLimiter := flowcontrol.NewTokenBucketRateLimiter( + config.CloudProviderRateLimitQPSWrite, + config.CloudProviderRateLimitBucketWrite) + return &Policy{ + rateLimiterReader: readLimiter, + rateLimiterWriter: writeLimiter, + } + } + return nil +} + +type Policy struct { + rateLimiterWriter flowcontrol.RateLimiter + rateLimiterReader flowcontrol.RateLimiter +} + +func (f Policy) Do(req *policy.Request) (*http.Response, error) { + if req.Raw().Method == http.MethodGet || req.Raw().Method == http.MethodHead { + if !f.rateLimiterReader.TryAccept() { + return nil, errors.New("rate limit reached") + } + } else { + if !f.rateLimiterWriter.TryAccept() { + return nil, errors.New("rate limit reached") + } + } + return req.Next() +} + +// CloudProviderRateLimitConfig indicates the rate limit config for each clients. +type CloudProviderRateLimitConfig struct { + // The default rate limit config options. + Config + + // Rate limit config for each clients. Values would override default settings above. + Entries map[string]*Config `json:",inline" yaml:",inline"` +} + +func NewCloudProviderRateLimitConfig() *CloudProviderRateLimitConfig { + return &CloudProviderRateLimitConfig{ + Config: Config{ + CloudProviderRateLimit: false, + }, + Entries: make(map[string]*Config), + } +} + +// GetRateLimitConfig returns the rate limit config for the given client. if the client is not found, the default is returned. +func (config *CloudProviderRateLimitConfig) GetRateLimitConfig(clientName string) *Config { + if entry, ok := config.Entries[clientName]; ok { + return entry + } + return &config.Config +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/retryrepectthrottled/throttle.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/retryrepectthrottled/throttle.go new file mode 100644 index 000000000..80c5e33f8 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/retryrepectthrottled/throttle.go @@ -0,0 +1,88 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package retryrepectthrottled + +import ( + "errors" + "net/http" + "strconv" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +const HeaderRetryAfter = "Retry-After" + +func NewThrottlingPolicy() policy.Policy { + return &ThrottlingPolicy{ + RetryAfterReader: time.Now(), + RetryAfterWriter: time.Now(), + } +} + +func GetRetriableStatusCode() []int { + return []int{ + http.StatusRequestTimeout, // 408 + http.StatusInternalServerError, // 500 + http.StatusBadGateway, // 502 + http.StatusServiceUnavailable, // 503 + http.StatusGatewayTimeout, // 504 + } +} + +// ThrottlingPolicy implements the Azure SDK for Go's Policy interface. +// throttle counter is based on resources operation per subscription. +type ThrottlingPolicy struct { + RetryAfterReader time.Time + RetryAfterWriter time.Time +} + +func (p *ThrottlingPolicy) Do(req *policy.Request) (*http.Response, error) { + if req.Raw().Method == http.MethodGet || req.Raw().Method == http.MethodHead { + return p.processThrottlePolicy(&p.RetryAfterReader, req) + } + return p.processThrottlePolicy(&p.RetryAfterWriter, req) +} + +func (p *ThrottlingPolicy) processThrottlePolicy(timer *time.Time, req *policy.Request) (*http.Response, error) { + if timer.After(time.Now()) { + return nil, errors.New("ThrottlingPolicy: Too many requests") + } + resp, err := req.Next() + if err != nil { + return resp, err + } + if runtime.HasStatusCode(resp, http.StatusTooManyRequests) { + // throttle policy will be triggered when the response status code is 429 + // in v1 client, throttle policy will be triggered when the retry-after header is set + // according to https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/async-operations + // the retry-after header will be set when the response status code is 202 + duration := resp.Header.Get(HeaderRetryAfter) + if duration == "" { + *timer = time.Now() + } + if retryAfter, _ := strconv.Atoi(duration); retryAfter > 0 { + *timer = time.Now().Add(time.Duration(retryAfter) * time.Second) + } else if t, err := time.Parse(time.RFC1123, duration); err == nil { + *timer = t + } + + return resp, errors.New("ThrottlingPolicy: Too many requests") + } + return resp, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/interface.go new file mode 100644 index 000000000..9fff0e214 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/interface.go @@ -0,0 +1,30 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package privateendpointclient + +import ( + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate,resource=PrivateEndpoint,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=PrivateEndpointsClient,expand=true,rateLimitKey=privateEndpointRateLimit +type Interface interface { + utils.GetWithExpandFunc[armnetwork.PrivateEndpoint] + utils.CreateOrUpdateFunc[armnetwork.PrivateEndpoint] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/zz_generated_client.go new file mode 100644 index 000000000..dc3e8d8cd --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/zz_generated_client.go @@ -0,0 +1,79 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package privateendpointclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.PrivateEndpointsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewPrivateEndpointsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the PrivateEndpoint +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *armnetwork.PrivateEndpoint, rerr error) { + var ops *armnetwork.PrivateEndpointsClientGetOptions + if expand != nil { + ops = &armnetwork.PrivateEndpointsClientGetOptions{Expand: expand} + } + ctx = utils.ContextWithClientName(ctx, "PrivateEndpointsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.PrivateEndpointsClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.PrivateEndpoint, nil +} + +// CreateOrUpdate creates or updates a PrivateEndpoint. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.PrivateEndpoint) (*armnetwork.PrivateEndpoint, error) { + ctx = utils.ContextWithClientName(ctx, "PrivateEndpointsClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.PrivateEndpointsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.PrivateEndpoint, nil + } + return nil, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/interface.go new file mode 100644 index 000000000..a152277a3 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package privatelinkserviceclient + +import ( + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;list,resource=PrivateLinkService,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=PrivateLinkServicesClient,expand=true,rateLimitKey=privateLinkServiceRateLimit +type Interface interface { + utils.GetWithExpandFunc[armnetwork.PrivateLinkService] + utils.CreateOrUpdateFunc[armnetwork.PrivateLinkService] + utils.DeleteFunc[armnetwork.PrivateLinkService] + utils.ListFunc[armnetwork.PrivateLinkService] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/zz_generated_client.go new file mode 100644 index 000000000..90abb4a9f --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/zz_generated_client.go @@ -0,0 +1,106 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package privatelinkserviceclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.PrivateLinkServicesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewPrivateLinkServicesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the PrivateLinkService +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *armnetwork.PrivateLinkService, rerr error) { + var ops *armnetwork.PrivateLinkServicesClientGetOptions + if expand != nil { + ops = &armnetwork.PrivateLinkServicesClientGetOptions{Expand: expand} + } + ctx = utils.ContextWithClientName(ctx, "PrivateLinkServicesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.PrivateLinkServicesClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.PrivateLinkService, nil +} + +// CreateOrUpdate creates or updates a PrivateLinkService. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.PrivateLinkService) (*armnetwork.PrivateLinkService, error) { + ctx = utils.ContextWithClientName(ctx, "PrivateLinkServicesClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.PrivateLinkServicesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.PrivateLinkService, nil + } + return nil, nil +} + +// Delete deletes a PrivateLinkService by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "PrivateLinkServicesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of PrivateLinkService in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.PrivateLinkService, rerr error) { + ctx = utils.ContextWithClientName(ctx, "PrivateLinkServicesClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.PrivateLinkServicesClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/interface.go new file mode 100644 index 000000000..edb3b93ed --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/interface.go @@ -0,0 +1,30 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package privatezoneclient + +import ( + armprivatedns "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate,resource=PrivateZone,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns,packageAlias=armprivatedns,clientName=PrivateZonesClient,expand=false,rateLimitKey=privateDNSRateLimit +type Interface interface { + utils.GetFunc[armprivatedns.PrivateZone] + utils.CreateOrUpdateFunc[armprivatedns.PrivateZone] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/zz_generated_client.go new file mode 100644 index 000000000..c317ca2c4 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/zz_generated_client.go @@ -0,0 +1,76 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package privatezoneclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armprivatedns "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armprivatedns.PrivateZonesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armprivatedns.NewPrivateZonesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the PrivateZone +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armprivatedns.PrivateZone, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "PrivateZonesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.PrivateZonesClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.PrivateZone, nil +} + +// CreateOrUpdate creates or updates a PrivateZone. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armprivatedns.PrivateZone) (*armprivatedns.PrivateZone, error) { + ctx = utils.ContextWithClientName(ctx, "PrivateZonesClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.PrivateZonesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.PrivateZone, nil + } + return nil, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/custom.go new file mode 100644 index 000000000..8e9330407 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/custom.go @@ -0,0 +1,62 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package providerclient + +import ( + "context" + "strings" + + armresources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" +) + +func (client *Client) ListProviders(ctx context.Context) (result []*armresources.Provider, rerr error) { + pager := client.ProvidersClient.NewListPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} +func (client *Client) GetProvider(ctx context.Context, resourceProviderNamespace string) (*armresources.Provider, error) { + resp, err := client.ProvidersClient.Get(ctx, resourceProviderNamespace, nil) + if err != nil { + return nil, err + } + return &resp.Provider, nil +} + +func (client *Client) GetVirtualMachineSupportedZones(ctx context.Context) (map[string][]*string, error) { + result, err := client.GetProvider(ctx, "Microsoft.Compute") + if err != nil { + return nil, err + } + regionZoneMap := make(map[string][]*string) + + for _, resourceType := range result.ResourceTypes { + if strings.EqualFold(*resourceType.ResourceType, "virtualMachines") { + for _, zoneMapping := range resourceType.ZoneMappings { + location := strings.ToLower(strings.ReplaceAll(*zoneMapping.Location, " ", "")) + regionZoneMap[location] = zoneMapping.Zones + } + + } + } + return regionZoneMap, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/interface.go new file mode 100644 index 000000000..056c3945a --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/interface.go @@ -0,0 +1,31 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package providerclient + +import ( + "context" + + armresources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" +) + +// +azure:client:resource=Provider,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources,packageAlias=armresources,clientName=ProvidersClient,expand=false +type Interface interface { + ListProviders(ctx context.Context) ([]*armresources.Provider, error) + GetProvider(ctx context.Context, resourceProviderNamespace string) (*armresources.Provider, error) + GetVirtualMachineSupportedZones(ctx context.Context) (map[string][]*string, error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/zz_generated_client.go new file mode 100644 index 000000000..a175b4e01 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/zz_generated_client.go @@ -0,0 +1,43 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package providerclient + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armresources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armresources.ProvidersClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armresources.NewProvidersClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/interface.go new file mode 100644 index 000000000..36e518436 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package publicipaddressclient + +import ( + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;list,resource=PublicIPAddress,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=PublicIPAddressesClient,expand=true,rateLimitKey=publicIPAddressRateLimit +type Interface interface { + utils.GetWithExpandFunc[armnetwork.PublicIPAddress] + utils.CreateOrUpdateFunc[armnetwork.PublicIPAddress] + utils.DeleteFunc[armnetwork.PublicIPAddress] + utils.ListFunc[armnetwork.PublicIPAddress] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/zz_generated_client.go new file mode 100644 index 000000000..449e418fa --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/zz_generated_client.go @@ -0,0 +1,106 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package publicipaddressclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.PublicIPAddressesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewPublicIPAddressesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the PublicIPAddress +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *armnetwork.PublicIPAddress, rerr error) { + var ops *armnetwork.PublicIPAddressesClientGetOptions + if expand != nil { + ops = &armnetwork.PublicIPAddressesClientGetOptions{Expand: expand} + } + ctx = utils.ContextWithClientName(ctx, "PublicIPAddressesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.PublicIPAddressesClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.PublicIPAddress, nil +} + +// CreateOrUpdate creates or updates a PublicIPAddress. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error) { + ctx = utils.ContextWithClientName(ctx, "PublicIPAddressesClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.PublicIPAddressesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.PublicIPAddress, nil + } + return nil, nil +} + +// Delete deletes a PublicIPAddress by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "PublicIPAddressesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of PublicIPAddress in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.PublicIPAddress, rerr error) { + ctx = utils.ContextWithClientName(ctx, "PublicIPAddressesClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.PublicIPAddressesClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/interface.go new file mode 100644 index 000000000..3f02160a5 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package publicipprefixclient + +import ( + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;list,resource=PublicIPPrefix,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=PublicIPPrefixesClient,expand=true +type Interface interface { + utils.GetWithExpandFunc[armnetwork.PublicIPPrefix] + utils.CreateOrUpdateFunc[armnetwork.PublicIPPrefix] + utils.DeleteFunc[armnetwork.PublicIPPrefix] + utils.ListFunc[armnetwork.PublicIPPrefix] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/zz_generated_client.go new file mode 100644 index 000000000..41a507308 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/zz_generated_client.go @@ -0,0 +1,106 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package publicipprefixclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.PublicIPPrefixesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewPublicIPPrefixesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the PublicIPPrefix +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *armnetwork.PublicIPPrefix, rerr error) { + var ops *armnetwork.PublicIPPrefixesClientGetOptions + if expand != nil { + ops = &armnetwork.PublicIPPrefixesClientGetOptions{Expand: expand} + } + ctx = utils.ContextWithClientName(ctx, "PublicIPPrefixesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.PublicIPPrefixesClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.PublicIPPrefix, nil +} + +// CreateOrUpdate creates or updates a PublicIPPrefix. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.PublicIPPrefix) (*armnetwork.PublicIPPrefix, error) { + ctx = utils.ContextWithClientName(ctx, "PublicIPPrefixesClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.PublicIPPrefixesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.PublicIPPrefix, nil + } + return nil, nil +} + +// Delete deletes a PublicIPPrefix by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "PublicIPPrefixesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of PublicIPPrefix in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.PublicIPPrefix, rerr error) { + ctx = utils.ContextWithClientName(ctx, "PublicIPPrefixesClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.PublicIPPrefixesClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/custom.go new file mode 100644 index 000000000..325defc10 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/custom.go @@ -0,0 +1,41 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package registryclient + +import ( + "context" + + armcontainerregistry "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +func (client *Client) Create(ctx context.Context, resourceGroupName string, resourceName string, resourceParam armcontainerregistry.Registry) (*armcontainerregistry.Registry, error) { + resp, err := utils.NewPollerWrapper(client.RegistriesClient.BeginCreate(ctx, resourceGroupName, resourceName, resourceParam, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.Registry, nil + } + return nil, nil +} + +func (client *Client) ImportImage(ctx context.Context, resourceGroup string, resourceName string, param armcontainerregistry.ImportImageParameters) error { + _, err := utils.NewPollerWrapper(client.RegistriesClient.BeginImportImage(ctx, resourceGroup, resourceName, param, nil)).WaitforPollerResp(ctx) + return err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/interface.go new file mode 100644 index 000000000..9374497a0 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/interface.go @@ -0,0 +1,35 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package registryclient + +import ( + "context" + + armcontainerregistry "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;delete;listbyrg,resource=Registry,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry,packageAlias=armcontainerregistry,clientName=RegistriesClient,expand=false +type Interface interface { + utils.GetFunc[armcontainerregistry.Registry] + Create(ctx context.Context, resourceGroupName string, resourceName string, resourceParam armcontainerregistry.Registry) (*armcontainerregistry.Registry, error) + utils.DeleteFunc[armcontainerregistry.Registry] + utils.ListFunc[armcontainerregistry.Registry] + ImportImage(ctx context.Context, resourceGroup string, resourceName string, param armcontainerregistry.ImportImageParameters) error +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/zz_generated_client.go new file mode 100644 index 000000000..693b7ea79 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/zz_generated_client.go @@ -0,0 +1,87 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package registryclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armcontainerregistry "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armcontainerregistry.RegistriesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armcontainerregistry.NewRegistriesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the Registry +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcontainerregistry.Registry, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "RegistriesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.RegistriesClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.Registry, nil +} + +// Delete deletes a Registry by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "RegistriesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of Registry in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcontainerregistry.Registry, rerr error) { + ctx = utils.ContextWithClientName(ctx, "RegistriesClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.RegistriesClient.NewListByResourceGroupPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/custom.go new file mode 100644 index 000000000..5c55020c5 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/custom.go @@ -0,0 +1,58 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package resourcegroupclient + +import ( + "context" + + resources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +func (client *Client) Get(ctx context.Context, resourceGroupName string) (result *resources.ResourceGroup, rerr error) { + resp, err := client.ResourceGroupsClient.Get(ctx, resourceGroupName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.ResourceGroup, nil +} +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceParam resources.ResourceGroup) (*resources.ResourceGroup, error) { + resp, err := client.ResourceGroupsClient.CreateOrUpdate(ctx, resourceGroupName, resourceParam, nil) + if err != nil { + return nil, err + } + return &resp.ResourceGroup, nil +} + +func (client *Client) Delete(ctx context.Context, resourceGroupName string) error { + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, nil)).WaitforPollerResp(ctx) + return err +} + +func (client *Client) List(ctx context.Context) (result []*resources.ResourceGroup, rerr error) { + pager := client.ResourceGroupsClient.NewListPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/interface.go new file mode 100644 index 000000000..96336d3a1 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package resourcegroupclient + +import ( + "context" + + resources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" +) + +// +azure:client:verbs=,resource=ResourceGroup,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources,packageAlias=resources,clientName=ResourceGroupsClient,expand=false +type Interface interface { + Get(ctx context.Context, resourceGroupName string) (result *resources.ResourceGroup, rerr error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceParam resources.ResourceGroup) (*resources.ResourceGroup, error) + Delete(ctx context.Context, resourceGroupName string) error + List(ctx context.Context) (result []*resources.ResourceGroup, rerr error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/zz_generated_client.go new file mode 100644 index 000000000..c847e3114 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/zz_generated_client.go @@ -0,0 +1,43 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package resourcegroupclient + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + resources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *resources.ResourceGroupsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := resources.NewResourceGroupsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/interface.go new file mode 100644 index 000000000..7755a36bf --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package routetableclient + +import ( + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;list,resource=RouteTable,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=RouteTablesClient,expand=false,rateLimitKey=routeTableRateLimit +type Interface interface { + utils.CreateOrUpdateFunc[armnetwork.RouteTable] + utils.DeleteFunc[armnetwork.RouteTable] + utils.ListFunc[armnetwork.RouteTable] + utils.GetFunc[armnetwork.RouteTable] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/zz_generated_client.go new file mode 100644 index 000000000..23aa9b8f4 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/zz_generated_client.go @@ -0,0 +1,103 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package routetableclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.RouteTablesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewRouteTablesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the RouteTable +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armnetwork.RouteTable, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "RouteTablesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.RouteTablesClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.RouteTable, nil +} + +// CreateOrUpdate creates or updates a RouteTable. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.RouteTable) (*armnetwork.RouteTable, error) { + ctx = utils.ContextWithClientName(ctx, "RouteTablesClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.RouteTablesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.RouteTable, nil + } + return nil, nil +} + +// Delete deletes a RouteTable by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "RouteTablesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of RouteTable in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.RouteTable, rerr error) { + ctx = utils.ContextWithClientName(ctx, "RouteTablesClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.RouteTablesClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/custom.go new file mode 100644 index 000000000..83d4f7daa --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/custom.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package secretclient + +import ( + "context" + + armkeyvault "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" +) + +// CreateOrUpdate creates or updates a Secret. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armkeyvault.SecretCreateOrUpdateParameters) (*armkeyvault.Secret, error) { + resp, err := client.SecretsClient.CreateOrUpdate(ctx, resourceGroupName, resourceName, parentResourceName, resource, nil) + if err != nil { + return nil, err + } + return &resp.Secret, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/interface.go new file mode 100644 index 000000000..1138915d6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/interface.go @@ -0,0 +1,33 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package secretclient + +import ( + "context" + + armkeyvault "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;list,resource=Vault,subResource=Secret,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault,packageAlias=armkeyvault,clientName=SecretsClient,expand=false +type Interface interface { + utils.SubResourceGetFunc[armkeyvault.Secret] + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armkeyvault.SecretCreateOrUpdateParameters) (*armkeyvault.Secret, error) + utils.SubResourceListFunc[armkeyvault.Secret] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/zz_generated_client.go new file mode 100644 index 000000000..ec78083cf --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/zz_generated_client.go @@ -0,0 +1,77 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package secretclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armkeyvault "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armkeyvault.SecretsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armkeyvault.NewSecretsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the Secret +func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armkeyvault.Secret, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "SecretsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.SecretsClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.Secret, nil +} + +// List gets a list of Secret in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string, parentResourceName string) (result []*armkeyvault.Secret, rerr error) { + ctx = utils.ContextWithClientName(ctx, "SecretsClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.SecretsClient.NewListPager(resourceGroupName, parentResourceName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/interface.go new file mode 100644 index 000000000..b243b34a6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package securitygroupclient + +import ( + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;list,resource=SecurityGroup,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=SecurityGroupsClient,expand=false,rateLimitKey=securityGroupRateLimit +type Interface interface { + utils.GetFunc[armnetwork.SecurityGroup] + utils.CreateOrUpdateFunc[armnetwork.SecurityGroup] + utils.DeleteFunc[armnetwork.SecurityGroup] + utils.ListFunc[armnetwork.SecurityGroup] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/zz_generated_client.go new file mode 100644 index 000000000..cd1255a3f --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/zz_generated_client.go @@ -0,0 +1,103 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package securitygroupclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.SecurityGroupsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewSecurityGroupsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the SecurityGroup +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armnetwork.SecurityGroup, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "SecurityGroupsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.SecurityGroupsClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.SecurityGroup, nil +} + +// CreateOrUpdate creates or updates a SecurityGroup. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.SecurityGroup) (*armnetwork.SecurityGroup, error) { + ctx = utils.ContextWithClientName(ctx, "SecurityGroupsClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.SecurityGroupsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.SecurityGroup, nil + } + return nil, nil +} + +// Delete deletes a SecurityGroup by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "SecurityGroupsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of SecurityGroup in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.SecurityGroup, rerr error) { + ctx = utils.ContextWithClientName(ctx, "SecurityGroupsClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.SecurityGroupsClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/custom.go new file mode 100644 index 000000000..d34163d92 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/custom.go @@ -0,0 +1,36 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package snapshotclient + +import ( + "context" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" +) + +// List gets a list of Snapshot in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.Snapshot, rerr error) { + pager := client.SnapshotsClient.NewListByResourceGroupPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/interface.go new file mode 100644 index 000000000..1cae1fb80 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package snapshotclient + +import ( + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete,resource=Snapshot,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5,packageAlias=armcompute,clientName=SnapshotsClient,expand=false,rateLimitKey=snapshotRateLimit +type Interface interface { + utils.GetFunc[armcompute.Snapshot] + utils.CreateOrUpdateFunc[armcompute.Snapshot] + utils.DeleteFunc[armcompute.Snapshot] + utils.ListFunc[armcompute.Snapshot] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/zz_generated_client.go new file mode 100644 index 000000000..e88c39127 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/zz_generated_client.go @@ -0,0 +1,86 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package snapshotclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armcompute.SnapshotsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armcompute.NewSnapshotsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the Snapshot +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcompute.Snapshot, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "SnapshotsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.SnapshotsClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.Snapshot, nil +} + +// CreateOrUpdate creates or updates a Snapshot. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcompute.Snapshot) (*armcompute.Snapshot, error) { + ctx = utils.ContextWithClientName(ctx, "SnapshotsClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.SnapshotsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.Snapshot, nil + } + return nil, nil +} + +// Delete deletes a Snapshot by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "SnapshotsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/custom.go new file mode 100644 index 000000000..192ab84b2 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/custom.go @@ -0,0 +1,53 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package sshpublickeyresourceclient + +import ( + "context" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" +) + +// Delete deletes a SSHPublicKeyResource by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + _, err := client.SSHPublicKeysClient.Delete(ctx, resourceGroupName, resourceName, nil) + return err +} + +func (client *Client) GenerateKeyPair(ctx context.Context, resourceGroupName string, sshPublicKeyName string) (*armcompute.SSHPublicKeyGenerateKeyPairResult, error) { + resp, err := client.SSHPublicKeysClient.GenerateKeyPair(ctx, resourceGroupName, sshPublicKeyName, nil) + if err != nil { + return nil, err + } + return &resp.SSHPublicKeyGenerateKeyPairResult, nil +} + +func (client *Client) Create(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters armcompute.SSHPublicKeyResource) (*armcompute.SSHPublicKeyResource, error) { + resp, err := client.SSHPublicKeysClient.Create(ctx, resourceGroupName, sshPublicKeyName, parameters, nil) + if err != nil { + return nil, err + } + return &resp.SSHPublicKeyResource, nil +} + +func (client *Client) Update(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters armcompute.SSHPublicKeyUpdateResource) (*armcompute.SSHPublicKeyResource, error) { + resp, err := client.SSHPublicKeysClient.Update(ctx, resourceGroupName, sshPublicKeyName, parameters, nil) + if err != nil { + return nil, err + } + return &resp.SSHPublicKeyResource, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/interface.go new file mode 100644 index 000000000..f3ae3fc18 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/interface.go @@ -0,0 +1,37 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package sshpublickeyresourceclient + +import ( + "context" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;listbyrg,resource=SSHPublicKeyResource,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5,packageAlias=armcompute,clientName=SSHPublicKeysClient,expand=false +type Interface interface { + utils.GetFunc[armcompute.SSHPublicKeyResource] + utils.DeleteFunc[armcompute.SSHPublicKeyResource] + utils.ListFunc[armcompute.SSHPublicKeyResource] + + Create(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters armcompute.SSHPublicKeyResource) (*armcompute.SSHPublicKeyResource, error) + Update(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters armcompute.SSHPublicKeyUpdateResource) (*armcompute.SSHPublicKeyResource, error) + GenerateKeyPair(ctx context.Context, resourceGroupName string, sshPublicKeyName string) (*armcompute.SSHPublicKeyGenerateKeyPairResult, error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/zz_generated_client.go new file mode 100644 index 000000000..1013b1664 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/zz_generated_client.go @@ -0,0 +1,77 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package sshpublickeyresourceclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armcompute.SSHPublicKeysClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armcompute.NewSSHPublicKeysClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the SSHPublicKeyResource +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcompute.SSHPublicKeyResource, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "SSHPublicKeysClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.SSHPublicKeysClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.SSHPublicKeyResource, nil +} + +// List gets a list of SSHPublicKeyResource in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.SSHPublicKeyResource, rerr error) { + ctx = utils.ContextWithClientName(ctx, "SSHPublicKeysClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.SSHPublicKeysClient.NewListByResourceGroupPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/interface.go new file mode 100644 index 000000000..e2ddb888c --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package subnetclient + +import ( + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;list,resource=VirtualNetwork,subResource=Subnet,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=SubnetsClient,expand=true,rateLimitKey=subnetsRateLimit +type Interface interface { + utils.SubResourceGetWithExpandFunc[armnetwork.Subnet] + utils.SubResourceCreateOrUpdateFunc[armnetwork.Subnet] + utils.SubResourceDeleteFunc[armnetwork.Subnet] + utils.SubResourceListFunc[armnetwork.Subnet] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/zz_generated_client.go new file mode 100644 index 000000000..6b4d863ec --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/zz_generated_client.go @@ -0,0 +1,106 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package subnetclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.SubnetsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewSubnetsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the Subnet +func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string, expand *string) (result *armnetwork.Subnet, rerr error) { + var ops *armnetwork.SubnetsClientGetOptions + if expand != nil { + ops = &armnetwork.SubnetsClientGetOptions{Expand: expand} + } + ctx = utils.ContextWithClientName(ctx, "SubnetsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.SubnetsClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.Subnet, nil +} + +// CreateOrUpdate creates or updates a Subnet. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armnetwork.Subnet) (*armnetwork.Subnet, error) { + ctx = utils.ContextWithClientName(ctx, "SubnetsClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.SubnetsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, parentResourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.Subnet, nil + } + return nil, nil +} + +// Delete deletes a Subnet by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "SubnetsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, parentResourceName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of Subnet in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string, parentResourceName string) (result []*armnetwork.Subnet, rerr error) { + ctx = utils.ContextWithClientName(ctx, "SubnetsClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.SubnetsClient.NewListPager(resourceGroupName, parentResourceName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/armbalancer.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/armbalancer.go new file mode 100644 index 000000000..b01612243 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/armbalancer.go @@ -0,0 +1,66 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package armbalancer + +import ( + "context" + "net/http" +) + +type Options struct { + Transport *http.Transport + + // PoolSize is the max number of connections that will be created by the connection pool. + // Default: 8 + PoolSize int + + // RecycleThreshold is the lowest value of any X-Ms-Ratelimit-Remaining-* header that + // can be seen before the associated connection will be re-established. + // Default: 100 + RecycleThreshold int64 + + // MinReqsBeforeRecycle is a safeguard to prevent frequent connection churn in the unlikely event + // that a connections lands on an ARM instance that already has a depleted rate limiting quota. + // Default: 10 + MinReqsBeforeRecycle int64 +} + +// New wraps a transport to provide smart connection pooling and client-side load balancing. +func New(ctx context.Context, opts Options) http.RoundTripper { + if opts.Transport == nil { + opts.Transport = http.DefaultTransport.(*http.Transport) + } + + if opts.PoolSize == 0 { + opts.PoolSize = 8 + } + + if opts.RecycleThreshold == 0 { + opts.RecycleThreshold = 100 + } + if opts.MinReqsBeforeRecycle == 0 { + opts.MinReqsBeforeRecycle = 10 + } + + return NewHostScopedTransport(ctx, func() *transportChannPool { + return newtransportChannPool(opts.PoolSize, func() Transport { + return &ClosableTransport{ + Transport: opts.Transport.Clone(), + } + }, &KillBeforeThrottledPolicy{opts.RecycleThreshold}) + }) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/host_scoped_transport.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/host_scoped_transport.go new file mode 100644 index 000000000..eb0986c4e --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/host_scoped_transport.go @@ -0,0 +1,63 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package armbalancer + +import ( + "context" + "net/http" + "strings" + "sync" + + "golang.org/x/sync/errgroup" +) + +func NewHostScopedTransport(ctx context.Context, transportFactory func() *transportChannPool) Transport { + ctx, cancelFn := context.WithCancel(ctx) + transport := &hostScopedTransport{ + ctx: ctx, + cancelFn: cancelFn, + transportMap: sync.Map{}, + transportFactory: transportFactory, + } + transport.serverGrp.SetLimit(-1) + return transport +} + +type hostScopedTransport struct { + ctx context.Context + cancelFn context.CancelFunc + transportMap sync.Map + transportFactory func() *transportChannPool + serverGrp errgroup.Group +} + +func (hostScopedTransport *hostScopedTransport) RoundTrip(req *http.Request) (*http.Response, error) { + transportRaw, ok := hostScopedTransport.transportMap.Load(strings.ToLower(req.Host)) + if !ok { + transportPool := hostScopedTransport.transportFactory() + hostScopedTransport.serverGrp.Go(func() error { return transportPool.Run(hostScopedTransport.ctx) }) + hostScopedTransport.transportMap.Store(strings.ToLower(req.Host), transportPool) + transportRaw = transportPool + } + transport := transportRaw.(Transport) + return transport.RoundTrip(req) +} + +func (hostScopedTransport *hostScopedTransport) ForceClose() error { + hostScopedTransport.cancelFn() + return hostScopedTransport.serverGrp.Wait() +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/transport.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/transport.go new file mode 100644 index 000000000..4def51685 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/transport.go @@ -0,0 +1,36 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package armbalancer + +import ( + "net/http" +) + +var _ Transport = &ClosableTransport{} + +type ClosableTransport struct { + *http.Transport +} + +func (transport *ClosableTransport) ForceClose() error { + transport.Transport.CloseIdleConnections() + return nil +} + +func (transport *ClosableTransport) RoundTrip(req *http.Request) (*http.Response, error) { + return transport.Transport.RoundTrip(req) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/transport_pool.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/transport_pool.go new file mode 100644 index 000000000..b2eb483ee --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer/transport_pool.go @@ -0,0 +1,160 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package armbalancer + +import ( + "context" + "net/http" + "strconv" + "strings" + "sync" + + "golang.org/x/sync/errgroup" +) + +type transportChannPool struct { + sync.WaitGroup + capacity chan struct{} + pool chan Transport + transportFactory func() Transport + transportDropPolicy []TransportDropPolicy +} + +type TransportDropPolicy interface { + ShouldDropTransport(header http.Header) bool +} + +type TransportDropPolicyFunc func(header http.Header) bool + +func (function TransportDropPolicyFunc) ShouldDropTransport(header http.Header) bool { + if function == nil { + return false + } + return function(header) +} + +type Transport interface { + http.RoundTripper + ForceClose() error +} + +func newtransportChannPool(size int, transportFactory func() Transport, dropPolicy ...TransportDropPolicy) *transportChannPool { + if size <= 0 { + return nil + } + pool := &transportChannPool{ + capacity: make(chan struct{}, size), + pool: make(chan Transport, size), + transportFactory: transportFactory, + transportDropPolicy: dropPolicy, + } + return pool +} + +func (pool *transportChannPool) Run(ctx context.Context) error { +CLEANUP: + for { + select { + case <-ctx.Done(): + break CLEANUP + case pool.capacity <- struct{}{}: + pool.pool <- pool.transportFactory() + } + } + + //cleanup + close(pool.capacity) // no more transport is added. consumers will be released if channel is closed. + errGroup := new(errgroup.Group) + errGroup.Go(func() error { + pool.Wait() // wait for transport recycle loop + close(pool.pool) // no more transport is added consumers will released if channel is closed. + return nil + }) + for transport := range pool.pool { + transport := transport + errGroup.Go(transport.ForceClose) + } + return errGroup.Wait() // close all of transports in pool +} + +func (pool *transportChannPool) RoundTrip(req *http.Request) (*http.Response, error) { + transport, err := pool.selectTransport(req) + if err != nil { + return nil, err + } + resp, err := transport.RoundTrip(req) + var header http.Header + if resp != nil { + header = resp.Header.Clone() + } + pool.Add(1) + go pool.recycleTransport(transport, header) + return resp, err +} + +func (pool *transportChannPool) selectTransport(req *http.Request) (Transport, error) { + for { + var t Transport + var ok bool + select { + case t, ok = <-pool.pool: + if !ok { + return nil, http.ErrServerClosed + } + return t, nil + case <-req.Context().Done(): + return nil, http.ErrServerClosed + } + } +} + +func (pool *transportChannPool) recycleTransport(t Transport, header http.Header) { + defer pool.Done() + for _, policy := range pool.transportDropPolicy { + if policy.ShouldDropTransport(header) { + t.ForceClose() // drop the transport + <-pool.capacity // notify pool to create new transport + return + } + } + pool.pool <- t +} + +func (pool *transportChannPool) ForceClose() error { + close(pool.pool) + return nil +} + +type KillBeforeThrottledPolicy struct { + RecycleThreshold int64 +} + +func (policy *KillBeforeThrottledPolicy) ShouldDropTransport(header http.Header) bool { + for key, vals := range header { + if !strings.HasPrefix(key, "X-Ms-Ratelimit-Remaining-") { + continue + } + n, err := strconv.ParseInt(vals[0], 10, 0) + if err != nil { + continue + } + if n < policy.RecycleThreshold { + return true + } + } + return false +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/const.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/const.go new file mode 100644 index 000000000..59ddc43f3 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/const.go @@ -0,0 +1,24 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +const ( + AzureClientID = "AZURE_CLIENT_ID" + AZURECLIENTSECRET = "AZURE_CLIENT_SECRET" //nolint:gosec + AzureFederatedTokenFile = "AZURE_FEDERATED_TOKEN_FILE" + AzureTenantID = "AZURE_TENANT_ID" +) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/ctx.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/ctx.go new file mode 100644 index 000000000..40b0b7d65 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/ctx.go @@ -0,0 +1,62 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +import "context" + +var ( + ctxKeyClientName = struct{}{} + ctxKeyMethodRequest = struct{}{} + ctxKeyResourceGroupName = struct{}{} + ctxKeySubscriptionID = struct{}{} +) + +func ContextWithClientName(ctx context.Context, clientName string) context.Context { + return context.WithValue(ctx, ctxKeyClientName, clientName) +} + +func ClientNameFromContext(ctx context.Context) (string, bool) { + rv, ok := ctx.Value(ctxKeyClientName).(string) + return rv, ok +} + +func ContextWithRequestMethod(ctx context.Context, methodRequest string) context.Context { + return context.WithValue(ctx, ctxKeyMethodRequest, methodRequest) +} + +func RequestMethodFromContext(ctx context.Context) (string, bool) { + rv, ok := ctx.Value(ctxKeyMethodRequest).(string) + return rv, ok +} + +func ContextWithResourceGroupName(ctx context.Context, resourceGroupName string) context.Context { + return context.WithValue(ctx, ctxKeyResourceGroupName, resourceGroupName) +} + +func ResourceGroupNameFromContext(ctx context.Context) (string, bool) { + rv, ok := ctx.Value(ctxKeyResourceGroupName).(string) + return rv, ok +} + +func ContextWithSubscriptionID(ctx context.Context, subscriptionID string) context.Context { + return context.WithValue(ctx, ctxKeySubscriptionID, subscriptionID) +} + +func SubscriptionIDFromContext(ctx context.Context) (string, bool) { + rv, ok := ctx.Value(ctxKeySubscriptionID).(string) + return rv, ok +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/interface.go new file mode 100644 index 000000000..02ca3b120 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/interface.go @@ -0,0 +1,69 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +import "context" + +// Get gets the service resource +type GetFunc[Type interface{}] interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result *Type, rerr error) +} + +// Get gets the service resource +type SubResourceGetFunc[Type interface{}] interface { + Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *Type, rerr error) +} + +// Get gets the service resource +type GetWithExpandFunc[Type interface{}] interface { + Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *Type, rerr error) +} + +// Get gets the service resource +type SubResourceGetWithExpandFunc[Type interface{}] interface { + Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string, expand *string) (result *Type, rerr error) +} + +// List gets a list of service resource in the resource group. +type ListFunc[Type interface{}] interface { + List(ctx context.Context, resourceGroupName string) (result []*Type, rerr error) +} + +// List gets a list of service resource in the resource group. +type SubResourceListFunc[Type interface{}] interface { + List(ctx context.Context, resourceGroupName string, parentResourceName string) (result []*Type, rerr error) +} + +// CreateOrUpdate creates or updates a service resource. +type CreateOrUpdateFunc[Type interface{}] interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resourceParam Type) (*Type, error) +} + +// CreateOrUpdate creates or updates a service resource. +type SubResourceCreateOrUpdateFunc[Type interface{}] interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string, resourceParam Type) (*Type, error) +} + +// Delete deletes a service resource by name. +type DeleteFunc[Type interface{}] interface { + Delete(ctx context.Context, resourceGroupName string, resourceName string) error +} + +// Delete deletes a service resource by name. +type SubResourceDeleteFunc[Type interface{}] interface { + Delete(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) error +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/options.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/options.go new file mode 100644 index 000000000..4a1378139 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/options.go @@ -0,0 +1,58 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +import ( + "net/http" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/retryrepectthrottled" +) + +var TracingProvider tracing.Provider + +const ( + DefaultMaxRetries = 3 + DefaultMaxRetryDelay = 60 * time.Second + DefaultRetryDelay = 5 * time.Second + DefaultTryTimeout = 10 * time.Second +) + +func GetDefaultOption() *arm.ClientOptions { + return &arm.ClientOptions{ + ClientOptions: policy.ClientOptions{ + Retry: policy.RetryOptions{ + RetryDelay: DefaultRetryDelay, + MaxRetryDelay: DefaultMaxRetryDelay, + MaxRetries: DefaultMaxRetries, + TryTimeout: DefaultTryTimeout, + StatusCodes: retryrepectthrottled.GetRetriableStatusCode(), + }, + PerRetryPolicies: []policy.Policy{ + retryrepectthrottled.NewThrottlingPolicy(), + }, + Transport: &http.Client{ + Transport: DefaultTransport, + }, + TracingProvider: TracingProvider, + }, + } +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/policy_wrapper.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/policy_wrapper.go new file mode 100644 index 000000000..d59d6016c --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/policy_wrapper.go @@ -0,0 +1,33 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +import ( + "errors" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +type FuncPolicyWrapper func(req *policy.Request) (*http.Response, error) + +func (f FuncPolicyWrapper) Do(req *policy.Request) (*http.Response, error) { + if f != nil { + return f(req) + } + return nil, errors.New("policy func is nil") +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/poller.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/poller.go new file mode 100644 index 000000000..63a930088 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/poller.go @@ -0,0 +1,55 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +import ( + "context" + "errors" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +func NewPollerWrapper[ResponseType interface{}](poller *runtime.Poller[ResponseType], err error) *PollerWrapper[ResponseType] { + return &PollerWrapper[ResponseType]{ + poller: poller, + err: err, + } +} + +type PollerWrapper[ResponseType interface{}] struct { + poller *runtime.Poller[ResponseType] + err error +} + +// Poller is the poller to be used for polling. +// assume that the poller will ends +func (handler *PollerWrapper[ResponseType]) WaitforPollerResp(ctx context.Context) (result *ResponseType, err error) { + if handler.err != nil { + return nil, handler.err + } + if handler.poller == nil { + return nil, errors.New("poller is nil") + } + resp, err := handler.poller.PollUntilDone(ctx, &runtime.PollUntilDoneOptions{ + Frequency: time.Second * 15, + }) + if err != nil { + return nil, err + } + return &resp, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/transport.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/transport.go new file mode 100644 index 000000000..bc2523188 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/transport.go @@ -0,0 +1,48 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +import ( + "crypto/tls" + "net" + "net/http" + "sync" + "time" +) + +var DefaultTransport *http.Transport +var once sync.Once + +func init() { + once.Do(func() { + DefaultTransport = &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).DialContext, + ForceAttemptHTTP2: true, + MaxIdleConns: 100, + MaxConnsPerHost: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + TLSClientConfig: &tls.Config{ + MinVersion: tls.VersionTLS12, + }, + } + }) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/custom.go new file mode 100644 index 000000000..298ec4407 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/custom.go @@ -0,0 +1,48 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package vaultclient + +import ( + "context" + + armkeyvault "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// Delete deletes a Vault by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + _, err := client.VaultsClient.Delete(ctx, resourceGroupName, resourceName, nil) + return err +} + +// CreateOrUpdate creates or updates a Vault. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armkeyvault.VaultCreateOrUpdateParameters) (*armkeyvault.Vault, error) { + resp, err := utils.NewPollerWrapper(client.VaultsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.Vault, nil + } + return nil, nil +} + +func (client *Client) PurgeDeleted(ctx context.Context, vaultName string, location string) error { + _, err := utils.NewPollerWrapper(client.BeginPurgeDeleted(ctx, vaultName, location, nil)).WaitforPollerResp(ctx) + return err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/interface.go new file mode 100644 index 000000000..50027f212 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/interface.go @@ -0,0 +1,35 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package vaultclient + +import ( + "context" + + armkeyvault "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;listbyrg,resource=Vault,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault,packageAlias=armkeyvault,clientName=VaultsClient,expand=false +type Interface interface { + utils.GetFunc[armkeyvault.Vault] + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armkeyvault.VaultCreateOrUpdateParameters) (*armkeyvault.Vault, error) + utils.DeleteFunc[armkeyvault.Vault] + PurgeDeleted(ctx context.Context, vaultName string, location string) error + utils.ListFunc[armkeyvault.Vault] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/zz_generated_client.go new file mode 100644 index 000000000..ccc5b0eeb --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/zz_generated_client.go @@ -0,0 +1,77 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package vaultclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armkeyvault "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armkeyvault.VaultsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armkeyvault.NewVaultsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the Vault +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armkeyvault.Vault, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "VaultsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.VaultsClient.Get(ctx, resourceGroupName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.Vault, nil +} + +// List gets a list of Vault in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armkeyvault.Vault, rerr error) { + ctx = utils.ContextWithClientName(ctx, "VaultsClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.VaultsClient.NewListByResourceGroupPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/custom.go new file mode 100644 index 000000000..b3db14286 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/custom.go @@ -0,0 +1,39 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package virtualmachineclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" +) + +// Get gets the VirtualMachine +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *armcompute.VirtualMachine, rerr error) { + var ops *armcompute.VirtualMachinesClientGetOptions + if expand != nil { + expand := armcompute.InstanceViewTypes(*expand) + ops = &armcompute.VirtualMachinesClientGetOptions{Expand: &expand} + } + + resp, err := client.VirtualMachinesClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.VirtualMachine, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/interface.go new file mode 100644 index 000000000..ef228f640 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/interface.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package virtualmachineclient + +import ( + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=createorupdate;delete;list,resource=VirtualMachine,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5,packageAlias=armcompute,clientName=VirtualMachinesClient,expand=true,rateLimitKey=virtualMachineRateLimit +type Interface interface { + utils.GetWithExpandFunc[armcompute.VirtualMachine] + utils.CreateOrUpdateFunc[armcompute.VirtualMachine] + utils.DeleteFunc[armcompute.VirtualMachine] + utils.ListFunc[armcompute.VirtualMachine] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/zz_generated_client.go new file mode 100644 index 000000000..8014a347b --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/zz_generated_client.go @@ -0,0 +1,88 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package virtualmachineclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armcompute.VirtualMachinesClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armcompute.NewVirtualMachinesClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// CreateOrUpdate creates or updates a VirtualMachine. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcompute.VirtualMachine) (*armcompute.VirtualMachine, error) { + ctx = utils.ContextWithClientName(ctx, "VirtualMachinesClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.VirtualMachinesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.VirtualMachine, nil + } + return nil, nil +} + +// Delete deletes a VirtualMachine by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "VirtualMachinesClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of VirtualMachine in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.VirtualMachine, rerr error) { + ctx = utils.ContextWithClientName(ctx, "VirtualMachinesClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.VirtualMachinesClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/custom.go new file mode 100644 index 000000000..16c9ddc0c --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/custom.go @@ -0,0 +1,37 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package virtualmachinescalesetclient + +import ( + "context" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" +) + +// Get gets the VirtualMachineScaleSet +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *armcompute.ExpandTypesForGetVMScaleSets) (result *armcompute.VirtualMachineScaleSet, rerr error) { + var ops *armcompute.VirtualMachineScaleSetsClientGetOptions + if expand != nil { + ops = &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: expand} + } + resp, err := client.VirtualMachineScaleSetsClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.VirtualMachineScaleSet, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/interface.go new file mode 100644 index 000000000..852a73470 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/interface.go @@ -0,0 +1,34 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package virtualmachinescalesetclient + +import ( + "context" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=createorupdate;delete;list,resource=VirtualMachineScaleSet,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5,packageAlias=armcompute,clientName=VirtualMachineScaleSetsClient,expand=true,rateLimitKey=virtualMachineSizesRateLimit +type Interface interface { + Get(ctx context.Context, resourceGroupName string, resourceName string, expand *armcompute.ExpandTypesForGetVMScaleSets) (result *armcompute.VirtualMachineScaleSet, rerr error) + utils.CreateOrUpdateFunc[armcompute.VirtualMachineScaleSet] + utils.DeleteFunc[armcompute.VirtualMachineScaleSet] + utils.ListFunc[armcompute.VirtualMachineScaleSet] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/zz_generated_client.go new file mode 100644 index 000000000..5034b62ba --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/zz_generated_client.go @@ -0,0 +1,88 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package virtualmachinescalesetclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armcompute.VirtualMachineScaleSetsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armcompute.NewVirtualMachineScaleSetsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// CreateOrUpdate creates or updates a VirtualMachineScaleSet. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcompute.VirtualMachineScaleSet) (*armcompute.VirtualMachineScaleSet, error) { + ctx = utils.ContextWithClientName(ctx, "VirtualMachineScaleSetsClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.VirtualMachineScaleSetsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.VirtualMachineScaleSet, nil + } + return nil, nil +} + +// Delete deletes a VirtualMachineScaleSet by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "VirtualMachineScaleSetsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of VirtualMachineScaleSet in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.VirtualMachineScaleSet, rerr error) { + ctx = utils.ContextWithClientName(ctx, "VirtualMachineScaleSetsClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.VirtualMachineScaleSetsClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/custom.go new file mode 100644 index 000000000..72747bec1 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/custom.go @@ -0,0 +1,99 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package virtualmachinescalesetvmclient + +import ( + "context" + "errors" + "sync" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// Update updates a VirtualMachine. +func (client *Client) Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters armcompute.VirtualMachineScaleSetVM) (*armcompute.VirtualMachineScaleSetVM, error) { + resp, err := client.UpdateAsync(ctx, resourceGroupName, VMScaleSetName, instanceID, parameters).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.VirtualMachineScaleSetVM, nil + } + return nil, nil +} + +func (client *Client) UpdateAsync(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters armcompute.VirtualMachineScaleSetVM) *utils.PollerWrapper[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse] { + return utils.NewPollerWrapper(client.VirtualMachineScaleSetVMsClient.BeginUpdate(ctx, resourceGroupName, VMScaleSetName, instanceID, parameters, nil)) +} + +func UpdateVMsInBatch(ctx context.Context, client *Client, resourceGroupName string, VMScaleSetName string, instances map[string]armcompute.VirtualMachineScaleSetVM, batchSize int) error { + if batchSize <= 0 { + return errors.New("batchSize should be greater than 0") + } + + if batchSize == 1 { + for instanceID, vm := range instances { + if _, err := client.Update(ctx, resourceGroupName, VMScaleSetName, instanceID, vm); err != nil { + return err + } + } + return nil + } + + cocurrentFence := make(chan struct{}, batchSize) + errChannel := make(chan error, len(instances)) + var workerGroup sync.WaitGroup + var err error + for instanceID, vm := range instances { + select { + case cocurrentFence <- struct{}{}: + workerGroup.Add(1) + go func(instanceID string, vm armcompute.VirtualMachineScaleSetVM) { + defer workerGroup.Done() + defer func() { <-cocurrentFence }() + _, err := client.Update(ctx, resourceGroupName, VMScaleSetName, instanceID, vm) + if err != nil { + errChannel <- err + return + } + }(instanceID, vm) + case err = <-errChannel: + if err != nil { + break + } + } + } + workerGroup.Wait() + close(cocurrentFence) + close(errChannel) + return err +} + +// List gets a list of VirtualMachineScaleSetVM in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string, parentResourceName string) (result []*armcompute.VirtualMachineScaleSetVM, rerr error) { + pager := client.VirtualMachineScaleSetVMsClient.NewListPager(resourceGroupName, parentResourceName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/interface.go new file mode 100644 index 000000000..bae4fdff6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/interface.go @@ -0,0 +1,35 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package virtualmachinescalesetvmclient + +import ( + "context" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;delete,resource=VirtualMachineScaleSet,subResource=VirtualMachineScaleSetVM,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5,packageAlias=armcompute,clientName=VirtualMachineScaleSetVMsClient,expand=false +type Interface interface { + utils.SubResourceGetFunc[armcompute.VirtualMachineScaleSetVM] + utils.SubResourceDeleteFunc[armcompute.VirtualMachineScaleSetVM] + utils.SubResourceListFunc[armcompute.VirtualMachineScaleSetVM] + // Update updates a VirtualMachineScaleSetVM. + Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters armcompute.VirtualMachineScaleSetVM) (*armcompute.VirtualMachineScaleSetVM, error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/zz_generated_client.go new file mode 100644 index 000000000..1ff038c98 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/zz_generated_client.go @@ -0,0 +1,70 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package virtualmachinescalesetvmclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armcompute.VirtualMachineScaleSetVMsClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armcompute.NewVirtualMachineScaleSetVMsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the VirtualMachineScaleSetVM +func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armcompute.VirtualMachineScaleSetVM, rerr error) { + + ctx = utils.ContextWithClientName(ctx, "VirtualMachineScaleSetVMsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.VirtualMachineScaleSetVMsClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.VirtualMachineScaleSetVM, nil +} + +// Delete deletes a VirtualMachineScaleSetVM by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "VirtualMachineScaleSetVMsClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, parentResourceName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/custom.go new file mode 100644 index 000000000..f51623940 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/custom.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package virtualnetworkclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" +) + +func (client *Client) CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, ipAddress string) (*armnetwork.IPAddressAvailabilityResult, error) { + resp, err := client.VirtualNetworksClient.CheckIPAddressAvailability(ctx, resourceGroupName, virtualNetworkName, ipAddress, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.IPAddressAvailabilityResult, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/interface.go new file mode 100644 index 000000000..f60114475 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/interface.go @@ -0,0 +1,35 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package virtualnetworkclient + +import ( + "context" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete;list,resource=VirtualNetwork,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4,packageAlias=armnetwork,clientName=VirtualNetworksClient,expand=true +type Interface interface { + utils.GetWithExpandFunc[armnetwork.VirtualNetwork] + utils.CreateOrUpdateFunc[armnetwork.VirtualNetwork] + utils.DeleteFunc[armnetwork.VirtualNetwork] + utils.ListFunc[armnetwork.VirtualNetwork] + CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, ipAddress string) (*armnetwork.IPAddressAvailabilityResult, error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/zz_generated_client.go new file mode 100644 index 000000000..7dced8853 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/zz_generated_client.go @@ -0,0 +1,106 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package virtualnetworkclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.VirtualNetworksClient + subscriptionID string +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + + client, err := armnetwork.NewVirtualNetworksClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{client, subscriptionID}, nil +} + +// Get gets the VirtualNetwork +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, expand *string) (result *armnetwork.VirtualNetwork, rerr error) { + var ops *armnetwork.VirtualNetworksClientGetOptions + if expand != nil { + ops = &armnetwork.VirtualNetworksClientGetOptions{Expand: expand} + } + ctx = utils.ContextWithClientName(ctx, "VirtualNetworksClient") + ctx = utils.ContextWithRequestMethod(ctx, "Get") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := client.VirtualNetworksClient.Get(ctx, resourceGroupName, resourceName, ops) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.VirtualNetwork, nil +} + +// CreateOrUpdate creates or updates a VirtualNetwork. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.VirtualNetwork) (*armnetwork.VirtualNetwork, error) { + ctx = utils.ContextWithClientName(ctx, "VirtualNetworksClient") + ctx = utils.ContextWithRequestMethod(ctx, "CreateOrUpdate") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + resp, err := utils.NewPollerWrapper(client.VirtualNetworksClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.VirtualNetwork, nil + } + return nil, nil +} + +// Delete deletes a VirtualNetwork by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) error { + ctx = utils.ContextWithClientName(ctx, "VirtualNetworksClient") + ctx = utils.ContextWithRequestMethod(ctx, "Delete") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + _, err := utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} + +// List gets a list of VirtualNetwork in the resource group. +func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.VirtualNetwork, rerr error) { + ctx = utils.ContextWithClientName(ctx, "VirtualNetworksClient") + ctx = utils.ContextWithRequestMethod(ctx, "List") + ctx = utils.ContextWithResourceGroupName(ctx, resourceGroupName) + ctx = utils.ContextWithSubscriptionID(ctx, client.subscriptionID) + pager := client.VirtualNetworksClient.NewListPager(resourceGroupName, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/deploymentclient/azure_deploymentclient.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/deploymentclient/azure_deploymentclient.go index 8a1524970..b99124d16 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/deploymentclient/azure_deploymentclient.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/deploymentclient/azure_deploymentclient.go @@ -440,7 +440,7 @@ func (c *Client) ExportTemplate(ctx context.Context, resourceGroupName string, d defer c.armClient.CloseResponse(ctx, response) if rerr != nil { klog.V(5).Infof("Received error in %s: resourceID: %s, error: %s", "deployment.exportTemplate.request", resourceID, rerr.Error()) - return + return result, rerr } err := autorest.Respond( diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/azure_vmssclient.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/azure_vmssclient.go index e24a435a2..dc0e45a5c 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/azure_vmssclient.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/azure_vmssclient.go @@ -474,7 +474,7 @@ func (c *Client) DeleteInstances(ctx context.Context, resourceGroupName string, return nil } -// DeleteInstancesAsync sends the delete request to ARM client and DOEST NOT wait on the future +// DeleteInstancesAsync sends the delete request to ARM client and DOES NOT wait on the future func (c *Client) DeleteInstancesAsync(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs compute.VirtualMachineScaleSetVMInstanceRequiredIDs, forceDelete bool) (*azure.Future, *retry.Error) { mc := metrics.NewMetricContext("vmss", "delete_instances_async", resourceGroupName, c.subscriptionID, "") @@ -529,7 +529,7 @@ func (c *Client) DeleteInstancesAsync(ctx context.Context, resourceGroupName str return &future, nil } -// DeallocateInstancesAsync sends the deallocate request to ARM client and DOEST NOT wait on the future +// DeallocateInstancesAsync sends the deallocate request to ARM client and DOES NOT wait on the future func (c *Client) DeallocateInstancesAsync(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs compute.VirtualMachineScaleSetVMInstanceRequiredIDs) (*azure.Future, *retry.Error) { mc := metrics.NewMetricContext("vmss", "deallocate_instances_async", resourceGroupName, c.subscriptionID, "") @@ -578,7 +578,7 @@ func (c *Client) DeallocateInstancesAsync(ctx context.Context, resourceGroupName return &future, nil } -// StartInstancesAsync sends the start request to ARM client and DOEST NOT wait on the future +// StartInstancesAsync sends the start request to ARM client and DOES NOT wait on the future func (c *Client) StartInstancesAsync(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs compute.VirtualMachineScaleSetVMInstanceRequiredIDs) (*azure.Future, *retry.Error) { mc := metrics.NewMetricContext("vmss", "start_instances_async", resourceGroupName, c.subscriptionID, "") diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/interface.go index c88e1ad06..10c9d0470 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/interface.go @@ -56,7 +56,7 @@ type Interface interface { // DeleteInstances deletes the instances for a VirtualMachineScaleSet. DeleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs compute.VirtualMachineScaleSetVMInstanceRequiredIDs) *retry.Error - // DeleteInstancesAsync sends the delete request to the ARM client and DOEST NOT wait on the future + // DeleteInstancesAsync sends the delete request to the ARM client and DOES NOT wait on the future DeleteInstancesAsync(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs compute.VirtualMachineScaleSetVMInstanceRequiredIDs, forceDelete bool) (*azure.Future, *retry.Error) // WaitForCreateOrUpdateResult waits for the response of the create or update request @@ -65,7 +65,7 @@ type Interface interface { // WaitForDeleteInstancesResult waits for the response of the delete instances request WaitForDeleteInstancesResult(ctx context.Context, future *azure.Future, resourceGroupName string) (*http.Response, error) - // DeallocateInstances sends the deallocate request to the ARM client and DOEST NOT wait on the future + // DeallocateInstances sends the deallocate request to the ARM client and DOES NOT wait on the future DeallocateInstancesAsync(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs compute.VirtualMachineScaleSetVMInstanceRequiredIDs) (*azure.Future, *retry.Error) // WaitForDeallocateInstancesResult waits for the response of the deallocate instances request diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/consts/consts.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/consts/consts.go index d9ddea625..723a4f89c 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/consts/consts.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/consts/consts.go @@ -17,6 +17,7 @@ limitations under the License. package consts import ( + "strings" "time" "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" @@ -156,8 +157,6 @@ const ( // NonVmssUniformNodesCacheTTLDefaultInSeconds is the TTL of the non vmss uniform node cache NonVmssUniformNodesCacheTTLDefaultInSeconds = 900 - // AvailabilitySetNodesCacheTTLDefaultInSeconds is the TTL of the availabilitySet node cache - AvailabilitySetNodesCacheTTLDefaultInSeconds = 900 // VMSSCacheTTLDefaultInSeconds is the TTL of the vmss cache VMSSCacheTTLDefaultInSeconds = 600 // VMSSVirtualMachinesCacheTTLDefaultInSeconds is the TTL of the vmss vm cache @@ -203,6 +202,8 @@ const ( IPVersionDualStackString string = "DualStack" ) +var IPVersionIPv6StringLower = strings.ToLower(IPVersionIPv6String) + // LB variables for dual-stack var ( // Service.Spec.LoadBalancerIP has been deprecated and may be removed in a future release. Those two annotations are introduced as alternatives to set IPv4/IPv6 LoadBalancer IPs. @@ -281,10 +282,15 @@ const ( // ServiceAnnotationIPTagsForPublicIP specifies the iptags used when dynamically creating a public ip ServiceAnnotationIPTagsForPublicIP = "service.beta.kubernetes.io/azure-pip-ip-tags" - // ServiceAnnotationAllowedServiceTag is the annotation used on the service + // ServiceAnnotationAllowedServiceTags is the annotation used on the service // to specify a list of allowed service tags separated by comma // Refer https://docs.microsoft.com/en-us/azure/virtual-network/security-overview#service-tags for all supported service tags. - ServiceAnnotationAllowedServiceTag = "service.beta.kubernetes.io/azure-allowed-service-tags" + ServiceAnnotationAllowedServiceTags = "service.beta.kubernetes.io/azure-allowed-service-tags" + + // ServiceAnnotationAllowedIPRanges is the annotation used on the service + // to specify a list of allowed IP Ranges separated by comma. + // It is compatible with both IPv4 and IPV6 CIDR formats. + ServiceAnnotationAllowedIPRanges = "service.beta.kubernetes.io/azure-allowed-ip-ranges" // ServiceAnnotationDenyAllExceptLoadBalancerSourceRanges denies all traffic to the load balancer except those // within the service.Spec.LoadBalancerSourceRanges. Ref: https://github.com/kubernetes-sigs/cloud-provider-azure/issues/374. @@ -497,6 +503,9 @@ const ( // ServiceAnnotationPLSCreation determines whether a PLS needs to be created. ServiceAnnotationPLSCreation = "service.beta.kubernetes.io/azure-pls-create" + // ServiceAnnotationPLSResourceGroup determines the resource group to create the PLS in. + ServiceAnnotationPLSResourceGroup = "service.beta.kubernetes.io/azure-pls-resource-group" + // ServiceAnnotationPLSName determines name of the PLS resource to create. ServiceAnnotationPLSName = "service.beta.kubernetes.io/azure-pls-name" @@ -552,3 +561,12 @@ const ( ServiceNameLabel = "kubernetes.io/service-name" ) + +// Load Balancer health probe mode +const ( + ClusterServiceLoadBalancerHealthProbeModeServiceNodePort = "servicenodeport" + ClusterServiceLoadBalancerHealthProbeModeShared = "shared" + ClusterServiceLoadBalancerHealthProbeDefaultPort = 10256 + ClusterServiceLoadBalancerHealthProbeDefaultPath = "/healthz" + SharedProbeName = "cluster-service-shared-health-probe" +) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go index dec5be640..52faba826 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go @@ -27,12 +27,9 @@ import ( "sync" "time" - ratelimitconfig "sigs.k8s.io/cloud-provider-azure/pkg/provider/config" - "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/adal" "github.com/Azure/go-autorest/autorest/azure" - v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" @@ -50,7 +47,9 @@ import ( cloudnodeutil "k8s.io/cloud-provider/node/helpers" nodeutil "k8s.io/component-helpers/node/util" "k8s.io/klog/v2" + "sigs.k8s.io/yaml" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader" azclients "sigs.k8s.io/cloud-provider-azure/pkg/azureclients" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/blobclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/containerserviceclient" @@ -79,10 +78,9 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/zoneclient" azcache "sigs.k8s.io/cloud-provider-azure/pkg/cache" "sigs.k8s.io/cloud-provider-azure/pkg/consts" + ratelimitconfig "sigs.k8s.io/cloud-provider-azure/pkg/provider/config" "sigs.k8s.io/cloud-provider-azure/pkg/retry" "sigs.k8s.io/cloud-provider-azure/pkg/util/taints" - - "sigs.k8s.io/yaml" ) var ( @@ -218,9 +216,6 @@ type Config struct { // NonVmssUniformNodesCacheTTLInSeconds sets the Cache TTL for NonVmssUniformNodesCacheTTLInSeconds // if not set, will use default value NonVmssUniformNodesCacheTTLInSeconds int `json:"nonVmssUniformNodesCacheTTLInSeconds,omitempty" yaml:"nonVmssUniformNodesCacheTTLInSeconds,omitempty"` - // AvailabilitySetNodesCacheTTLInSeconds sets the Cache TTL for availabilitySetNodesCache - // if not set, will use default value - AvailabilitySetNodesCacheTTLInSeconds int `json:"availabilitySetNodesCacheTTLInSeconds,omitempty" yaml:"availabilitySetNodesCacheTTLInSeconds,omitempty"` // VmssCacheTTLInSeconds sets the cache TTL for VMSS VmssCacheTTLInSeconds int `json:"vmssCacheTTLInSeconds,omitempty" yaml:"vmssCacheTTLInSeconds,omitempty"` // VmssVirtualMachinesCacheTTLInSeconds sets the cache TTL for vmssVirtualMachines @@ -281,6 +276,16 @@ type Config struct { RouteUpdateIntervalInSeconds int `json:"routeUpdateIntervalInSeconds,omitempty" yaml:"routeUpdateIntervalInSeconds,omitempty"` // LoadBalancerBackendPoolUpdateIntervalInSeconds is the interval for updating load balancer backend pool of local services. Default is 30 seconds. LoadBalancerBackendPoolUpdateIntervalInSeconds int `json:"loadBalancerBackendPoolUpdateIntervalInSeconds,omitempty" yaml:"loadBalancerBackendPoolUpdateIntervalInSeconds,omitempty"` + + // ClusterServiceLoadBalancerHealthProbeMode determines the health probe mode for cluster service load balancer. + // Supported values are `shared` and `servicenodeport`. + // `unshared`: the health probe will be created against each port of each service by watching the backend application (default). + // `shared`: all cluster services shares one HTTP probe targeting the kube-proxy on the node (/healthz:10256). + ClusterServiceLoadBalancerHealthProbeMode string `json:"clusterServiceLoadBalancerHealthProbeMode,omitempty" yaml:"clusterServiceLoadBalancerHealthProbeMode,omitempty"` + // ClusterServiceSharedLoadBalancerHealthProbePort defines the target port of the shared health probe. Default to 10256. + ClusterServiceSharedLoadBalancerHealthProbePort int32 `json:"clusterServiceSharedLoadBalancerHealthProbePort,omitempty" yaml:"clusterServiceSharedLoadBalancerHealthProbePort,omitempty"` + // ClusterServiceSharedLoadBalancerHealthProbePath defines the target path of the shared health probe. Default to `/healthz`. + ClusterServiceSharedLoadBalancerHealthProbePath string `json:"clusterServiceSharedLoadBalancerHealthProbePath,omitempty" yaml:"clusterServiceSharedLoadBalancerHealthProbePath,omitempty"` } // MultipleStandardLoadBalancerConfiguration stores the properties regarding multiple standard load balancers. @@ -333,12 +338,6 @@ type MultipleStandardLoadBalancerConfigurationStatus struct { ActiveNodes sets.Set[string] `json:"activeNodes" yaml:"activeNodes"` } -type InitSecretConfig struct { - SecretName string `json:"secretName,omitempty" yaml:"secretName,omitempty"` - SecretNamespace string `json:"secretNamespace,omitempty" yaml:"secretNamespace,omitempty"` - CloudConfigKey string `json:"cloudConfigKey,omitempty" yaml:"cloudConfigKey,omitempty"` -} - // HasExtendedLocation returns true if extendedlocation prop are specified. func (config *Config) HasExtendedLocation() bool { return config.ExtendedLocationName != "" && config.ExtendedLocationType != "" @@ -356,7 +355,6 @@ var ( // Cloud holds the config and clients type Cloud struct { Config - InitSecretConfig Environment azure.Environment RoutesClient routeclient.Interface @@ -433,7 +431,7 @@ type Cloud struct { // key: [resourceGroupName] // Value: sync.Map of [pipName]*PublicIPAddress pipCache azcache.Resource - // use LB frontEndIpConfiguration ID as the key and search for PLS attached to the frontEnd + // use [resourceGroupName*LBFrontEndIpConfigurationID] as the key and search for PLS attached to the frontEnd plsCache azcache.Resource // a timed cache storing storage account properties to avoid querying storage account frequently storageAccountCache azcache.Resource @@ -444,7 +442,6 @@ type Cloud struct { serviceReconcileLock sync.Mutex *ManagedDiskController - *controllerCommon // multipleStandardLoadBalancerConfigurationsSynced make sure the `reconcileMultipleStandardLoadBalancerConfigurations` // runs only once every time the cloud provide restarts. @@ -458,11 +455,23 @@ type Cloud struct { } // NewCloud returns a Cloud with initialized clients -func NewCloud(ctx context.Context, configReader io.Reader, callFromCCM bool) (cloudprovider.Interface, error) { - az, err := NewCloudWithoutFeatureGates(ctx, configReader, callFromCCM) +func NewCloud(ctx context.Context, config *Config, callFromCCM bool) (cloudprovider.Interface, error) { + az := &Cloud{ + nodeNames: sets.New[string](), + nodeZones: map[string]sets.Set[string]{}, + nodeResourceGroups: map[string]string{}, + unmanagedNodes: sets.New[string](), + routeCIDRs: map[string]string{}, + excludeLoadBalancerNodes: sets.New[string](), + nodePrivateIPs: map[string]sets.Set[string]{}, + nodePrivateIPToNodeNameMap: map[string]string{}, + } + + err := az.InitializeCloudFromConfig(ctx, config, false, callFromCCM) if err != nil { return nil, err } + az.ipv6DualStackEnabled = true return az, nil @@ -474,6 +483,7 @@ func NewCloudFromConfigFile(ctx context.Context, configFilePath string, calFromC err error ) + var configValue *Config if configFilePath != "" { var config *os.File config, err = os.Open(configFilePath) @@ -483,12 +493,12 @@ func NewCloudFromConfigFile(ctx context.Context, configFilePath string, calFromC } defer config.Close() - cloud, err = NewCloud(ctx, config, calFromCCM) - } else { - // Pass explicit nil so plugins can actually check for nil. See - // "Why is my nil error value not equal to nil?" in golang.org/doc/faq. - cloud, err = NewCloud(ctx, nil, false) + configValue, err = ParseConfig(config) + if err != nil { + klog.Fatalf("Failed to parse Azure cloud provider config: %v", err) + } } + cloud, err = NewCloud(ctx, configValue, calFromCCM && configFilePath != "") if err != nil { return nil, fmt.Errorf("could not init cloud provider azure: %w", err) @@ -500,73 +510,23 @@ func NewCloudFromConfigFile(ctx context.Context, configFilePath string, calFromC return cloud, nil } -func (az *Cloud) configSecretMetadata(secretName, secretNamespace, cloudConfigKey string) { - if secretName == "" { - secretName = consts.DefaultCloudProviderConfigSecName - } - if secretNamespace == "" { - secretNamespace = consts.DefaultCloudProviderConfigSecNamespace - } - if cloudConfigKey == "" { - cloudConfigKey = consts.DefaultCloudProviderConfigSecKey - } - - az.InitSecretConfig = InitSecretConfig{ - SecretName: secretName, - SecretNamespace: secretNamespace, - CloudConfigKey: cloudConfigKey, - } -} - func NewCloudFromSecret(ctx context.Context, clientBuilder cloudprovider.ControllerClientBuilder, secretName, secretNamespace, cloudConfigKey string) (cloudprovider.Interface, error) { - az := &Cloud{ - nodeNames: sets.New[string](), - nodeZones: map[string]sets.Set[string]{}, - nodeResourceGroups: map[string]string{}, - unmanagedNodes: sets.New[string](), - routeCIDRs: map[string]string{}, - excludeLoadBalancerNodes: sets.New[string](), - nodePrivateIPs: map[string]sets.Set[string]{}, - nodePrivateIPToNodeNameMap: map[string]string{}, - } - - az.configSecretMetadata(secretName, secretNamespace, cloudConfigKey) - - az.Initialize(clientBuilder, wait.NeverStop) - - err := az.InitializeCloudFromSecret(ctx) + config, err := configloader.Load[Config](ctx, &configloader.K8sSecretLoaderConfig{ + K8sSecretConfig: configloader.K8sSecretConfig{ + SecretName: secretName, + SecretNamespace: secretNamespace, + CloudConfigKey: cloudConfigKey, + }, + KubeClient: clientBuilder.ClientOrDie("cloud-provider-azure"), + }, nil) if err != nil { - return nil, fmt.Errorf("NewCloudFromSecret: failed to initialize cloud from secret %s/%s: %w", az.SecretNamespace, az.SecretName, err) + return nil, fmt.Errorf("NewCloudFromSecret: failed to get config from secret %s/%s: %w", secretNamespace, secretName, err) } - - az.ipv6DualStackEnabled = true - - return az, nil -} - -// NewCloudWithoutFeatureGates returns a Cloud without trying to wire the feature gates. This is used by the unit tests -// that don't load the actual features being used in the cluster. -func NewCloudWithoutFeatureGates(ctx context.Context, configReader io.Reader, callFromCCM bool) (*Cloud, error) { - config, err := ParseConfig(configReader) + az, err := NewCloud(ctx, config, true) if err != nil { - return nil, err - } - - az := &Cloud{ - nodeNames: sets.New[string](), - nodeZones: map[string]sets.Set[string]{}, - nodeResourceGroups: map[string]string{}, - unmanagedNodes: sets.New[string](), - routeCIDRs: map[string]string{}, - excludeLoadBalancerNodes: sets.New[string](), - nodePrivateIPs: map[string]sets.Set[string]{}, - nodePrivateIPToNodeNameMap: map[string]string{}, - } - - err = az.InitializeCloudFromConfig(ctx, config, false, callFromCCM) - if err != nil { - return nil, err + return nil, fmt.Errorf("NewCloudFromSecret: failed to initialize cloud from secret %s/%s: %w", secretNamespace, secretName, err) } + az.Initialize(clientBuilder, wait.NeverStop) return az, nil } @@ -630,29 +590,28 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, } } - env, err := ratelimitconfig.ParseAzureEnvironment(config.Cloud, config.ResourceManagerEndpoint, config.IdentitySystem) - if err != nil { - return err + if config.ClusterServiceLoadBalancerHealthProbeMode == "" { + config.ClusterServiceLoadBalancerHealthProbeMode = consts.ClusterServiceLoadBalancerHealthProbeModeServiceNodePort + } else { + supportedClusterServiceLoadBalancerHealthProbeModes := sets.New( + strings.ToLower(consts.ClusterServiceLoadBalancerHealthProbeModeServiceNodePort), + strings.ToLower(consts.ClusterServiceLoadBalancerHealthProbeModeShared), + ) + if !supportedClusterServiceLoadBalancerHealthProbeModes.Has(strings.ToLower(config.ClusterServiceLoadBalancerHealthProbeMode)) { + return fmt.Errorf("clusterServiceLoadBalancerHealthProbeMode %s is not supported, supported values are %v", config.ClusterServiceLoadBalancerHealthProbeMode, supportedClusterServiceLoadBalancerHealthProbeModes.UnsortedList()) + } } - - servicePrincipalToken, err := ratelimitconfig.GetServicePrincipalToken(&config.AzureAuthConfig, env, env.ServiceManagementEndpoint) - if errors.Is(err, ratelimitconfig.ErrorNoAuth) { - // Only controller-manager would lazy-initialize from secret, and credentials are required for such case. - if fromSecret { - err := fmt.Errorf("no credentials provided for Azure cloud provider") - klog.Fatal(err) - return err + if strings.EqualFold(config.ClusterServiceLoadBalancerHealthProbeMode, consts.ClusterServiceLoadBalancerHealthProbeModeShared) { + if config.ClusterServiceSharedLoadBalancerHealthProbePort == 0 { + config.ClusterServiceSharedLoadBalancerHealthProbePort = consts.ClusterServiceLoadBalancerHealthProbeDefaultPort } - - // No credentials provided, useInstanceMetadata should be enabled for Kubelet. - // TODO(feiskyer): print different error message for Kubelet and controller-manager, as they're - // requiring different credential settings. - if !config.UseInstanceMetadata && config.CloudConfigType == cloudConfigTypeFile { - return fmt.Errorf("useInstanceMetadata must be enabled without Azure credentials") + if config.ClusterServiceSharedLoadBalancerHealthProbePath == "" { + config.ClusterServiceSharedLoadBalancerHealthProbePath = consts.ClusterServiceLoadBalancerHealthProbeDefaultPath } + } - klog.V(2).Infof("Azure cloud provider is starting without credentials") - } else if err != nil { + env, err := ratelimitconfig.ParseAzureEnvironment(config.Cloud, config.ResourceManagerEndpoint, config.IdentitySystem) + if err != nil { return err } @@ -674,18 +633,6 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, return err } - // No credentials provided, InstanceMetadataService would be used for getting Azure resources. - // Note that this only applies to Kubelet, controller-manager should configure credentials for managing Azure resources. - if servicePrincipalToken == nil { - return nil - } - - // If uses network resources in different AAD Tenant, then prepare corresponding Service Principal Token for VM/VMSS client and network resources client - err = az.configureMultiTenantClients(servicePrincipalToken) - if err != nil { - return err - } - if az.MaximumLoadBalancerRuleCount == 0 { az.MaximumLoadBalancerRuleCount = consts.MaximumLoadBalancerRuleCount } @@ -718,15 +665,65 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, return err } } + servicePrincipalToken, err := ratelimitconfig.GetServicePrincipalToken(&config.AzureAuthConfig, env, env.ServiceManagementEndpoint) + if errors.Is(err, ratelimitconfig.ErrorNoAuth) { + // Only controller-manager would lazy-initialize from secret, and credentials are required for such case. + if fromSecret { + err := fmt.Errorf("no credentials provided for Azure cloud provider") + klog.Fatal(err) + return err + } + + // No credentials provided, useInstanceMetadata should be enabled for Kubelet. + // TODO(feiskyer): print different error message for Kubelet and controller-manager, as they're + // requiring different credential settings. + if !config.UseInstanceMetadata && config.CloudConfigType == cloudConfigTypeFile { + return fmt.Errorf("useInstanceMetadata must be enabled without Azure credentials") + } + + klog.V(2).Infof("Azure cloud provider is starting without credentials") + } else if err != nil { + return err + } + // No credentials provided, InstanceMetadataService would be used for getting Azure resources. + // Note that this only applies to Kubelet, controller-manager should configure credentials for managing Azure resources. + if servicePrincipalToken == nil { + return nil + } + + // If uses network resources in different AAD Tenant, then prepare corresponding Service Principal Token for VM/VMSS client and network resources client + multiTenantServicePrincipalToken, networkResourceServicePrincipalToken, err := az.getAuthTokenInMultiTenantEnv(servicePrincipalToken) + if err != nil { + return err + } + az.configAzureClients(servicePrincipalToken, multiTenantServicePrincipalToken, networkResourceServicePrincipalToken) err = az.initCaches() if err != nil { return err } - if err := initDiskControllers(az); err != nil { + if err := InitDiskControllers(az); err != nil { return err } + // Common controller contains the function + // needed by both blob disk and managed disk controllers + qps := float32(ratelimitconfig.DefaultAtachDetachDiskQPS) + bucket := ratelimitconfig.DefaultAtachDetachDiskBucket + if az.Config.AttachDetachDiskRateLimit != nil { + qps = az.Config.AttachDetachDiskRateLimit.CloudProviderRateLimitQPSWrite + bucket = az.Config.AttachDetachDiskRateLimit.CloudProviderRateLimitBucketWrite + } + klog.V(2).Infof("attach/detach disk operation rate limit QPS: %f, Bucket: %d", qps, bucket) + + common := &controllerCommon{ + cloud: az, + lockMap: newLockMap(), + diskOpRateLimiter: flowcontrol.NewTokenBucketRateLimiter(qps, bucket), + AttachDetachInitialDelayInMs: defaultAttachDetachInitialDelayInMs, + } + + az.ManagedDiskController = &ManagedDiskController{common} // updating routes and syncing zones only in CCM if callFromCCM { @@ -874,23 +871,21 @@ func (az *Cloud) setLBDefaults(config *Config) error { return nil } -func (az *Cloud) configureMultiTenantClients(servicePrincipalToken *adal.ServicePrincipalToken) error { +func (az *Cloud) getAuthTokenInMultiTenantEnv(servicePrincipalToken *adal.ServicePrincipalToken) (*adal.MultiTenantServicePrincipalToken, *adal.ServicePrincipalToken, error) { var err error var multiTenantServicePrincipalToken *adal.MultiTenantServicePrincipalToken var networkResourceServicePrincipalToken *adal.ServicePrincipalToken if az.Config.UsesNetworkResourceInDifferentTenant() { multiTenantServicePrincipalToken, err = ratelimitconfig.GetMultiTenantServicePrincipalToken(&az.Config.AzureAuthConfig, &az.Environment) if err != nil { - return err + return nil, nil, err } networkResourceServicePrincipalToken, err = ratelimitconfig.GetNetworkResourceServicePrincipalToken(&az.Config.AzureAuthConfig, &az.Environment) if err != nil { - return err + return nil, nil, err } } - - az.configAzureClients(servicePrincipalToken, multiTenantServicePrincipalToken, networkResourceServicePrincipalToken) - return nil + return multiTenantServicePrincipalToken, networkResourceServicePrincipalToken, nil } func (az *Cloud) setCloudProviderBackoffDefaults(config *Config) wait.Backoff { @@ -1118,12 +1113,17 @@ func (az *Cloud) Instances() (cloudprovider.Instances, bool) { return az, true } -// InstancesV2 returns an instancesV2 interface. Also returns true if the interface is supported, false otherwise. +// InstancesV2 is an implementation for instances and should only be implemented by external cloud providers. +// Implementing InstancesV2 is behaviorally identical to Instances but is optimized to significantly reduce +// API calls to the cloud provider when registering and syncing nodes. Implementation of this interface will +// disable calls to the Zones interface. Also returns true if the interface is supported, false otherwise. func (az *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool) { return az, true } // Zones returns a zones interface. Also returns true if the interface is supported, false otherwise. +// DEPRECATED: Zones is deprecated in favor of retrieving zone/region information from InstancesV2. +// This interface will not be called if InstancesV2 is enabled. func (az *Cloud) Zones() (cloudprovider.Zones, bool) { if az.isStackCloud() { // Azure stack does not support zones at this point @@ -1153,7 +1153,7 @@ func (az *Cloud) ProviderName() string { return consts.CloudProviderName } -func initDiskControllers(az *Cloud) error { +func InitDiskControllers(az *Cloud) error { // Common controller contains the function // needed by both blob disk and managed disk controllers @@ -1172,8 +1172,7 @@ func initDiskControllers(az *Cloud) error { AttachDetachInitialDelayInMs: defaultAttachDetachInitialDelayInMs, } - az.ManagedDiskController = &ManagedDiskController{common: common} - az.controllerCommon = common + az.ManagedDiskController = &ManagedDiskController{common} return nil } @@ -1258,18 +1257,19 @@ func (az *Cloud) updateNodeCaches(prevNode, newNode *v1.Node) { az.unmanagedNodes.Delete(prevNode.ObjectMeta.Name) } - // if the node is being deleted from the cluster, exclude it from load balancers - if newNode == nil { - az.excludeLoadBalancerNodes.Insert(prevNode.ObjectMeta.Name) - az.nodesWithCorrectLoadBalancerByPrimaryVMSet.Delete(strings.ToLower(prevNode.ObjectMeta.Name)) - } - // Remove from nodePrivateIPs cache. for _, address := range getNodePrivateIPAddresses(prevNode) { - klog.V(4).Infof("removing IP address %s of the node %s", address, prevNode.Name) + klog.V(6).Infof("removing IP address %s of the node %s", address, prevNode.Name) az.nodePrivateIPs[prevNode.Name].Delete(address) delete(az.nodePrivateIPToNodeNameMap, address) } + + // if the node is being deleted from the cluster, exclude it from load balancers + if newNode == nil { + az.excludeLoadBalancerNodes.Insert(prevNode.ObjectMeta.Name) + az.nodesWithCorrectLoadBalancerByPrimaryVMSet.Delete(strings.ToLower(prevNode.ObjectMeta.Name)) + delete(az.nodePrivateIPs, strings.ToLower(prevNode.Name)) + } } if newNode != nil { @@ -1318,15 +1318,15 @@ func (az *Cloud) updateNodeCaches(prevNode, newNode *v1.Node) { // Add to nodePrivateIPs cache for _, address := range getNodePrivateIPAddresses(newNode) { - if az.nodePrivateIPs[newNode.Name] == nil { - az.nodePrivateIPs[newNode.Name] = sets.New[string]() + if az.nodePrivateIPs[strings.ToLower(newNode.Name)] == nil { + az.nodePrivateIPs[strings.ToLower(newNode.Name)] = sets.New[string]() } if az.nodePrivateIPToNodeNameMap == nil { az.nodePrivateIPToNodeNameMap = make(map[string]string) } klog.V(6).Infof("adding IP address %s of the node %s", address, newNode.Name) - az.nodePrivateIPs[newNode.Name].Insert(address) + az.nodePrivateIPs[strings.ToLower(newNode.Name)].Insert(address) az.nodePrivateIPToNodeNameMap[address] = newNode.Name } } @@ -1356,7 +1356,7 @@ func (az *Cloud) updateNodeTaint(node *v1.Node) { klog.Errorf("failed to add taint %s to the node %s", v1.TaintNodeOutOfService, node.Name) } } else { - klog.V(2).Infof("node %s is not ready but node shutdown taint is not added, skip adding node out-of-service taint", node.Name) + klog.V(2).Infof("node %s is not ready but either shutdown taint is missing or out-of-service taint is already added, skip adding node out-of-service taint", node.Name) } } } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_config.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_config.go index 6711c5f65..ccfac7184 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_config.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_config.go @@ -16,16 +16,6 @@ limitations under the License. package provider -import ( - "context" - "fmt" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/klog/v2" - - "sigs.k8s.io/yaml" -) - // The config type for Azure cloud provider secret. Supported values are: // * file : The values are read from local cloud-config file. // * secret : The values from secret would override all configures from local cloud-config file. @@ -37,54 +27,3 @@ const ( cloudConfigTypeSecret cloudConfigType = "secret" cloudConfigTypeMerge cloudConfigType = "merge" ) - -// InitializeCloudFromSecret initializes Azure cloud provider from Kubernetes secret. -func (az *Cloud) InitializeCloudFromSecret(ctx context.Context) error { - config, err := az.GetConfigFromSecret() - if err != nil { - klog.Errorf("Failed to get cloud-config from secret: %v", err) - return fmt.Errorf("InitializeCloudFromSecret: failed to get cloud config from secret %s/%s: %w", az.SecretNamespace, az.SecretName, err) - } - - if config == nil { - // Skip re-initialization if the config is not override. - return nil - } - - if err := az.InitializeCloudFromConfig(ctx, config, true, true); err != nil { - klog.Errorf("Failed to initialize Azure cloud provider: %v", err) - return fmt.Errorf("InitializeCloudFromSecret: failed to initialize Azure cloud provider: %w", err) - } - - return nil -} - -func (az *Cloud) GetConfigFromSecret() (*Config, error) { - // Read config from file and no override, return nil. - if az.Config.CloudConfigType == cloudConfigTypeFile { - return nil, nil - } - - secret, err := az.KubeClient.CoreV1().Secrets(az.SecretNamespace).Get(context.TODO(), az.SecretName, metav1.GetOptions{}) - if err != nil { - return nil, fmt.Errorf("failed to get secret %s/%s: %w", az.SecretNamespace, az.SecretName, err) - } - - cloudConfigData, ok := secret.Data[az.CloudConfigKey] - if !ok { - return nil, fmt.Errorf("cloud-config is not set in the secret (%s/%s)", az.SecretNamespace, az.SecretName) - } - - config := Config{} - if az.Config.CloudConfigType == "" || az.Config.CloudConfigType == cloudConfigTypeMerge { - // Merge cloud config, set default value to existing config. - config = az.Config - } - - err = yaml.Unmarshal(cloudConfigData, &config) - if err != nil { - return nil, fmt.Errorf("failed to parse Azure cloud-config: %w", err) - } - - return &config, nil -} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_common.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_common.go index 9702a8956..7e84e2e30 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_common.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_common.go @@ -168,9 +168,10 @@ func (c *controllerCommon) getNodeVMSet(nodeName types.NodeName, crt azcache.Azu // AttachDisk attaches a disk to vm // parameter async indicates whether allow multiple batch disk attach on one node in parallel +// occupiedLuns is used to avoid conflict with other disk attach in k8s VolumeAttachments // return (lun, error) func (c *controllerCommon) AttachDisk(ctx context.Context, async bool, diskName, diskURI string, nodeName types.NodeName, - cachingMode compute.CachingTypes, disk *compute.Disk) (int32, error) { + cachingMode compute.CachingTypes, disk *compute.Disk, occupiedLuns []int) (int32, error) { diskEncryptionSetID := "" writeAcceleratorEnabled := false @@ -261,7 +262,7 @@ func (c *controllerCommon) AttachDisk(ctx context.Context, async bool, diskName, return -1, err } - lun, err := c.SetDiskLun(nodeName, diskuri, diskMap) + lun, err := c.SetDiskLun(nodeName, diskuri, diskMap, occupiedLuns) if err != nil { return -1, err } @@ -527,8 +528,8 @@ func (c *controllerCommon) cleanDetachDiskRequests(nodeName string) (map[string] return diskMap, nil } -// getNodeDataDisks invokes vmSet interfaces to get data disks for the node. -func (c *controllerCommon) getNodeDataDisks(nodeName types.NodeName, crt azcache.AzureCacheReadType) ([]compute.DataDisk, *string, error) { +// GetNodeDataDisks invokes vmSet interfaces to get data disks for the node. +func (c *controllerCommon) GetNodeDataDisks(nodeName types.NodeName, crt azcache.AzureCacheReadType) ([]compute.DataDisk, *string, error) { vmset, err := c.getNodeVMSet(nodeName, crt) if err != nil { return nil, nil, err @@ -539,9 +540,9 @@ func (c *controllerCommon) getNodeDataDisks(nodeName types.NodeName, crt azcache // GetDiskLun finds the lun on the host that the vhd is attached to, given a vhd's diskName and diskURI. func (c *controllerCommon) GetDiskLun(diskName, diskURI string, nodeName types.NodeName) (int32, *string, error) { - // getNodeDataDisks need to fetch the cached data/fresh data if cache expired here + // GetNodeDataDisks need to fetch the cached data/fresh data if cache expired here // to ensure we get LUN based on latest entry. - disks, provisioningState, err := c.getNodeDataDisks(nodeName, azcache.CacheReadTypeDefault) + disks, provisioningState, err := c.GetNodeDataDisks(nodeName, azcache.CacheReadTypeDefault) if err != nil { klog.Errorf("error of getting data disks for node %s: %v", nodeName, err) return -1, provisioningState, err @@ -564,9 +565,10 @@ func (c *controllerCommon) GetDiskLun(diskName, diskURI string, nodeName types.N } // SetDiskLun find unused luns and allocate lun for every disk in diskMap. +// occupiedLuns is used to avoid conflict with other disk attach in k8s VolumeAttachments // Return lun of diskURI, -1 if all luns are used. -func (c *controllerCommon) SetDiskLun(nodeName types.NodeName, diskURI string, diskMap map[string]*AttachDiskOptions) (int32, error) { - disks, _, err := c.getNodeDataDisks(nodeName, azcache.CacheReadTypeDefault) +func (c *controllerCommon) SetDiskLun(nodeName types.NodeName, diskURI string, diskMap map[string]*AttachDiskOptions, occupiedLuns []int) (int32, error) { + disks, _, err := c.GetNodeDataDisks(nodeName, azcache.CacheReadTypeDefault) if err != nil { klog.Errorf("error of getting data disks for node %s: %v", nodeName, err) return -1, err @@ -594,6 +596,10 @@ func (c *controllerCommon) SetDiskLun(nodeName types.NodeName, diskURI string, d return lun, nil } + for _, lun := range occupiedLuns { + used[int32(lun)] = true + } + // allocate lun for every disk in diskMap var diskLuns []int32 count := 0 @@ -636,11 +642,11 @@ func (c *controllerCommon) DisksAreAttached(diskNames []string, nodeName types.N attached[diskName] = false } - // doing stalled read for getNodeDataDisks to ensure we don't call ARM + // doing stalled read for GetNodeDataDisks to ensure we don't call ARM // for every reconcile call. The cache is invalidated after Attach/Detach // disk. So the new entry will be fetched and cached the first time reconcile // loop runs after the Attach/Disk OP which will reflect the latest model. - disks, _, err := c.getNodeDataDisks(nodeName, azcache.CacheReadTypeUnsafe) + disks, _, err := c.GetNodeDataDisks(nodeName, azcache.CacheReadTypeUnsafe) if err != nil { if errors.Is(err, cloudprovider.InstanceNotFound) { // if host doesn't exist, no need to detach diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_standard.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_standard.go index 3a494ecdf..4ce4d9c47 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_standard.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_standard.go @@ -265,7 +265,7 @@ func (as *availabilitySet) UpdateVMAsync(ctx context.Context, nodeName types.Nod } func (as *availabilitySet) updateCache(nodeName string, vm *compute.VirtualMachine) { - if as.common.DisableUpdateCache { + if as.ManagedDiskController.DisableUpdateCache { return } as.cloud.vmCache.Update(nodeName, vm) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_vmssflex.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_vmssflex.go index e3ad7a9b7..17c914dd4 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_vmssflex.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_vmssflex.go @@ -264,7 +264,7 @@ func (fs *FlexScaleSet) UpdateVMAsync(ctx context.Context, nodeName types.NodeNa } func (fs *FlexScaleSet) updateCache(nodeName string, vm *compute.VirtualMachine) error { - if fs.common.DisableUpdateCache { + if fs.ManagedDiskController.DisableUpdateCache { return nil } if vm == nil { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_fakes.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_fakes.go index 58d764473..cf58e172f 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_fakes.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_fakes.go @@ -128,7 +128,7 @@ func GetTestCloud(ctrl *gomock.Controller) (az *Cloud) { az.LoadBalancerBackendPool = NewMockBackendPool(ctrl) az.storageAccountCache, _ = az.newStorageAccountCache() - _ = initDiskControllers(az) + _ = InitDiskControllers(az) az.regionZonesMap = map[string][]string{az.Location: {"1", "2", "3"}} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instance_metadata.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instance_metadata.go index c79fd6395..99f4cc905 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instance_metadata.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instance_metadata.go @@ -18,6 +18,7 @@ package provider import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -271,3 +272,20 @@ func (ims *InstanceMetadataService) GetMetadata(crt azcache.AzureCacheReadType) return nil, fmt.Errorf("failure of getting instance metadata") } + +// GetPlatformSubFaultDomain returns the PlatformSubFaultDomain from IMDS if set. +func (az *Cloud) GetPlatformSubFaultDomain() (string, error) { + if az.UseInstanceMetadata { + metadata, err := az.Metadata.GetMetadata(azcache.CacheReadTypeUnsafe) + if err != nil { + klog.Errorf("GetPlatformSubFaultDomain: failed to GetMetadata: %s", err.Error()) + return "", err + } + if metadata.Compute == nil { + _ = az.Metadata.imsCache.Delete(consts.MetadataCacheKey) + return "", errors.New("failure of getting compute information from instance metadata") + } + return metadata.Compute.PlatformSubFaultDomain, nil + } + return "", nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instances.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instances_v1.go similarity index 78% rename from vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instances.go rename to vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instances_v1.go index f14fe57d6..8682afd3b 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instances.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instances_v1.go @@ -32,11 +32,14 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/consts" ) +var _ cloudprovider.Instances = (*Cloud)(nil) + const ( vmPowerStatePrefix = "PowerState/" vmPowerStateStopped = "stopped" vmPowerStateDeallocated = "deallocated" vmPowerStateDeallocating = "deallocating" + vmPowerStateUnknown = "unknown" // nodeNameEnvironmentName is the environment variable name for getting node name. // It is only used for out-of-tree cloud provider. @@ -219,38 +222,6 @@ func (az *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID stri return true, nil } -// InstanceExists returns true if the instance for the given node exists according to the cloud provider. -// Use the node.name or node.spec.providerID field to find the node in the cloud provider. -func (az *Cloud) InstanceExists(ctx context.Context, node *v1.Node) (bool, error) { - if node == nil { - return false, nil - } - unmanaged, err := az.IsNodeUnmanaged(node.Name) - if err != nil { - return false, err - } - if unmanaged { - klog.V(4).Infof("InstanceExists: omitting unmanaged node %q", node.Name) - return true, nil - } - - providerID := node.Spec.ProviderID - if providerID == "" { - var err error - providerID, err = cloudprovider.GetInstanceProviderID(ctx, az, types.NodeName(node.Name)) - if err != nil { - if strings.Contains(err.Error(), cloudprovider.InstanceNotFound.Error()) { - return false, nil - } - - klog.Errorf("InstanceExists: failed to get the provider ID by node name %s: %v", node.Name, err) - return false, err - } - } - - return az.InstanceExistsByProviderID(ctx, providerID) -} - // InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes func (az *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error) { if providerID == "" { @@ -298,38 +269,6 @@ func (az *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID st return provisioningSucceeded && (status == vmPowerStateStopped || status == vmPowerStateDeallocated || status == vmPowerStateDeallocating), nil } -// InstanceShutdown returns true if the instance is shutdown according to the cloud provider. -// Use the node.name or node.spec.providerID field to find the node in the cloud provider. -func (az *Cloud) InstanceShutdown(ctx context.Context, node *v1.Node) (bool, error) { - if node == nil { - return false, nil - } - unmanaged, err := az.IsNodeUnmanaged(node.Name) - if err != nil { - return false, err - } - if unmanaged { - klog.V(4).Infof("InstanceShutdown: omitting unmanaged node %q", node.Name) - return false, nil - } - providerID := node.Spec.ProviderID - if providerID == "" { - var err error - providerID, err = cloudprovider.GetInstanceProviderID(ctx, az, types.NodeName(node.Name)) - if err != nil { - // Returns false, so the controller manager will continue to check InstanceExistsByProviderID(). - if strings.Contains(err.Error(), cloudprovider.InstanceNotFound.Error()) { - return false, nil - } - - klog.Errorf("InstanceShutdown: failed to get the provider ID by node name %s: %v", node.Name, err) - return false, err - } - } - - return az.InstanceShutdownByProviderID(ctx, providerID) -} - func (az *Cloud) isCurrentInstance(name types.NodeName, metadataVMName string) (bool, error) { var err error nodeName := mapNodeNameToVMName(name) @@ -503,59 +442,6 @@ func (az *Cloud) CurrentNodeName(ctx context.Context, hostname string) (types.No return types.NodeName(hostname), nil } -// InstanceMetadata returns the instance's metadata. The values returned in InstanceMetadata are -// translated into specific fields in the Node object on registration. -// Use the node.name or node.spec.providerID field to find the node in the cloud provider. -func (az *Cloud) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error) { - meta := cloudprovider.InstanceMetadata{} - if node == nil { - return &meta, nil - } - unmanaged, err := az.IsNodeUnmanaged(node.Name) - if err != nil { - return &meta, err - } - if unmanaged { - klog.V(4).Infof("InstanceMetadata: omitting unmanaged node %q", node.Name) - return &meta, nil - } - - if node.Spec.ProviderID != "" { - meta.ProviderID = node.Spec.ProviderID - } else { - providerID, err := cloudprovider.GetInstanceProviderID(ctx, az, types.NodeName(node.Name)) - if err != nil { - klog.Errorf("InstanceMetadata: failed to get the provider ID by node name %s: %v", node.Name, err) - return nil, err - } - meta.ProviderID = providerID - } - - instanceType, err := az.InstanceType(ctx, types.NodeName(node.Name)) - if err != nil { - klog.Errorf("InstanceMetadata: failed to get the instance type of %s: %v", node.Name, err) - return &cloudprovider.InstanceMetadata{}, err - } - meta.InstanceType = instanceType - - nodeAddresses, err := az.NodeAddresses(ctx, types.NodeName(node.Name)) - if err != nil { - klog.Errorf("InstanceMetadata: failed to get the node address of %s: %v", node.Name, err) - return &cloudprovider.InstanceMetadata{}, err - } - meta.NodeAddresses = nodeAddresses - - zone, err := az.GetZoneByNodeName(ctx, types.NodeName(node.Name)) - if err != nil { - klog.Errorf("InstanceMetadata: failed to get the node zone of %s: %v", node.Name, err) - return &cloudprovider.InstanceMetadata{}, err - } - meta.Zone = zone.FailureDomain - meta.Region = zone.Region - - return &meta, nil -} - // mapNodeNameToVMName maps a k8s NodeName to an Azure VM Name // This is a simple string cast. func mapNodeNameToVMName(nodeName types.NodeName) string { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instances_v2.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instances_v2.go new file mode 100644 index 000000000..38b08663b --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_instances_v2.go @@ -0,0 +1,146 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package provider + +import ( + "context" + "strings" + + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/types" + cloudprovider "k8s.io/cloud-provider" + "k8s.io/klog/v2" +) + +var _ cloudprovider.InstancesV2 = (*Cloud)(nil) + +// InstanceExists returns true if the instance for the given node exists according to the cloud provider. +// Use the node.name or node.spec.providerID field to find the node in the cloud provider. +func (az *Cloud) InstanceExists(ctx context.Context, node *v1.Node) (bool, error) { + if node == nil { + return false, nil + } + unmanaged, err := az.IsNodeUnmanaged(node.Name) + if err != nil { + return false, err + } + if unmanaged { + klog.V(4).Infof("InstanceExists: omitting unmanaged node %q", node.Name) + return true, nil + } + + providerID := node.Spec.ProviderID + if providerID == "" { + var err error + providerID, err = cloudprovider.GetInstanceProviderID(ctx, az, types.NodeName(node.Name)) + if err != nil { + if strings.Contains(err.Error(), cloudprovider.InstanceNotFound.Error()) { + return false, nil + } + + klog.Errorf("InstanceExists: failed to get the provider ID by node name %s: %v", node.Name, err) + return false, err + } + } + + return az.InstanceExistsByProviderID(ctx, providerID) +} + +// InstanceShutdown returns true if the instance is shutdown according to the cloud provider. +// Use the node.name or node.spec.providerID field to find the node in the cloud provider. +func (az *Cloud) InstanceShutdown(ctx context.Context, node *v1.Node) (bool, error) { + if node == nil { + return false, nil + } + unmanaged, err := az.IsNodeUnmanaged(node.Name) + if err != nil { + return false, err + } + if unmanaged { + klog.V(4).Infof("InstanceShutdown: omitting unmanaged node %q", node.Name) + return false, nil + } + providerID := node.Spec.ProviderID + if providerID == "" { + var err error + providerID, err = cloudprovider.GetInstanceProviderID(ctx, az, types.NodeName(node.Name)) + if err != nil { + // Returns false, so the controller manager will continue to check InstanceExistsByProviderID(). + if strings.Contains(err.Error(), cloudprovider.InstanceNotFound.Error()) { + return false, nil + } + + klog.Errorf("InstanceShutdown: failed to get the provider ID by node name %s: %v", node.Name, err) + return false, err + } + } + + return az.InstanceShutdownByProviderID(ctx, providerID) +} + +// InstanceMetadata returns the instance's metadata. The values returned in InstanceMetadata are +// translated into specific fields in the Node object on registration. +// Use the node.name or node.spec.providerID field to find the node in the cloud provider. +func (az *Cloud) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error) { + meta := cloudprovider.InstanceMetadata{} + if node == nil { + return &meta, nil + } + unmanaged, err := az.IsNodeUnmanaged(node.Name) + if err != nil { + return &meta, err + } + if unmanaged { + klog.V(4).Infof("InstanceMetadata: omitting unmanaged node %q", node.Name) + return &meta, nil + } + + if node.Spec.ProviderID != "" { + meta.ProviderID = node.Spec.ProviderID + } else { + providerID, err := cloudprovider.GetInstanceProviderID(ctx, az, types.NodeName(node.Name)) + if err != nil { + klog.Errorf("InstanceMetadata: failed to get the provider ID by node name %s: %v", node.Name, err) + return nil, err + } + meta.ProviderID = providerID + } + + instanceType, err := az.InstanceType(ctx, types.NodeName(node.Name)) + if err != nil { + klog.Errorf("InstanceMetadata: failed to get the instance type of %s: %v", node.Name, err) + return &cloudprovider.InstanceMetadata{}, err + } + meta.InstanceType = instanceType + + nodeAddresses, err := az.NodeAddresses(ctx, types.NodeName(node.Name)) + if err != nil { + klog.Errorf("InstanceMetadata: failed to get the node address of %s: %v", node.Name, err) + return &cloudprovider.InstanceMetadata{}, err + } + meta.NodeAddresses = nodeAddresses + + zone, err := az.GetZoneByNodeName(ctx, types.NodeName(node.Name)) + if err != nil { + klog.Errorf("InstanceMetadata: failed to get the node zone of %s: %v", node.Name, err) + return &cloudprovider.InstanceMetadata{}, err + } + meta.Zone = zone.FailureDomain + meta.Region = zone.Region + + return &meta, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer.go index 825a60256..ef4d960bb 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer.go @@ -41,16 +41,18 @@ import ( cloudprovider "k8s.io/cloud-provider" servicehelpers "k8s.io/cloud-provider/service/helpers" "k8s.io/klog/v2" - utilnet "k8s.io/utils/net" "k8s.io/utils/pointer" "k8s.io/utils/strings/slices" azcache "sigs.k8s.io/cloud-provider-azure/pkg/cache" "sigs.k8s.io/cloud-provider-azure/pkg/consts" "sigs.k8s.io/cloud-provider-azure/pkg/metrics" + "sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer" "sigs.k8s.io/cloud-provider-azure/pkg/retry" ) +var _ cloudprovider.LoadBalancer = (*Cloud)(nil) + // Since public IP is not a part of the load balancer on Azure, // there is a chance that we could orphan public IP resources while we delete the load balancer (kubernetes/kubernetes#80571). // We need to make sure the existence of the load balancer depends on the load balancer resource and public IP resource on Azure. @@ -78,8 +80,11 @@ func (az *Cloud) existsPip(clusterName string, service *v1.Service) bool { return true } -// GetLoadBalancer returns whether the specified load balancer and its components exist, and +// GetLoadBalancer returns whether the specified load balancer exists, and // if so, what its status is. +// Implementations must treat the *v1.Service parameter as read-only and not modify it. +// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager. +// TODO: Break this up into different interfaces (LB, etc) when we have more than one type of service func (az *Cloud) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error) { existingLBs, err := az.ListLB(service) if err != nil { @@ -167,6 +172,12 @@ func (az *Cloud) reconcileService(ctx context.Context, clusterName string, servi key := strings.ToLower(serviceName) if az.useMultipleStandardLoadBalancers() && isLocalService(service) { az.localServiceNameToServiceInfoMap.Store(key, newServiceInfo(getServiceIPFamily(service), lbName)) + // There are chances that the endpointslice changes after EnsureHostsInPool, so + // need to check endpointslice for a second time. + if err := az.checkAndApplyLocalServiceBackendPoolUpdates(*lb, service); err != nil { + klog.Errorf("failed to checkAndApplyLocalServiceBackendPoolUpdates: %v", err) + return nil, err + } } else { az.localServiceNameToServiceInfoMap.Delete(key) } @@ -175,6 +186,15 @@ func (az *Cloud) reconcileService(ctx context.Context, clusterName string, servi } // EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one. Returns the status of the balancer +// Implementations must treat the *v1.Service and *v1.Node +// parameters as read-only and not modify them. +// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager. +// +// Implementations may return a (possibly wrapped) api.RetryError to enforce +// backing off at a fixed duration. This can be used for cases like when the +// load balancer is not ready yet (e.g., it is still being provisioned) and +// polling at a fixed rate is preferred over backing off exponentially in +// order to minimize latency. func (az *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) { // When a client updates the internal load balancer annotation, // the service may be switched from an internal LB to a public one, or vice versa. @@ -223,6 +243,9 @@ func (az *Cloud) getLatestService(serviceName string, deepcopy bool) (*v1.Servic } // UpdateLoadBalancer updates hosts under the specified load balancer. +// Implementations must treat the *v1.Service and *v1.Node +// parameters as read-only and not modify them. +// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager func (az *Cloud) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error { // Serialize service reconcile process az.serviceReconcileLock.Lock() @@ -275,6 +298,8 @@ func (az *Cloud) UpdateLoadBalancer(ctx context.Context, clusterName string, ser // This construction is useful because many cloud providers' load balancers // have multiple underlying components, meaning a Get could say that the LB // doesn't exist even if some part of it is still laying around. +// Implementations must treat the *v1.Service parameter as read-only and not modify it. +// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager func (az *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error { // Serialize service reconcile process az.serviceReconcileLock.Lock() @@ -327,7 +352,8 @@ func (az *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName stri return nil } -// GetLoadBalancerName returns the LoadBalancer name. +// GetLoadBalancerName returns the name of the load balancer. Implementations must treat the +// *v1.Service parameter as read-only and not modify it. func (az *Cloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string { return cloudprovider.DefaultLoadBalancerName(service) } @@ -1635,25 +1661,22 @@ func (az *Cloud) reconcileLoadBalancer(clusterName string, service *v1.Service, // reconcile the load balancer's backend pool configuration. if wantLb { - preConfig, changed, shouldRefreshLB, err := az.LoadBalancerBackendPool.ReconcileBackendPools(clusterName, service, lb) + var ( + preConfig, backendPoolsUpdated bool + err error + ) + preConfig, backendPoolsUpdated, lb, err = az.LoadBalancerBackendPool.ReconcileBackendPools(clusterName, service, lb) if err != nil { return lb, err } - if changed { + if backendPoolsUpdated { dirtyLb = true } isBackendPoolPreConfigured = preConfig // If the LB is changed, refresh it to avoid etag mismatch error // later when create or update the LB. - if shouldRefreshLB { - klog.V(4).Infof("reconcileLoadBalancer for service(%s): refreshing load balancer %s", serviceName, lbName) - lb, _, err = az.getAzureLoadBalancer(lbName, azcache.CacheReadTypeForceRefresh) - if err != nil { - return lb, fmt.Errorf("reconcileLoadBalancer for service (%s): failed to get load balancer %s: %w", serviceName, lbName, err) - } - addOrUpdateLBInList(existingLBs, lb) - } + addOrUpdateLBInList(existingLBs, lb) } // reconcile the load balancer's frontend IP configurations. @@ -1801,18 +1824,9 @@ func (az *Cloud) reconcileLoadBalancer(clusterName string, service *v1.Service, if az.useMultipleStandardLoadBalancers() { lbToReconcile = *existingLBs } - for _, lb := range lbToReconcile { - lbName := pointer.StringDeref(lb.Name, "") - if lb.LoadBalancerPropertiesFormat != nil && lb.LoadBalancerPropertiesFormat.BackendAddressPools != nil { - for _, backendPool := range *lb.LoadBalancerPropertiesFormat.BackendAddressPools { - isIPv6 := isBackendPoolIPv6(pointer.StringDeref(backendPool.Name, "")) - if strings.EqualFold(pointer.StringDeref(backendPool.Name, ""), az.getBackendPoolNameForService(service, clusterName, isIPv6)) { - if err := az.LoadBalancerBackendPool.EnsureHostsInPool(service, nodes, lbBackendPoolIDs[isIPv6], vmSetName, clusterName, lbName, backendPool); err != nil { - return nil, err - } - } - } - } + lb, err = az.reconcileBackendPoolHosts(lb, lbToReconcile, service, nodes, clusterName, vmSetName, lbBackendPoolIDs) + if err != nil { + return nil, err } } @@ -1824,6 +1838,44 @@ func (az *Cloud) reconcileLoadBalancer(clusterName string, service *v1.Service, return lb, nil } +func (az *Cloud) reconcileBackendPoolHosts( + currentLB *network.LoadBalancer, + lbs []network.LoadBalancer, + service *v1.Service, + nodes []*v1.Node, + clusterName, vmSetName string, + lbBackendPoolIDs map[bool]string, +) (*network.LoadBalancer, error) { + var res *network.LoadBalancer + res = currentLB + for _, lb := range lbs { + lb := lb + lbName := pointer.StringDeref(lb.Name, "") + if lb.LoadBalancerPropertiesFormat != nil && lb.LoadBalancerPropertiesFormat.BackendAddressPools != nil { + for i, backendPool := range *lb.LoadBalancerPropertiesFormat.BackendAddressPools { + isIPv6 := isBackendPoolIPv6(pointer.StringDeref(backendPool.Name, "")) + if strings.EqualFold(pointer.StringDeref(backendPool.Name, ""), az.getBackendPoolNameForService(service, clusterName, isIPv6)) { + if err := az.LoadBalancerBackendPool.EnsureHostsInPool( + service, + nodes, + lbBackendPoolIDs[isIPv6], + vmSetName, + clusterName, + lbName, + (*lb.LoadBalancerPropertiesFormat.BackendAddressPools)[i], + ); err != nil { + return nil, err + } + } + } + } + if strings.EqualFold(lbName, *currentLB.Name) { + res = &lb + } + } + return res, nil +} + // addOrUpdateLBInList adds or updates the given lb in the list func addOrUpdateLBInList(lbs *[]network.LoadBalancer, targetLB *network.LoadBalancer) { for i, lb := range *lbs { @@ -2542,6 +2594,7 @@ func (az *Cloud) getExpectedLBRules( // healthcheck proxy server serves http requests // https://github.com/kubernetes/kubernetes/blob/7c013c3f64db33cf19f38bb2fc8d9182e42b0b7b/pkg/proxy/healthcheck/service_health.go#L236 var nodeEndpointHealthprobe *network.Probe + var nodeEndpointHealthprobeAdded bool if servicehelpers.NeedsHealthCheck(service) && !(consts.IsPLSEnabled(service.Annotations) && consts.IsPLSProxyProtocolEnabled(service.Annotations)) { podPresencePath, podPresencePort := servicehelpers.GetServiceHealthCheckPathPort(service) lbRuleName := az.getLoadBalancerRuleName(service, v1.ProtocolTCP, podPresencePort, isIPv6) @@ -2559,7 +2612,13 @@ func (az *Cloud) getExpectedLBRules( ProbeThreshold: numberOfProbes, }, } - expectedProbes = append(expectedProbes, *nodeEndpointHealthprobe) + } + + var useSharedProbe bool + if az.useSharedLoadBalancerHealthProbeMode() && + !strings.EqualFold(string(service.Spec.ExternalTrafficPolicy), string(v1.ServiceExternalTrafficPolicyLocal)) { + nodeEndpointHealthprobe = az.buildClusterServiceSharedProbe() + useSharedProbe = true } // In HA mode, lb forward traffic of all port to backend @@ -2579,7 +2638,7 @@ func (az *Cloud) getExpectedLBRules( if nodeEndpointHealthprobe == nil { // use user customized health probe rule if any for _, port := range service.Spec.Ports { - portprobe, err := az.buildHealthProbeRulesForPort(service, port, lbRuleName) + portprobe, err := az.buildHealthProbeRulesForPort(service, port, lbRuleName, nil, false) if err != nil { klog.V(2).ErrorS(err, "error occurred when buildHealthProbeRulesForPort", "service", service.Name, "namespace", service.Namespace, "rule-name", lbRuleName, "port", port.Port) @@ -2597,6 +2656,7 @@ func (az *Cloud) getExpectedLBRules( props.Probe = &network.SubResource{ ID: pointer.String(az.getLoadBalancerProbeID(lbName, *nodeEndpointHealthprobe.Name)), } + expectedProbes = append(expectedProbes, *nodeEndpointHealthprobe) } expectedRules = append(expectedRules, network.LoadBalancingRule{ @@ -2640,23 +2700,25 @@ func (az *Cloud) getExpectedLBRules( "rule-name", lbRuleName, "port", port.Port) } if !isNoHealthProbeRule { - if nodeEndpointHealthprobe == nil { - portprobe, err := az.buildHealthProbeRulesForPort(service, port, lbRuleName) - if err != nil { - klog.V(2).ErrorS(err, "error occurred when buildHealthProbeRulesForPort", "service", service.Name, "namespace", service.Namespace, - "rule-name", lbRuleName, "port", port.Port) - return expectedProbes, expectedRules, err - } - if portprobe != nil { - props.Probe = &network.SubResource{ - ID: pointer.String(az.getLoadBalancerProbeID(lbName, *portprobe.Name)), - } - expectedProbes = append(expectedProbes, *portprobe) + portprobe, err := az.buildHealthProbeRulesForPort(service, port, lbRuleName, nodeEndpointHealthprobe, useSharedProbe) + if err != nil { + klog.V(2).ErrorS(err, "error occurred when buildHealthProbeRulesForPort", "service", service.Name, "namespace", service.Namespace, + "rule-name", lbRuleName, "port", port.Port) + return expectedProbes, expectedRules, err + } + if portprobe != nil { + props.Probe = &network.SubResource{ + ID: pointer.String(az.getLoadBalancerProbeID(lbName, *portprobe.Name)), } - } else { + expectedProbes = append(expectedProbes, *portprobe) + } else if nodeEndpointHealthprobe != nil { props.Probe = &network.SubResource{ ID: pointer.String(az.getLoadBalancerProbeID(lbName, *nodeEndpointHealthprobe.Name)), } + if !nodeEndpointHealthprobeAdded { + expectedProbes = append(expectedProbes, *nodeEndpointHealthprobe) + nodeEndpointHealthprobeAdded = true + } } } if consts.IsK8sServiceDisableLoadBalancerFloatingIP(service) { @@ -2813,36 +2875,50 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service, } } - sourceRanges, err := servicehelpers.GetLoadBalancerSourceRanges(service) + accessControl, err := loadbalancer.NewAccessControl(service) if err != nil { + klog.ErrorS(err, "Failed to parse access control configuration for service", "service", service.Name) return nil, err } - serviceTags := getServiceTags(service) - if len(serviceTags) != 0 { - delete(sourceRanges, consts.DefaultLoadBalancerSourceRanges) - } - sourceAddressPrefixes := map[bool][]string{} - if (sourceRanges == nil || servicehelpers.IsAllowAll(sourceRanges)) && len(serviceTags) == 0 { - if !requiresInternalLoadBalancer(service) || len(service.Spec.LoadBalancerSourceRanges) > 0 { - sourceAddressPrefixes[false] = []string{"Internet"} - sourceAddressPrefixes[true] = []string{"Internet"} - } - } else { - for _, ip := range sourceRanges { - if ip == nil { - continue - } - isIPv6 := net.ParseIP(ip.IP.String()).To4() == nil - sourceAddressPrefixes[isIPv6] = append(sourceAddressPrefixes[isIPv6], ip.String()) + var ( + sourceRanges = accessControl.SourceRanges() + allowedServiceTags = accessControl.AllowedServiceTags() + allowedIPRanges = accessControl.AllowedIPRanges() + sourceAddressPrefixes = map[bool][]string{ + false: accessControl.IPV4Sources(), + true: accessControl.IPV6Sources(), } - sourceAddressPrefixes[false] = append(sourceAddressPrefixes[false], serviceTags...) - sourceAddressPrefixes[true] = append(sourceAddressPrefixes[true], serviceTags...) + ) + + if len(sourceRanges) != 0 && len(allowedIPRanges) != 0 { + // Block the service and return error if both of spec.loadBalancerSourceRanges and annotation are specified + klog.Errorf("Service %s is using both of spec.loadBalancerSourceRanges and annotation %s.", service.Name, consts.ServiceAnnotationAllowedIPRanges) + return nil, fmt.Errorf( + "both of spec.loadBalancerSourceRanges and annotation %s are specified for service %s, which is not allowed", + consts.ServiceAnnotationAllowedIPRanges, service.Name, + ) + } + if len(sourceRanges) != 0 && len(allowedServiceTags) != 0 { + // Suggesting to use aks custom annotation instead of spec.loadBalancerSourceRanges + klog.Warningf( + "Service %s is using both of spec.loadBalancerSourceRanges and annotation %s.", + service.Name, consts.ServiceAnnotationAllowedServiceTags, + ) + az.Event(service, v1.EventTypeWarning, "ConflictConfiguration", fmt.Sprintf( + "Please use annotation %s instead of spec.loadBalancerSourceRanges while using %s annotation at the same time.", + consts.ServiceAnnotationAllowedIPRanges, consts.ServiceAnnotationAllowedServiceTags, + )) } - expectedSecurityRules := []network.SecurityRule{} + var expectedSecurityRules []network.SecurityRule handleSecurityRules := func(isIPv6 bool) error { - expectedSecurityRulesSingleStack, err := az.getExpectedSecurityRules(wantLb, ports, sourceAddressPrefixes[isIPv6], service, destinationIPAddresses[isIPv6], sourceRanges, backendIPAddresses[isIPv6], disableFloatingIP, isIPv6) + expectedSecurityRulesSingleStack, err := az.getExpectedSecurityRules( + wantLb, ports, + sourceAddressPrefixes[isIPv6], service, + destinationIPAddresses[isIPv6], sourceRanges, + backendIPAddresses[isIPv6], disableFloatingIP, isIPv6, + ) expectedSecurityRules = append(expectedSecurityRules, expectedSecurityRulesSingleStack...) return err } @@ -3026,7 +3102,16 @@ func (az *Cloud) reconcileSecurityRules(sg network.SecurityGroup, return dirtySg, updatedRules, nil } -func (az *Cloud) getExpectedSecurityRules(wantLb bool, ports []v1.ServicePort, sourceAddressPrefixes []string, service *v1.Service, destinationIPAddresses []string, sourceRanges utilnet.IPNetSet, backendIPAddresses []string, disableFloatingIP, isIPv6 bool) ([]network.SecurityRule, error) { +func (az *Cloud) getExpectedSecurityRules( + wantLb bool, + ports []v1.ServicePort, + sourceAddressPrefixes []string, + service *v1.Service, + destinationIPAddresses []string, + sourceRanges []netip.Prefix, + backendIPAddresses []string, + disableFloatingIP, isIPv6 bool, +) ([]network.SecurityRule, error) { expectedSecurityRules := []network.SecurityRule{} if wantLb { @@ -3069,7 +3154,7 @@ func (az *Cloud) getExpectedSecurityRules(wantLb bool, ports []v1.ServicePort, s } shouldAddDenyRule := false - if len(sourceRanges) > 0 && !servicehelpers.IsAllowAll(sourceRanges) { + if len(sourceRanges) > 0 && !loadbalancer.IsCIDRsAllowAll(sourceRanges) { if v, ok := service.Annotations[consts.ServiceAnnotationDenyAllExceptLoadBalancerSourceRanges]; ok && strings.EqualFold(v, consts.TrueAnnotationValue) { shouldAddDenyRule = true } @@ -3828,7 +3913,7 @@ func getServiceTags(service *v1.Service) []string { return nil } - if serviceTags, found := service.Annotations[consts.ServiceAnnotationAllowedServiceTag]; found { + if serviceTags, found := service.Annotations[consts.ServiceAnnotationAllowedServiceTags]; found { result := []string{} tags := strings.Split(strings.TrimSpace(serviceTags), ",") for _, tag := range tags { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_backendpool.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_backendpool.go index 28d75bdb0..d1db1e382 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_backendpool.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_backendpool.go @@ -52,7 +52,7 @@ type BackendPool interface { // ReconcileBackendPools creates the inbound backend pool if it is not existed, and removes nodes that are supposed to be // excluded from the load balancers. - ReconcileBackendPools(clusterName string, service *v1.Service, lb *network.LoadBalancer) (bool, bool, bool, error) + ReconcileBackendPools(clusterName string, service *v1.Service, lb *network.LoadBalancer) (bool, bool, *network.LoadBalancer, error) // GetBackendPrivateIPs returns the private IPs of LoadBalancer's backend pool GetBackendPrivateIPs(clusterName string, service *v1.Service, lb *network.LoadBalancer) ([]string, []string) @@ -157,14 +157,18 @@ func (bc *backendPoolTypeNodeIPConfig) CleanupVMSetFromBackendPoolByCondition(sl return slb, nil } -func (bc *backendPoolTypeNodeIPConfig) ReconcileBackendPools(clusterName string, service *v1.Service, lb *network.LoadBalancer) (bool, bool, bool, error) { +func (bc *backendPoolTypeNodeIPConfig) ReconcileBackendPools( + clusterName string, + service *v1.Service, + lb *network.LoadBalancer, +) (bool, bool, *network.LoadBalancer, error) { var newBackendPools []network.BackendAddressPool var err error if lb.BackendAddressPools != nil { newBackendPools = *lb.BackendAddressPools } - var changed, shouldRefreshLB, isOperationSucceeded, isMigration bool + var backendPoolsCreated, backendPoolsUpdated, isOperationSucceeded, isMigration bool foundBackendPools := map[bool]bool{} lbName := *lb.Name @@ -201,11 +205,11 @@ func (bc *backendPoolTypeNodeIPConfig) ReconcileBackendPools(clusterName string, bp.VirtualNetwork = nil if err := bc.CreateOrUpdateLBBackendPool(lbName, bp); err != nil { klog.Errorf("bc.ReconcileBackendPools for service (%s): failed to cleanup IP based backend pool %s: %s", serviceName, lbBackendPoolNames[isIPv6], err.Error()) - return false, false, false, fmt.Errorf("bc.ReconcileBackendPools for service (%s): failed to cleanup IP based backend pool %s: %w", serviceName, lbBackendPoolNames[isIPv6], err) + return false, false, nil, fmt.Errorf("bc.ReconcileBackendPools for service (%s): failed to cleanup IP based backend pool %s: %w", serviceName, lbBackendPoolNames[isIPv6], err) } newBackendPools[i] = bp lb.BackendAddressPools = &newBackendPools - shouldRefreshLB = true + backendPoolsUpdated = true } } @@ -219,7 +223,7 @@ func (bc *backendPoolTypeNodeIPConfig) ReconcileBackendPools(clusterName string, klog.V(2).Infof("bc.ReconcileBackendPools for service (%s): vm not found for ipConfID %s", serviceName, ipConfID) bipConfigNotFound = append(bipConfigNotFound, ipConf) } else { - return false, false, false, err + return false, false, nil, err } } @@ -230,7 +234,7 @@ func (bc *backendPoolTypeNodeIPConfig) ReconcileBackendPools(clusterName string, shouldExcludeLoadBalancer, err := bc.ShouldNodeExcludedFromLoadBalancer(nodeName) if err != nil { klog.Errorf("bc.ReconcileBackendPools: ShouldNodeExcludedFromLoadBalancer(%s) failed with error: %v", nodeName, err) - return false, false, false, err + return false, false, nil, err } if shouldExcludeLoadBalancer { klog.V(2).Infof("bc.ReconcileBackendPools for service (%s): lb backendpool - found unwanted node %s, decouple it from the LB %s", serviceName, nodeName, lbName) @@ -257,17 +261,18 @@ func (bc *backendPoolTypeNodeIPConfig) ReconcileBackendPools(clusterName string, // decouple the backendPool from the node updated, err := bc.VMSet.EnsureBackendPoolDeleted(service, lbBackendPoolIDsSlice, vmSetName, &backendpoolToBeDeleted, false) if err != nil { - return false, false, false, err + return false, false, nil, err } if updated { - shouldRefreshLB = true + backendPoolsUpdated = true } } - if shouldRefreshLB { + if backendPoolsUpdated { + klog.V(4).Infof("bc.ReconcileBackendPools for service(%s): refreshing load balancer %s", serviceName, lbName) lb, _, err = bc.getAzureLoadBalancer(lbName, cache.CacheReadTypeForceRefresh) if err != nil { - return false, false, false, fmt.Errorf("bc.ReconcileBackendPools for service (%s): failed to get loadbalancer %s: %w", serviceName, lbName, err) + return false, false, nil, fmt.Errorf("bc.ReconcileBackendPools for service (%s): failed to get loadbalancer %s: %w", serviceName, lbName, err) } } @@ -278,7 +283,7 @@ func (bc *backendPoolTypeNodeIPConfig) ReconcileBackendPools(clusterName string, isBackendPoolPreConfigured = newBackendPool(lb, isBackendPoolPreConfigured, bc.PreConfiguredBackendPoolLoadBalancerTypes, serviceName, lbBackendPoolNames[ipFamily == v1.IPv6Protocol]) - changed = true + backendPoolsCreated = true } if isMigration { @@ -288,7 +293,7 @@ func (bc *backendPoolTypeNodeIPConfig) ReconcileBackendPools(clusterName string, } isOperationSucceeded = true - return isBackendPoolPreConfigured, changed, false, err + return isBackendPoolPreConfigured, backendPoolsCreated, lb, err } func getBackendIPConfigurationsToBeDeleted( @@ -352,7 +357,7 @@ func (bc *backendPoolTypeNodeIPConfig) GetBackendPrivateIPs(clusterName string, klog.Errorf("bc.GetBackendPrivateIPs for service (%s): GetNodeNameByIPConfigurationID failed with error: %v", serviceName, err) continue } - privateIPsSet, ok := bc.nodePrivateIPs[nodeName] + privateIPsSet, ok := bc.nodePrivateIPs[strings.ToLower(nodeName)] if !ok { klog.Warningf("bc.GetBackendPrivateIPs for service (%s): failed to get private IPs of node %s", serviceName, nodeName) continue @@ -561,13 +566,13 @@ func (bi *backendPoolTypeNodeIP) CleanupVMSetFromBackendPoolByCondition(slb *net return slb, nil } -func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(clusterName string, service *v1.Service, lb *network.LoadBalancer) (bool, bool, bool, error) { +func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(clusterName string, service *v1.Service, lb *network.LoadBalancer) (bool, bool, *network.LoadBalancer, error) { var newBackendPools []network.BackendAddressPool if lb.BackendAddressPools != nil { newBackendPools = *lb.BackendAddressPools } - var changed, shouldRefreshLB, isOperationSucceeded, isMigration, updated bool + var backendPoolsUpdated, shouldRefreshLB, isOperationSucceeded, isMigration, updated bool foundBackendPools := map[bool]bool{} lbName := *lb.Name serviceName := getServiceName(service) @@ -626,7 +631,7 @@ func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(clusterName string, servi name, err := getLBNameFromBackendPoolID(id) if err != nil { klog.Errorf("bi.ReconcileBackendPools for service (%s): failed to get LB name from backend pool ID: %s", serviceName, err.Error()) - return false, false, false, err + return false, false, nil, err } backendPoolNames = append(backendPoolNames, name) } @@ -634,7 +639,7 @@ func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(clusterName string, servi if err := bi.MigrateToIPBasedBackendPoolAndWaitForCompletion(lbName, backendPoolNames, nicsCountMap); err != nil { backendPoolNamesStr := strings.Join(backendPoolNames, ",") klog.Errorf("Failed to migrate to IP based backend pool for lb %s, backend pool %s: %s", lbName, backendPoolNamesStr, err.Error()) - return false, false, false, err + return false, false, nil, err } } @@ -651,14 +656,14 @@ func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(clusterName string, servi shouldRefreshLB, err = bi.VMSet.EnsureBackendPoolDeleted(service, lbBackendPoolIDsSlice, vmSetName, lb.BackendAddressPools, true) if err != nil { klog.Errorf("bi.ReconcileBackendPools for service (%s): failed to EnsureBackendPoolDeleted: %s", serviceName, err.Error()) - return false, false, false, err + return false, false, nil, err } for _, i := range bpIdxes { bp := newBackendPools[i] var nodeIPAddressesToBeDeleted []string for nodeName := range bi.excludeLoadBalancerNodes { - for ip := range bi.nodePrivateIPs[nodeName] { + for ip := range bi.nodePrivateIPs[strings.ToLower(nodeName)] { klog.V(2).Infof("bi.ReconcileBackendPools for service (%s): found unwanted node private IP %s, decouple it from the LB %s", serviceName, ip, lbName) nodeIPAddressesToBeDeleted = append(nodeIPAddressesToBeDeleted, ip) } @@ -696,7 +701,7 @@ func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(clusterName string, servi if updated { (*lb.BackendAddressPools)[i] = bp if err := bi.CreateOrUpdateLBBackendPool(lbName, bp); err != nil { - return false, false, false, fmt.Errorf("bi.ReconcileBackendPools for service (%s): lb backendpool - failed to update backend pool %s for load balancer %s: %w", serviceName, pointer.StringDeref(bp.Name, ""), lbName, err) + return false, false, nil, fmt.Errorf("bi.ReconcileBackendPools for service (%s): lb backendpool - failed to update backend pool %s for load balancer %s: %w", serviceName, pointer.StringDeref(bp.Name, ""), lbName, err) } shouldRefreshLB = true } @@ -704,6 +709,13 @@ func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(clusterName string, servi } shouldRefreshLB = shouldRefreshLB || isMigration + if shouldRefreshLB { + klog.V(4).Infof("bi.ReconcileBackendPools for service(%s): refreshing load balancer %s", serviceName, lbName) + lb, _, err = bi.getAzureLoadBalancer(lbName, cache.CacheReadTypeForceRefresh) + if err != nil { + return false, false, nil, fmt.Errorf("bi.ReconcileBackendPools for service (%s): failed to get loadbalancer %s: %w", serviceName, lbName, err) + } + } for _, ipFamily := range service.Spec.IPFamilies { if foundBackendPools[ipFamily == v1.IPv6Protocol] { @@ -712,7 +724,7 @@ func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(clusterName string, servi isBackendPoolPreConfigured = newBackendPool(lb, isBackendPoolPreConfigured, bi.PreConfiguredBackendPoolLoadBalancerTypes, serviceName, lbBackendPoolNames[ipFamily == v1.IPv6Protocol]) - changed = true + backendPoolsUpdated = true } if isMigration { @@ -722,7 +734,7 @@ func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(clusterName string, servi } isOperationSucceeded = true - return isBackendPoolPreConfigured, changed, shouldRefreshLB, nil + return isBackendPoolPreConfigured, backendPoolsUpdated, lb, nil } func (bi *backendPoolTypeNodeIP) GetBackendPrivateIPs(clusterName string, service *v1.Service, lb *network.LoadBalancer) ([]string, []string) { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_healthprobe.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_healthprobe.go index 8664f907a..4b0f0c896 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_healthprobe.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_healthprobe.go @@ -22,16 +22,37 @@ import ( "strings" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network" + v1 "k8s.io/api/core/v1" + "k8s.io/klog/v2" "k8s.io/utils/pointer" "sigs.k8s.io/cloud-provider-azure/pkg/consts" ) +func (az *Cloud) buildClusterServiceSharedProbe() *network.Probe { + return &network.Probe{ + Name: pointer.String(consts.SharedProbeName), + ProbePropertiesFormat: &network.ProbePropertiesFormat{ + Protocol: network.ProbeProtocolHTTP, + Port: pointer.Int32(az.ClusterServiceSharedLoadBalancerHealthProbePort), + RequestPath: pointer.String(az.ClusterServiceSharedLoadBalancerHealthProbePath), + IntervalInSeconds: pointer.Int32(consts.HealthProbeDefaultProbeInterval), + ProbeThreshold: pointer.Int32(consts.HealthProbeDefaultNumOfProbe), + }, + } +} + // buildHealthProbeRulesForPort // for following sku: basic loadbalancer vs standard load balancer // for following protocols: TCP HTTP HTTPS(SLB only) -func (az *Cloud) buildHealthProbeRulesForPort(serviceManifest *v1.Service, port v1.ServicePort, lbrule string) (*network.Probe, error) { +// return nil if no new probe is added +func (az *Cloud) buildHealthProbeRulesForPort(serviceManifest *v1.Service, port v1.ServicePort, lbrule string, healthCheckNodePortProbe *network.Probe, useSharedProbe bool) (*network.Probe, error) { + if useSharedProbe { + klog.V(4).Infof("skip creating health probe for port %s because the shared probe is used", port.Port) + return nil, nil + } + if port.Protocol == v1.ProtocolUDP || port.Protocol == v1.ProtocolSCTP { return nil, nil } @@ -43,57 +64,7 @@ func (az *Cloud) buildHealthProbeRulesForPort(serviceManifest *v1.Service, port // order - Specific Override // port_ annotation // global annotation - - // Select Protocol - // - var protocol *string - - // 1. Look up port-specific override - protocol, err = consts.GetHealthProbeConfigOfPortFromK8sSvcAnnotation(serviceManifest.Annotations, port.Port, consts.HealthProbeParamsProtocol) - if err != nil { - return nil, fmt.Errorf("failed to parse annotation %s: %w", consts.BuildHealthProbeAnnotationKeyForPort(port.Port, consts.HealthProbeParamsProtocol), err) - } - - // 2. If not specified, look up from AppProtocol - // Note - this order is to remain compatible with previous versions - if protocol == nil { - protocol = port.AppProtocol - } - - // 3. If protocol is still nil, check the global annotation - if protocol == nil { - protocol, err = consts.GetAttributeValueInSvcAnnotation(serviceManifest.Annotations, consts.ServiceAnnotationLoadBalancerHealthProbeProtocol) - if err != nil { - return nil, fmt.Errorf("failed to parse annotation %s: %w", consts.ServiceAnnotationLoadBalancerHealthProbeProtocol, err) - } - } - - // 4. Finally, if protocol is still nil, default to TCP - if protocol == nil { - protocol = pointer.String(string(network.ProtocolTCP)) - } - - *protocol = strings.TrimSpace(*protocol) - switch { - case strings.EqualFold(*protocol, string(network.ProtocolTCP)): - properties.Protocol = network.ProbeProtocolTCP - case strings.EqualFold(*protocol, string(network.ProtocolHTTPS)): - //HTTPS probe is only supported in standard loadbalancer - //For backward compatibility,when unsupported protocol is used, fall back to tcp protocol in basic lb mode instead - if !az.useStandardLoadBalancer() { - properties.Protocol = network.ProbeProtocolTCP - } else { - properties.Protocol = network.ProbeProtocolHTTPS - } - case strings.EqualFold(*protocol, string(network.ProtocolHTTP)): - properties.Protocol = network.ProbeProtocolHTTP - default: - //For backward compatibility,when unsupported protocol is used, fall back to tcp protocol in basic lb mode instead - properties.Protocol = network.ProbeProtocolTCP - } - // Lookup or Override Health Probe Port - properties.Port = &port.NodePort probePort, err := consts.GetHealthProbeConfigOfPortFromK8sSvcAnnotation(serviceManifest.Annotations, port.Port, consts.HealthProbeParamsPort, func(s *string) error { if s == nil { @@ -148,6 +119,57 @@ func (az *Cloud) buildHealthProbeRulesForPort(serviceManifest *v1.Service, port properties.Port = pointer.Int32(int32(port)) } } + } else if healthCheckNodePortProbe != nil { + return nil, nil + } else { + properties.Port = &port.NodePort + } + // Select Protocol + // + var protocol *string + + // 1. Look up port-specific override + protocol, err = consts.GetHealthProbeConfigOfPortFromK8sSvcAnnotation(serviceManifest.Annotations, port.Port, consts.HealthProbeParamsProtocol) + if err != nil { + return nil, fmt.Errorf("failed to parse annotation %s: %w", consts.BuildHealthProbeAnnotationKeyForPort(port.Port, consts.HealthProbeParamsProtocol), err) + } + + // 2. If not specified, look up from AppProtocol + // Note - this order is to remain compatible with previous versions + if protocol == nil { + protocol = port.AppProtocol + } + + // 3. If protocol is still nil, check the global annotation + if protocol == nil { + protocol, err = consts.GetAttributeValueInSvcAnnotation(serviceManifest.Annotations, consts.ServiceAnnotationLoadBalancerHealthProbeProtocol) + if err != nil { + return nil, fmt.Errorf("failed to parse annotation %s: %w", consts.ServiceAnnotationLoadBalancerHealthProbeProtocol, err) + } + } + + // 4. Finally, if protocol is still nil, default to TCP + if protocol == nil { + protocol = pointer.String(string(network.ProtocolTCP)) + } + + *protocol = strings.TrimSpace(*protocol) + switch { + case strings.EqualFold(*protocol, string(network.ProtocolTCP)): + properties.Protocol = network.ProbeProtocolTCP + case strings.EqualFold(*protocol, string(network.ProtocolHTTPS)): + //HTTPS probe is only supported in standard loadbalancer + //For backward compatibility,when unsupported protocol is used, fall back to tcp protocol in basic lb mode instead + if !az.useStandardLoadBalancer() { + properties.Protocol = network.ProbeProtocolTCP + } else { + properties.Protocol = network.ProbeProtocolHTTPS + } + case strings.EqualFold(*protocol, string(network.ProtocolHTTP)): + properties.Protocol = network.ProbeProtocolHTTP + default: + //For backward compatibility,when unsupported protocol is used, fall back to tcp protocol in basic lb mode instead + properties.Protocol = network.ProbeProtocolTCP } // Select request path diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_repo.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_repo.go index d18d6521a..f92c95c5d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_repo.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_repo.go @@ -387,3 +387,12 @@ func isBackendPoolOnSameLB(newBackendPoolID string, existingBackendPools []strin return true, "", nil } + +func (az *Cloud) serviceOwnsRule(service *v1.Service, rule string) bool { + if !strings.EqualFold(string(service.Spec.ExternalTrafficPolicy), string(v1.ServiceExternalTrafficPolicyTypeLocal)) && + rule == consts.SharedProbeName { + return true + } + prefix := az.getRulePrefix(service) + return strings.HasPrefix(strings.ToUpper(rule), strings.ToUpper(prefix)) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_local_services.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_local_services.go index 66ff100ed..25ff0e816 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_local_services.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_local_services.go @@ -33,6 +33,7 @@ import ( "k8s.io/client-go/informers" "k8s.io/client-go/tools/cache" "k8s.io/klog/v2" + utilnet "k8s.io/utils/net" "k8s.io/utils/pointer" "sigs.k8s.io/cloud-provider-azure/pkg/consts" @@ -286,7 +287,6 @@ func (az *Cloud) getLocalServiceInfo(serviceName string) (*serviceInfo, bool) { // setUpEndpointSlicesInformer creates an informer for EndpointSlices of local services. // It watches the update events and send backend pool update operations to the batch updater. -// TODO (niqi): the update of endpointslice may be slower than tue update of endpoint pods. Need to fix this. func (az *Cloud) setUpEndpointSlicesInformer(informerFactory informers.SharedInformerFactory) { endpointSlicesInformer := informerFactory.Discovery().V1().EndpointSlices().Informer() _, _ = endpointSlicesInformer.AddEventHandler( @@ -311,7 +311,7 @@ func (az *Cloud) setUpEndpointSlicesInformer(informerFactory informers.SharedInf key := strings.ToLower(fmt.Sprintf("%s/%s", newES.Namespace, svcName)) si, found := az.getLocalServiceInfo(key) if !found { - klog.V(4).Infof("EndpointSlice %s/%s belongs to service %s, but the service is not a local service, skip updating load balancer backend pool", key, newES.Namespace, newES.Name) + klog.V(4).Infof("EndpointSlice %s/%s belongs to service %s, but the service is not a local service, or has not finished the initial reconciliation loop. Skip updating load balancer backend pool", newES.Namespace, newES.Name, key) return } lbName, ipFamily := si.lbName, si.ipFamily @@ -328,18 +328,13 @@ func (az *Cloud) setUpEndpointSlicesInformer(informerFactory informers.SharedInf } } for _, previousNodeName := range previousNodeNames { - nodeIPsSet := az.nodePrivateIPs[previousNodeName] + nodeIPsSet := az.nodePrivateIPs[strings.ToLower(previousNodeName)] previousIPs = append(previousIPs, setToStrings(nodeIPsSet)...) } for _, currentNodeName := range currentNodeNames { - nodeIPsSet := az.nodePrivateIPs[currentNodeName] + nodeIPsSet := az.nodePrivateIPs[strings.ToLower(currentNodeName)] currentIPs = append(currentIPs, setToStrings(nodeIPsSet)...) } - ipsToBeDeleted := compareNodeIPs(previousIPs, currentIPs) - if len(ipsToBeDeleted) == 0 && len(previousIPs) == len(currentIPs) { - klog.V(4).Infof("No IP change detected for EndpointSlice %s/%s, skip updating load balancer backend pool", newES.Namespace, newES.Name) - return - } if az.backendPoolUpdater != nil { var bpNames []string @@ -353,14 +348,11 @@ func (az *Cloud) setUpEndpointSlicesInformer(informerFactory informers.SharedInf default: bpNames = append(bpNames, bpNameIPv4, bpNameIPv6) } + currentIPsInBackendPools := make(map[string][]string) for _, bpName := range bpNames { - if len(ipsToBeDeleted) > 0 { - az.backendPoolUpdater.addOperation(getRemoveIPsFromBackendPoolOperation(key, lbName, bpName, ipsToBeDeleted)) - } - if len(currentIPs) > 0 { - az.backendPoolUpdater.addOperation(getAddIPsToBackendPoolOperation(key, lbName, bpName, currentIPs)) - } + currentIPsInBackendPools[bpName] = previousIPs } + az.applyIPChangesAmongLocalServiceBackendPoolsByIPFamily(lbName, key, currentIPsInBackendPools, currentIPs) } }, DeleteFunc: func(obj interface{}) { @@ -408,7 +400,7 @@ func compareNodeIPs(previousIPs, currentIPs []string) []string { func getLocalServiceBackendPoolName(serviceName string, ipv6 bool) string { serviceName = strings.ToLower(strings.Replace(serviceName, "/", "-", -1)) if ipv6 { - return fmt.Sprintf("%s-ipv6", serviceName) + return fmt.Sprintf("%s-%s", serviceName, consts.IPVersionIPv6StringLower) } return serviceName } @@ -471,12 +463,16 @@ func newServiceInfo(ipFamily, lbName string) *serviceInfo { // getLocalServiceEndpointsNodeNames gets the node names that host all endpoints of the local service. func (az *Cloud) getLocalServiceEndpointsNodeNames(service *v1.Service) (sets.Set[string], error) { - var ep *discovery_v1.EndpointSlice + var ( + ep *discovery_v1.EndpointSlice + foundInCache bool + ) az.endpointSlicesCache.Range(func(key, value interface{}) bool { endpointSlice := value.(*discovery_v1.EndpointSlice) if strings.EqualFold(getServiceNameOfEndpointSlice(endpointSlice), service.Name) && strings.EqualFold(endpointSlice.Namespace, service.Namespace) { ep = endpointSlice + foundInCache = true return false } return true @@ -499,6 +495,9 @@ func (az *Cloud) getLocalServiceEndpointsNodeNames(service *v1.Service) (sets.Se if ep == nil { return nil, fmt.Errorf("failed to find EndpointSlice for service %s/%s", service.Namespace, service.Name) } + if !foundInCache { + az.endpointSlicesCache.Store(strings.ToLower(fmt.Sprintf("%s/%s", ep.Namespace, ep.Name)), ep) + } var nodeNames []string for _, endpoint := range ep.Endpoints { @@ -544,3 +543,84 @@ func (az *Cloud) cleanupLocalServiceBackendPool( } return lbs, nil } + +// checkAndApplyLocalServiceBackendPoolUpdates if the IPs in the backend pool are aligned +// with the corresponding endpointslice, and update the backend pool if necessary. +func (az *Cloud) checkAndApplyLocalServiceBackendPoolUpdates(lb network.LoadBalancer, service *v1.Service) error { + serviceName := getServiceName(service) + endpointsNodeNames, err := az.getLocalServiceEndpointsNodeNames(service) + if err != nil { + return err + } + var expectedIPs []string + for nodeName := range endpointsNodeNames { + ips := az.nodePrivateIPs[strings.ToLower(nodeName)] + for ip := range ips { + expectedIPs = append(expectedIPs, ip) + } + } + currentIPsInBackendPools := make(map[string][]string) + for _, bp := range *lb.BackendAddressPools { + bpName := pointer.StringDeref(bp.Name, "") + if localServiceOwnsBackendPool(serviceName, bpName) { + var currentIPs []string + for _, address := range *bp.LoadBalancerBackendAddresses { + currentIPs = append(currentIPs, *address.IPAddress) + } + currentIPsInBackendPools[bpName] = currentIPs + } + } + az.applyIPChangesAmongLocalServiceBackendPoolsByIPFamily(*lb.Name, serviceName, currentIPsInBackendPools, expectedIPs) + + return nil +} + +// applyIPChangesAmongLocalServiceBackendPoolsByIPFamily reconciles IPs by IP family +// amone the backend pools of a local service. +func (az *Cloud) applyIPChangesAmongLocalServiceBackendPoolsByIPFamily( + lbName, serviceName string, + currentIPsInBackendPools map[string][]string, + expectedIPs []string, +) { + currentIPsInBackendPoolsIPv4 := make(map[string][]string) + currentIPsInBackendPoolsIPv6 := make(map[string][]string) + for bpName, ips := range currentIPsInBackendPools { + if managedResourceHasIPv6Suffix(bpName) { + currentIPsInBackendPoolsIPv6[bpName] = ips + } else { + currentIPsInBackendPoolsIPv4[bpName] = ips + } + } + + var ipv4, ipv6 []string + for _, ip := range expectedIPs { + if utilnet.IsIPv6String(ip) { + ipv6 = append(ipv6, ip) + } else { + ipv4 = append(ipv4, ip) + } + } + az.reconcileIPsInLocalServiceBackendPoolsAsync(lbName, serviceName, currentIPsInBackendPoolsIPv6, ipv6) + az.reconcileIPsInLocalServiceBackendPoolsAsync(lbName, serviceName, currentIPsInBackendPoolsIPv4, ipv4) +} + +// reconcileIPsInLocalServiceBackendPoolsAsync reconciles IPs in the backend pools of a local service. +func (az *Cloud) reconcileIPsInLocalServiceBackendPoolsAsync( + lbName, serviceName string, + currentIPsInBackendPools map[string][]string, + expectedIPs []string, +) { + for bpName, currentIPs := range currentIPsInBackendPools { + ipsToBeDeleted := compareNodeIPs(currentIPs, expectedIPs) + if len(ipsToBeDeleted) == 0 && len(currentIPs) == len(expectedIPs) { + klog.V(4).Infof("No IP change detected for service %s, skip updating load balancer backend pool", serviceName) + return + } + if len(ipsToBeDeleted) > 0 { + az.backendPoolUpdater.addOperation(getRemoveIPsFromBackendPoolOperation(serviceName, lbName, bpName, ipsToBeDeleted)) + } + if len(expectedIPs) > 0 { + az.backendPoolUpdater.addOperation(getAddIPsToBackendPoolOperation(serviceName, lbName, bpName, expectedIPs)) + } + } +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_managedDiskController.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_managedDiskController.go index a0b8af849..206be6034 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_managedDiskController.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_managedDiskController.go @@ -29,6 +29,7 @@ import ( v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" kwait "k8s.io/apimachinery/pkg/util/wait" + cloudprovider "k8s.io/cloud-provider" cloudvolume "k8s.io/cloud-provider/volume" volumehelpers "k8s.io/cloud-provider/volume/helpers" "k8s.io/klog/v2" @@ -37,9 +38,11 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/consts" ) +var _ cloudprovider.PVLabeler = (*Cloud)(nil) + // ManagedDiskController : managed disk controller struct type ManagedDiskController struct { - common *controllerCommon + *controllerCommon } // ManagedDiskOptions specifies the options of managed disks. @@ -99,7 +102,7 @@ func (c *ManagedDiskController) CreateManagedDisk(ctx context.Context, options * var createZones []string if len(options.AvailabilityZone) > 0 { - requestedZone := c.common.cloud.GetZoneID(options.AvailabilityZone) + requestedZone := c.cloud.GetZoneID(options.AvailabilityZone) if requestedZone != "" { createZones = append(createZones, requestedZone) } @@ -121,14 +124,14 @@ func (c *ManagedDiskController) CreateManagedDisk(ctx context.Context, options * diskSizeGB := int32(options.SizeGB) diskSku := options.StorageAccountType - rg := c.common.cloud.ResourceGroup + rg := c.cloud.ResourceGroup if options.ResourceGroup != "" { rg = options.ResourceGroup } - if options.SubscriptionID != "" && !strings.EqualFold(options.SubscriptionID, c.common.cloud.SubscriptionID) && options.ResourceGroup == "" { + if options.SubscriptionID != "" && !strings.EqualFold(options.SubscriptionID, c.cloud.SubscriptionID) && options.ResourceGroup == "" { return "", fmt.Errorf("resourceGroup must be specified when subscriptionID(%s) is not empty", options.SubscriptionID) } - subsID := c.common.cloud.SubscriptionID + subsID := c.cloud.SubscriptionID if options.SubscriptionID != "" { subsID = options.SubscriptionID } @@ -229,7 +232,7 @@ func (c *ManagedDiskController) CreateManagedDisk(ctx context.Context, options * diskProperties.MaxShares = &options.MaxShares } - location := c.common.cloud.Location + location := c.cloud.Location if options.Location != "" { location = options.Location } @@ -242,10 +245,10 @@ func (c *ManagedDiskController) CreateManagedDisk(ctx context.Context, options * DiskProperties: &diskProperties, } - if c.common.cloud.HasExtendedLocation() { + if c.cloud.HasExtendedLocation() { model.ExtendedLocation = &compute.ExtendedLocation{ - Name: pointer.String(c.common.cloud.ExtendedLocationName), - Type: compute.ExtendedLocationTypes(c.common.cloud.ExtendedLocationType), + Name: pointer.String(c.cloud.ExtendedLocationName), + Type: compute.ExtendedLocationTypes(c.cloud.ExtendedLocationType), } } @@ -253,7 +256,7 @@ func (c *ManagedDiskController) CreateManagedDisk(ctx context.Context, options * model.Zones = &createZones } - if rerr := c.common.cloud.DisksClient.CreateOrUpdate(ctx, subsID, rg, options.DiskName, model); rerr != nil { + if rerr := c.cloud.DisksClient.CreateOrUpdate(ctx, subsID, rg, options.DiskName, model); rerr != nil { return "", rerr.Error() } @@ -296,12 +299,12 @@ func (c *ManagedDiskController) DeleteManagedDisk(ctx context.Context, diskURI s return err } - if state, ok := c.common.diskStateMap.Load(strings.ToLower(diskURI)); ok { + if state, ok := c.diskStateMap.Load(strings.ToLower(diskURI)); ok { return fmt.Errorf("failed to delete disk(%s) since it's in %s state", diskURI, state.(string)) } diskName := path.Base(diskURI) - disk, rerr := c.common.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName) + disk, rerr := c.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName) if rerr != nil { if rerr.HTTPStatusCode == http.StatusNotFound { klog.V(2).Infof("azureDisk - disk(%s) is already deleted", diskURI) @@ -316,7 +319,7 @@ func (c *ManagedDiskController) DeleteManagedDisk(ctx context.Context, diskURI s return fmt.Errorf("disk(%s) already attached to node(%s), could not be deleted", diskURI, *disk.ManagedBy) } - if rerr := c.common.cloud.DisksClient.Delete(ctx, subsID, resourceGroup, diskName); rerr != nil { + if rerr := c.cloud.DisksClient.Delete(ctx, subsID, resourceGroup, diskName); rerr != nil { return rerr.Error() } // We don't need poll here, k8s will immediately stop referencing the disk @@ -329,7 +332,7 @@ func (c *ManagedDiskController) DeleteManagedDisk(ctx context.Context, diskURI s // GetDisk return: disk provisionState, diskID, error func (c *ManagedDiskController) GetDisk(ctx context.Context, subsID, resourceGroup, diskName string) (string, string, error) { - result, rerr := c.common.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName) + result, rerr := c.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName) if rerr != nil { return "", "", rerr.Error() } @@ -348,7 +351,7 @@ func (c *ManagedDiskController) ResizeDisk(ctx context.Context, diskURI string, return oldSize, err } - result, rerr := c.common.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName) + result, rerr := c.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName) if rerr != nil { return oldSize, rerr.Error() } @@ -381,7 +384,7 @@ func (c *ManagedDiskController) ResizeDisk(ctx context.Context, diskURI string, }, } - if rerr := c.common.cloud.DisksClient.Update(ctx, subsID, resourceGroup, diskName, diskParameter); rerr != nil { + if rerr := c.cloud.DisksClient.Update(ctx, subsID, resourceGroup, diskName, diskParameter); rerr != nil { return oldSize, rerr.Error() } @@ -400,6 +403,7 @@ func getInfoFromDiskURI(diskURI string) (string, string, error) { return fields[4], fields[2], nil } +// PVLabeler is an abstract, pluggable interface for fetching labels for volumes // GetLabelsForVolume implements PVLabeler.GetLabelsForVolume func (c *Cloud) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error) { // Ignore if not AzureDisk. diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_mock_loadbalancer_backendpool.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_mock_loadbalancer_backendpool.go index 9d1911995..1c81fb761 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_mock_loadbalancer_backendpool.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_mock_loadbalancer_backendpool.go @@ -92,12 +92,12 @@ func (mr *MockBackendPoolMockRecorder) GetBackendPrivateIPs(clusterName, service } // ReconcileBackendPools mocks base method. -func (m *MockBackendPool) ReconcileBackendPools(clusterName string, service *v1.Service, lb *network.LoadBalancer) (bool, bool, bool, error) { +func (m *MockBackendPool) ReconcileBackendPools(clusterName string, service *v1.Service, lb *network.LoadBalancer) (bool, bool, *network.LoadBalancer, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ReconcileBackendPools", clusterName, service, lb) ret0, _ := ret[0].(bool) ret1, _ := ret[1].(bool) - ret2, _ := ret[2].(bool) + ret2, _ := ret[2].(*network.LoadBalancer) ret3, _ := ret[3].(error) return ret0, ret1, ret2, ret3 } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice.go index 1739b9b1c..80f28045b 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice.go @@ -86,7 +86,7 @@ func (az *Cloud) reconcilePrivateLinkService( } // Secondly, check if there is a private link service already created - existingPLS, err := az.getPrivateLinkService(fipConfigID, azcache.CacheReadTypeDefault) + existingPLS, err := az.getPrivateLinkService(az.getPLSResourceGroup(service), fipConfigID, azcache.CacheReadTypeDefault) if err != nil { klog.Errorf("reconcilePrivateLinkService for service(%s): getPrivateLinkService(%s) failed: %v", serviceName, pointer.StringDeref(fipConfigID, ""), err) return err @@ -153,14 +153,14 @@ func (az *Cloud) reconcilePrivateLinkService( return err } existingPLS.Etag = pointer.String("") - err = az.CreateOrUpdatePLS(service, existingPLS) + err = az.CreateOrUpdatePLS(service, az.getPLSResourceGroup(service), existingPLS) if err != nil { klog.Errorf("reconcilePrivateLinkService for service(%s) abort backoff: pls(%s) - updating: %s", serviceName, plsName, err.Error()) return err } } } else if !wantPLS { - existingPLS, err := az.getPrivateLinkService(fipConfigID, azcache.CacheReadTypeDefault) + existingPLS, err := az.getPrivateLinkService(az.getPLSResourceGroup(service), fipConfigID, azcache.CacheReadTypeDefault) if err != nil { klog.Errorf("reconcilePrivateLinkService for service(%s): getPrivateLinkService(%s) failed: %v", serviceName, pointer.StringDeref(fipConfigID, ""), err) return err @@ -181,6 +181,17 @@ func (az *Cloud) reconcilePrivateLinkService( return nil } +func (az *Cloud) getPLSResourceGroup(service *v1.Service) string { + if resourceGroup, found := service.Annotations[consts.ServiceAnnotationPLSResourceGroup]; found { + resourceGroupName := strings.TrimSpace(resourceGroup) + if len(resourceGroupName) > 0 { + return resourceGroupName + } + } + + return az.PrivateLinkServiceResourceGroup +} + func (az *Cloud) disablePLSNetworkPolicy(service *v1.Service) error { serviceName := getServiceName(service) subnetName := getPLSSubnetName(service) @@ -218,14 +229,14 @@ func (az *Cloud) safeDeletePLS(pls *network.PrivateLinkService, service *v1.Serv if peConns != nil { for _, peConn := range *peConns { klog.V(2).Infof("deletePLS: deleting PEConnection %s", pointer.StringDeref(peConn.Name, "")) - rerr := az.DeletePEConn(service, pointer.StringDeref(pls.Name, ""), pointer.StringDeref(peConn.Name, "")) + rerr := az.DeletePEConn(service, az.getPLSResourceGroup(service), pointer.StringDeref(pls.Name, ""), pointer.StringDeref(peConn.Name, "")) if rerr != nil { return rerr } } } - rerr := az.DeletePLS(service, pointer.StringDeref(pls.Name, ""), pointer.StringDeref((*pls.LoadBalancerFrontendIPConfigurations)[0].ID, "")) + rerr := az.DeletePLS(service, az.getPLSResourceGroup(service), pointer.StringDeref(pls.Name, ""), pointer.StringDeref((*pls.LoadBalancerFrontendIPConfigurations)[0].ID, "")) if rerr != nil { return rerr } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice_repo.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice_repo.go index ae43681f0..8dfe0cb8c 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice_repo.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice_repo.go @@ -18,6 +18,7 @@ package provider import ( "encoding/json" + "fmt" "net/http" "strings" "time" @@ -32,14 +33,14 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/retry" ) -func (az *Cloud) CreateOrUpdatePLS(service *v1.Service, pls network.PrivateLinkService) error { +func (az *Cloud) CreateOrUpdatePLS(service *v1.Service, resourceGroup string, pls network.PrivateLinkService) error { ctx, cancel := getContextWithCancel() defer cancel() - rerr := az.PrivateLinkServiceClient.CreateOrUpdate(ctx, az.PrivateLinkServiceResourceGroup, pointer.StringDeref(pls.Name, ""), pls, pointer.StringDeref(pls.Etag, "")) + rerr := az.PrivateLinkServiceClient.CreateOrUpdate(ctx, resourceGroup, pointer.StringDeref(pls.Name, ""), pls, pointer.StringDeref(pls.Etag, "")) if rerr == nil { // Invalidate the cache right after updating - _ = az.plsCache.Delete(pointer.StringDeref((*pls.LoadBalancerFrontendIPConfigurations)[0].ID, "")) + _ = az.plsCache.Delete(getPLSCacheKey(resourceGroup, pointer.StringDeref((*pls.LoadBalancerFrontendIPConfigurations)[0].ID, ""))) return nil } @@ -49,26 +50,26 @@ func (az *Cloud) CreateOrUpdatePLS(service *v1.Service, pls network.PrivateLinkS // Invalidate the cache because etag mismatch. if rerr.HTTPStatusCode == http.StatusPreconditionFailed { klog.V(3).Infof("Private link service cache for %s is cleanup because of http.StatusPreconditionFailed", pointer.StringDeref(pls.Name, "")) - _ = az.plsCache.Delete(pointer.StringDeref((*pls.LoadBalancerFrontendIPConfigurations)[0].ID, "")) + _ = az.plsCache.Delete(getPLSCacheKey(resourceGroup, pointer.StringDeref((*pls.LoadBalancerFrontendIPConfigurations)[0].ID, ""))) } // Invalidate the cache because another new operation has canceled the current request. if strings.Contains(strings.ToLower(rerr.Error().Error()), consts.OperationCanceledErrorMessage) { klog.V(3).Infof("Private link service for %s is cleanup because CreateOrUpdatePrivateLinkService is canceled by another operation", pointer.StringDeref(pls.Name, "")) - _ = az.plsCache.Delete(pointer.StringDeref((*pls.LoadBalancerFrontendIPConfigurations)[0].ID, "")) + _ = az.plsCache.Delete(getPLSCacheKey(resourceGroup, pointer.StringDeref((*pls.LoadBalancerFrontendIPConfigurations)[0].ID, ""))) } klog.Errorf("PrivateLinkServiceClient.CreateOrUpdate(%s) failed: %v", pointer.StringDeref(pls.Name, ""), rerr.Error()) return rerr.Error() } // DeletePLS invokes az.PrivateLinkServiceClient.Delete with exponential backoff retry -func (az *Cloud) DeletePLS(service *v1.Service, plsName string, plsLBFrontendID string) *retry.Error { +func (az *Cloud) DeletePLS(service *v1.Service, resourceGroup, plsName, plsLBFrontendID string) *retry.Error { ctx, cancel := getContextWithCancel() defer cancel() - rerr := az.PrivateLinkServiceClient.Delete(ctx, az.PrivateLinkServiceResourceGroup, plsName) + rerr := az.PrivateLinkServiceClient.Delete(ctx, resourceGroup, plsName) if rerr == nil { // Invalidate the cache right after deleting - _ = az.plsCache.Delete(plsLBFrontendID) + _ = az.plsCache.Delete(getPLSCacheKey(resourceGroup, plsLBFrontendID)) return nil } @@ -78,11 +79,11 @@ func (az *Cloud) DeletePLS(service *v1.Service, plsName string, plsLBFrontendID } // DeletePEConn invokes az.PrivateLinkServiceClient.DeletePEConnection with exponential backoff retry -func (az *Cloud) DeletePEConn(service *v1.Service, plsName string, peConnName string) *retry.Error { +func (az *Cloud) DeletePEConn(service *v1.Service, resourceGroup, plsName, peConnName string) *retry.Error { ctx, cancel := getContextWithCancel() defer cancel() - rerr := az.PrivateLinkServiceClient.DeletePEConnection(ctx, az.PrivateLinkServiceResourceGroup, plsName, peConnName) + rerr := az.PrivateLinkServiceClient.DeletePEConnection(ctx, resourceGroup, plsName, peConnName) if rerr == nil { return nil } @@ -97,7 +98,8 @@ func (az *Cloud) newPLSCache() (azcache.Resource, error) { getter := func(key string) (interface{}, error) { ctx, cancel := getContextWithCancel() defer cancel() - plsList, err := az.PrivateLinkServiceClient.List(ctx, az.PrivateLinkServiceResourceGroup) + resourceGroup, frontendID := parsePLSCacheKey(key) + plsList, err := az.PrivateLinkServiceClient.List(ctx, resourceGroup) exists, rerr := checkResourceExistsFromError(err) if rerr != nil { return nil, rerr.Error() @@ -114,7 +116,7 @@ func (az *Cloud) newPLSCache() (azcache.Resource, error) { continue } for _, fipConfig := range *fipConfigs { - if strings.EqualFold(*fipConfig.ID, key) { + if strings.EqualFold(*fipConfig.ID, frontendID) { return &pls, nil } } @@ -122,7 +124,7 @@ func (az *Cloud) newPLSCache() (azcache.Resource, error) { } } - klog.V(2).Infof("No privateLinkService found for frontendIPConfig %q", key) + klog.V(2).Infof("No privateLinkService found for frontendIPConfig %q in rg %q", frontendID, resourceGroup) plsNotExistID := consts.PrivateLinkServiceNotExistID return &network.PrivateLinkService{ID: &plsNotExistID}, nil } @@ -133,10 +135,19 @@ func (az *Cloud) newPLSCache() (azcache.Resource, error) { return azcache.NewTimedCache(time.Duration(az.PlsCacheTTLInSeconds)*time.Second, getter, az.Config.DisableAPICallCache) } -func (az *Cloud) getPrivateLinkService(frontendIPConfigID *string, crt azcache.AzureCacheReadType) (pls network.PrivateLinkService, err error) { - cachedPLS, err := az.plsCache.GetWithDeepCopy(*frontendIPConfigID, crt) +func (az *Cloud) getPrivateLinkService(resourceGroup string, frontendIPConfigID *string, crt azcache.AzureCacheReadType) (pls network.PrivateLinkService, err error) { + cachedPLS, err := az.plsCache.GetWithDeepCopy(getPLSCacheKey(resourceGroup, *frontendIPConfigID), crt) if err != nil { return pls, err } return *(cachedPLS.(*network.PrivateLinkService)), nil } + +func getPLSCacheKey(resourceGroup, plsLBFrontendID string) string { + return fmt.Sprintf("%s*%s", resourceGroup, plsLBFrontendID) +} + +func parsePLSCacheKey(key string) (string, string) { + splits := strings.Split(key, "*") + return splits[0], splits[1] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_publicip_repo.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_publicip_repo.go index 2ace3b992..bb24e1321 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_publicip_repo.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_publicip_repo.go @@ -104,7 +104,7 @@ func (az *Cloud) newPIPCache() (azcache.Resource, error) { pipMap := &sync.Map{} for _, pip := range pipList { pip := pip - pipMap.Store(pointer.StringDeref(pip.Name, ""), &pip) + pipMap.Store(strings.ToLower(pointer.StringDeref(pip.Name, "")), &pip) } return pipMap, nil } @@ -122,7 +122,7 @@ func (az *Cloud) getPublicIPAddress(pipResourceGroup string, pipName string, crt } pips := cached.(*sync.Map) - pip, ok := pips.Load(pipName) + pip, ok := pips.Load(strings.ToLower(pipName)) if !ok { // pip not found, refresh cache and retry cached, err = az.pipCache.Get(pipResourceGroup, azcache.CacheReadTypeForceRefresh) @@ -130,7 +130,7 @@ func (az *Cloud) getPublicIPAddress(pipResourceGroup string, pipName string, crt return network.PublicIPAddress{}, false, err } pips = cached.(*sync.Map) - pip, ok = pips.Load(pipName) + pip, ok = pips.Load(strings.ToLower(pipName)) if !ok { return network.PublicIPAddress{}, false, nil } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routes.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routes.go index 4379531bf..6d269394a 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routes.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routes.go @@ -37,6 +37,8 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/metrics" ) +var _ cloudprovider.Routes = (*Cloud)(nil) + // routeOperation defines the allowed operations for route updating. type routeOperation string @@ -275,6 +277,7 @@ func (d *delayedRouteUpdater) addOperation(operation batchOperation) batchOperat func (d *delayedRouteUpdater) removeOperation(name string) {} // ListRoutes lists all managed routes that belong to the specified clusterName +// implements cloudprovider.Routes.ListRoutes func (az *Cloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error) { klog.V(10).Infof("ListRoutes: START clusterName=%q", clusterName) routeTable, existsRouteTable, err := az.getRouteTable(azcache.CacheReadTypeDefault) @@ -367,6 +370,7 @@ func (az *Cloud) createRouteTable() error { // CreateRoute creates the described managed route // route.Name will be ignored, although the cloud-provider may use nameHint // to create a more user-meaningful name. +// implements cloudprovider.Routes.CreateRoute func (az *Cloud) CreateRoute(ctx context.Context, clusterName string, nameHint string, kubeRoute *cloudprovider.Route) error { mc := metrics.NewMetricContext("routes", "create_route", az.ResourceGroup, az.getNetworkResourceSubscriptionID(), string(kubeRoute.TargetNode)) isOperationSucceeded := false @@ -442,6 +446,7 @@ func (az *Cloud) CreateRoute(ctx context.Context, clusterName string, nameHint s // DeleteRoute deletes the specified managed route // Route should be as returned by ListRoutes +// implements cloudprovider.Routes.DeleteRoute func (az *Cloud) DeleteRoute(ctx context.Context, clusterName string, kubeRoute *cloudprovider.Route) error { mc := metrics.NewMetricContext("routes", "delete_route", az.ResourceGroup, az.getNetworkResourceSubscriptionID(), string(kubeRoute.TargetNode)) isOperationSucceeded := false @@ -549,6 +554,10 @@ func cidrtoRfc1035(cidr string) string { // ensureRouteTableTagged ensures the route table is tagged as configured func (az *Cloud) ensureRouteTableTagged(rt *network.RouteTable) (map[string]*string, bool) { + if !strings.EqualFold(az.RouteTableResourceGroup, az.ResourceGroup) { + return nil, false + } + if az.Tags == "" && (az.TagsMap == nil || len(az.TagsMap) == 0) { return nil, false } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_standard.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_standard.go index 1040317be..5bc0b27ee 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_standard.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_standard.go @@ -54,14 +54,6 @@ var ( vmasIDRE = regexp.MustCompile(`/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Compute/availabilitySets/(.+)`) ) -const ( - v6Suffix = "IPv6" -) - -var ( - v6SuffixLower = strings.ToLower(v6Suffix) -) - // returns the full identifier of an availabilitySet func (az *Cloud) getAvailabilitySetID(resourceGroup, availabilitySetName string) string { return fmt.Sprintf( @@ -270,7 +262,7 @@ func isInternalLoadBalancer(lb *network.LoadBalancer) bool { // clusters moving from IPv6 to dualstack will require no changes as the IPv4 backend pool will created with func getBackendPoolName(clusterName string, isIPv6 bool) string { if isIPv6 { - return fmt.Sprintf("%s-%s", clusterName, v6Suffix) + return fmt.Sprintf("%s-%s", clusterName, consts.IPVersionIPv6String) } return clusterName @@ -290,7 +282,7 @@ func isBackendPoolIPv6(name string) bool { } func managedResourceHasIPv6Suffix(name string) bool { - return strings.HasSuffix(strings.ToLower(name), fmt.Sprintf("-%s", v6SuffixLower)) + return strings.HasSuffix(strings.ToLower(name), fmt.Sprintf("-%s", consts.IPVersionIPv6StringLower)) } func (az *Cloud) getLoadBalancerRuleName(service *v1.Service, protocol v1.Protocol, port int32, isIPv6 bool) string { @@ -353,12 +345,6 @@ func (az *Cloud) getPublicIPName(clusterName string, service *v1.Service, isIPv6 return getResourceByIPFamily(pipName, isDualStack, isIPv6), nil } -// TODO: UT -func (az *Cloud) serviceOwnsRule(service *v1.Service, rule string) bool { - prefix := az.getRulePrefix(service) - return strings.HasPrefix(strings.ToUpper(rule), strings.ToUpper(prefix)) -} - func publicIPOwnsFrontendIP(service *v1.Service, fip *network.FrontendIPConfiguration, pip *network.PublicIPAddress) bool { if pip != nil && pip.ID != nil && @@ -523,8 +509,8 @@ func (as *availabilitySet) GetPowerStatusByNodeName(name string) (powerState str } // vm.InstanceView or vm.InstanceView.Statuses are nil when the VM is under deleting. - klog.V(3).Infof("InstanceView for node %q is nil, assuming it's stopped", name) - return vmPowerStateStopped, nil + klog.V(3).Infof("InstanceView for node %q is nil, assuming it's deleting", name) + return vmPowerStateUnknown, nil } // GetProvisioningStateByNodeName returns the provisioningState for the specified node. diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_storageaccount.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_storageaccount.go index 7e50bb2dd..127c1b07c 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_storageaccount.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_storageaccount.go @@ -625,11 +625,16 @@ func (az *Cloud) getStorageAccountWithCache(ctx context.Context, subsID, resourc // AddStorageAccountTags add tags to storage account func (az *Cloud) AddStorageAccountTags(ctx context.Context, subsID, resourceGroup, account string, tags map[string]*string) *retry.Error { + // add lock to avoid concurrent update on the cache + az.lockMap.LockEntry(account) + defer az.lockMap.UnlockEntry(account) + result, rerr := az.getStorageAccountWithCache(ctx, subsID, resourceGroup, account) if rerr != nil { return rerr } + originalLen := len(result.Tags) newTags := result.Tags if newTags == nil { newTags = make(map[string]*string) @@ -640,10 +645,11 @@ func (az *Cloud) AddStorageAccountTags(ctx context.Context, subsID, resourceGrou newTags[k] = v } - if len(newTags) > len(result.Tags) { + if len(newTags) > originalLen { // only update when newTags is different from old tags _ = az.storageAccountCache.Delete(account) // clean cache updateParams := storage.AccountUpdateParameters{Tags: newTags} + klog.V(2).Infof("update storage account(%s) with tags(%+v)", account, newTags) return az.StorageAccountClient.Update(ctx, subsID, resourceGroup, account, updateParams) } return nil @@ -651,6 +657,10 @@ func (az *Cloud) AddStorageAccountTags(ctx context.Context, subsID, resourceGrou // RemoveStorageAccountTag remove tag from storage account func (az *Cloud) RemoveStorageAccountTag(ctx context.Context, subsID, resourceGroup, account, key string) *retry.Error { + // add lock to avoid concurrent update on the cache + az.lockMap.LockEntry(account) + defer az.lockMap.UnlockEntry(account) + result, rerr := az.getStorageAccountWithCache(ctx, subsID, resourceGroup, account) if rerr != nil { return rerr diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_utils.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_utils.go index e8724ef6a..9651be53b 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_utils.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_utils.go @@ -404,7 +404,7 @@ func setServiceLoadBalancerIP(service *v1.Service, ip string) { } parsedIP := net.ParseIP(ip) if parsedIP == nil { - klog.Warning("setServiceLoadBalancerIP: IP %q is not valid for Service", ip, service.Name) + klog.Warningf("setServiceLoadBalancerIP: IP %q is not valid for Service %q", ip, service.Name) return } @@ -453,7 +453,7 @@ func getServicePIPPrefixID(service *v1.Service, isIPv6 bool) string { // the old PIPs will be recreated. func getResourceByIPFamily(resource string, isDualStack, isIPv6 bool) string { if isDualStack && isIPv6 { - return fmt.Sprintf("%s-%s", resource, v6Suffix) + return fmt.Sprintf("%s-%s", resource, consts.IPVersionIPv6String) } return resource } @@ -604,3 +604,18 @@ func getServiceIPFamily(service *v1.Service) string { } return consts.IPVersionIPv4String } + +// getResourceGroupAndNameFromNICID parses the ip configuration ID to get the resource group and nic name. +func getResourceGroupAndNameFromNICID(ipConfigurationID string) (string, string, error) { + matches := nicIDRE.FindStringSubmatch(ipConfigurationID) + if len(matches) != 3 { + klog.V(4).Infof("Can not extract nic name from ipConfigurationID (%s)", ipConfigurationID) + return "", "", fmt.Errorf("invalid ip config ID %s", ipConfigurationID) + } + + nicResourceGroup, nicName := matches[1], matches[2] + if nicResourceGroup == "" || nicName == "" { + return "", "", fmt.Errorf("invalid ip config ID %s", ipConfigurationID) + } + return nicResourceGroup, nicName, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss.go index 24b29ac81..5ab2b996b 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss.go @@ -293,8 +293,8 @@ func (ss *ScaleSet) GetPowerStatusByNodeName(name string) (powerState string, er } // vm.InstanceView or vm.InstanceView.Statuses are nil when the VM is under deleting. - klog.V(3).Infof("InstanceView for node %q is nil, assuming it's stopped", name) - return vmPowerStateStopped, nil + klog.V(3).Infof("InstanceView for node %q is nil, assuming it's deleting", name) + return vmPowerStateUnknown, nil } // GetProvisioningStateByNodeName returns the provisioningState for the specified node. diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss_cache.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss_cache.go index 860fead7a..592e05d16 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss_cache.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss_cache.go @@ -288,7 +288,7 @@ func (ss *ScaleSet) DeleteCacheForNode(nodeName string) error { } func (ss *ScaleSet) updateCache(nodeName, resourceGroupName, vmssName, instanceID string, updatedVM *compute.VirtualMachineScaleSetVM) error { - if ss.common.DisableUpdateCache { + if ss.ManagedDiskController.DisableUpdateCache { return nil } // lock the VMSS entry to ensure a consistent view of the VM map when there are concurrent updates. @@ -467,6 +467,12 @@ func (ss *ScaleSet) getVMManagementTypeByProviderID(providerID string, crt azcac } +// getVMManagementTypeByIPConfigurationID determines the VM type by the following steps: +// 1. If the ipConfigurationID is in the format of vmssIPConfigurationRE, returns vmss uniform. +// 2. If the name of the VM can be obtained by trimming the `-nic` suffix from the nic name, and the VM name is in the +// VMAS cache, returns availability set. +// 3. If the VM name obtained from step 2 is not in the VMAS cache, try to get the VM name from NIC.VirtualMachine.ID. +// 4. If the VM name obtained from step 3 is in the VMAS cache, returns availability set. Or, returns vmss flex. func (ss *ScaleSet) getVMManagementTypeByIPConfigurationID(ipConfigurationID string, crt azcache.AzureCacheReadType) (VMManagementType, error) { if ss.DisableAvailabilitySetNodes && !ss.EnableVmssFlexNodes { return ManagedByVmssUniform, nil @@ -484,16 +490,11 @@ func (ss *ScaleSet) getVMManagementTypeByIPConfigurationID(ipConfigurationID str return ManagedByUnknownVMSet, err } - matches := nicIDRE.FindStringSubmatch(ipConfigurationID) - if len(matches) != 3 { + nicResourceGroup, nicName, err := getResourceGroupAndNameFromNICID(ipConfigurationID) + if err != nil { return ManagedByUnknownVMSet, fmt.Errorf("can not extract nic name from ipConfigurationID (%s)", ipConfigurationID) } - nicResourceGroup, nicName := matches[1], matches[2] - if nicResourceGroup == "" || nicName == "" { - return ManagedByUnknownVMSet, fmt.Errorf("invalid ip config ID %s", ipConfigurationID) - } - vmName := strings.Replace(nicName, "-nic", "", 1) cachedAvSetVMs := cached.(NonVmssUniformNodesEntry).AvSetVMNodeNames @@ -501,5 +502,35 @@ func (ss *ScaleSet) getVMManagementTypeByIPConfigurationID(ipConfigurationID str if cachedAvSetVMs.Has(vmName) { return ManagedByAvSet, nil } + + // Get the vmName by nic.VirtualMachine.ID if the vmName is not in the format + // of `vmName-nic`. This introduces an extra ARM call. + vmName, err = ss.GetVMNameByIPConfigurationName(nicResourceGroup, nicName) + if err != nil { + return ManagedByUnknownVMSet, fmt.Errorf("failed to get vm name by ip config ID %s: %w", ipConfigurationID, err) + } + if cachedAvSetVMs.Has(vmName) { + return ManagedByAvSet, nil + } + return ManagedByVmssFlex, nil } + +func (az *Cloud) GetVMNameByIPConfigurationName(nicResourceGroup, nicName string) (string, error) { + ctx, cancel := getContextWithCancel() + defer cancel() + nic, rerr := az.InterfacesClient.Get(ctx, nicResourceGroup, nicName, "") + if rerr != nil { + return "", fmt.Errorf("failed to get interface of name %s: %w", nicName, rerr.Error()) + } + if nic.InterfacePropertiesFormat == nil || nic.InterfacePropertiesFormat.VirtualMachine == nil || nic.InterfacePropertiesFormat.VirtualMachine.ID == nil { + return "", fmt.Errorf("failed to get vm ID of nic %s", pointer.StringDeref(nic.Name, "")) + } + vmID := pointer.StringDeref(nic.InterfacePropertiesFormat.VirtualMachine.ID, "") + matches := vmIDRE.FindStringSubmatch(vmID) + if len(matches) != 2 { + return "", fmt.Errorf("invalid virtual machine ID %s", vmID) + } + vmName := matches[1] + return vmName, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmssflex.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmssflex.go index 22889373b..42202a5af 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmssflex.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmssflex.go @@ -279,8 +279,8 @@ func (fs *FlexScaleSet) GetPowerStatusByNodeName(name string) (powerState string } // vm.InstanceView or vm.InstanceView.Statuses are nil when the VM is under deleting. - klog.V(3).Infof("InstanceView for node %q is nil, assuming it's stopped", name) - return vmPowerStateStopped, nil + klog.V(3).Infof("InstanceView for node %q is nil, assuming it's deleting", name) + return vmPowerStateUnknown, nil } // GetPrimaryInterface gets machine primary network interface by node name. @@ -384,33 +384,16 @@ func (fs *FlexScaleSet) GetNodeNameByIPConfigurationID(ipConfigurationID string) } func (fs *FlexScaleSet) getNodeInformationByIPConfigurationID(ipConfigurationID string) (string, string, string, error) { - matches := nicIDRE.FindStringSubmatch(ipConfigurationID) - if len(matches) != 3 { - klog.V(4).Infof("Can not extract nic name from ipConfigurationID (%s)", ipConfigurationID) - return "", "", "", fmt.Errorf("invalid ip config ID %s", ipConfigurationID) - } - - nicResourceGroup, nicName := matches[1], matches[2] - if nicResourceGroup == "" || nicName == "" { - return "", "", "", fmt.Errorf("invalid ip config ID %s", ipConfigurationID) + nicResourceGroup, nicName, err := getResourceGroupAndNameFromNICID(ipConfigurationID) + if err != nil { + return "", "", "", fmt.Errorf("failed to get resource group and name from ip config ID %s: %w", ipConfigurationID, err) } // get vmName by nic name - ctx, cancel := getContextWithCancel() - defer cancel() - nic, rerr := fs.InterfacesClient.Get(ctx, nicResourceGroup, nicName, "") - if rerr != nil { - return "", "", "", fmt.Errorf("getNodeInformationByIPConfigurationID(%s): failed to get interface of name %s: %w", ipConfigurationID, nicName, rerr.Error()) - } - if nic.InterfacePropertiesFormat == nil || nic.InterfacePropertiesFormat.VirtualMachine == nil || nic.InterfacePropertiesFormat.VirtualMachine.ID == nil { - return "", "", "", fmt.Errorf("failed to get vm ID of ip config ID %s", ipConfigurationID) - } - vmID := pointer.StringDeref(nic.InterfacePropertiesFormat.VirtualMachine.ID, "") - matches = vmIDRE.FindStringSubmatch(vmID) - if len(matches) != 2 { - return "", "", "", fmt.Errorf("invalid virtual machine ID %s", vmID) + vmName, err := fs.GetVMNameByIPConfigurationName(nicResourceGroup, nicName) + if err != nil { + return "", "", "", fmt.Errorf("failed to get vm name of ip config ID %s", ipConfigurationID) } - vmName := matches[1] nodeName, err := fs.getNodeNameByVMName(vmName) if err != nil { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_wrap.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_wrap.go index 1675aa12e..cb7dd54f9 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_wrap.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_wrap.go @@ -97,3 +97,7 @@ func ConvertResourceGroupNameToLower(resourceID string) (string, error) { resourceGroup := matches[1] return strings.Replace(resourceID, resourceGroup, strings.ToLower(resourceGroup), 1), nil } + +func (az *Cloud) useSharedLoadBalancerHealthProbeMode() bool { + return strings.EqualFold(az.ClusterServiceLoadBalancerHealthProbeMode, consts.ClusterServiceLoadBalancerHealthProbeModeShared) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_zones.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_zones.go index 7c922ac84..7260f850c 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_zones.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_zones.go @@ -34,6 +34,8 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/retry" ) +var _ cloudprovider.Zones = (*Cloud)(nil) + func (az *Cloud) refreshZones(ctx context.Context, refreshFunc func() error) { klog.V(2).Info("refreshZones: refreshing zones every 30 minutes.") err := wait.PollUntilContextCancel(ctx, consts.ZoneFetchingInterval, false, func(ctx context.Context) (bool, error) { @@ -139,6 +141,8 @@ func (az *Cloud) GetZoneID(zoneLabel string) string { } // GetZone returns the Zone containing the current availability zone and locality region that the program is running in. +// DEPRECATED: Zones is deprecated in favor of retrieving zone/region information from InstancesV2. +// This interface will not be called if InstancesV2 is enabled. // If the node is not running with availability zones, then it will fall back to fault domain. func (az *Cloud) GetZone(ctx context.Context) (cloudprovider.Zone, error) { if az.UseInstanceMetadata { @@ -181,6 +185,8 @@ func (az *Cloud) GetZone(ctx context.Context) (cloudprovider.Zone, error) { // GetZoneByProviderID implements Zones.GetZoneByProviderID // This is particularly useful in external cloud providers where the kubelet // does not initialize node data. +// DEPRECATED: Zones is deprecated in favor of retrieving zone/region information from InstancesV2. +// This interface will not be called if InstancesV2 is enabled. func (az *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error) { if providerID == "" { return cloudprovider.Zone{}, errNodeNotInitialized @@ -203,6 +209,8 @@ func (az *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cl // GetZoneByNodeName implements Zones.GetZoneByNodeName // This is particularly useful in external cloud providers where the kubelet // does not initialize node data. +// DEPRECATED: Zones is deprecated in favor of retrieving zone/region information from InstancesV2. +// This interface will not be called if InstancesV2 is enabled. func (az *Cloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error) { // Returns "" for unmanaged nodes because azure cloud provider couldn't fetch information for them. unmanaged, err := az.IsNodeUnmanaged(string(nodeName)) @@ -216,20 +224,3 @@ func (az *Cloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) return az.VMSet.GetZoneByNodeName(string(nodeName)) } - -// GetPlatformSubFaultDomain returns the PlatformSubFaultDomain from IMDS if set. -func (az *Cloud) GetPlatformSubFaultDomain() (string, error) { - if az.UseInstanceMetadata { - metadata, err := az.Metadata.GetMetadata(azcache.CacheReadTypeUnsafe) - if err != nil { - klog.Errorf("GetPlatformSubFaultDomain: failed to GetMetadata: %s", err.Error()) - return "", err - } - if metadata.Compute == nil { - _ = az.Metadata.imsCache.Delete(consts.MetadataCacheKey) - return "", errors.New("failure of getting compute information from instance metadata") - } - return metadata.Compute.PlatformSubFaultDomain, nil - } - return "", nil -} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer/accesscontrol.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer/accesscontrol.go new file mode 100644 index 000000000..c71758469 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer/accesscontrol.go @@ -0,0 +1,202 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package loadbalancer + +import ( + "fmt" + "net/netip" + "strings" + + v1 "k8s.io/api/core/v1" + + "sigs.k8s.io/cloud-provider-azure/pkg/consts" +) + +// IsInternal returns true if the given service is internal load balancer. +func IsInternal(svc *v1.Service) bool { + value, found := svc.Annotations[consts.ServiceAnnotationLoadBalancerInternal] + return found && strings.ToLower(value) == "true" +} + +// IsExternal returns true if the given service is external load balancer. +func IsExternal(svc *v1.Service) bool { + return !IsInternal(svc) +} + +// AllowedServiceTags returns the allowed service tags configured by user through AKS custom annotation. +func AllowedServiceTags(svc *v1.Service) ([]string, error) { + const Sep = "," + + value, found := svc.Annotations[consts.ServiceAnnotationAllowedServiceTags] + if !found { + return nil, nil + } + + return strings.Split(strings.TrimSpace(value), Sep), nil +} + +// AllowedIPRanges returns the allowed IP ranges configured by user through AKS custom annotation. +func AllowedIPRanges(svc *v1.Service) ([]netip.Prefix, error) { + const Sep = "," + + value, found := svc.Annotations[consts.ServiceAnnotationAllowedIPRanges] + if !found { + return nil, nil + } + + rv, err := ParseCIDRs(strings.Split(strings.TrimSpace(value), Sep)) + if err != nil { + return nil, fmt.Errorf("invalid service annotation %s:%s: %w", consts.ServiceAnnotationAllowedIPRanges, value, err) + } + + return rv, nil +} + +// SourceRanges returns the allowed IP ranges configured by user through `spec.LoadBalancerSourceRanges` and standard annotation. +// If `spec.LoadBalancerSourceRanges` is not set, it will try to parse the annotation. +func SourceRanges(svc *v1.Service) ([]netip.Prefix, error) { + if len(svc.Spec.LoadBalancerSourceRanges) > 0 { + rv, err := ParseCIDRs(svc.Spec.LoadBalancerSourceRanges) + if err != nil { + return nil, fmt.Errorf("invalid service.Spec.LoadBalancerSourceRanges [%v]: %w", svc.Spec.LoadBalancerSourceRanges, err) + } + return rv, nil + } + + const Sep = "," + value, found := svc.Annotations[v1.AnnotationLoadBalancerSourceRangesKey] + if !found { + return nil, nil + } + rv, err := ParseCIDRs(strings.Split(strings.TrimSpace(value), Sep)) + if err != nil { + return nil, fmt.Errorf("invalid service annotation %s:%s: %w", v1.AnnotationLoadBalancerSourceRangesKey, value, err) + } + return rv, nil +} + +type AccessControl struct { + svc *v1.Service + + // immutable redundant states. + sourceRanges []netip.Prefix + allowedIPRanges []netip.Prefix + allowedServiceTags []string +} + +func NewAccessControl(svc *v1.Service) (*AccessControl, error) { + sourceRanges, err := SourceRanges(svc) + if err != nil { + return nil, err + } + allowedIPRanges, err := AllowedIPRanges(svc) + if err != nil { + return nil, err + } + allowedServiceTags, err := AllowedServiceTags(svc) + if err != nil { + return nil, err + } + + return &AccessControl{ + svc: svc, + sourceRanges: sourceRanges, + allowedIPRanges: allowedIPRanges, + allowedServiceTags: allowedServiceTags, + }, nil +} + +// SourceRanges returns the allowed IP ranges configured by user through `spec.LoadBalancerSourceRanges` and standard annotation. +func (ac *AccessControl) SourceRanges() []netip.Prefix { + return ac.sourceRanges +} + +// AllowedIPRanges returns the allowed IP ranges configured by user through AKS custom annotation. +func (ac *AccessControl) AllowedIPRanges() []netip.Prefix { + return ac.allowedIPRanges +} + +// AllowedServiceTags returns the allowed service tags configured by user through AKS custom annotation. +func (ac *AccessControl) AllowedServiceTags() []string { + return ac.allowedServiceTags +} + +// IsAllowFromInternet returns true if the given service is allowed to be accessed from internet. +// To be specific, +// 1. For all types of LB, it returns false if the given service is specified with `service tags` or `not allowed all IP ranges`. +// 2. For internal LB, it returns true iff the given service is explicitly specified with `allowed all IP ranges`. Refer: https://github.com/kubernetes-sigs/cloud-provider-azure/issues/698 +func (ac *AccessControl) IsAllowFromInternet() bool { + if len(ac.allowedServiceTags) > 0 { + return false + } + if len(ac.sourceRanges) > 0 && !IsCIDRsAllowAll(ac.sourceRanges) { + return false + } + if len(ac.allowedIPRanges) > 0 && !IsCIDRsAllowAll(ac.allowedIPRanges) { + return false + } + if IsExternal(ac.svc) { + return true + } + // Internal LB with explicit allowedAll IP ranges is allowed to be accessed from internet. + return len(ac.allowedIPRanges) > 0 || len(ac.sourceRanges) > 0 +} + +// IPV4Sources returns the allowed sources for IPv4. +func (ac *AccessControl) IPV4Sources() []string { + var rv []string + + if ac.IsAllowFromInternet() { + rv = append(rv, "Internet") + } + for _, cidr := range ac.sourceRanges { + if cidr.Addr().Is4() { + rv = append(rv, cidr.String()) + } + } + for _, cidr := range ac.allowedIPRanges { + if cidr.Addr().Is4() { + rv = append(rv, cidr.String()) + } + } + rv = append(rv, ac.allowedServiceTags...) + + return rv +} + +// IPV6Sources returns the allowed sources for IPv6. +func (ac *AccessControl) IPV6Sources() []string { + var ( + rv []string + ) + if ac.IsAllowFromInternet() { + rv = append(rv, "Internet") + } + for _, cidr := range ac.sourceRanges { + if cidr.Addr().Is6() { + rv = append(rv, cidr.String()) + } + } + for _, cidr := range ac.allowedIPRanges { + if cidr.Addr().Is6() { + rv = append(rv, cidr.String()) + } + } + rv = append(rv, ac.allowedServiceTags...) + + return rv +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer/netip.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer/netip.go new file mode 100644 index 000000000..c7e4632b6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer/netip.go @@ -0,0 +1,50 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package loadbalancer + +import ( + "fmt" + "net/netip" +) + +const ( + IPv4AllowedAll = "0.0.0.0/0" + IPv6AllowedAll = "::/0" +) + +// IsCIDRsAllowAll return true if the given IP Ranges covers all IPs. +// It returns false if the given IP Ranges is empty. +func IsCIDRsAllowAll(cidrs []netip.Prefix) bool { + for _, cidr := range cidrs { + if cidr.String() == IPv4AllowedAll || cidr.String() == IPv6AllowedAll { + return true + } + } + return false +} + +func ParseCIDRs(parts []string) ([]netip.Prefix, error) { + var rv []netip.Prefix + for _, part := range parts { + prefix, err := netip.ParsePrefix(part) + if err != nil { + return nil, fmt.Errorf("invalid IP range %s: %w", part, err) + } + rv = append(rv, prefix) + } + return rv, nil +} diff --git a/vendor/sigs.k8s.io/yaml/LICENSE b/vendor/sigs.k8s.io/yaml/LICENSE index 7805d36de..093d6d3ed 100644 --- a/vendor/sigs.k8s.io/yaml/LICENSE +++ b/vendor/sigs.k8s.io/yaml/LICENSE @@ -48,3 +48,259 @@ 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. + +# The forked go-yaml.v3 library under this project is covered by two +different licenses (MIT and Apache): + +#### MIT License #### + +The following files were ported to Go from C files of libyaml, and thus +are still covered by their original MIT license, with the additional +copyright staring in 2011 when the project was ported over: + + apic.go emitterc.go parserc.go readerc.go scannerc.go + writerc.go yamlh.go yamlprivateh.go + +Copyright (c) 2006-2010 Kirill Simonov +Copyright (c) 2006-2011 Kirill Simonov + +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. + +### Apache License ### + +All the remaining project files are covered by the Apache license: + +Copyright (c) 2011-2019 Canonical Ltd + +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. + +# The forked go-yaml.v2 library under the project is covered by an +Apache license: + + 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/sigs.k8s.io/yaml/OWNERS b/vendor/sigs.k8s.io/yaml/OWNERS index 325b40b07..003a149e1 100644 --- a/vendor/sigs.k8s.io/yaml/OWNERS +++ b/vendor/sigs.k8s.io/yaml/OWNERS @@ -2,26 +2,22 @@ approvers: - dims -- lavalamp +- jpbetz - smarterclayton - deads2k - sttts - liggitt -- caesarxuchao reviewers: - dims - thockin -- lavalamp +- jpbetz - smarterclayton - wojtek-t - deads2k - derekwaynecarr -- caesarxuchao - mikedanese - liggitt -- gmarek - sttts -- ncdc - tallclair labels: - sig/api-machinery diff --git a/vendor/sigs.k8s.io/yaml/fields.go b/vendor/sigs.k8s.io/yaml/fields.go index 235b7f2cf..0ea28bd03 100644 --- a/vendor/sigs.k8s.io/yaml/fields.go +++ b/vendor/sigs.k8s.io/yaml/fields.go @@ -16,53 +16,53 @@ import ( "unicode/utf8" ) -// indirect walks down v allocating pointers as needed, +// indirect walks down 'value' allocating pointers as needed, // until it gets to a non-pointer. // if it encounters an Unmarshaler, indirect stops and returns that. // if decodingNull is true, indirect stops at the last pointer so it can be set to nil. -func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) { - // If v is a named type and is addressable, +func indirect(value reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) { + // If 'value' is a named type and is addressable, // start with its address, so that if the type has pointer methods, // we find them. - if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { - v = v.Addr() + if value.Kind() != reflect.Ptr && value.Type().Name() != "" && value.CanAddr() { + value = value.Addr() } for { // Load value from interface, but only if the result will be // usefully addressable. - if v.Kind() == reflect.Interface && !v.IsNil() { - e := v.Elem() - if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { - v = e + if value.Kind() == reflect.Interface && !value.IsNil() { + element := value.Elem() + if element.Kind() == reflect.Ptr && !element.IsNil() && (!decodingNull || element.Elem().Kind() == reflect.Ptr) { + value = element continue } } - if v.Kind() != reflect.Ptr { + if value.Kind() != reflect.Ptr { break } - if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { + if value.Elem().Kind() != reflect.Ptr && decodingNull && value.CanSet() { break } - if v.IsNil() { - if v.CanSet() { - v.Set(reflect.New(v.Type().Elem())) + if value.IsNil() { + if value.CanSet() { + value.Set(reflect.New(value.Type().Elem())) } else { - v = reflect.New(v.Type().Elem()) + value = reflect.New(value.Type().Elem()) } } - if v.Type().NumMethod() > 0 { - if u, ok := v.Interface().(json.Unmarshaler); ok { + if value.Type().NumMethod() > 0 { + if u, ok := value.Interface().(json.Unmarshaler); ok { return u, nil, reflect.Value{} } - if u, ok := v.Interface().(encoding.TextUnmarshaler); ok { + if u, ok := value.Interface().(encoding.TextUnmarshaler); ok { return nil, u, reflect.Value{} } } - v = v.Elem() + value = value.Elem() } - return nil, nil, v + return nil, nil, value } // A field represents a single field found in a struct. @@ -134,8 +134,8 @@ func typeFields(t reflect.Type) []field { next := []field{{typ: t}} // Count of queued names for current level and the next. - count := map[reflect.Type]int{} - nextCount := map[reflect.Type]int{} + var count map[reflect.Type]int + var nextCount map[reflect.Type]int // Types already visited at an earlier level. visited := map[reflect.Type]bool{} @@ -348,8 +348,9 @@ const ( // 4) simpleLetterEqualFold, no specials, no non-letters. // // The letters S and K are special because they map to 3 runes, not just 2: -// * S maps to s and to U+017F 'ſ' Latin small letter long s -// * k maps to K and to U+212A 'K' Kelvin sign +// - S maps to s and to U+017F 'ſ' Latin small letter long s +// - k maps to K and to U+212A 'K' Kelvin sign +// // See http://play.golang.org/p/tTxjOc0OGo // // The returned function is specialized for matching against s and @@ -420,10 +421,8 @@ func equalFoldRight(s, t []byte) bool { t = t[size:] } - if len(t) > 0 { - return false - } - return true + + return len(t) <= 0 } // asciiEqualFold is a specialization of bytes.EqualFold for use when diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE @@ -0,0 +1,201 @@ + 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/sigs.k8s.io/yaml/goyaml.v2/LICENSE.libyaml b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE.libyaml new file mode 100644 index 000000000..8da58fbf6 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE.libyaml @@ -0,0 +1,31 @@ +The following files were ported to Go from C files of libyaml, and thus +are still covered by their original copyright and license: + + apic.go + emitterc.go + parserc.go + readerc.go + scannerc.go + writerc.go + yamlh.go + yamlprivateh.go + +Copyright (c) 2006 Kirill Simonov + +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/sigs.k8s.io/yaml/goyaml.v2/NOTICE b/vendor/sigs.k8s.io/yaml/goyaml.v2/NOTICE new file mode 100644 index 000000000..866d74a7a --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/NOTICE @@ -0,0 +1,13 @@ +Copyright 2011-2016 Canonical Ltd. + +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/sigs.k8s.io/yaml/goyaml.v2/OWNERS b/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS new file mode 100644 index 000000000..73be0a3a9 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS @@ -0,0 +1,24 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: +- dims +- jpbetz +- smarterclayton +- deads2k +- sttts +- liggitt +- natasha41575 +- knverey +reviewers: +- dims +- thockin +- jpbetz +- smarterclayton +- deads2k +- derekwaynecarr +- mikedanese +- liggitt +- sttts +- tallclair +labels: +- sig/api-machinery diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md b/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md new file mode 100644 index 000000000..53f4139dc --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md @@ -0,0 +1,143 @@ +# go-yaml fork + +This package is a fork of the go-yaml library and is intended solely for consumption +by kubernetes projects. In this fork, we plan to support only critical changes required for +kubernetes, such as small bug fixes and regressions. Larger, general-purpose feature requests +should be made in the upstream go-yaml library, and we will reject such changes in this fork +unless we are pulling them from upstream. + +This fork is based on v2.4.0: https://github.com/go-yaml/yaml/releases/tag/v2.4.0 + +# YAML support for the Go language + +Introduction +------------ + +The yaml package enables Go programs to comfortably encode and decode YAML +values. It was developed within [Canonical](https://www.canonical.com) as +part of the [juju](https://juju.ubuntu.com) project, and is based on a +pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) +C library to parse and generate YAML data quickly and reliably. + +Compatibility +------------- + +The yaml package supports most of YAML 1.1 and 1.2, including support for +anchors, tags, map merging, etc. Multi-document unmarshalling is not yet +implemented, and base-60 floats from YAML 1.1 are purposefully not +supported since they're a poor design and are gone in YAML 1.2. + +Installation and usage +---------------------- + +The import path for the package is *gopkg.in/yaml.v2*. + +To install it, run: + + go get gopkg.in/yaml.v2 + +API documentation +----------------- + +If opened in a browser, the import path itself leads to the API documentation: + + * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) + +API stability +------------- + +The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in). + + +License +------- + +The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details. + + +Example +------- + +```Go +package main + +import ( + "fmt" + "log" + + "gopkg.in/yaml.v2" +) + +var data = ` +a: Easy! +b: + c: 2 + d: [3, 4] +` + +// Note: struct fields must be public in order for unmarshal to +// correctly populate the data. +type T struct { + A string + B struct { + RenamedC int `yaml:"c"` + D []int `yaml:",flow"` + } +} + +func main() { + t := T{} + + err := yaml.Unmarshal([]byte(data), &t) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- t:\n%v\n\n", t) + + d, err := yaml.Marshal(&t) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- t dump:\n%s\n\n", string(d)) + + m := make(map[interface{}]interface{}) + + err = yaml.Unmarshal([]byte(data), &m) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- m:\n%v\n\n", m) + + d, err = yaml.Marshal(&m) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- m dump:\n%s\n\n", string(d)) +} +``` + +This example will generate the following output: + +``` +--- t: +{Easy! {2 [3 4]}} + +--- t dump: +a: Easy! +b: + c: 2 + d: [3, 4] + + +--- m: +map[a:Easy! b:map[c:2 d:[3 4]]] + +--- m dump: +a: Easy! +b: + c: 2 + d: + - 3 + - 4 +``` + diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go new file mode 100644 index 000000000..acf71402c --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go @@ -0,0 +1,744 @@ +package yaml + +import ( + "io" +) + +func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { + //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens)) + + // Check if we can move the queue at the beginning of the buffer. + if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) { + if parser.tokens_head != len(parser.tokens) { + copy(parser.tokens, parser.tokens[parser.tokens_head:]) + } + parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head] + parser.tokens_head = 0 + } + parser.tokens = append(parser.tokens, *token) + if pos < 0 { + return + } + copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:]) + parser.tokens[parser.tokens_head+pos] = *token +} + +// Create a new parser object. +func yaml_parser_initialize(parser *yaml_parser_t) bool { + *parser = yaml_parser_t{ + raw_buffer: make([]byte, 0, input_raw_buffer_size), + buffer: make([]byte, 0, input_buffer_size), + } + return true +} + +// Destroy a parser object. +func yaml_parser_delete(parser *yaml_parser_t) { + *parser = yaml_parser_t{} +} + +// String read handler. +func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { + if parser.input_pos == len(parser.input) { + return 0, io.EOF + } + n = copy(buffer, parser.input[parser.input_pos:]) + parser.input_pos += n + return n, nil +} + +// Reader read handler. +func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { + return parser.input_reader.Read(buffer) +} + +// Set a string input. +func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { + if parser.read_handler != nil { + panic("must set the input source only once") + } + parser.read_handler = yaml_string_read_handler + parser.input = input + parser.input_pos = 0 +} + +// Set a file input. +func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) { + if parser.read_handler != nil { + panic("must set the input source only once") + } + parser.read_handler = yaml_reader_read_handler + parser.input_reader = r +} + +// Set the source encoding. +func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { + if parser.encoding != yaml_ANY_ENCODING { + panic("must set the encoding only once") + } + parser.encoding = encoding +} + +var disableLineWrapping = false + +// Create a new emitter object. +func yaml_emitter_initialize(emitter *yaml_emitter_t) { + *emitter = yaml_emitter_t{ + buffer: make([]byte, output_buffer_size), + raw_buffer: make([]byte, 0, output_raw_buffer_size), + states: make([]yaml_emitter_state_t, 0, initial_stack_size), + events: make([]yaml_event_t, 0, initial_queue_size), + } + if disableLineWrapping { + emitter.best_width = -1 + } +} + +// Destroy an emitter object. +func yaml_emitter_delete(emitter *yaml_emitter_t) { + *emitter = yaml_emitter_t{} +} + +// String write handler. +func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + *emitter.output_buffer = append(*emitter.output_buffer, buffer...) + return nil +} + +// yaml_writer_write_handler uses emitter.output_writer to write the +// emitted text. +func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + _, err := emitter.output_writer.Write(buffer) + return err +} + +// Set a string output. +func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) { + if emitter.write_handler != nil { + panic("must set the output target only once") + } + emitter.write_handler = yaml_string_write_handler + emitter.output_buffer = output_buffer +} + +// Set a file output. +func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) { + if emitter.write_handler != nil { + panic("must set the output target only once") + } + emitter.write_handler = yaml_writer_write_handler + emitter.output_writer = w +} + +// Set the output encoding. +func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) { + if emitter.encoding != yaml_ANY_ENCODING { + panic("must set the output encoding only once") + } + emitter.encoding = encoding +} + +// Set the canonical output style. +func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { + emitter.canonical = canonical +} + +//// Set the indentation increment. +func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { + if indent < 2 || indent > 9 { + indent = 2 + } + emitter.best_indent = indent +} + +// Set the preferred line width. +func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) { + if width < 0 { + width = -1 + } + emitter.best_width = width +} + +// Set if unescaped non-ASCII characters are allowed. +func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) { + emitter.unicode = unicode +} + +// Set the preferred line break character. +func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { + emitter.line_break = line_break +} + +///* +// * Destroy a token object. +// */ +// +//YAML_DECLARE(void) +//yaml_token_delete(yaml_token_t *token) +//{ +// assert(token); // Non-NULL token object expected. +// +// switch (token.type) +// { +// case YAML_TAG_DIRECTIVE_TOKEN: +// yaml_free(token.data.tag_directive.handle); +// yaml_free(token.data.tag_directive.prefix); +// break; +// +// case YAML_ALIAS_TOKEN: +// yaml_free(token.data.alias.value); +// break; +// +// case YAML_ANCHOR_TOKEN: +// yaml_free(token.data.anchor.value); +// break; +// +// case YAML_TAG_TOKEN: +// yaml_free(token.data.tag.handle); +// yaml_free(token.data.tag.suffix); +// break; +// +// case YAML_SCALAR_TOKEN: +// yaml_free(token.data.scalar.value); +// break; +// +// default: +// break; +// } +// +// memset(token, 0, sizeof(yaml_token_t)); +//} +// +///* +// * Check if a string is a valid UTF-8 sequence. +// * +// * Check 'reader.c' for more details on UTF-8 encoding. +// */ +// +//static int +//yaml_check_utf8(yaml_char_t *start, size_t length) +//{ +// yaml_char_t *end = start+length; +// yaml_char_t *pointer = start; +// +// while (pointer < end) { +// unsigned char octet; +// unsigned int width; +// unsigned int value; +// size_t k; +// +// octet = pointer[0]; +// width = (octet & 0x80) == 0x00 ? 1 : +// (octet & 0xE0) == 0xC0 ? 2 : +// (octet & 0xF0) == 0xE0 ? 3 : +// (octet & 0xF8) == 0xF0 ? 4 : 0; +// value = (octet & 0x80) == 0x00 ? octet & 0x7F : +// (octet & 0xE0) == 0xC0 ? octet & 0x1F : +// (octet & 0xF0) == 0xE0 ? octet & 0x0F : +// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; +// if (!width) return 0; +// if (pointer+width > end) return 0; +// for (k = 1; k < width; k ++) { +// octet = pointer[k]; +// if ((octet & 0xC0) != 0x80) return 0; +// value = (value << 6) + (octet & 0x3F); +// } +// if (!((width == 1) || +// (width == 2 && value >= 0x80) || +// (width == 3 && value >= 0x800) || +// (width == 4 && value >= 0x10000))) return 0; +// +// pointer += width; +// } +// +// return 1; +//} +// + +// Create STREAM-START. +func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) { + *event = yaml_event_t{ + typ: yaml_STREAM_START_EVENT, + encoding: encoding, + } +} + +// Create STREAM-END. +func yaml_stream_end_event_initialize(event *yaml_event_t) { + *event = yaml_event_t{ + typ: yaml_STREAM_END_EVENT, + } +} + +// Create DOCUMENT-START. +func yaml_document_start_event_initialize( + event *yaml_event_t, + version_directive *yaml_version_directive_t, + tag_directives []yaml_tag_directive_t, + implicit bool, +) { + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: implicit, + } +} + +// Create DOCUMENT-END. +func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) { + *event = yaml_event_t{ + typ: yaml_DOCUMENT_END_EVENT, + implicit: implicit, + } +} + +///* +// * Create ALIAS. +// */ +// +//YAML_DECLARE(int) +//yaml_alias_event_initialize(event *yaml_event_t, anchor *yaml_char_t) +//{ +// mark yaml_mark_t = { 0, 0, 0 } +// anchor_copy *yaml_char_t = NULL +// +// assert(event) // Non-NULL event object is expected. +// assert(anchor) // Non-NULL anchor is expected. +// +// if (!yaml_check_utf8(anchor, strlen((char *)anchor))) return 0 +// +// anchor_copy = yaml_strdup(anchor) +// if (!anchor_copy) +// return 0 +// +// ALIAS_EVENT_INIT(*event, anchor_copy, mark, mark) +// +// return 1 +//} + +// Create SCALAR. +func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool { + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + anchor: anchor, + tag: tag, + value: value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(style), + } + return true +} + +// Create SEQUENCE-START. +func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool { + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } + return true +} + +// Create SEQUENCE-END. +func yaml_sequence_end_event_initialize(event *yaml_event_t) bool { + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + } + return true +} + +// Create MAPPING-START. +func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) { + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } +} + +// Create MAPPING-END. +func yaml_mapping_end_event_initialize(event *yaml_event_t) { + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + } +} + +// Destroy an event object. +func yaml_event_delete(event *yaml_event_t) { + *event = yaml_event_t{} +} + +///* +// * Create a document object. +// */ +// +//YAML_DECLARE(int) +//yaml_document_initialize(document *yaml_document_t, +// version_directive *yaml_version_directive_t, +// tag_directives_start *yaml_tag_directive_t, +// tag_directives_end *yaml_tag_directive_t, +// start_implicit int, end_implicit int) +//{ +// struct { +// error yaml_error_type_t +// } context +// struct { +// start *yaml_node_t +// end *yaml_node_t +// top *yaml_node_t +// } nodes = { NULL, NULL, NULL } +// version_directive_copy *yaml_version_directive_t = NULL +// struct { +// start *yaml_tag_directive_t +// end *yaml_tag_directive_t +// top *yaml_tag_directive_t +// } tag_directives_copy = { NULL, NULL, NULL } +// value yaml_tag_directive_t = { NULL, NULL } +// mark yaml_mark_t = { 0, 0, 0 } +// +// assert(document) // Non-NULL document object is expected. +// assert((tag_directives_start && tag_directives_end) || +// (tag_directives_start == tag_directives_end)) +// // Valid tag directives are expected. +// +// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error +// +// if (version_directive) { +// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t)) +// if (!version_directive_copy) goto error +// version_directive_copy.major = version_directive.major +// version_directive_copy.minor = version_directive.minor +// } +// +// if (tag_directives_start != tag_directives_end) { +// tag_directive *yaml_tag_directive_t +// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE)) +// goto error +// for (tag_directive = tag_directives_start +// tag_directive != tag_directives_end; tag_directive ++) { +// assert(tag_directive.handle) +// assert(tag_directive.prefix) +// if (!yaml_check_utf8(tag_directive.handle, +// strlen((char *)tag_directive.handle))) +// goto error +// if (!yaml_check_utf8(tag_directive.prefix, +// strlen((char *)tag_directive.prefix))) +// goto error +// value.handle = yaml_strdup(tag_directive.handle) +// value.prefix = yaml_strdup(tag_directive.prefix) +// if (!value.handle || !value.prefix) goto error +// if (!PUSH(&context, tag_directives_copy, value)) +// goto error +// value.handle = NULL +// value.prefix = NULL +// } +// } +// +// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy, +// tag_directives_copy.start, tag_directives_copy.top, +// start_implicit, end_implicit, mark, mark) +// +// return 1 +// +//error: +// STACK_DEL(&context, nodes) +// yaml_free(version_directive_copy) +// while (!STACK_EMPTY(&context, tag_directives_copy)) { +// value yaml_tag_directive_t = POP(&context, tag_directives_copy) +// yaml_free(value.handle) +// yaml_free(value.prefix) +// } +// STACK_DEL(&context, tag_directives_copy) +// yaml_free(value.handle) +// yaml_free(value.prefix) +// +// return 0 +//} +// +///* +// * Destroy a document object. +// */ +// +//YAML_DECLARE(void) +//yaml_document_delete(document *yaml_document_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// tag_directive *yaml_tag_directive_t +// +// context.error = YAML_NO_ERROR // Eliminate a compiler warning. +// +// assert(document) // Non-NULL document object is expected. +// +// while (!STACK_EMPTY(&context, document.nodes)) { +// node yaml_node_t = POP(&context, document.nodes) +// yaml_free(node.tag) +// switch (node.type) { +// case YAML_SCALAR_NODE: +// yaml_free(node.data.scalar.value) +// break +// case YAML_SEQUENCE_NODE: +// STACK_DEL(&context, node.data.sequence.items) +// break +// case YAML_MAPPING_NODE: +// STACK_DEL(&context, node.data.mapping.pairs) +// break +// default: +// assert(0) // Should not happen. +// } +// } +// STACK_DEL(&context, document.nodes) +// +// yaml_free(document.version_directive) +// for (tag_directive = document.tag_directives.start +// tag_directive != document.tag_directives.end +// tag_directive++) { +// yaml_free(tag_directive.handle) +// yaml_free(tag_directive.prefix) +// } +// yaml_free(document.tag_directives.start) +// +// memset(document, 0, sizeof(yaml_document_t)) +//} +// +///** +// * Get a document node. +// */ +// +//YAML_DECLARE(yaml_node_t *) +//yaml_document_get_node(document *yaml_document_t, index int) +//{ +// assert(document) // Non-NULL document object is expected. +// +// if (index > 0 && document.nodes.start + index <= document.nodes.top) { +// return document.nodes.start + index - 1 +// } +// return NULL +//} +// +///** +// * Get the root object. +// */ +// +//YAML_DECLARE(yaml_node_t *) +//yaml_document_get_root_node(document *yaml_document_t) +//{ +// assert(document) // Non-NULL document object is expected. +// +// if (document.nodes.top != document.nodes.start) { +// return document.nodes.start +// } +// return NULL +//} +// +///* +// * Add a scalar node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_scalar(document *yaml_document_t, +// tag *yaml_char_t, value *yaml_char_t, length int, +// style yaml_scalar_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// value_copy *yaml_char_t = NULL +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// assert(value) // Non-NULL value is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (length < 0) { +// length = strlen((char *)value) +// } +// +// if (!yaml_check_utf8(value, length)) goto error +// value_copy = yaml_malloc(length+1) +// if (!value_copy) goto error +// memcpy(value_copy, value, length) +// value_copy[length] = '\0' +// +// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// yaml_free(tag_copy) +// yaml_free(value_copy) +// +// return 0 +//} +// +///* +// * Add a sequence node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_sequence(document *yaml_document_t, +// tag *yaml_char_t, style yaml_sequence_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// struct { +// start *yaml_node_item_t +// end *yaml_node_item_t +// top *yaml_node_item_t +// } items = { NULL, NULL, NULL } +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error +// +// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end, +// style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// STACK_DEL(&context, items) +// yaml_free(tag_copy) +// +// return 0 +//} +// +///* +// * Add a mapping node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_mapping(document *yaml_document_t, +// tag *yaml_char_t, style yaml_mapping_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// struct { +// start *yaml_node_pair_t +// end *yaml_node_pair_t +// top *yaml_node_pair_t +// } pairs = { NULL, NULL, NULL } +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error +// +// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end, +// style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// STACK_DEL(&context, pairs) +// yaml_free(tag_copy) +// +// return 0 +//} +// +///* +// * Append an item to a sequence node. +// */ +// +//YAML_DECLARE(int) +//yaml_document_append_sequence_item(document *yaml_document_t, +// sequence int, item int) +//{ +// struct { +// error yaml_error_type_t +// } context +// +// assert(document) // Non-NULL document is required. +// assert(sequence > 0 +// && document.nodes.start + sequence <= document.nodes.top) +// // Valid sequence id is required. +// assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE) +// // A sequence node is required. +// assert(item > 0 && document.nodes.start + item <= document.nodes.top) +// // Valid item id is required. +// +// if (!PUSH(&context, +// document.nodes.start[sequence-1].data.sequence.items, item)) +// return 0 +// +// return 1 +//} +// +///* +// * Append a pair of a key and a value to a mapping node. +// */ +// +//YAML_DECLARE(int) +//yaml_document_append_mapping_pair(document *yaml_document_t, +// mapping int, key int, value int) +//{ +// struct { +// error yaml_error_type_t +// } context +// +// pair yaml_node_pair_t +// +// assert(document) // Non-NULL document is required. +// assert(mapping > 0 +// && document.nodes.start + mapping <= document.nodes.top) +// // Valid mapping id is required. +// assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE) +// // A mapping node is required. +// assert(key > 0 && document.nodes.start + key <= document.nodes.top) +// // Valid key id is required. +// assert(value > 0 && document.nodes.start + value <= document.nodes.top) +// // Valid value id is required. +// +// pair.key = key +// pair.value = value +// +// if (!PUSH(&context, +// document.nodes.start[mapping-1].data.mapping.pairs, pair)) +// return 0 +// +// return 1 +//} +// +// diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/decode.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/decode.go new file mode 100644 index 000000000..129bc2a97 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/decode.go @@ -0,0 +1,815 @@ +package yaml + +import ( + "encoding" + "encoding/base64" + "fmt" + "io" + "math" + "reflect" + "strconv" + "time" +) + +const ( + documentNode = 1 << iota + mappingNode + sequenceNode + scalarNode + aliasNode +) + +type node struct { + kind int + line, column int + tag string + // For an alias node, alias holds the resolved alias. + alias *node + value string + implicit bool + children []*node + anchors map[string]*node +} + +// ---------------------------------------------------------------------------- +// Parser, produces a node tree out of a libyaml event stream. + +type parser struct { + parser yaml_parser_t + event yaml_event_t + doc *node + doneInit bool +} + +func newParser(b []byte) *parser { + p := parser{} + if !yaml_parser_initialize(&p.parser) { + panic("failed to initialize YAML emitter") + } + if len(b) == 0 { + b = []byte{'\n'} + } + yaml_parser_set_input_string(&p.parser, b) + return &p +} + +func newParserFromReader(r io.Reader) *parser { + p := parser{} + if !yaml_parser_initialize(&p.parser) { + panic("failed to initialize YAML emitter") + } + yaml_parser_set_input_reader(&p.parser, r) + return &p +} + +func (p *parser) init() { + if p.doneInit { + return + } + p.expect(yaml_STREAM_START_EVENT) + p.doneInit = true +} + +func (p *parser) destroy() { + if p.event.typ != yaml_NO_EVENT { + yaml_event_delete(&p.event) + } + yaml_parser_delete(&p.parser) +} + +// expect consumes an event from the event stream and +// checks that it's of the expected type. +func (p *parser) expect(e yaml_event_type_t) { + if p.event.typ == yaml_NO_EVENT { + if !yaml_parser_parse(&p.parser, &p.event) { + p.fail() + } + } + if p.event.typ == yaml_STREAM_END_EVENT { + failf("attempted to go past the end of stream; corrupted value?") + } + if p.event.typ != e { + p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ) + p.fail() + } + yaml_event_delete(&p.event) + p.event.typ = yaml_NO_EVENT +} + +// peek peeks at the next event in the event stream, +// puts the results into p.event and returns the event type. +func (p *parser) peek() yaml_event_type_t { + if p.event.typ != yaml_NO_EVENT { + return p.event.typ + } + if !yaml_parser_parse(&p.parser, &p.event) { + p.fail() + } + return p.event.typ +} + +func (p *parser) fail() { + var where string + var line int + if p.parser.problem_mark.line != 0 { + line = p.parser.problem_mark.line + // Scanner errors don't iterate line before returning error + if p.parser.error == yaml_SCANNER_ERROR { + line++ + } + } else if p.parser.context_mark.line != 0 { + line = p.parser.context_mark.line + } + if line != 0 { + where = "line " + strconv.Itoa(line) + ": " + } + var msg string + if len(p.parser.problem) > 0 { + msg = p.parser.problem + } else { + msg = "unknown problem parsing YAML content" + } + failf("%s%s", where, msg) +} + +func (p *parser) anchor(n *node, anchor []byte) { + if anchor != nil { + p.doc.anchors[string(anchor)] = n + } +} + +func (p *parser) parse() *node { + p.init() + switch p.peek() { + case yaml_SCALAR_EVENT: + return p.scalar() + case yaml_ALIAS_EVENT: + return p.alias() + case yaml_MAPPING_START_EVENT: + return p.mapping() + case yaml_SEQUENCE_START_EVENT: + return p.sequence() + case yaml_DOCUMENT_START_EVENT: + return p.document() + case yaml_STREAM_END_EVENT: + // Happens when attempting to decode an empty buffer. + return nil + default: + panic("attempted to parse unknown event: " + p.event.typ.String()) + } +} + +func (p *parser) node(kind int) *node { + return &node{ + kind: kind, + line: p.event.start_mark.line, + column: p.event.start_mark.column, + } +} + +func (p *parser) document() *node { + n := p.node(documentNode) + n.anchors = make(map[string]*node) + p.doc = n + p.expect(yaml_DOCUMENT_START_EVENT) + n.children = append(n.children, p.parse()) + p.expect(yaml_DOCUMENT_END_EVENT) + return n +} + +func (p *parser) alias() *node { + n := p.node(aliasNode) + n.value = string(p.event.anchor) + n.alias = p.doc.anchors[n.value] + if n.alias == nil { + failf("unknown anchor '%s' referenced", n.value) + } + p.expect(yaml_ALIAS_EVENT) + return n +} + +func (p *parser) scalar() *node { + n := p.node(scalarNode) + n.value = string(p.event.value) + n.tag = string(p.event.tag) + n.implicit = p.event.implicit + p.anchor(n, p.event.anchor) + p.expect(yaml_SCALAR_EVENT) + return n +} + +func (p *parser) sequence() *node { + n := p.node(sequenceNode) + p.anchor(n, p.event.anchor) + p.expect(yaml_SEQUENCE_START_EVENT) + for p.peek() != yaml_SEQUENCE_END_EVENT { + n.children = append(n.children, p.parse()) + } + p.expect(yaml_SEQUENCE_END_EVENT) + return n +} + +func (p *parser) mapping() *node { + n := p.node(mappingNode) + p.anchor(n, p.event.anchor) + p.expect(yaml_MAPPING_START_EVENT) + for p.peek() != yaml_MAPPING_END_EVENT { + n.children = append(n.children, p.parse(), p.parse()) + } + p.expect(yaml_MAPPING_END_EVENT) + return n +} + +// ---------------------------------------------------------------------------- +// Decoder, unmarshals a node into a provided value. + +type decoder struct { + doc *node + aliases map[*node]bool + mapType reflect.Type + terrors []string + strict bool + + decodeCount int + aliasCount int + aliasDepth int +} + +var ( + mapItemType = reflect.TypeOf(MapItem{}) + durationType = reflect.TypeOf(time.Duration(0)) + defaultMapType = reflect.TypeOf(map[interface{}]interface{}{}) + ifaceType = defaultMapType.Elem() + timeType = reflect.TypeOf(time.Time{}) + ptrTimeType = reflect.TypeOf(&time.Time{}) +) + +func newDecoder(strict bool) *decoder { + d := &decoder{mapType: defaultMapType, strict: strict} + d.aliases = make(map[*node]bool) + return d +} + +func (d *decoder) terror(n *node, tag string, out reflect.Value) { + if n.tag != "" { + tag = n.tag + } + value := n.value + if tag != yaml_SEQ_TAG && tag != yaml_MAP_TAG { + if len(value) > 10 { + value = " `" + value[:7] + "...`" + } else { + value = " `" + value + "`" + } + } + d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.line+1, shortTag(tag), value, out.Type())) +} + +func (d *decoder) callUnmarshaler(n *node, u Unmarshaler) (good bool) { + terrlen := len(d.terrors) + err := u.UnmarshalYAML(func(v interface{}) (err error) { + defer handleErr(&err) + d.unmarshal(n, reflect.ValueOf(v)) + if len(d.terrors) > terrlen { + issues := d.terrors[terrlen:] + d.terrors = d.terrors[:terrlen] + return &TypeError{issues} + } + return nil + }) + if e, ok := err.(*TypeError); ok { + d.terrors = append(d.terrors, e.Errors...) + return false + } + if err != nil { + fail(err) + } + return true +} + +// d.prepare initializes and dereferences pointers and calls UnmarshalYAML +// if a value is found to implement it. +// It returns the initialized and dereferenced out value, whether +// unmarshalling was already done by UnmarshalYAML, and if so whether +// its types unmarshalled appropriately. +// +// If n holds a null value, prepare returns before doing anything. +func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { + if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "~" || n.value == "" && n.implicit) { + return out, false, false + } + again := true + for again { + again = false + if out.Kind() == reflect.Ptr { + if out.IsNil() { + out.Set(reflect.New(out.Type().Elem())) + } + out = out.Elem() + again = true + } + if out.CanAddr() { + if u, ok := out.Addr().Interface().(Unmarshaler); ok { + good = d.callUnmarshaler(n, u) + return out, true, good + } + } + } + return out, false, false +} + +const ( + // 400,000 decode operations is ~500kb of dense object declarations, or + // ~5kb of dense object declarations with 10000% alias expansion + alias_ratio_range_low = 400000 + + // 4,000,000 decode operations is ~5MB of dense object declarations, or + // ~4.5MB of dense object declarations with 10% alias expansion + alias_ratio_range_high = 4000000 + + // alias_ratio_range is the range over which we scale allowed alias ratios + alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low) +) + +func allowedAliasRatio(decodeCount int) float64 { + switch { + case decodeCount <= alias_ratio_range_low: + // allow 99% to come from alias expansion for small-to-medium documents + return 0.99 + case decodeCount >= alias_ratio_range_high: + // allow 10% to come from alias expansion for very large documents + return 0.10 + default: + // scale smoothly from 99% down to 10% over the range. + // this maps to 396,000 - 400,000 allowed alias-driven decodes over the range. + // 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps). + return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range) + } +} + +func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) { + d.decodeCount++ + if d.aliasDepth > 0 { + d.aliasCount++ + } + if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) { + failf("document contains excessive aliasing") + } + switch n.kind { + case documentNode: + return d.document(n, out) + case aliasNode: + return d.alias(n, out) + } + out, unmarshaled, good := d.prepare(n, out) + if unmarshaled { + return good + } + switch n.kind { + case scalarNode: + good = d.scalar(n, out) + case mappingNode: + good = d.mapping(n, out) + case sequenceNode: + good = d.sequence(n, out) + default: + panic("internal error: unknown node kind: " + strconv.Itoa(n.kind)) + } + return good +} + +func (d *decoder) document(n *node, out reflect.Value) (good bool) { + if len(n.children) == 1 { + d.doc = n + d.unmarshal(n.children[0], out) + return true + } + return false +} + +func (d *decoder) alias(n *node, out reflect.Value) (good bool) { + if d.aliases[n] { + // TODO this could actually be allowed in some circumstances. + failf("anchor '%s' value contains itself", n.value) + } + d.aliases[n] = true + d.aliasDepth++ + good = d.unmarshal(n.alias, out) + d.aliasDepth-- + delete(d.aliases, n) + return good +} + +var zeroValue reflect.Value + +func resetMap(out reflect.Value) { + for _, k := range out.MapKeys() { + out.SetMapIndex(k, zeroValue) + } +} + +func (d *decoder) scalar(n *node, out reflect.Value) bool { + var tag string + var resolved interface{} + if n.tag == "" && !n.implicit { + tag = yaml_STR_TAG + resolved = n.value + } else { + tag, resolved = resolve(n.tag, n.value) + if tag == yaml_BINARY_TAG { + data, err := base64.StdEncoding.DecodeString(resolved.(string)) + if err != nil { + failf("!!binary value contains invalid base64 data") + } + resolved = string(data) + } + } + if resolved == nil { + if out.Kind() == reflect.Map && !out.CanAddr() { + resetMap(out) + } else { + out.Set(reflect.Zero(out.Type())) + } + return true + } + if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { + // We've resolved to exactly the type we want, so use that. + out.Set(resolvedv) + return true + } + // Perhaps we can use the value as a TextUnmarshaler to + // set its value. + if out.CanAddr() { + u, ok := out.Addr().Interface().(encoding.TextUnmarshaler) + if ok { + var text []byte + if tag == yaml_BINARY_TAG { + text = []byte(resolved.(string)) + } else { + // We let any value be unmarshaled into TextUnmarshaler. + // That might be more lax than we'd like, but the + // TextUnmarshaler itself should bowl out any dubious values. + text = []byte(n.value) + } + err := u.UnmarshalText(text) + if err != nil { + fail(err) + } + return true + } + } + switch out.Kind() { + case reflect.String: + if tag == yaml_BINARY_TAG { + out.SetString(resolved.(string)) + return true + } + if resolved != nil { + out.SetString(n.value) + return true + } + case reflect.Interface: + if resolved == nil { + out.Set(reflect.Zero(out.Type())) + } else if tag == yaml_TIMESTAMP_TAG { + // It looks like a timestamp but for backward compatibility + // reasons we set it as a string, so that code that unmarshals + // timestamp-like values into interface{} will continue to + // see a string and not a time.Time. + // TODO(v3) Drop this. + out.Set(reflect.ValueOf(n.value)) + } else { + out.Set(reflect.ValueOf(resolved)) + } + return true + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + switch resolved := resolved.(type) { + case int: + if !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + return true + } + case int64: + if !out.OverflowInt(resolved) { + out.SetInt(resolved) + return true + } + case uint64: + if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + return true + } + case float64: + if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + return true + } + case string: + if out.Type() == durationType { + d, err := time.ParseDuration(resolved) + if err == nil { + out.SetInt(int64(d)) + return true + } + } + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + switch resolved := resolved.(type) { + case int: + if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + case int64: + if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + case uint64: + if !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + case float64: + if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + } + case reflect.Bool: + switch resolved := resolved.(type) { + case bool: + out.SetBool(resolved) + return true + } + case reflect.Float32, reflect.Float64: + switch resolved := resolved.(type) { + case int: + out.SetFloat(float64(resolved)) + return true + case int64: + out.SetFloat(float64(resolved)) + return true + case uint64: + out.SetFloat(float64(resolved)) + return true + case float64: + out.SetFloat(resolved) + return true + } + case reflect.Struct: + if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { + out.Set(resolvedv) + return true + } + case reflect.Ptr: + if out.Type().Elem() == reflect.TypeOf(resolved) { + // TODO DOes this make sense? When is out a Ptr except when decoding a nil value? + elem := reflect.New(out.Type().Elem()) + elem.Elem().Set(reflect.ValueOf(resolved)) + out.Set(elem) + return true + } + } + d.terror(n, tag, out) + return false +} + +func settableValueOf(i interface{}) reflect.Value { + v := reflect.ValueOf(i) + sv := reflect.New(v.Type()).Elem() + sv.Set(v) + return sv +} + +func (d *decoder) sequence(n *node, out reflect.Value) (good bool) { + l := len(n.children) + + var iface reflect.Value + switch out.Kind() { + case reflect.Slice: + out.Set(reflect.MakeSlice(out.Type(), l, l)) + case reflect.Array: + if l != out.Len() { + failf("invalid array: want %d elements but got %d", out.Len(), l) + } + case reflect.Interface: + // No type hints. Will have to use a generic sequence. + iface = out + out = settableValueOf(make([]interface{}, l)) + default: + d.terror(n, yaml_SEQ_TAG, out) + return false + } + et := out.Type().Elem() + + j := 0 + for i := 0; i < l; i++ { + e := reflect.New(et).Elem() + if ok := d.unmarshal(n.children[i], e); ok { + out.Index(j).Set(e) + j++ + } + } + if out.Kind() != reflect.Array { + out.Set(out.Slice(0, j)) + } + if iface.IsValid() { + iface.Set(out) + } + return true +} + +func (d *decoder) mapping(n *node, out reflect.Value) (good bool) { + switch out.Kind() { + case reflect.Struct: + return d.mappingStruct(n, out) + case reflect.Slice: + return d.mappingSlice(n, out) + case reflect.Map: + // okay + case reflect.Interface: + if d.mapType.Kind() == reflect.Map { + iface := out + out = reflect.MakeMap(d.mapType) + iface.Set(out) + } else { + slicev := reflect.New(d.mapType).Elem() + if !d.mappingSlice(n, slicev) { + return false + } + out.Set(slicev) + return true + } + default: + d.terror(n, yaml_MAP_TAG, out) + return false + } + outt := out.Type() + kt := outt.Key() + et := outt.Elem() + + mapType := d.mapType + if outt.Key() == ifaceType && outt.Elem() == ifaceType { + d.mapType = outt + } + + if out.IsNil() { + out.Set(reflect.MakeMap(outt)) + } + l := len(n.children) + for i := 0; i < l; i += 2 { + if isMerge(n.children[i]) { + d.merge(n.children[i+1], out) + continue + } + k := reflect.New(kt).Elem() + if d.unmarshal(n.children[i], k) { + kkind := k.Kind() + if kkind == reflect.Interface { + kkind = k.Elem().Kind() + } + if kkind == reflect.Map || kkind == reflect.Slice { + failf("invalid map key: %#v", k.Interface()) + } + e := reflect.New(et).Elem() + if d.unmarshal(n.children[i+1], e) { + d.setMapIndex(n.children[i+1], out, k, e) + } + } + } + d.mapType = mapType + return true +} + +func (d *decoder) setMapIndex(n *node, out, k, v reflect.Value) { + if d.strict && out.MapIndex(k) != zeroValue { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: key %#v already set in map", n.line+1, k.Interface())) + return + } + out.SetMapIndex(k, v) +} + +func (d *decoder) mappingSlice(n *node, out reflect.Value) (good bool) { + outt := out.Type() + if outt.Elem() != mapItemType { + d.terror(n, yaml_MAP_TAG, out) + return false + } + + mapType := d.mapType + d.mapType = outt + + var slice []MapItem + var l = len(n.children) + for i := 0; i < l; i += 2 { + if isMerge(n.children[i]) { + d.merge(n.children[i+1], out) + continue + } + item := MapItem{} + k := reflect.ValueOf(&item.Key).Elem() + if d.unmarshal(n.children[i], k) { + v := reflect.ValueOf(&item.Value).Elem() + if d.unmarshal(n.children[i+1], v) { + slice = append(slice, item) + } + } + } + out.Set(reflect.ValueOf(slice)) + d.mapType = mapType + return true +} + +func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { + sinfo, err := getStructInfo(out.Type()) + if err != nil { + panic(err) + } + name := settableValueOf("") + l := len(n.children) + + var inlineMap reflect.Value + var elemType reflect.Type + if sinfo.InlineMap != -1 { + inlineMap = out.Field(sinfo.InlineMap) + inlineMap.Set(reflect.New(inlineMap.Type()).Elem()) + elemType = inlineMap.Type().Elem() + } + + var doneFields []bool + if d.strict { + doneFields = make([]bool, len(sinfo.FieldsList)) + } + for i := 0; i < l; i += 2 { + ni := n.children[i] + if isMerge(ni) { + d.merge(n.children[i+1], out) + continue + } + if !d.unmarshal(ni, name) { + continue + } + if info, ok := sinfo.FieldsMap[name.String()]; ok { + if d.strict { + if doneFields[info.Id] { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.line+1, name.String(), out.Type())) + continue + } + doneFields[info.Id] = true + } + var field reflect.Value + if info.Inline == nil { + field = out.Field(info.Num) + } else { + field = out.FieldByIndex(info.Inline) + } + d.unmarshal(n.children[i+1], field) + } else if sinfo.InlineMap != -1 { + if inlineMap.IsNil() { + inlineMap.Set(reflect.MakeMap(inlineMap.Type())) + } + value := reflect.New(elemType).Elem() + d.unmarshal(n.children[i+1], value) + d.setMapIndex(n.children[i+1], inlineMap, name, value) + } else if d.strict { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.line+1, name.String(), out.Type())) + } + } + return true +} + +func failWantMap() { + failf("map merge requires map or sequence of maps as the value") +} + +func (d *decoder) merge(n *node, out reflect.Value) { + switch n.kind { + case mappingNode: + d.unmarshal(n, out) + case aliasNode: + if n.alias != nil && n.alias.kind != mappingNode { + failWantMap() + } + d.unmarshal(n, out) + case sequenceNode: + // Step backwards as earlier nodes take precedence. + for i := len(n.children) - 1; i >= 0; i-- { + ni := n.children[i] + if ni.kind == aliasNode { + if ni.alias != nil && ni.alias.kind != mappingNode { + failWantMap() + } + } else if ni.kind != mappingNode { + failWantMap() + } + d.unmarshal(ni, out) + } + default: + failWantMap() + } +} + +func isMerge(n *node) bool { + return n.kind == scalarNode && n.value == "<<" && (n.implicit == true || n.tag == yaml_MERGE_TAG) +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go new file mode 100644 index 000000000..a1c2cc526 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go @@ -0,0 +1,1685 @@ +package yaml + +import ( + "bytes" + "fmt" +) + +// Flush the buffer if needed. +func flush(emitter *yaml_emitter_t) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) { + return yaml_emitter_flush(emitter) + } + return true +} + +// Put a character to the output buffer. +func put(emitter *yaml_emitter_t, value byte) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + emitter.buffer[emitter.buffer_pos] = value + emitter.buffer_pos++ + emitter.column++ + return true +} + +// Put a line break to the output buffer. +func put_break(emitter *yaml_emitter_t) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + switch emitter.line_break { + case yaml_CR_BREAK: + emitter.buffer[emitter.buffer_pos] = '\r' + emitter.buffer_pos += 1 + case yaml_LN_BREAK: + emitter.buffer[emitter.buffer_pos] = '\n' + emitter.buffer_pos += 1 + case yaml_CRLN_BREAK: + emitter.buffer[emitter.buffer_pos+0] = '\r' + emitter.buffer[emitter.buffer_pos+1] = '\n' + emitter.buffer_pos += 2 + default: + panic("unknown line break setting") + } + emitter.column = 0 + emitter.line++ + return true +} + +// Copy a character from a string into buffer. +func write(emitter *yaml_emitter_t, s []byte, i *int) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + p := emitter.buffer_pos + w := width(s[*i]) + switch w { + case 4: + emitter.buffer[p+3] = s[*i+3] + fallthrough + case 3: + emitter.buffer[p+2] = s[*i+2] + fallthrough + case 2: + emitter.buffer[p+1] = s[*i+1] + fallthrough + case 1: + emitter.buffer[p+0] = s[*i+0] + default: + panic("unknown character width") + } + emitter.column++ + emitter.buffer_pos += w + *i += w + return true +} + +// Write a whole string into buffer. +func write_all(emitter *yaml_emitter_t, s []byte) bool { + for i := 0; i < len(s); { + if !write(emitter, s, &i) { + return false + } + } + return true +} + +// Copy a line break character from a string into buffer. +func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool { + if s[*i] == '\n' { + if !put_break(emitter) { + return false + } + *i++ + } else { + if !write(emitter, s, i) { + return false + } + emitter.column = 0 + emitter.line++ + } + return true +} + +// Set an emitter error and return false. +func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_EMITTER_ERROR + emitter.problem = problem + return false +} + +// Emit an event. +func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.events = append(emitter.events, *event) + for !yaml_emitter_need_more_events(emitter) { + event := &emitter.events[emitter.events_head] + if !yaml_emitter_analyze_event(emitter, event) { + return false + } + if !yaml_emitter_state_machine(emitter, event) { + return false + } + yaml_event_delete(event) + emitter.events_head++ + } + return true +} + +// Check if we need to accumulate more events before emitting. +// +// We accumulate extra +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START +// +func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { + if emitter.events_head == len(emitter.events) { + return true + } + var accumulate int + switch emitter.events[emitter.events_head].typ { + case yaml_DOCUMENT_START_EVENT: + accumulate = 1 + break + case yaml_SEQUENCE_START_EVENT: + accumulate = 2 + break + case yaml_MAPPING_START_EVENT: + accumulate = 3 + break + default: + return false + } + if len(emitter.events)-emitter.events_head > accumulate { + return false + } + var level int + for i := emitter.events_head; i < len(emitter.events); i++ { + switch emitter.events[i].typ { + case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT: + level++ + case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT: + level-- + } + if level == 0 { + return false + } + } + return true +} + +// Append a directive to the directives stack. +func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool { + for i := 0; i < len(emitter.tag_directives); i++ { + if bytes.Equal(value.handle, emitter.tag_directives[i].handle) { + if allow_duplicates { + return true + } + return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive") + } + } + + // [Go] Do we actually need to copy this given garbage collection + // and the lack of deallocating destructors? + tag_copy := yaml_tag_directive_t{ + handle: make([]byte, len(value.handle)), + prefix: make([]byte, len(value.prefix)), + } + copy(tag_copy.handle, value.handle) + copy(tag_copy.prefix, value.prefix) + emitter.tag_directives = append(emitter.tag_directives, tag_copy) + return true +} + +// Increase the indentation level. +func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool { + emitter.indents = append(emitter.indents, emitter.indent) + if emitter.indent < 0 { + if flow { + emitter.indent = emitter.best_indent + } else { + emitter.indent = 0 + } + } else if !indentless { + emitter.indent += emitter.best_indent + } + return true +} + +// State dispatcher. +func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool { + switch emitter.state { + default: + case yaml_EMIT_STREAM_START_STATE: + return yaml_emitter_emit_stream_start(emitter, event) + + case yaml_EMIT_FIRST_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, true) + + case yaml_EMIT_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, false) + + case yaml_EMIT_DOCUMENT_CONTENT_STATE: + return yaml_emitter_emit_document_content(emitter, event) + + case yaml_EMIT_DOCUMENT_END_STATE: + return yaml_emitter_emit_document_end(emitter, event) + + case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, true) + + case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, false) + + case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, true) + + case yaml_EMIT_FLOW_MAPPING_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, false) + + case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, true) + + case yaml_EMIT_FLOW_MAPPING_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, false) + + case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, true) + + case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, false) + + case yaml_EMIT_END_STATE: + return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END") + } + panic("invalid emitter state") +} + +// Expect STREAM-START. +func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if event.typ != yaml_STREAM_START_EVENT { + return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START") + } + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = event.encoding + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = yaml_UTF8_ENCODING + } + } + if emitter.best_indent < 2 || emitter.best_indent > 9 { + emitter.best_indent = 2 + } + if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 { + emitter.best_width = 80 + } + if emitter.best_width < 0 { + emitter.best_width = 1<<31 - 1 + } + if emitter.line_break == yaml_ANY_BREAK { + emitter.line_break = yaml_LN_BREAK + } + + emitter.indent = -1 + emitter.line = 0 + emitter.column = 0 + emitter.whitespace = true + emitter.indention = true + + if emitter.encoding != yaml_UTF8_ENCODING { + if !yaml_emitter_write_bom(emitter) { + return false + } + } + emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE + return true +} + +// Expect DOCUMENT-START or STREAM-END. +func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + + if event.typ == yaml_DOCUMENT_START_EVENT { + + if event.version_directive != nil { + if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) { + return false + } + } + + for i := 0; i < len(event.tag_directives); i++ { + tag_directive := &event.tag_directives[i] + if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) { + return false + } + if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) { + return false + } + } + + for i := 0; i < len(default_tag_directives); i++ { + tag_directive := &default_tag_directives[i] + if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) { + return false + } + } + + implicit := event.implicit + if !first || emitter.canonical { + implicit = false + } + + if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if event.version_directive != nil { + implicit = false + if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if len(event.tag_directives) > 0 { + implicit = false + for i := 0; i < len(event.tag_directives); i++ { + tag_directive := &event.tag_directives[i] + if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) { + return false + } + if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) { + return false + } + if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + if yaml_emitter_check_empty_document(emitter) { + implicit = false + } + if !implicit { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { + return false + } + if emitter.canonical { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE + return true + } + + if event.typ == yaml_STREAM_END_EVENT { + if emitter.open_ended { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_flush(emitter) { + return false + } + emitter.state = yaml_EMIT_END_STATE + return true + } + + return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END") +} + +// Expect the root node. +func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) + return yaml_emitter_emit_node(emitter, event, true, false, false, false) +} + +// Expect DOCUMENT-END. +func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if event.typ != yaml_DOCUMENT_END_EVENT { + return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END") + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !event.implicit { + // [Go] Allocate the slice elsewhere. + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_flush(emitter) { + return false + } + emitter.state = yaml_EMIT_DOCUMENT_START_STATE + emitter.tag_directives = emitter.tag_directives[:0] + return true +} + +// Expect a flow item node. +func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.typ == yaml_SEQUENCE_END_EVENT { + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.canonical && !first { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true + } + + if !first { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) + return yaml_emitter_emit_node(emitter, event, false, true, false, false) +} + +// Expect a flow key node. +func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.typ == yaml_MAPPING_END_EVENT { + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.canonical && !first { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + + if !first { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if !emitter.canonical && yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } + if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a flow value node. +func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { + if simple { + if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { + return false + } + } else { + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) { + return false + } + } + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a block item node. +func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_increase_indent(emitter, false, emitter.mapping_context && !emitter.indention) { + return false + } + } + if event.typ == yaml_SEQUENCE_END_EVENT { + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) + return yaml_emitter_emit_node(emitter, event, false, true, false, false) +} + +// Expect a block key node. +func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_increase_indent(emitter, false, false) { + return false + } + } + if event.typ == yaml_MAPPING_END_EVENT { + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } + if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a block value node. +func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { + if simple { + if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { + return false + } + } else { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) { + return false + } + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a node. +func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, + root bool, sequence bool, mapping bool, simple_key bool) bool { + + emitter.root_context = root + emitter.sequence_context = sequence + emitter.mapping_context = mapping + emitter.simple_key_context = simple_key + + switch event.typ { + case yaml_ALIAS_EVENT: + return yaml_emitter_emit_alias(emitter, event) + case yaml_SCALAR_EVENT: + return yaml_emitter_emit_scalar(emitter, event) + case yaml_SEQUENCE_START_EVENT: + return yaml_emitter_emit_sequence_start(emitter, event) + case yaml_MAPPING_START_EVENT: + return yaml_emitter_emit_mapping_start(emitter, event) + default: + return yaml_emitter_set_emitter_error(emitter, + fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ)) + } +} + +// Expect ALIAS. +func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true +} + +// Expect SCALAR. +func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_select_scalar_style(emitter, event) { + return false + } + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + if !yaml_emitter_process_scalar(emitter) { + return false + } + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true +} + +// Expect SEQUENCE-START. +func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || + yaml_emitter_check_empty_sequence(emitter) { + emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE + } + return true +} + +// Expect MAPPING-START. +func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE || + yaml_emitter_check_empty_mapping(emitter) { + emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE + } + return true +} + +// Check if the document content is an empty scalar. +func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool { + return false // [Go] Huh? +} + +// Check if the next events represent an empty sequence. +func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT && + emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT +} + +// Check if the next events represent an empty mapping. +func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT && + emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT +} + +// Check if the next node can be expressed as a simple key. +func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool { + length := 0 + switch emitter.events[emitter.events_head].typ { + case yaml_ALIAS_EVENT: + length += len(emitter.anchor_data.anchor) + case yaml_SCALAR_EVENT: + if emitter.scalar_data.multiline { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + + len(emitter.scalar_data.value) + case yaml_SEQUENCE_START_EVENT: + if !yaml_emitter_check_empty_sequence(emitter) { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + case yaml_MAPPING_START_EVENT: + if !yaml_emitter_check_empty_mapping(emitter) { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + default: + return false + } + return length <= 128 +} + +// Determine an acceptable scalar style. +func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 + if no_tag && !event.implicit && !event.quoted_implicit { + return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified") + } + + style := event.scalar_style() + if style == yaml_ANY_SCALAR_STYLE { + style = yaml_PLAIN_SCALAR_STYLE + } + if emitter.canonical { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + if emitter.simple_key_context && emitter.scalar_data.multiline { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + if style == yaml_PLAIN_SCALAR_STYLE { + if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed || + emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if no_tag && !event.implicit { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + } + if style == yaml_SINGLE_QUOTED_SCALAR_STYLE { + if !emitter.scalar_data.single_quoted_allowed { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE { + if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + + if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE { + emitter.tag_data.handle = []byte{'!'} + } + emitter.scalar_data.style = style + return true +} + +// Write an anchor. +func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool { + if emitter.anchor_data.anchor == nil { + return true + } + c := []byte{'&'} + if emitter.anchor_data.alias { + c[0] = '*' + } + if !yaml_emitter_write_indicator(emitter, c, true, false, false) { + return false + } + return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor) +} + +// Write a tag. +func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool { + if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 { + return true + } + if len(emitter.tag_data.handle) > 0 { + if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) { + return false + } + if len(emitter.tag_data.suffix) > 0 { + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + } + } else { + // [Go] Allocate these slices elsewhere. + if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) { + return false + } + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{'>'}, false, false, false) { + return false + } + } + return true +} + +// Write a scalar. +func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool { + switch emitter.scalar_data.style { + case yaml_PLAIN_SCALAR_STYLE: + return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_SINGLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_single_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_DOUBLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_double_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_LITERAL_SCALAR_STYLE: + return yaml_emitter_write_literal_scalar(emitter, emitter.scalar_data.value) + + case yaml_FOLDED_SCALAR_STYLE: + return yaml_emitter_write_folded_scalar(emitter, emitter.scalar_data.value) + } + panic("unknown scalar style") +} + +// Check if a %YAML directive is valid. +func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool { + if version_directive.major != 1 || version_directive.minor != 1 { + return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive") + } + return true +} + +// Check if a %TAG directive is valid. +func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool { + handle := tag_directive.handle + prefix := tag_directive.prefix + if len(handle) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty") + } + if handle[0] != '!' { + return yaml_emitter_set_emitter_error(emitter, "tag handle must start with '!'") + } + if handle[len(handle)-1] != '!' { + return yaml_emitter_set_emitter_error(emitter, "tag handle must end with '!'") + } + for i := 1; i < len(handle)-1; i += width(handle[i]) { + if !is_alpha(handle, i) { + return yaml_emitter_set_emitter_error(emitter, "tag handle must contain alphanumerical characters only") + } + } + if len(prefix) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag prefix must not be empty") + } + return true +} + +// Check if an anchor is valid. +func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool { + if len(anchor) == 0 { + problem := "anchor value must not be empty" + if alias { + problem = "alias value must not be empty" + } + return yaml_emitter_set_emitter_error(emitter, problem) + } + for i := 0; i < len(anchor); i += width(anchor[i]) { + if !is_alpha(anchor, i) { + problem := "anchor value must contain alphanumerical characters only" + if alias { + problem = "alias value must contain alphanumerical characters only" + } + return yaml_emitter_set_emitter_error(emitter, problem) + } + } + emitter.anchor_data.anchor = anchor + emitter.anchor_data.alias = alias + return true +} + +// Check if a tag is valid. +func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool { + if len(tag) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty") + } + for i := 0; i < len(emitter.tag_directives); i++ { + tag_directive := &emitter.tag_directives[i] + if bytes.HasPrefix(tag, tag_directive.prefix) { + emitter.tag_data.handle = tag_directive.handle + emitter.tag_data.suffix = tag[len(tag_directive.prefix):] + return true + } + } + emitter.tag_data.suffix = tag + return true +} + +// Check if a scalar is valid. +func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { + var ( + block_indicators = false + flow_indicators = false + line_breaks = false + special_characters = false + + leading_space = false + leading_break = false + trailing_space = false + trailing_break = false + break_space = false + space_break = false + + preceded_by_whitespace = false + followed_by_whitespace = false + previous_space = false + previous_break = false + ) + + emitter.scalar_data.value = value + + if len(value) == 0 { + emitter.scalar_data.multiline = false + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = false + return true + } + + if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) { + block_indicators = true + flow_indicators = true + } + + preceded_by_whitespace = true + for i, w := 0, 0; i < len(value); i += w { + w = width(value[i]) + followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w) + + if i == 0 { + switch value[i] { + case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`': + flow_indicators = true + block_indicators = true + case '?', ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '-': + if followed_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } else { + switch value[i] { + case ',', '?', '[', ']', '{', '}': + flow_indicators = true + case ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '#': + if preceded_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } + + if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode { + special_characters = true + } + if is_space(value, i) { + if i == 0 { + leading_space = true + } + if i+width(value[i]) == len(value) { + trailing_space = true + } + if previous_break { + break_space = true + } + previous_space = true + previous_break = false + } else if is_break(value, i) { + line_breaks = true + if i == 0 { + leading_break = true + } + if i+width(value[i]) == len(value) { + trailing_break = true + } + if previous_space { + space_break = true + } + previous_space = false + previous_break = true + } else { + previous_space = false + previous_break = false + } + + // [Go]: Why 'z'? Couldn't be the end of the string as that's the loop condition. + preceded_by_whitespace = is_blankz(value, i) + } + + emitter.scalar_data.multiline = line_breaks + emitter.scalar_data.flow_plain_allowed = true + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = true + + if leading_space || leading_break || trailing_space || trailing_break { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + if trailing_space { + emitter.scalar_data.block_allowed = false + } + if break_space { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + } + if space_break || special_characters { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + emitter.scalar_data.block_allowed = false + } + if line_breaks { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + if flow_indicators { + emitter.scalar_data.flow_plain_allowed = false + } + if block_indicators { + emitter.scalar_data.block_plain_allowed = false + } + return true +} + +// Check if the event data is valid. +func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + emitter.anchor_data.anchor = nil + emitter.tag_data.handle = nil + emitter.tag_data.suffix = nil + emitter.scalar_data.value = nil + + switch event.typ { + case yaml_ALIAS_EVENT: + if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) { + return false + } + + case yaml_SCALAR_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || (!event.implicit && !event.quoted_implicit)) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + if !yaml_emitter_analyze_scalar(emitter, event.value) { + return false + } + + case yaml_SEQUENCE_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + + case yaml_MAPPING_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + } + return true +} + +// Write the BOM character. +func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool { + if !flush(emitter) { + return false + } + pos := emitter.buffer_pos + emitter.buffer[pos+0] = '\xEF' + emitter.buffer[pos+1] = '\xBB' + emitter.buffer[pos+2] = '\xBF' + emitter.buffer_pos += 3 + return true +} + +func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool { + indent := emitter.indent + if indent < 0 { + indent = 0 + } + if !emitter.indention || emitter.column > indent || (emitter.column == indent && !emitter.whitespace) { + if !put_break(emitter) { + return false + } + } + for emitter.column < indent { + if !put(emitter, ' ') { + return false + } + } + emitter.whitespace = true + emitter.indention = true + return true +} + +func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []byte, need_whitespace, is_whitespace, is_indention bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !write_all(emitter, indicator) { + return false + } + emitter.whitespace = is_whitespace + emitter.indention = (emitter.indention && is_indention) + emitter.open_ended = false + return true +} + +func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool { + if !write_all(emitter, value) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool { + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !write_all(emitter, value) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_whitespace bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + for i := 0; i < len(value); { + var must_write bool + switch value[i] { + case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\'', '(', ')', '[', ']': + must_write = true + default: + must_write = is_alpha(value, i) + } + if must_write { + if !write(emitter, value, &i) { + return false + } + } else { + w := width(value[i]) + for k := 0; k < w; k++ { + octet := value[i] + i++ + if !put(emitter, '%') { + return false + } + + c := octet >> 4 + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + + c = octet & 0x0f + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + } + } + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + + spaces := false + breaks := false + for i := 0; i < len(value); { + if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && !is_space(value, i+1) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + + emitter.whitespace = false + emitter.indention = false + if emitter.root_context { + emitter.open_ended = true + } + + return true +} + +func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + + if !yaml_emitter_write_indicator(emitter, []byte{'\''}, true, false, false) { + return false + } + + spaces := false + breaks := false + for i := 0; i < len(value); { + if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 && !is_space(value, i+1) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if value[i] == '\'' { + if !put(emitter, '\'') { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'\''}, false, false, false) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + spaces := false + if !yaml_emitter_write_indicator(emitter, []byte{'"'}, true, false, false) { + return false + } + + for i := 0; i < len(value); { + if !is_printable(value, i) || (!emitter.unicode && !is_ascii(value, i)) || + is_bom(value, i) || is_break(value, i) || + value[i] == '"' || value[i] == '\\' { + + octet := value[i] + + var w int + var v rune + switch { + case octet&0x80 == 0x00: + w, v = 1, rune(octet&0x7F) + case octet&0xE0 == 0xC0: + w, v = 2, rune(octet&0x1F) + case octet&0xF0 == 0xE0: + w, v = 3, rune(octet&0x0F) + case octet&0xF8 == 0xF0: + w, v = 4, rune(octet&0x07) + } + for k := 1; k < w; k++ { + octet = value[i+k] + v = (v << 6) + (rune(octet) & 0x3F) + } + i += w + + if !put(emitter, '\\') { + return false + } + + var ok bool + switch v { + case 0x00: + ok = put(emitter, '0') + case 0x07: + ok = put(emitter, 'a') + case 0x08: + ok = put(emitter, 'b') + case 0x09: + ok = put(emitter, 't') + case 0x0A: + ok = put(emitter, 'n') + case 0x0b: + ok = put(emitter, 'v') + case 0x0c: + ok = put(emitter, 'f') + case 0x0d: + ok = put(emitter, 'r') + case 0x1b: + ok = put(emitter, 'e') + case 0x22: + ok = put(emitter, '"') + case 0x5c: + ok = put(emitter, '\\') + case 0x85: + ok = put(emitter, 'N') + case 0xA0: + ok = put(emitter, '_') + case 0x2028: + ok = put(emitter, 'L') + case 0x2029: + ok = put(emitter, 'P') + default: + if v <= 0xFF { + ok = put(emitter, 'x') + w = 2 + } else if v <= 0xFFFF { + ok = put(emitter, 'u') + w = 4 + } else { + ok = put(emitter, 'U') + w = 8 + } + for k := (w - 1) * 4; ok && k >= 0; k -= 4 { + digit := byte((v >> uint(k)) & 0x0F) + if digit < 10 { + ok = put(emitter, digit+'0') + } else { + ok = put(emitter, digit+'A'-10) + } + } + } + if !ok { + return false + } + spaces = false + } else if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 { + if !yaml_emitter_write_indent(emitter) { + return false + } + if is_space(value, i+1) { + if !put(emitter, '\\') { + return false + } + } + i += width(value[i]) + } else if !write(emitter, value, &i) { + return false + } + spaces = true + } else { + if !write(emitter, value, &i) { + return false + } + spaces = false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'"'}, false, false, false) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool { + if is_space(value, 0) || is_break(value, 0) { + indent_hint := []byte{'0' + byte(emitter.best_indent)} + if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) { + return false + } + } + + emitter.open_ended = false + + var chomp_hint [1]byte + if len(value) == 0 { + chomp_hint[0] = '-' + } else { + i := len(value) - 1 + for value[i]&0xC0 == 0x80 { + i-- + } + if !is_break(value, i) { + chomp_hint[0] = '-' + } else if i == 0 { + chomp_hint[0] = '+' + emitter.open_ended = true + } else { + i-- + for value[i]&0xC0 == 0x80 { + i-- + } + if is_break(value, i) { + chomp_hint[0] = '+' + emitter.open_ended = true + } + } + } + if chomp_hint[0] != 0 { + if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) { + return false + } + } + return true +} + +func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool { + if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) { + return false + } + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + if !put_break(emitter) { + return false + } + emitter.indention = true + emitter.whitespace = true + breaks := true + for i := 0; i < len(value); { + if is_break(value, i) { + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + breaks = false + } + } + + return true +} + +func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool { + if !yaml_emitter_write_indicator(emitter, []byte{'>'}, true, false, false) { + return false + } + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + + if !put_break(emitter) { + return false + } + emitter.indention = true + emitter.whitespace = true + + breaks := true + leading_spaces := true + for i := 0; i < len(value); { + if is_break(value, i) { + if !breaks && !leading_spaces && value[i] == '\n' { + k := 0 + for is_break(value, k) { + k += width(value[k]) + } + if !is_blankz(value, k) { + if !put_break(emitter) { + return false + } + } + } + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + leading_spaces = is_blank(value, i) + } + if !breaks && is_space(value, i) && !is_space(value, i+1) && emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + emitter.indention = false + breaks = false + } + } + return true +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/encode.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/encode.go new file mode 100644 index 000000000..0ee738e11 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/encode.go @@ -0,0 +1,390 @@ +package yaml + +import ( + "encoding" + "fmt" + "io" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +// jsonNumber is the interface of the encoding/json.Number datatype. +// Repeating the interface here avoids a dependency on encoding/json, and also +// supports other libraries like jsoniter, which use a similar datatype with +// the same interface. Detecting this interface is useful when dealing with +// structures containing json.Number, which is a string under the hood. The +// encoder should prefer the use of Int64(), Float64() and string(), in that +// order, when encoding this type. +type jsonNumber interface { + Float64() (float64, error) + Int64() (int64, error) + String() string +} + +type encoder struct { + emitter yaml_emitter_t + event yaml_event_t + out []byte + flow bool + // doneInit holds whether the initial stream_start_event has been + // emitted. + doneInit bool +} + +func newEncoder() *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_string(&e.emitter, &e.out) + yaml_emitter_set_unicode(&e.emitter, true) + return e +} + +func newEncoderWithWriter(w io.Writer) *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_writer(&e.emitter, w) + yaml_emitter_set_unicode(&e.emitter, true) + return e +} + +func (e *encoder) init() { + if e.doneInit { + return + } + yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) + e.emit() + e.doneInit = true +} + +func (e *encoder) finish() { + e.emitter.open_ended = false + yaml_stream_end_event_initialize(&e.event) + e.emit() +} + +func (e *encoder) destroy() { + yaml_emitter_delete(&e.emitter) +} + +func (e *encoder) emit() { + // This will internally delete the e.event value. + e.must(yaml_emitter_emit(&e.emitter, &e.event)) +} + +func (e *encoder) must(ok bool) { + if !ok { + msg := e.emitter.problem + if msg == "" { + msg = "unknown problem generating YAML content" + } + failf("%s", msg) + } +} + +func (e *encoder) marshalDoc(tag string, in reflect.Value) { + e.init() + yaml_document_start_event_initialize(&e.event, nil, nil, true) + e.emit() + e.marshal(tag, in) + yaml_document_end_event_initialize(&e.event, true) + e.emit() +} + +func (e *encoder) marshal(tag string, in reflect.Value) { + if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { + e.nilv() + return + } + iface := in.Interface() + switch m := iface.(type) { + case jsonNumber: + integer, err := m.Int64() + if err == nil { + // In this case the json.Number is a valid int64 + in = reflect.ValueOf(integer) + break + } + float, err := m.Float64() + if err == nil { + // In this case the json.Number is a valid float64 + in = reflect.ValueOf(float) + break + } + // fallback case - no number could be obtained + in = reflect.ValueOf(m.String()) + case time.Time, *time.Time: + // Although time.Time implements TextMarshaler, + // we don't want to treat it as a string for YAML + // purposes because YAML has special support for + // timestamps. + case Marshaler: + v, err := m.MarshalYAML() + if err != nil { + fail(err) + } + if v == nil { + e.nilv() + return + } + in = reflect.ValueOf(v) + case encoding.TextMarshaler: + text, err := m.MarshalText() + if err != nil { + fail(err) + } + in = reflect.ValueOf(string(text)) + case nil: + e.nilv() + return + } + switch in.Kind() { + case reflect.Interface: + e.marshal(tag, in.Elem()) + case reflect.Map: + e.mapv(tag, in) + case reflect.Ptr: + if in.Type() == ptrTimeType { + e.timev(tag, in.Elem()) + } else { + e.marshal(tag, in.Elem()) + } + case reflect.Struct: + if in.Type() == timeType { + e.timev(tag, in) + } else { + e.structv(tag, in) + } + case reflect.Slice, reflect.Array: + if in.Type().Elem() == mapItemType { + e.itemsv(tag, in) + } else { + e.slicev(tag, in) + } + case reflect.String: + e.stringv(tag, in) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if in.Type() == durationType { + e.stringv(tag, reflect.ValueOf(iface.(time.Duration).String())) + } else { + e.intv(tag, in) + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + e.uintv(tag, in) + case reflect.Float32, reflect.Float64: + e.floatv(tag, in) + case reflect.Bool: + e.boolv(tag, in) + default: + panic("cannot marshal type: " + in.Type().String()) + } +} + +func (e *encoder) mapv(tag string, in reflect.Value) { + e.mappingv(tag, func() { + keys := keyList(in.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + e.marshal("", k) + e.marshal("", in.MapIndex(k)) + } + }) +} + +func (e *encoder) itemsv(tag string, in reflect.Value) { + e.mappingv(tag, func() { + slice := in.Convert(reflect.TypeOf([]MapItem{})).Interface().([]MapItem) + for _, item := range slice { + e.marshal("", reflect.ValueOf(item.Key)) + e.marshal("", reflect.ValueOf(item.Value)) + } + }) +} + +func (e *encoder) structv(tag string, in reflect.Value) { + sinfo, err := getStructInfo(in.Type()) + if err != nil { + panic(err) + } + e.mappingv(tag, func() { + for _, info := range sinfo.FieldsList { + var value reflect.Value + if info.Inline == nil { + value = in.Field(info.Num) + } else { + value = in.FieldByIndex(info.Inline) + } + if info.OmitEmpty && isZero(value) { + continue + } + e.marshal("", reflect.ValueOf(info.Key)) + e.flow = info.Flow + e.marshal("", value) + } + if sinfo.InlineMap >= 0 { + m := in.Field(sinfo.InlineMap) + if m.Len() > 0 { + e.flow = false + keys := keyList(m.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + if _, found := sinfo.FieldsMap[k.String()]; found { + panic(fmt.Sprintf("Can't have key %q in inlined map; conflicts with struct field", k.String())) + } + e.marshal("", k) + e.flow = false + e.marshal("", m.MapIndex(k)) + } + } + } + }) +} + +func (e *encoder) mappingv(tag string, f func()) { + implicit := tag == "" + style := yaml_BLOCK_MAPPING_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_MAPPING_STYLE + } + yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) + e.emit() + f() + yaml_mapping_end_event_initialize(&e.event) + e.emit() +} + +func (e *encoder) slicev(tag string, in reflect.Value) { + implicit := tag == "" + style := yaml_BLOCK_SEQUENCE_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_SEQUENCE_STYLE + } + e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) + e.emit() + n := in.Len() + for i := 0; i < n; i++ { + e.marshal("", in.Index(i)) + } + e.must(yaml_sequence_end_event_initialize(&e.event)) + e.emit() +} + +// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. +// +// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported +// in YAML 1.2 and by this package, but these should be marshalled quoted for +// the time being for compatibility with other parsers. +func isBase60Float(s string) (result bool) { + // Fast path. + if s == "" { + return false + } + c := s[0] + if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { + return false + } + // Do the full match. + return base60float.MatchString(s) +} + +// From http://yaml.org/type/float.html, except the regular expression there +// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. +var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) + +func (e *encoder) stringv(tag string, in reflect.Value) { + var style yaml_scalar_style_t + s := in.String() + canUsePlain := true + switch { + case !utf8.ValidString(s): + if tag == yaml_BINARY_TAG { + failf("explicitly tagged !!binary data must be base64-encoded") + } + if tag != "" { + failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) + } + // It can't be encoded directly as YAML so use a binary tag + // and encode it as base64. + tag = yaml_BINARY_TAG + s = encodeBase64(s) + case tag == "": + // Check to see if it would resolve to a specific + // tag when encoded unquoted. If it doesn't, + // there's no need to quote it. + rtag, _ := resolve("", s) + canUsePlain = rtag == yaml_STR_TAG && !isBase60Float(s) + } + // Note: it's possible for user code to emit invalid YAML + // if they explicitly specify a tag and a string containing + // text that's incompatible with that tag. + switch { + case strings.Contains(s, "\n"): + style = yaml_LITERAL_SCALAR_STYLE + case canUsePlain: + style = yaml_PLAIN_SCALAR_STYLE + default: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + e.emitScalar(s, "", tag, style) +} + +func (e *encoder) boolv(tag string, in reflect.Value) { + var s string + if in.Bool() { + s = "true" + } else { + s = "false" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) intv(tag string, in reflect.Value) { + s := strconv.FormatInt(in.Int(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) uintv(tag string, in reflect.Value) { + s := strconv.FormatUint(in.Uint(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) timev(tag string, in reflect.Value) { + t := in.Interface().(time.Time) + s := t.Format(time.RFC3339Nano) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) floatv(tag string, in reflect.Value) { + // Issue #352: When formatting, use the precision of the underlying value + precision := 64 + if in.Kind() == reflect.Float32 { + precision = 32 + } + + s := strconv.FormatFloat(in.Float(), 'g', -1, precision) + switch s { + case "+Inf": + s = ".inf" + case "-Inf": + s = "-.inf" + case "NaN": + s = ".nan" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) nilv() { + e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t) { + implicit := tag == "" + e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) + e.emit() +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go new file mode 100644 index 000000000..81d05dfe5 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go @@ -0,0 +1,1095 @@ +package yaml + +import ( + "bytes" +) + +// The parser implements the following grammar: +// +// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +// implicit_document ::= block_node DOCUMENT-END* +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// block_node_or_indentless_sequence ::= +// ALIAS +// | properties (block_content | indentless_block_sequence)? +// | block_content +// | indentless_block_sequence +// block_node ::= ALIAS +// | properties block_content? +// | block_content +// flow_node ::= ALIAS +// | properties flow_content? +// | flow_content +// properties ::= TAG ANCHOR? | ANCHOR TAG? +// block_content ::= block_collection | flow_collection | SCALAR +// flow_content ::= flow_collection | SCALAR +// block_collection ::= block_sequence | block_mapping +// flow_collection ::= flow_sequence | flow_mapping +// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +// block_mapping ::= BLOCK-MAPPING_START +// ((KEY block_node_or_indentless_sequence?)? +// (VALUE block_node_or_indentless_sequence?)?)* +// BLOCK-END +// flow_sequence ::= FLOW-SEQUENCE-START +// (flow_sequence_entry FLOW-ENTRY)* +// flow_sequence_entry? +// FLOW-SEQUENCE-END +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// flow_mapping ::= FLOW-MAPPING-START +// (flow_mapping_entry FLOW-ENTRY)* +// flow_mapping_entry? +// FLOW-MAPPING-END +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + +// Peek the next token in the token queue. +func peek_token(parser *yaml_parser_t) *yaml_token_t { + if parser.token_available || yaml_parser_fetch_more_tokens(parser) { + return &parser.tokens[parser.tokens_head] + } + return nil +} + +// Remove the next token from the queue (must be called after peek_token). +func skip_token(parser *yaml_parser_t) { + parser.token_available = false + parser.tokens_parsed++ + parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN + parser.tokens_head++ +} + +// Get the next event. +func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool { + // Erase the event object. + *event = yaml_event_t{} + + // No events after the end of the stream or error. + if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE { + return true + } + + // Generate the next event. + return yaml_parser_state_machine(parser, event) +} + +// Set parser error. +func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.problem = problem + parser.problem_mark = problem_mark + return false +} + +func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = problem_mark + return false +} + +// State dispatcher. +func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool { + //trace("yaml_parser_state_machine", "state:", parser.state.String()) + + switch parser.state { + case yaml_PARSE_STREAM_START_STATE: + return yaml_parser_parse_stream_start(parser, event) + + case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, true) + + case yaml_PARSE_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, false) + + case yaml_PARSE_DOCUMENT_CONTENT_STATE: + return yaml_parser_parse_document_content(parser, event) + + case yaml_PARSE_DOCUMENT_END_STATE: + return yaml_parser_parse_document_end(parser, event) + + case yaml_PARSE_BLOCK_NODE_STATE: + return yaml_parser_parse_node(parser, event, true, false) + + case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: + return yaml_parser_parse_node(parser, event, true, true) + + case yaml_PARSE_FLOW_NODE_STATE: + return yaml_parser_parse_node(parser, event, false, false) + + case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, true) + + case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, false) + + case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_indentless_sequence_entry(parser, event) + + case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, true) + + case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, false) + + case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: + return yaml_parser_parse_block_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, true) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, false) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event) + + case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, true) + + case yaml_PARSE_FLOW_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, true) + + default: + panic("invalid parser state") + } +} + +// Parse the production: +// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +// ************ +func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_STREAM_START_TOKEN { + return yaml_parser_set_parser_error(parser, "did not find expected ", token.start_mark) + } + parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE + *event = yaml_event_t{ + typ: yaml_STREAM_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + encoding: token.encoding, + } + skip_token(parser) + return true +} + +// Parse the productions: +// implicit_document ::= block_node DOCUMENT-END* +// * +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// ************************* +func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { + + token := peek_token(parser) + if token == nil { + return false + } + + // Parse extra document end indicators. + if !implicit { + for token.typ == yaml_DOCUMENT_END_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } + + if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN && + token.typ != yaml_TAG_DIRECTIVE_TOKEN && + token.typ != yaml_DOCUMENT_START_TOKEN && + token.typ != yaml_STREAM_END_TOKEN { + // Parse an implicit document. + if !yaml_parser_process_directives(parser, nil, nil) { + return false + } + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_BLOCK_NODE_STATE + + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + } else if token.typ != yaml_STREAM_END_TOKEN { + // Parse an explicit document. + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + start_mark := token.start_mark + if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) { + return false + } + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_DOCUMENT_START_TOKEN { + yaml_parser_set_parser_error(parser, + "did not find expected ", token.start_mark) + return false + } + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE + end_mark := token.end_mark + + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: false, + } + skip_token(parser) + + } else { + // Parse the stream end. + parser.state = yaml_PARSE_END_STATE + *event = yaml_event_t{ + typ: yaml_STREAM_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + } + + return true +} + +// Parse the productions: +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// *********** +// +func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VERSION_DIRECTIVE_TOKEN || + token.typ == yaml_TAG_DIRECTIVE_TOKEN || + token.typ == yaml_DOCUMENT_START_TOKEN || + token.typ == yaml_DOCUMENT_END_TOKEN || + token.typ == yaml_STREAM_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + return yaml_parser_process_empty_scalar(parser, event, + token.start_mark) + } + return yaml_parser_parse_node(parser, event, true, false) +} + +// Parse the productions: +// implicit_document ::= block_node DOCUMENT-END* +// ************* +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// +func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + start_mark := token.start_mark + end_mark := token.start_mark + + implicit := true + if token.typ == yaml_DOCUMENT_END_TOKEN { + end_mark = token.end_mark + skip_token(parser) + implicit = false + } + + parser.tag_directives = parser.tag_directives[:0] + + parser.state = yaml_PARSE_DOCUMENT_START_STATE + *event = yaml_event_t{ + typ: yaml_DOCUMENT_END_EVENT, + start_mark: start_mark, + end_mark: end_mark, + implicit: implicit, + } + return true +} + +// Parse the productions: +// block_node_or_indentless_sequence ::= +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// block_node ::= ALIAS +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// flow_node ::= ALIAS +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// properties ::= TAG ANCHOR? | ANCHOR TAG? +// ************************* +// block_content ::= block_collection | flow_collection | SCALAR +// ****** +// flow_content ::= flow_collection | SCALAR +// ****** +func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { + //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_ALIAS_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + *event = yaml_event_t{ + typ: yaml_ALIAS_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + anchor: token.value, + } + skip_token(parser) + return true + } + + start_mark := token.start_mark + end_mark := token.start_mark + + var tag_token bool + var tag_handle, tag_suffix, anchor []byte + var tag_mark yaml_mark_t + if token.typ == yaml_ANCHOR_TOKEN { + anchor = token.value + start_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_TAG_TOKEN { + tag_token = true + tag_handle = token.value + tag_suffix = token.suffix + tag_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } else if token.typ == yaml_TAG_TOKEN { + tag_token = true + tag_handle = token.value + tag_suffix = token.suffix + start_mark = token.start_mark + tag_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_ANCHOR_TOKEN { + anchor = token.value + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } + + var tag []byte + if tag_token { + if len(tag_handle) == 0 { + tag = tag_suffix + tag_suffix = nil + } else { + for i := range parser.tag_directives { + if bytes.Equal(parser.tag_directives[i].handle, tag_handle) { + tag = append([]byte(nil), parser.tag_directives[i].prefix...) + tag = append(tag, tag_suffix...) + break + } + } + if len(tag) == 0 { + yaml_parser_set_parser_error_context(parser, + "while parsing a node", start_mark, + "found undefined tag handle", tag_mark) + return false + } + } + } + + implicit := len(tag) == 0 + if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + return true + } + if token.typ == yaml_SCALAR_TOKEN { + var plain_implicit, quoted_implicit bool + end_mark = token.end_mark + if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') { + plain_implicit = true + } else if len(tag) == 0 { + quoted_implicit = true + } + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + value: token.value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(token.style), + } + skip_token(parser) + return true + } + if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN { + // [Go] Some of the events below can be merged as they differ only on style. + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), + } + return true + } + if token.typ == yaml_FLOW_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + return true + } + if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + return true + } + if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), + } + return true + } + if len(anchor) > 0 || len(tag) > 0 { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + quoted_implicit: false, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + return true + } + + context := "while parsing a flow node" + if block { + context = "while parsing a block node" + } + yaml_parser_set_parser_error_context(parser, context, start_mark, + "did not find expected node content", token.start_mark) + return false +} + +// Parse the productions: +// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +// ******************** *********** * ********* +// +func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } else { + parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } + if token.typ == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + skip_token(parser) + return true + } + + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a block collection", context_mark, + "did not find expected '-' indicator", token.start_mark) +} + +// Parse the productions: +// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +// *********** * +func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_BLOCK_ENTRY_TOKEN && + token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark? + } + return true +} + +// Parse the productions: +// block_mapping ::= BLOCK-MAPPING_START +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* +// +// BLOCK-END +// ********* +// +func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_KEY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } else { + parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } else if token.typ == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + return true + } + + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a block mapping", context_mark, + "did not find expected key", token.start_mark) +} + +// Parse the productions: +// block_mapping ::= BLOCK-MAPPING_START +// +// ((KEY block_node_or_indentless_sequence?)? +// +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END +// +// +func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VALUE_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Parse the productions: +// flow_sequence ::= FLOW-SEQUENCE-START +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * +// +func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + if !first { + if token.typ == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow sequence", context_mark, + "did not find expected ',' or ']'", token.start_mark) + } + } + + if token.typ == yaml_KEY_TOKEN { + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + implicit: true, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + skip_token(parser) + return true + } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + skip_token(parser) + return true +} + +// +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// *** * +// +func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_FLOW_ENTRY_TOKEN && + token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + mark := token.end_mark + skip_token(parser) + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) +} + +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// ***** * +// +func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VALUE_TOKEN { + skip_token(parser) + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * +// +func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, // [Go] Shouldn't this be end_mark? + } + return true +} + +// Parse the productions: +// flow_mapping ::= FLOW-MAPPING-START +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * *** * +// +func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ != yaml_FLOW_MAPPING_END_TOKEN { + if !first { + if token.typ == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow mapping", context_mark, + "did not find expected ',' or '}'", token.start_mark) + } + } + + if token.typ == yaml_KEY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_FLOW_ENTRY_TOKEN && + token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } else { + parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) + } + } else if token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + return true +} + +// Parse the productions: +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * ***** * +// +func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { + token := peek_token(parser) + if token == nil { + return false + } + if empty { + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) + } + if token.typ == yaml_VALUE_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Generate an empty scalar event. +func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool { + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: mark, + end_mark: mark, + value: nil, // Empty + implicit: true, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + return true +} + +var default_tag_directives = []yaml_tag_directive_t{ + {[]byte("!"), []byte("!")}, + {[]byte("!!"), []byte("tag:yaml.org,2002:")}, +} + +// Parse directives. +func yaml_parser_process_directives(parser *yaml_parser_t, + version_directive_ref **yaml_version_directive_t, + tag_directives_ref *[]yaml_tag_directive_t) bool { + + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + + token := peek_token(parser) + if token == nil { + return false + } + + for token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN { + if token.typ == yaml_VERSION_DIRECTIVE_TOKEN { + if version_directive != nil { + yaml_parser_set_parser_error(parser, + "found duplicate %YAML directive", token.start_mark) + return false + } + if token.major != 1 || token.minor != 1 { + yaml_parser_set_parser_error(parser, + "found incompatible YAML document", token.start_mark) + return false + } + version_directive = &yaml_version_directive_t{ + major: token.major, + minor: token.minor, + } + } else if token.typ == yaml_TAG_DIRECTIVE_TOKEN { + value := yaml_tag_directive_t{ + handle: token.value, + prefix: token.prefix, + } + if !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) { + return false + } + tag_directives = append(tag_directives, value) + } + + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + + for i := range default_tag_directives { + if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) { + return false + } + } + + if version_directive_ref != nil { + *version_directive_ref = version_directive + } + if tag_directives_ref != nil { + *tag_directives_ref = tag_directives + } + return true +} + +// Append a tag directive to the directives stack. +func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool { + for i := range parser.tag_directives { + if bytes.Equal(value.handle, parser.tag_directives[i].handle) { + if allow_duplicates { + return true + } + return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark) + } + } + + // [Go] I suspect the copy is unnecessary. This was likely done + // because there was no way to track ownership of the data. + value_copy := yaml_tag_directive_t{ + handle: make([]byte, len(value.handle)), + prefix: make([]byte, len(value.prefix)), + } + copy(value_copy.handle, value.handle) + copy(value_copy.prefix, value.prefix) + parser.tag_directives = append(parser.tag_directives, value_copy) + return true +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go new file mode 100644 index 000000000..7c1f5fac3 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go @@ -0,0 +1,412 @@ +package yaml + +import ( + "io" +) + +// Set the reader error and return 0. +func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool { + parser.error = yaml_READER_ERROR + parser.problem = problem + parser.problem_offset = offset + parser.problem_value = value + return false +} + +// Byte order marks. +const ( + bom_UTF8 = "\xef\xbb\xbf" + bom_UTF16LE = "\xff\xfe" + bom_UTF16BE = "\xfe\xff" +) + +// Determine the input stream encoding by checking the BOM symbol. If no BOM is +// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. +func yaml_parser_determine_encoding(parser *yaml_parser_t) bool { + // Ensure that we had enough bytes in the raw buffer. + for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 { + if !yaml_parser_update_raw_buffer(parser) { + return false + } + } + + // Determine the encoding. + buf := parser.raw_buffer + pos := parser.raw_buffer_pos + avail := len(buf) - pos + if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] { + parser.encoding = yaml_UTF16LE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] { + parser.encoding = yaml_UTF16BE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] { + parser.encoding = yaml_UTF8_ENCODING + parser.raw_buffer_pos += 3 + parser.offset += 3 + } else { + parser.encoding = yaml_UTF8_ENCODING + } + return true +} + +// Update the raw buffer. +func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool { + size_read := 0 + + // Return if the raw buffer is full. + if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) { + return true + } + + // Return on EOF. + if parser.eof { + return true + } + + // Move the remaining bytes in the raw buffer to the beginning. + if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) { + copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:]) + } + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos] + parser.raw_buffer_pos = 0 + + // Call the read handler to fill the buffer. + size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)]) + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read] + if err == io.EOF { + parser.eof = true + } else if err != nil { + return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1) + } + return true +} + +// Ensure that the buffer contains at least `length` characters. +// Return true on success, false on failure. +// +// The length is supposed to be significantly less that the buffer size. +func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { + if parser.read_handler == nil { + panic("read handler must be set") + } + + // [Go] This function was changed to guarantee the requested length size at EOF. + // The fact we need to do this is pretty awful, but the description above implies + // for that to be the case, and there are tests + + // If the EOF flag is set and the raw buffer is empty, do nothing. + if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { + // [Go] ACTUALLY! Read the documentation of this function above. + // This is just broken. To return true, we need to have the + // given length in the buffer. Not doing that means every single + // check that calls this function to make sure the buffer has a + // given length is Go) panicking; or C) accessing invalid memory. + //return true + } + + // Return if the buffer contains enough characters. + if parser.unread >= length { + return true + } + + // Determine the input encoding if it is not known yet. + if parser.encoding == yaml_ANY_ENCODING { + if !yaml_parser_determine_encoding(parser) { + return false + } + } + + // Move the unread characters to the beginning of the buffer. + buffer_len := len(parser.buffer) + if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len { + copy(parser.buffer, parser.buffer[parser.buffer_pos:]) + buffer_len -= parser.buffer_pos + parser.buffer_pos = 0 + } else if parser.buffer_pos == buffer_len { + buffer_len = 0 + parser.buffer_pos = 0 + } + + // Open the whole buffer for writing, and cut it before returning. + parser.buffer = parser.buffer[:cap(parser.buffer)] + + // Fill the buffer until it has enough characters. + first := true + for parser.unread < length { + + // Fill the raw buffer if necessary. + if !first || parser.raw_buffer_pos == len(parser.raw_buffer) { + if !yaml_parser_update_raw_buffer(parser) { + parser.buffer = parser.buffer[:buffer_len] + return false + } + } + first = false + + // Decode the raw buffer. + inner: + for parser.raw_buffer_pos != len(parser.raw_buffer) { + var value rune + var width int + + raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos + + // Decode the next character. + switch parser.encoding { + case yaml_UTF8_ENCODING: + // Decode a UTF-8 character. Check RFC 3629 + // (http://www.ietf.org/rfc/rfc3629.txt) for more details. + // + // The following table (taken from the RFC) is used for + // decoding. + // + // Char. number range | UTF-8 octet sequence + // (hexadecimal) | (binary) + // --------------------+------------------------------------ + // 0000 0000-0000 007F | 0xxxxxxx + // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx + // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx + // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + // + // Additionally, the characters in the range 0xD800-0xDFFF + // are prohibited as they are reserved for use with UTF-16 + // surrogate pairs. + + // Determine the length of the UTF-8 sequence. + octet := parser.raw_buffer[parser.raw_buffer_pos] + switch { + case octet&0x80 == 0x00: + width = 1 + case octet&0xE0 == 0xC0: + width = 2 + case octet&0xF0 == 0xE0: + width = 3 + case octet&0xF8 == 0xF0: + width = 4 + default: + // The leading octet is invalid. + return yaml_parser_set_reader_error(parser, + "invalid leading UTF-8 octet", + parser.offset, int(octet)) + } + + // Check if the raw buffer contains an incomplete character. + if width > raw_unread { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-8 octet sequence", + parser.offset, -1) + } + break inner + } + + // Decode the leading octet. + switch { + case octet&0x80 == 0x00: + value = rune(octet & 0x7F) + case octet&0xE0 == 0xC0: + value = rune(octet & 0x1F) + case octet&0xF0 == 0xE0: + value = rune(octet & 0x0F) + case octet&0xF8 == 0xF0: + value = rune(octet & 0x07) + default: + value = 0 + } + + // Check and decode the trailing octets. + for k := 1; k < width; k++ { + octet = parser.raw_buffer[parser.raw_buffer_pos+k] + + // Check if the octet is valid. + if (octet & 0xC0) != 0x80 { + return yaml_parser_set_reader_error(parser, + "invalid trailing UTF-8 octet", + parser.offset+k, int(octet)) + } + + // Decode the octet. + value = (value << 6) + rune(octet&0x3F) + } + + // Check the length of the sequence against the value. + switch { + case width == 1: + case width == 2 && value >= 0x80: + case width == 3 && value >= 0x800: + case width == 4 && value >= 0x10000: + default: + return yaml_parser_set_reader_error(parser, + "invalid length of a UTF-8 sequence", + parser.offset, -1) + } + + // Check the range of the value. + if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF { + return yaml_parser_set_reader_error(parser, + "invalid Unicode character", + parser.offset, int(value)) + } + + case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING: + var low, high int + if parser.encoding == yaml_UTF16LE_ENCODING { + low, high = 0, 1 + } else { + low, high = 1, 0 + } + + // The UTF-16 encoding is not as simple as one might + // naively think. Check RFC 2781 + // (http://www.ietf.org/rfc/rfc2781.txt). + // + // Normally, two subsequent bytes describe a Unicode + // character. However a special technique (called a + // surrogate pair) is used for specifying character + // values larger than 0xFFFF. + // + // A surrogate pair consists of two pseudo-characters: + // high surrogate area (0xD800-0xDBFF) + // low surrogate area (0xDC00-0xDFFF) + // + // The following formulas are used for decoding + // and encoding characters using surrogate pairs: + // + // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) + // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) + // W1 = 110110yyyyyyyyyy + // W2 = 110111xxxxxxxxxx + // + // where U is the character value, W1 is the high surrogate + // area, W2 is the low surrogate area. + + // Check for incomplete UTF-16 character. + if raw_unread < 2 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 character", + parser.offset, -1) + } + break inner + } + + // Get the character. + value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8) + + // Check for unexpected low surrogate area. + if value&0xFC00 == 0xDC00 { + return yaml_parser_set_reader_error(parser, + "unexpected low surrogate area", + parser.offset, int(value)) + } + + // Check for a high surrogate area. + if value&0xFC00 == 0xD800 { + width = 4 + + // Check for incomplete surrogate pair. + if raw_unread < 4 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 surrogate pair", + parser.offset, -1) + } + break inner + } + + // Get the next character. + value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8) + + // Check for a low surrogate area. + if value2&0xFC00 != 0xDC00 { + return yaml_parser_set_reader_error(parser, + "expected low surrogate area", + parser.offset+2, int(value2)) + } + + // Generate the value of the surrogate pair. + value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF) + } else { + width = 2 + } + + default: + panic("impossible") + } + + // Check if the character is in the allowed range: + // #x9 | #xA | #xD | [#x20-#x7E] (8 bit) + // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) + // | [#x10000-#x10FFFF] (32 bit) + switch { + case value == 0x09: + case value == 0x0A: + case value == 0x0D: + case value >= 0x20 && value <= 0x7E: + case value == 0x85: + case value >= 0xA0 && value <= 0xD7FF: + case value >= 0xE000 && value <= 0xFFFD: + case value >= 0x10000 && value <= 0x10FFFF: + default: + return yaml_parser_set_reader_error(parser, + "control characters are not allowed", + parser.offset, int(value)) + } + + // Move the raw pointers. + parser.raw_buffer_pos += width + parser.offset += width + + // Finally put the character into the buffer. + if value <= 0x7F { + // 0000 0000-0000 007F . 0xxxxxxx + parser.buffer[buffer_len+0] = byte(value) + buffer_len += 1 + } else if value <= 0x7FF { + // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6)) + parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F)) + buffer_len += 2 + } else if value <= 0xFFFF { + // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12)) + parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F)) + buffer_len += 3 + } else { + // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18)) + parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F)) + parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F)) + buffer_len += 4 + } + + parser.unread++ + } + + // On EOF, put NUL into the buffer and return. + if parser.eof { + parser.buffer[buffer_len] = 0 + buffer_len++ + parser.unread++ + break + } + } + // [Go] Read the documentation of this function above. To return true, + // we need to have the given length in the buffer. Not doing that means + // every single check that calls this function to make sure the buffer + // has a given length is Go) panicking; or C) accessing invalid memory. + // This happens here due to the EOF above breaking early. + for buffer_len < length { + parser.buffer[buffer_len] = 0 + buffer_len++ + } + parser.buffer = parser.buffer[:buffer_len] + return true +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go new file mode 100644 index 000000000..4120e0c91 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go @@ -0,0 +1,258 @@ +package yaml + +import ( + "encoding/base64" + "math" + "regexp" + "strconv" + "strings" + "time" +) + +type resolveMapItem struct { + value interface{} + tag string +} + +var resolveTable = make([]byte, 256) +var resolveMap = make(map[string]resolveMapItem) + +func init() { + t := resolveTable + t[int('+')] = 'S' // Sign + t[int('-')] = 'S' + for _, c := range "0123456789" { + t[int(c)] = 'D' // Digit + } + for _, c := range "yYnNtTfFoO~" { + t[int(c)] = 'M' // In map + } + t[int('.')] = '.' // Float (potentially in map) + + var resolveMapList = []struct { + v interface{} + tag string + l []string + }{ + {true, yaml_BOOL_TAG, []string{"y", "Y", "yes", "Yes", "YES"}}, + {true, yaml_BOOL_TAG, []string{"true", "True", "TRUE"}}, + {true, yaml_BOOL_TAG, []string{"on", "On", "ON"}}, + {false, yaml_BOOL_TAG, []string{"n", "N", "no", "No", "NO"}}, + {false, yaml_BOOL_TAG, []string{"false", "False", "FALSE"}}, + {false, yaml_BOOL_TAG, []string{"off", "Off", "OFF"}}, + {nil, yaml_NULL_TAG, []string{"", "~", "null", "Null", "NULL"}}, + {math.NaN(), yaml_FLOAT_TAG, []string{".nan", ".NaN", ".NAN"}}, + {math.Inf(+1), yaml_FLOAT_TAG, []string{".inf", ".Inf", ".INF"}}, + {math.Inf(+1), yaml_FLOAT_TAG, []string{"+.inf", "+.Inf", "+.INF"}}, + {math.Inf(-1), yaml_FLOAT_TAG, []string{"-.inf", "-.Inf", "-.INF"}}, + {"<<", yaml_MERGE_TAG, []string{"<<"}}, + } + + m := resolveMap + for _, item := range resolveMapList { + for _, s := range item.l { + m[s] = resolveMapItem{item.v, item.tag} + } + } +} + +const longTagPrefix = "tag:yaml.org,2002:" + +func shortTag(tag string) string { + // TODO This can easily be made faster and produce less garbage. + if strings.HasPrefix(tag, longTagPrefix) { + return "!!" + tag[len(longTagPrefix):] + } + return tag +} + +func longTag(tag string) string { + if strings.HasPrefix(tag, "!!") { + return longTagPrefix + tag[2:] + } + return tag +} + +func resolvableTag(tag string) bool { + switch tag { + case "", yaml_STR_TAG, yaml_BOOL_TAG, yaml_INT_TAG, yaml_FLOAT_TAG, yaml_NULL_TAG, yaml_TIMESTAMP_TAG: + return true + } + return false +} + +var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`) + +func resolve(tag string, in string) (rtag string, out interface{}) { + if !resolvableTag(tag) { + return tag, in + } + + defer func() { + switch tag { + case "", rtag, yaml_STR_TAG, yaml_BINARY_TAG: + return + case yaml_FLOAT_TAG: + if rtag == yaml_INT_TAG { + switch v := out.(type) { + case int64: + rtag = yaml_FLOAT_TAG + out = float64(v) + return + case int: + rtag = yaml_FLOAT_TAG + out = float64(v) + return + } + } + } + failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag)) + }() + + // Any data is accepted as a !!str or !!binary. + // Otherwise, the prefix is enough of a hint about what it might be. + hint := byte('N') + if in != "" { + hint = resolveTable[in[0]] + } + if hint != 0 && tag != yaml_STR_TAG && tag != yaml_BINARY_TAG { + // Handle things we can lookup in a map. + if item, ok := resolveMap[in]; ok { + return item.tag, item.value + } + + // Base 60 floats are a bad idea, were dropped in YAML 1.2, and + // are purposefully unsupported here. They're still quoted on + // the way out for compatibility with other parser, though. + + switch hint { + case 'M': + // We've already checked the map above. + + case '.': + // Not in the map, so maybe a normal float. + floatv, err := strconv.ParseFloat(in, 64) + if err == nil { + return yaml_FLOAT_TAG, floatv + } + + case 'D', 'S': + // Int, float, or timestamp. + // Only try values as a timestamp if the value is unquoted or there's an explicit + // !!timestamp tag. + if tag == "" || tag == yaml_TIMESTAMP_TAG { + t, ok := parseTimestamp(in) + if ok { + return yaml_TIMESTAMP_TAG, t + } + } + + plain := strings.Replace(in, "_", "", -1) + intv, err := strconv.ParseInt(plain, 0, 64) + if err == nil { + if intv == int64(int(intv)) { + return yaml_INT_TAG, int(intv) + } else { + return yaml_INT_TAG, intv + } + } + uintv, err := strconv.ParseUint(plain, 0, 64) + if err == nil { + return yaml_INT_TAG, uintv + } + if yamlStyleFloat.MatchString(plain) { + floatv, err := strconv.ParseFloat(plain, 64) + if err == nil { + return yaml_FLOAT_TAG, floatv + } + } + if strings.HasPrefix(plain, "0b") { + intv, err := strconv.ParseInt(plain[2:], 2, 64) + if err == nil { + if intv == int64(int(intv)) { + return yaml_INT_TAG, int(intv) + } else { + return yaml_INT_TAG, intv + } + } + uintv, err := strconv.ParseUint(plain[2:], 2, 64) + if err == nil { + return yaml_INT_TAG, uintv + } + } else if strings.HasPrefix(plain, "-0b") { + intv, err := strconv.ParseInt("-" + plain[3:], 2, 64) + if err == nil { + if true || intv == int64(int(intv)) { + return yaml_INT_TAG, int(intv) + } else { + return yaml_INT_TAG, intv + } + } + } + default: + panic("resolveTable item not yet handled: " + string(rune(hint)) + " (with " + in + ")") + } + } + return yaml_STR_TAG, in +} + +// encodeBase64 encodes s as base64 that is broken up into multiple lines +// as appropriate for the resulting length. +func encodeBase64(s string) string { + const lineLen = 70 + encLen := base64.StdEncoding.EncodedLen(len(s)) + lines := encLen/lineLen + 1 + buf := make([]byte, encLen*2+lines) + in := buf[0:encLen] + out := buf[encLen:] + base64.StdEncoding.Encode(in, []byte(s)) + k := 0 + for i := 0; i < len(in); i += lineLen { + j := i + lineLen + if j > len(in) { + j = len(in) + } + k += copy(out[k:], in[i:j]) + if lines > 1 { + out[k] = '\n' + k++ + } + } + return string(out[:k]) +} + +// This is a subset of the formats allowed by the regular expression +// defined at http://yaml.org/type/timestamp.html. +var allowedTimestampFormats = []string{ + "2006-1-2T15:4:5.999999999Z07:00", // RCF3339Nano with short date fields. + "2006-1-2t15:4:5.999999999Z07:00", // RFC3339Nano with short date fields and lower-case "t". + "2006-1-2 15:4:5.999999999", // space separated with no time zone + "2006-1-2", // date only + // Notable exception: time.Parse cannot handle: "2001-12-14 21:59:43.10 -5" + // from the set of examples. +} + +// parseTimestamp parses s as a timestamp string and +// returns the timestamp and reports whether it succeeded. +// Timestamp formats are defined at http://yaml.org/type/timestamp.html +func parseTimestamp(s string) (time.Time, bool) { + // TODO write code to check all the formats supported by + // http://yaml.org/type/timestamp.html instead of using time.Parse. + + // Quick check: all date formats start with YYYY-. + i := 0 + for ; i < len(s); i++ { + if c := s[i]; c < '0' || c > '9' { + break + } + } + if i != 4 || i == len(s) || s[i] != '-' { + return time.Time{}, false + } + for _, format := range allowedTimestampFormats { + if t, err := time.Parse(format, s); err == nil { + return t, true + } + } + return time.Time{}, false +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go new file mode 100644 index 000000000..0b9bb6030 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go @@ -0,0 +1,2711 @@ +package yaml + +import ( + "bytes" + "fmt" +) + +// Introduction +// ************ +// +// The following notes assume that you are familiar with the YAML specification +// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in +// some cases we are less restrictive that it requires. +// +// The process of transforming a YAML stream into a sequence of events is +// divided on two steps: Scanning and Parsing. +// +// The Scanner transforms the input stream into a sequence of tokens, while the +// parser transform the sequence of tokens produced by the Scanner into a +// sequence of parsing events. +// +// The Scanner is rather clever and complicated. The Parser, on the contrary, +// is a straightforward implementation of a recursive-descendant parser (or, +// LL(1) parser, as it is usually called). +// +// Actually there are two issues of Scanning that might be called "clever", the +// rest is quite straightforward. The issues are "block collection start" and +// "simple keys". Both issues are explained below in details. +// +// Here the Scanning step is explained and implemented. We start with the list +// of all the tokens produced by the Scanner together with short descriptions. +// +// Now, tokens: +// +// STREAM-START(encoding) # The stream start. +// STREAM-END # The stream end. +// VERSION-DIRECTIVE(major,minor) # The '%YAML' directive. +// TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive. +// DOCUMENT-START # '---' +// DOCUMENT-END # '...' +// BLOCK-SEQUENCE-START # Indentation increase denoting a block +// BLOCK-MAPPING-START # sequence or a block mapping. +// BLOCK-END # Indentation decrease. +// FLOW-SEQUENCE-START # '[' +// FLOW-SEQUENCE-END # ']' +// BLOCK-SEQUENCE-START # '{' +// BLOCK-SEQUENCE-END # '}' +// BLOCK-ENTRY # '-' +// FLOW-ENTRY # ',' +// KEY # '?' or nothing (simple keys). +// VALUE # ':' +// ALIAS(anchor) # '*anchor' +// ANCHOR(anchor) # '&anchor' +// TAG(handle,suffix) # '!handle!suffix' +// SCALAR(value,style) # A scalar. +// +// The following two tokens are "virtual" tokens denoting the beginning and the +// end of the stream: +// +// STREAM-START(encoding) +// STREAM-END +// +// We pass the information about the input stream encoding with the +// STREAM-START token. +// +// The next two tokens are responsible for tags: +// +// VERSION-DIRECTIVE(major,minor) +// TAG-DIRECTIVE(handle,prefix) +// +// Example: +// +// %YAML 1.1 +// %TAG ! !foo +// %TAG !yaml! tag:yaml.org,2002: +// --- +// +// The correspoding sequence of tokens: +// +// STREAM-START(utf-8) +// VERSION-DIRECTIVE(1,1) +// TAG-DIRECTIVE("!","!foo") +// TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:") +// DOCUMENT-START +// STREAM-END +// +// Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole +// line. +// +// The document start and end indicators are represented by: +// +// DOCUMENT-START +// DOCUMENT-END +// +// Note that if a YAML stream contains an implicit document (without '---' +// and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be +// produced. +// +// In the following examples, we present whole documents together with the +// produced tokens. +// +// 1. An implicit document: +// +// 'a scalar' +// +// Tokens: +// +// STREAM-START(utf-8) +// SCALAR("a scalar",single-quoted) +// STREAM-END +// +// 2. An explicit document: +// +// --- +// 'a scalar' +// ... +// +// Tokens: +// +// STREAM-START(utf-8) +// DOCUMENT-START +// SCALAR("a scalar",single-quoted) +// DOCUMENT-END +// STREAM-END +// +// 3. Several documents in a stream: +// +// 'a scalar' +// --- +// 'another scalar' +// --- +// 'yet another scalar' +// +// Tokens: +// +// STREAM-START(utf-8) +// SCALAR("a scalar",single-quoted) +// DOCUMENT-START +// SCALAR("another scalar",single-quoted) +// DOCUMENT-START +// SCALAR("yet another scalar",single-quoted) +// STREAM-END +// +// We have already introduced the SCALAR token above. The following tokens are +// used to describe aliases, anchors, tag, and scalars: +// +// ALIAS(anchor) +// ANCHOR(anchor) +// TAG(handle,suffix) +// SCALAR(value,style) +// +// The following series of examples illustrate the usage of these tokens: +// +// 1. A recursive sequence: +// +// &A [ *A ] +// +// Tokens: +// +// STREAM-START(utf-8) +// ANCHOR("A") +// FLOW-SEQUENCE-START +// ALIAS("A") +// FLOW-SEQUENCE-END +// STREAM-END +// +// 2. A tagged scalar: +// +// !!float "3.14" # A good approximation. +// +// Tokens: +// +// STREAM-START(utf-8) +// TAG("!!","float") +// SCALAR("3.14",double-quoted) +// STREAM-END +// +// 3. Various scalar styles: +// +// --- # Implicit empty plain scalars do not produce tokens. +// --- a plain scalar +// --- 'a single-quoted scalar' +// --- "a double-quoted scalar" +// --- |- +// a literal scalar +// --- >- +// a folded +// scalar +// +// Tokens: +// +// STREAM-START(utf-8) +// DOCUMENT-START +// DOCUMENT-START +// SCALAR("a plain scalar",plain) +// DOCUMENT-START +// SCALAR("a single-quoted scalar",single-quoted) +// DOCUMENT-START +// SCALAR("a double-quoted scalar",double-quoted) +// DOCUMENT-START +// SCALAR("a literal scalar",literal) +// DOCUMENT-START +// SCALAR("a folded scalar",folded) +// STREAM-END +// +// Now it's time to review collection-related tokens. We will start with +// flow collections: +// +// FLOW-SEQUENCE-START +// FLOW-SEQUENCE-END +// FLOW-MAPPING-START +// FLOW-MAPPING-END +// FLOW-ENTRY +// KEY +// VALUE +// +// The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and +// FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}' +// correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the +// indicators '?' and ':', which are used for denoting mapping keys and values, +// are represented by the KEY and VALUE tokens. +// +// The following examples show flow collections: +// +// 1. A flow sequence: +// +// [item 1, item 2, item 3] +// +// Tokens: +// +// STREAM-START(utf-8) +// FLOW-SEQUENCE-START +// SCALAR("item 1",plain) +// FLOW-ENTRY +// SCALAR("item 2",plain) +// FLOW-ENTRY +// SCALAR("item 3",plain) +// FLOW-SEQUENCE-END +// STREAM-END +// +// 2. A flow mapping: +// +// { +// a simple key: a value, # Note that the KEY token is produced. +// ? a complex key: another value, +// } +// +// Tokens: +// +// STREAM-START(utf-8) +// FLOW-MAPPING-START +// KEY +// SCALAR("a simple key",plain) +// VALUE +// SCALAR("a value",plain) +// FLOW-ENTRY +// KEY +// SCALAR("a complex key",plain) +// VALUE +// SCALAR("another value",plain) +// FLOW-ENTRY +// FLOW-MAPPING-END +// STREAM-END +// +// A simple key is a key which is not denoted by the '?' indicator. Note that +// the Scanner still produce the KEY token whenever it encounters a simple key. +// +// For scanning block collections, the following tokens are used (note that we +// repeat KEY and VALUE here): +// +// BLOCK-SEQUENCE-START +// BLOCK-MAPPING-START +// BLOCK-END +// BLOCK-ENTRY +// KEY +// VALUE +// +// The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation +// increase that precedes a block collection (cf. the INDENT token in Python). +// The token BLOCK-END denote indentation decrease that ends a block collection +// (cf. the DEDENT token in Python). However YAML has some syntax pecularities +// that makes detections of these tokens more complex. +// +// The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators +// '-', '?', and ':' correspondingly. +// +// The following examples show how the tokens BLOCK-SEQUENCE-START, +// BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner: +// +// 1. Block sequences: +// +// - item 1 +// - item 2 +// - +// - item 3.1 +// - item 3.2 +// - +// key 1: value 1 +// key 2: value 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-ENTRY +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 3.1",plain) +// BLOCK-ENTRY +// SCALAR("item 3.2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// 2. Block mappings: +// +// a simple key: a value # The KEY token is produced here. +// ? a complex key +// : another value +// a mapping: +// key 1: value 1 +// key 2: value 2 +// a sequence: +// - item 1 +// - item 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("a simple key",plain) +// VALUE +// SCALAR("a value",plain) +// KEY +// SCALAR("a complex key",plain) +// VALUE +// SCALAR("another value",plain) +// KEY +// SCALAR("a mapping",plain) +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// KEY +// SCALAR("a sequence",plain) +// VALUE +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// YAML does not always require to start a new block collection from a new +// line. If the current line contains only '-', '?', and ':' indicators, a new +// block collection may start at the current line. The following examples +// illustrate this case: +// +// 1. Collections in a sequence: +// +// - - item 1 +// - item 2 +// - key 1: value 1 +// key 2: value 2 +// - ? complex key +// : complex value +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("complex key") +// VALUE +// SCALAR("complex value") +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// 2. Collections in a mapping: +// +// ? a sequence +// : - item 1 +// - item 2 +// ? a mapping +// : key 1: value 1 +// key 2: value 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("a sequence",plain) +// VALUE +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// KEY +// SCALAR("a mapping",plain) +// VALUE +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// YAML also permits non-indented sequences if they are included into a block +// mapping. In this case, the token BLOCK-SEQUENCE-START is not produced: +// +// key: +// - item 1 # BLOCK-SEQUENCE-START is NOT produced here. +// - item 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("key",plain) +// VALUE +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// + +// Ensure that the buffer contains the required number of characters. +// Return true on success, false on failure (reader error or memory error). +func cache(parser *yaml_parser_t, length int) bool { + // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B) + return parser.unread >= length || yaml_parser_update_buffer(parser, length) +} + +// Advance the buffer pointer. +func skip(parser *yaml_parser_t) { + parser.mark.index++ + parser.mark.column++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) +} + +func skip_line(parser *yaml_parser_t) { + if is_crlf(parser.buffer, parser.buffer_pos) { + parser.mark.index += 2 + parser.mark.column = 0 + parser.mark.line++ + parser.unread -= 2 + parser.buffer_pos += 2 + } else if is_break(parser.buffer, parser.buffer_pos) { + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) + } +} + +// Copy a character to a string buffer and advance pointers. +func read(parser *yaml_parser_t, s []byte) []byte { + w := width(parser.buffer[parser.buffer_pos]) + if w == 0 { + panic("invalid character sequence") + } + if len(s) == 0 { + s = make([]byte, 0, 32) + } + if w == 1 && len(s)+w <= cap(s) { + s = s[:len(s)+1] + s[len(s)-1] = parser.buffer[parser.buffer_pos] + parser.buffer_pos++ + } else { + s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) + parser.buffer_pos += w + } + parser.mark.index++ + parser.mark.column++ + parser.unread-- + return s +} + +// Copy a line break character to a string buffer and advance pointers. +func read_line(parser *yaml_parser_t, s []byte) []byte { + buf := parser.buffer + pos := parser.buffer_pos + switch { + case buf[pos] == '\r' && buf[pos+1] == '\n': + // CR LF . LF + s = append(s, '\n') + parser.buffer_pos += 2 + parser.mark.index++ + parser.unread-- + case buf[pos] == '\r' || buf[pos] == '\n': + // CR|LF . LF + s = append(s, '\n') + parser.buffer_pos += 1 + case buf[pos] == '\xC2' && buf[pos+1] == '\x85': + // NEL . LF + s = append(s, '\n') + parser.buffer_pos += 2 + case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'): + // LS|PS . LS|PS + s = append(s, buf[parser.buffer_pos:pos+3]...) + parser.buffer_pos += 3 + default: + return s + } + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + return s +} + +// Get the next token. +func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool { + // Erase the token object. + *token = yaml_token_t{} // [Go] Is this necessary? + + // No tokens after STREAM-END or error. + if parser.stream_end_produced || parser.error != yaml_NO_ERROR { + return true + } + + // Ensure that the tokens queue contains enough tokens. + if !parser.token_available { + if !yaml_parser_fetch_more_tokens(parser) { + return false + } + } + + // Fetch the next token from the queue. + *token = parser.tokens[parser.tokens_head] + parser.tokens_head++ + parser.tokens_parsed++ + parser.token_available = false + + if token.typ == yaml_STREAM_END_TOKEN { + parser.stream_end_produced = true + } + return true +} + +// Set the scanner error and return false. +func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool { + parser.error = yaml_SCANNER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = parser.mark + return false +} + +func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool { + context := "while parsing a tag" + if directive { + context = "while parsing a %TAG directive" + } + return yaml_parser_set_scanner_error(parser, context, context_mark, problem) +} + +func trace(args ...interface{}) func() { + pargs := append([]interface{}{"+++"}, args...) + fmt.Println(pargs...) + pargs = append([]interface{}{"---"}, args...) + return func() { fmt.Println(pargs...) } +} + +// Ensure that the tokens queue contains at least one token which can be +// returned to the Parser. +func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { + // While we need more tokens to fetch, do it. + for { + if parser.tokens_head != len(parser.tokens) { + // If queue is non-empty, check if any potential simple key may + // occupy the head position. + head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed] + if !ok { + break + } else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok { + return false + } else if !valid { + break + } + } + // Fetch the next token. + if !yaml_parser_fetch_next_token(parser) { + return false + } + } + + parser.token_available = true + return true +} + +// The dispatcher for token fetchers. +func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { + // Ensure that the buffer is initialized. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check if we just started scanning. Fetch STREAM-START then. + if !parser.stream_start_produced { + return yaml_parser_fetch_stream_start(parser) + } + + // Eat whitespaces and comments until we reach the next token. + if !yaml_parser_scan_to_next_token(parser) { + return false + } + + // Check the indentation level against the current column. + if !yaml_parser_unroll_indent(parser, parser.mark.column) { + return false + } + + // Ensure that the buffer contains at least 4 characters. 4 is the length + // of the longest indicators ('--- ' and '... '). + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + + // Is it the end of the stream? + if is_z(parser.buffer, parser.buffer_pos) { + return yaml_parser_fetch_stream_end(parser) + } + + // Is it a directive? + if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' { + return yaml_parser_fetch_directive(parser) + } + + buf := parser.buffer + pos := parser.buffer_pos + + // Is it the document start indicator? + if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN) + } + + // Is it the document end indicator? + if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN) + } + + // Is it the flow sequence start indicator? + if buf[pos] == '[' { + return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN) + } + + // Is it the flow mapping start indicator? + if parser.buffer[parser.buffer_pos] == '{' { + return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN) + } + + // Is it the flow sequence end indicator? + if parser.buffer[parser.buffer_pos] == ']' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_SEQUENCE_END_TOKEN) + } + + // Is it the flow mapping end indicator? + if parser.buffer[parser.buffer_pos] == '}' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_MAPPING_END_TOKEN) + } + + // Is it the flow entry indicator? + if parser.buffer[parser.buffer_pos] == ',' { + return yaml_parser_fetch_flow_entry(parser) + } + + // Is it the block entry indicator? + if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) { + return yaml_parser_fetch_block_entry(parser) + } + + // Is it the key indicator? + if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_key(parser) + } + + // Is it the value indicator? + if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_value(parser) + } + + // Is it an alias? + if parser.buffer[parser.buffer_pos] == '*' { + return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN) + } + + // Is it an anchor? + if parser.buffer[parser.buffer_pos] == '&' { + return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN) + } + + // Is it a tag? + if parser.buffer[parser.buffer_pos] == '!' { + return yaml_parser_fetch_tag(parser) + } + + // Is it a literal scalar? + if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, true) + } + + // Is it a folded scalar? + if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, false) + } + + // Is it a single-quoted scalar? + if parser.buffer[parser.buffer_pos] == '\'' { + return yaml_parser_fetch_flow_scalar(parser, true) + } + + // Is it a double-quoted scalar? + if parser.buffer[parser.buffer_pos] == '"' { + return yaml_parser_fetch_flow_scalar(parser, false) + } + + // Is it a plain scalar? + // + // A plain scalar may start with any non-blank characters except + // + // '-', '?', ':', ',', '[', ']', '{', '}', + // '#', '&', '*', '!', '|', '>', '\'', '\"', + // '%', '@', '`'. + // + // In the block context (and, for the '-' indicator, in the flow context + // too), it may also start with the characters + // + // '-', '?', ':' + // + // if it is followed by a non-space character. + // + // The last rule is more restrictive than the specification requires. + // [Go] Make this logic more reasonable. + //switch parser.buffer[parser.buffer_pos] { + //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`': + //} + if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' || + parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' || + parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || + parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' || + parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' || + parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' || + parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' || + parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' || + parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') || + (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) || + (parser.flow_level == 0 && + (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') && + !is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_plain_scalar(parser) + } + + // If we don't determine the token type so far, it is an error. + return yaml_parser_set_scanner_error(parser, + "while scanning for the next token", parser.mark, + "found character that cannot start any token") +} + +func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) { + if !simple_key.possible { + return false, true + } + + // The 1.2 specification says: + // + // "If the ? indicator is omitted, parsing needs to see past the + // implicit key to recognize it as such. To limit the amount of + // lookahead required, the “:” indicator must appear at most 1024 + // Unicode characters beyond the start of the key. In addition, the key + // is restricted to a single line." + // + if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index { + // Check if the potential simple key to be removed is required. + if simple_key.required { + return false, yaml_parser_set_scanner_error(parser, + "while scanning a simple key", simple_key.mark, + "could not find expected ':'") + } + simple_key.possible = false + return false, true + } + return true, true +} + +// Check if a simple key may start at the current position and add it if +// needed. +func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { + // A simple key is required at the current position if the scanner is in + // the block context and the current column coincides with the indentation + // level. + + required := parser.flow_level == 0 && parser.indent == parser.mark.column + + // + // If the current position may start a simple key, save it. + // + if parser.simple_key_allowed { + simple_key := yaml_simple_key_t{ + possible: true, + required: required, + token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + mark: parser.mark, + } + + if !yaml_parser_remove_simple_key(parser) { + return false + } + parser.simple_keys[len(parser.simple_keys)-1] = simple_key + parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1 + } + return true +} + +// Remove a potential simple key at the current flow level. +func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { + i := len(parser.simple_keys) - 1 + if parser.simple_keys[i].possible { + // If the key is required, it is an error. + if parser.simple_keys[i].required { + return yaml_parser_set_scanner_error(parser, + "while scanning a simple key", parser.simple_keys[i].mark, + "could not find expected ':'") + } + // Remove the key from the stack. + parser.simple_keys[i].possible = false + delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number) + } + return true +} + +// max_flow_level limits the flow_level +const max_flow_level = 10000 + +// Increase the flow level and resize the simple key list if needed. +func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { + // Reset the simple key on the next level. + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{ + possible: false, + required: false, + token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + mark: parser.mark, + }) + + // Increase the flow level. + parser.flow_level++ + if parser.flow_level > max_flow_level { + return yaml_parser_set_scanner_error(parser, + "while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark, + fmt.Sprintf("exceeded max depth of %d", max_flow_level)) + } + return true +} + +// Decrease the flow level. +func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { + if parser.flow_level > 0 { + parser.flow_level-- + last := len(parser.simple_keys) - 1 + delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number) + parser.simple_keys = parser.simple_keys[:last] + } + return true +} + +// max_indents limits the indents stack size +const max_indents = 10000 + +// Push the current indentation level to the stack and set the new level +// the current column is greater than the indentation level. In this case, +// append or insert the specified token into the token queue. +func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool { + // In the flow context, do nothing. + if parser.flow_level > 0 { + return true + } + + if parser.indent < column { + // Push the current indentation level to the stack and set the new + // indentation level. + parser.indents = append(parser.indents, parser.indent) + parser.indent = column + if len(parser.indents) > max_indents { + return yaml_parser_set_scanner_error(parser, + "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark, + fmt.Sprintf("exceeded max depth of %d", max_indents)) + } + + // Create a token and insert it into the queue. + token := yaml_token_t{ + typ: typ, + start_mark: mark, + end_mark: mark, + } + if number > -1 { + number -= parser.tokens_parsed + } + yaml_insert_token(parser, number, &token) + } + return true +} + +// Pop indentation levels from the indents stack until the current level +// becomes less or equal to the column. For each indentation level, append +// the BLOCK-END token. +func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool { + // In the flow context, do nothing. + if parser.flow_level > 0 { + return true + } + + // Loop through the indentation levels in the stack. + for parser.indent > column { + // Create a token and append it to the queue. + token := yaml_token_t{ + typ: yaml_BLOCK_END_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + } + yaml_insert_token(parser, -1, &token) + + // Pop the indentation level. + parser.indent = parser.indents[len(parser.indents)-1] + parser.indents = parser.indents[:len(parser.indents)-1] + } + return true +} + +// Initialize the scanner and produce the STREAM-START token. +func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool { + + // Set the initial indentation. + parser.indent = -1 + + // Initialize the simple key stack. + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) + + parser.simple_keys_by_tok = make(map[int]int) + + // A simple key is allowed at the beginning of the stream. + parser.simple_key_allowed = true + + // We have started. + parser.stream_start_produced = true + + // Create the STREAM-START token and append it to the queue. + token := yaml_token_t{ + typ: yaml_STREAM_START_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + encoding: parser.encoding, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the STREAM-END token and shut down the scanner. +func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { + + // Force new line. + if parser.mark.column != 0 { + parser.mark.column = 0 + parser.mark.line++ + } + + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Create the STREAM-END token and append it to the queue. + token := yaml_token_t{ + typ: yaml_STREAM_END_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token. +func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Create the YAML-DIRECTIVE or TAG-DIRECTIVE token. + token := yaml_token_t{} + if !yaml_parser_scan_directive(parser, &token) { + return false + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the DOCUMENT-START or DOCUMENT-END token. +func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Consume the token. + start_mark := parser.mark + + skip(parser) + skip(parser) + skip(parser) + + end_mark := parser.mark + + // Create the DOCUMENT-START or DOCUMENT-END token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token. +func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // The indicators '[' and '{' may start a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // Increase the flow level. + if !yaml_parser_increase_flow_level(parser) { + return false + } + + // A simple key may follow the indicators '[' and '{'. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token. +func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // Reset any potential simple key on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Decrease the flow level. + if !yaml_parser_decrease_flow_level(parser) { + return false + } + + // No simple keys after the indicators ']' and '}'. + parser.simple_key_allowed = false + + // Consume the token. + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-ENTRY token. +func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool { + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after ','. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-ENTRY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_FLOW_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the BLOCK-ENTRY token. +func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool { + // Check if the scanner is in the block context. + if parser.flow_level == 0 { + // Check if we are allowed to start a new entry. + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "block sequence entries are not allowed in this context") + } + // Add the BLOCK-SEQUENCE-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) { + return false + } + } else { + // It is an error for the '-' indicator to occur in the flow context, + // but we let the Parser detect and report about it because the Parser + // is able to point to the context. + } + + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after '-'. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the BLOCK-ENTRY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_BLOCK_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the KEY token. +func yaml_parser_fetch_key(parser *yaml_parser_t) bool { + + // In the block context, additional checks are required. + if parser.flow_level == 0 { + // Check if we are allowed to start a new key (not nessesary simple). + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping keys are not allowed in this context") + } + // Add the BLOCK-MAPPING-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after '?' in the block context. + parser.simple_key_allowed = parser.flow_level == 0 + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the KEY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_KEY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the VALUE token. +func yaml_parser_fetch_value(parser *yaml_parser_t) bool { + + simple_key := &parser.simple_keys[len(parser.simple_keys)-1] + + // Have we found a simple key? + if valid, ok := yaml_simple_key_is_valid(parser, simple_key); !ok { + return false + + } else if valid { + + // Create the KEY token and insert it into the queue. + token := yaml_token_t{ + typ: yaml_KEY_TOKEN, + start_mark: simple_key.mark, + end_mark: simple_key.mark, + } + yaml_insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token) + + // In the block context, we may need to add the BLOCK-MAPPING-START token. + if !yaml_parser_roll_indent(parser, simple_key.mark.column, + simple_key.token_number, + yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) { + return false + } + + // Remove the simple key. + simple_key.possible = false + delete(parser.simple_keys_by_tok, simple_key.token_number) + + // A simple key cannot follow another simple key. + parser.simple_key_allowed = false + + } else { + // The ':' indicator follows a complex key. + + // In the block context, extra checks are required. + if parser.flow_level == 0 { + + // Check if we are allowed to start a complex value. + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping values are not allowed in this context") + } + + // Add the BLOCK-MAPPING-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + // Simple keys after ':' are allowed in the block context. + parser.simple_key_allowed = parser.flow_level == 0 + } + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the VALUE token and append it to the queue. + token := yaml_token_t{ + typ: yaml_VALUE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the ALIAS or ANCHOR token. +func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // An anchor or an alias could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow an anchor or an alias. + parser.simple_key_allowed = false + + // Create the ALIAS or ANCHOR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_anchor(parser, &token, typ) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the TAG token. +func yaml_parser_fetch_tag(parser *yaml_parser_t) bool { + // A tag could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a tag. + parser.simple_key_allowed = false + + // Create the TAG token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_tag(parser, &token) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens. +func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool { + // Remove any potential simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // A simple key may follow a block scalar. + parser.simple_key_allowed = true + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_block_scalar(parser, &token, literal) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens. +func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool { + // A plain scalar could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a flow scalar. + parser.simple_key_allowed = false + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_flow_scalar(parser, &token, single) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,plain) token. +func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool { + // A plain scalar could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a flow scalar. + parser.simple_key_allowed = false + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_plain_scalar(parser, &token) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Eat whitespaces and comments until the next token is found. +func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { + + // Until the next token is not found. + for { + // Allow the BOM mark to start a line. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) { + skip(parser) + } + + // Eat whitespaces. + // Tabs are allowed: + // - in the flow context + // - in the block context, but not at the beginning of the line or + // after '-', '?', or ':' (complex value). + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for parser.buffer[parser.buffer_pos] == ' ' || ((parser.flow_level > 0 || !parser.simple_key_allowed) && parser.buffer[parser.buffer_pos] == '\t') { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Eat a comment until a line break. + if parser.buffer[parser.buffer_pos] == '#' { + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // If it is a line break, eat it. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + + // In the block context, a new line may start a simple key. + if parser.flow_level == 0 { + parser.simple_key_allowed = true + } + } else { + break // We have found a token. + } + } + + return true +} + +// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// +func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { + // Eat '%'. + start_mark := parser.mark + skip(parser) + + // Scan the directive name. + var name []byte + if !yaml_parser_scan_directive_name(parser, start_mark, &name) { + return false + } + + // Is it a YAML directive? + if bytes.Equal(name, []byte("YAML")) { + // Scan the VERSION directive value. + var major, minor int8 + if !yaml_parser_scan_version_directive_value(parser, start_mark, &major, &minor) { + return false + } + end_mark := parser.mark + + // Create a VERSION-DIRECTIVE token. + *token = yaml_token_t{ + typ: yaml_VERSION_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + major: major, + minor: minor, + } + + // Is it a TAG directive? + } else if bytes.Equal(name, []byte("TAG")) { + // Scan the TAG directive value. + var handle, prefix []byte + if !yaml_parser_scan_tag_directive_value(parser, start_mark, &handle, &prefix) { + return false + } + end_mark := parser.mark + + // Create a TAG-DIRECTIVE token. + *token = yaml_token_t{ + typ: yaml_TAG_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + prefix: prefix, + } + + // Unknown directive. + } else { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found unknown directive name") + return false + } + + // Eat the rest of the line including any comments. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + if parser.buffer[parser.buffer_pos] == '#' { + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // Check if we are at the end of the line. + if !is_breakz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "did not find expected comment or line break") + return false + } + + // Eat a line break. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } + + return true +} + +// Scan the directive name. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ +// +func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { + // Consume the directive name. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + var s []byte + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the name is empty. + if len(s) == 0 { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "could not find expected directive name") + return false + } + + // Check for an blank character after the name. + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found unexpected non-alphabetical character") + return false + } + *name = s + return true +} + +// Scan the value of VERSION-DIRECTIVE. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^^^^^^ +func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { + // Eat whitespaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Consume the major version number. + if !yaml_parser_scan_version_directive_number(parser, start_mark, major) { + return false + } + + // Eat '.'. + if parser.buffer[parser.buffer_pos] != '.' { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected digit or '.' character") + } + + skip(parser) + + // Consume the minor version number. + if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) { + return false + } + return true +} + +const max_number_length = 2 + +// Scan the version number of VERSION-DIRECTIVE. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ +func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { + + // Repeat while the next character is digit. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + var value, length int8 + for is_digit(parser.buffer, parser.buffer_pos) { + // Check if the number is too long. + length++ + if length > max_number_length { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "found extremely long version number") + } + value = value*10 + int8(as_digit(parser.buffer, parser.buffer_pos)) + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the number was present. + if length == 0 { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected version number") + } + *number = value + return true +} + +// Scan the value of a TAG-DIRECTIVE token. +// +// Scope: +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// +func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { + var handle_value, prefix_value []byte + + // Eat whitespaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Scan a handle. + if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) { + return false + } + + // Expect a whitespace. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blank(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace") + return false + } + + // Eat whitespaces. + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Scan a prefix. + if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) { + return false + } + + // Expect a whitespace or line break. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace or line break") + return false + } + + *handle = handle_value + *prefix = prefix_value + return true +} + +func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, typ yaml_token_type_t) bool { + var s []byte + + // Eat the indicator character. + start_mark := parser.mark + skip(parser) + + // Consume the value. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + end_mark := parser.mark + + /* + * Check if length of the anchor is greater than 0 and it is followed by + * a whitespace character or one of the indicators: + * + * '?', ':', ',', ']', '}', '%', '@', '`'. + */ + + if len(s) == 0 || + !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '?' || + parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '}' || + parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' || + parser.buffer[parser.buffer_pos] == '`') { + context := "while scanning an alias" + if typ == yaml_ANCHOR_TOKEN { + context = "while scanning an anchor" + } + yaml_parser_set_scanner_error(parser, context, start_mark, + "did not find expected alphabetic or numeric character") + return false + } + + // Create a token. + *token = yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + value: s, + } + + return true +} + +/* + * Scan a TAG token. + */ + +func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool { + var handle, suffix []byte + + start_mark := parser.mark + + // Check if the tag is in the canonical form. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + if parser.buffer[parser.buffer_pos+1] == '<' { + // Keep the handle as '' + + // Eat '!<' + skip(parser) + skip(parser) + + // Consume the tag value. + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + + // Check for '>' and eat it. + if parser.buffer[parser.buffer_pos] != '>' { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find the expected '>'") + return false + } + + skip(parser) + } else { + // The tag has either the '!suffix' or the '!handle!suffix' form. + + // First, try to scan a handle. + if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) { + return false + } + + // Check if it is, indeed, handle. + if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' { + // Scan the suffix now. + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + } else { + // It wasn't a handle after all. Scan the rest of the tag. + if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) { + return false + } + + // Set the handle to '!'. + handle = []byte{'!'} + + // A special case: the '!' tag. Set the handle to '' and the + // suffix to '!'. + if len(suffix) == 0 { + handle, suffix = suffix, handle + } + } + } + + // Check the character which ends the tag. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find expected whitespace or line break") + return false + } + + end_mark := parser.mark + + // Create a token. + *token = yaml_token_t{ + typ: yaml_TAG_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + suffix: suffix, + } + return true +} + +// Scan a tag handle. +func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool { + // Check the initial '!' character. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.buffer[parser.buffer_pos] != '!' { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + + var s []byte + + // Copy the '!' character. + s = read(parser, s) + + // Copy all subsequent alphabetical and numerical characters. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the trailing character is '!' and copy it. + if parser.buffer[parser.buffer_pos] == '!' { + s = read(parser, s) + } else { + // It's either the '!' tag or not really a tag handle. If it's a %TAG + // directive, it's an error. If it's a tag token, it must be a part of URI. + if directive && string(s) != "!" { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + } + + *handle = s + return true +} + +// Scan a tag. +func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool { + //size_t length = head ? strlen((char *)head) : 0 + var s []byte + hasTag := len(head) > 0 + + // Copy the head if needed. + // + // Note that we don't copy the leading '!' character. + if len(head) > 1 { + s = append(s, head[1:]...) + } + + // Scan the tag. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // The set of characters that may appear in URI is as follows: + // + // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&', + // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']', + // '%'. + // [Go] Convert this into more reasonable logic. + for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' || + parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' || + parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' || + parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '=' || + parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '$' || + parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '.' || + parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '~' || + parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '\'' || + parser.buffer[parser.buffer_pos] == '(' || parser.buffer[parser.buffer_pos] == ')' || + parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' || + parser.buffer[parser.buffer_pos] == '%' { + // Check if it is a URI-escape sequence. + if parser.buffer[parser.buffer_pos] == '%' { + if !yaml_parser_scan_uri_escapes(parser, directive, start_mark, &s) { + return false + } + } else { + s = read(parser, s) + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + hasTag = true + } + + if !hasTag { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected tag URI") + return false + } + *uri = s + return true +} + +// Decode an URI-escape sequence corresponding to a single UTF-8 character. +func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool { + + // Decode the required number of characters. + w := 1024 + for w > 0 { + // Check for a URI-escaped octet. + if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { + return false + } + + if !(parser.buffer[parser.buffer_pos] == '%' && + is_hex(parser.buffer, parser.buffer_pos+1) && + is_hex(parser.buffer, parser.buffer_pos+2)) { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find URI escaped octet") + } + + // Get the octet. + octet := byte((as_hex(parser.buffer, parser.buffer_pos+1) << 4) + as_hex(parser.buffer, parser.buffer_pos+2)) + + // If it is the leading octet, determine the length of the UTF-8 sequence. + if w == 1024 { + w = width(octet) + if w == 0 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect leading UTF-8 octet") + } + } else { + // Check if the trailing octet is correct. + if octet&0xC0 != 0x80 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect trailing UTF-8 octet") + } + } + + // Copy the octet and move the pointers. + *s = append(*s, octet) + skip(parser) + skip(parser) + skip(parser) + w-- + } + return true +} + +// Scan a block scalar. +func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, literal bool) bool { + // Eat the indicator '|' or '>'. + start_mark := parser.mark + skip(parser) + + // Scan the additional block scalar indicators. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check for a chomping indicator. + var chomping, increment int + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + // Set the chomping method and eat the indicator. + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + skip(parser) + + // Check for an indentation indicator. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_digit(parser.buffer, parser.buffer_pos) { + // Check that the indentation is greater than 0. + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + + // Get the indentation level and eat the indicator. + increment = as_digit(parser.buffer, parser.buffer_pos) + skip(parser) + } + + } else if is_digit(parser.buffer, parser.buffer_pos) { + // Do the same as above, but in the opposite order. + + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + increment = as_digit(parser.buffer, parser.buffer_pos) + skip(parser) + + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + skip(parser) + } + } + + // Eat whitespaces and comments to the end of the line. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + if parser.buffer[parser.buffer_pos] == '#' { + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // Check if we are at the end of the line. + if !is_breakz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "did not find expected comment or line break") + return false + } + + // Eat a line break. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } + + end_mark := parser.mark + + // Set the indentation level if it was specified. + var indent int + if increment > 0 { + if parser.indent >= 0 { + indent = parser.indent + increment + } else { + indent = increment + } + } + + // Scan the leading line breaks and determine the indentation level if needed. + var s, leading_break, trailing_breaks []byte + if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { + return false + } + + // Scan the block scalar content. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + var leading_blank, trailing_blank bool + for parser.mark.column == indent && !is_z(parser.buffer, parser.buffer_pos) { + // We are at the beginning of a non-empty line. + + // Is it a trailing whitespace? + trailing_blank = is_blank(parser.buffer, parser.buffer_pos) + + // Check if we need to fold the leading line break. + if !literal && !leading_blank && !trailing_blank && len(leading_break) > 0 && leading_break[0] == '\n' { + // Do we need to join the lines by space? + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } + } else { + s = append(s, leading_break...) + } + leading_break = leading_break[:0] + + // Append the remaining line breaks. + s = append(s, trailing_breaks...) + trailing_breaks = trailing_breaks[:0] + + // Is it a leading whitespace? + leading_blank = is_blank(parser.buffer, parser.buffer_pos) + + // Consume the current line. + for !is_breakz(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Consume the line break. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + leading_break = read_line(parser, leading_break) + + // Eat the following indentation spaces and line breaks. + if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { + return false + } + } + + // Chomp the tail. + if chomping != -1 { + s = append(s, leading_break...) + } + if chomping == 1 { + s = append(s, trailing_breaks...) + } + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_LITERAL_SCALAR_STYLE, + } + if !literal { + token.style = yaml_FOLDED_SCALAR_STYLE + } + return true +} + +// Scan indentation spaces and line breaks for a block scalar. Determine the +// indentation level if needed. +func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool { + *end_mark = parser.mark + + // Eat the indentation spaces and line breaks. + max_indent := 0 + for { + // Eat the indentation spaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for (*indent == 0 || parser.mark.column < *indent) && is_space(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + if parser.mark.column > max_indent { + max_indent = parser.mark.column + } + + // Check for a tab character messing the indentation. + if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) { + return yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found a tab character where an indentation space is expected") + } + + // Have we found a non-empty line? + if !is_break(parser.buffer, parser.buffer_pos) { + break + } + + // Consume the line break. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + // [Go] Should really be returning breaks instead. + *breaks = read_line(parser, *breaks) + *end_mark = parser.mark + } + + // Determine the indentation level if needed. + if *indent == 0 { + *indent = max_indent + if *indent < parser.indent+1 { + *indent = parser.indent + 1 + } + if *indent < 1 { + *indent = 1 + } + } + return true +} + +// Scan a quoted scalar. +func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, single bool) bool { + // Eat the left quote. + start_mark := parser.mark + skip(parser) + + // Consume the content of the quoted scalar. + var s, leading_break, trailing_breaks, whitespaces []byte + for { + // Check that there are no document indicators at the beginning of the line. + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos+0] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos+0] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz(parser.buffer, parser.buffer_pos+3) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected document indicator") + return false + } + + // Check for EOF. + if is_z(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected end of stream") + return false + } + + // Consume non-blank characters. + leading_blanks := false + for !is_blankz(parser.buffer, parser.buffer_pos) { + if single && parser.buffer[parser.buffer_pos] == '\'' && parser.buffer[parser.buffer_pos+1] == '\'' { + // Is is an escaped single quote. + s = append(s, '\'') + skip(parser) + skip(parser) + + } else if single && parser.buffer[parser.buffer_pos] == '\'' { + // It is a right single quote. + break + } else if !single && parser.buffer[parser.buffer_pos] == '"' { + // It is a right double quote. + break + + } else if !single && parser.buffer[parser.buffer_pos] == '\\' && is_break(parser.buffer, parser.buffer_pos+1) { + // It is an escaped line break. + if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { + return false + } + skip(parser) + skip_line(parser) + leading_blanks = true + break + + } else if !single && parser.buffer[parser.buffer_pos] == '\\' { + // It is an escape sequence. + code_length := 0 + + // Check the escape character. + switch parser.buffer[parser.buffer_pos+1] { + case '0': + s = append(s, 0) + case 'a': + s = append(s, '\x07') + case 'b': + s = append(s, '\x08') + case 't', '\t': + s = append(s, '\x09') + case 'n': + s = append(s, '\x0A') + case 'v': + s = append(s, '\x0B') + case 'f': + s = append(s, '\x0C') + case 'r': + s = append(s, '\x0D') + case 'e': + s = append(s, '\x1B') + case ' ': + s = append(s, '\x20') + case '"': + s = append(s, '"') + case '\'': + s = append(s, '\'') + case '\\': + s = append(s, '\\') + case 'N': // NEL (#x85) + s = append(s, '\xC2') + s = append(s, '\x85') + case '_': // #xA0 + s = append(s, '\xC2') + s = append(s, '\xA0') + case 'L': // LS (#x2028) + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA8') + case 'P': // PS (#x2029) + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA9') + case 'x': + code_length = 2 + case 'u': + code_length = 4 + case 'U': + code_length = 8 + default: + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found unknown escape character") + return false + } + + skip(parser) + skip(parser) + + // Consume an arbitrary escape code. + if code_length > 0 { + var value int + + // Scan the character value. + if parser.unread < code_length && !yaml_parser_update_buffer(parser, code_length) { + return false + } + for k := 0; k < code_length; k++ { + if !is_hex(parser.buffer, parser.buffer_pos+k) { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "did not find expected hexdecimal number") + return false + } + value = (value << 4) + as_hex(parser.buffer, parser.buffer_pos+k) + } + + // Check the value and write the character. + if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found invalid Unicode character escape code") + return false + } + if value <= 0x7F { + s = append(s, byte(value)) + } else if value <= 0x7FF { + s = append(s, byte(0xC0+(value>>6))) + s = append(s, byte(0x80+(value&0x3F))) + } else if value <= 0xFFFF { + s = append(s, byte(0xE0+(value>>12))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } else { + s = append(s, byte(0xF0+(value>>18))) + s = append(s, byte(0x80+((value>>12)&0x3F))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } + + // Advance the pointer. + for k := 0; k < code_length; k++ { + skip(parser) + } + } + } else { + // It is a non-escaped non-blank character. + s = read(parser, s) + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + } + + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check if we are at the end of the scalar. + if single { + if parser.buffer[parser.buffer_pos] == '\'' { + break + } + } else { + if parser.buffer[parser.buffer_pos] == '"' { + break + } + } + + // Consume blank characters. + for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { + if is_blank(parser.buffer, parser.buffer_pos) { + // Consume a space or a tab character. + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + // Check if it is a first line break. + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Join the whitespaces or fold line breaks. + if leading_blanks { + // Do we need to fold line breaks? + if len(leading_break) > 0 && leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + } + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + } + trailing_breaks = trailing_breaks[:0] + leading_break = leading_break[:0] + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + // Eat the right quote. + skip(parser) + end_mark := parser.mark + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_SINGLE_QUOTED_SCALAR_STYLE, + } + if !single { + token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + return true +} + +// Scan a plain scalar. +func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool { + + var s, leading_break, trailing_breaks, whitespaces []byte + var leading_blanks bool + var indent = parser.indent + 1 + + start_mark := parser.mark + end_mark := parser.mark + + // Consume the content of the plain scalar. + for { + // Check for a document indicator. + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos+0] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos+0] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz(parser.buffer, parser.buffer_pos+3) { + break + } + + // Check for a comment. + if parser.buffer[parser.buffer_pos] == '#' { + break + } + + // Consume non-blank characters. + for !is_blankz(parser.buffer, parser.buffer_pos) { + + // Check for indicators that may end a plain scalar. + if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) || + (parser.flow_level > 0 && + (parser.buffer[parser.buffer_pos] == ',' || + parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || + parser.buffer[parser.buffer_pos] == '}')) { + break + } + + // Check if we need to join whitespaces and breaks. + if leading_blanks || len(whitespaces) > 0 { + if leading_blanks { + // Do we need to fold line breaks? + if leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + } + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + } + trailing_breaks = trailing_breaks[:0] + leading_break = leading_break[:0] + leading_blanks = false + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + // Copy the character. + s = read(parser, s) + + end_mark = parser.mark + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + } + + // Is it the end? + if !(is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos)) { + break + } + + // Consume blank characters. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { + if is_blank(parser.buffer, parser.buffer_pos) { + + // Check for tab characters that abuse indentation. + if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", + start_mark, "found a tab character that violates indentation") + return false + } + + // Consume a space or a tab character. + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + // Check if it is a first line break. + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check indentation level. + if parser.flow_level == 0 && parser.mark.column < indent { + break + } + } + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_PLAIN_SCALAR_STYLE, + } + + // Note that we change the 'simple_key_allowed' flag. + if leading_blanks { + parser.simple_key_allowed = true + } + return true +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go new file mode 100644 index 000000000..4c45e660a --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go @@ -0,0 +1,113 @@ +package yaml + +import ( + "reflect" + "unicode" +) + +type keyList []reflect.Value + +func (l keyList) Len() int { return len(l) } +func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } +func (l keyList) Less(i, j int) bool { + a := l[i] + b := l[j] + ak := a.Kind() + bk := b.Kind() + for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { + a = a.Elem() + ak = a.Kind() + } + for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { + b = b.Elem() + bk = b.Kind() + } + af, aok := keyFloat(a) + bf, bok := keyFloat(b) + if aok && bok { + if af != bf { + return af < bf + } + if ak != bk { + return ak < bk + } + return numLess(a, b) + } + if ak != reflect.String || bk != reflect.String { + return ak < bk + } + ar, br := []rune(a.String()), []rune(b.String()) + for i := 0; i < len(ar) && i < len(br); i++ { + if ar[i] == br[i] { + continue + } + al := unicode.IsLetter(ar[i]) + bl := unicode.IsLetter(br[i]) + if al && bl { + return ar[i] < br[i] + } + if al || bl { + return bl + } + var ai, bi int + var an, bn int64 + if ar[i] == '0' || br[i] == '0' { + for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + if ar[j] != '0' { + an = 1 + bn = 1 + break + } + } + } + for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { + an = an*10 + int64(ar[ai]-'0') + } + for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { + bn = bn*10 + int64(br[bi]-'0') + } + if an != bn { + return an < bn + } + if ai != bi { + return ai < bi + } + return ar[i] < br[i] + } + return len(ar) < len(br) +} + +// keyFloat returns a float value for v if it is a number/bool +// and whether it is a number/bool or not. +func keyFloat(v reflect.Value) (f float64, ok bool) { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return float64(v.Int()), true + case reflect.Float32, reflect.Float64: + return v.Float(), true + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return float64(v.Uint()), true + case reflect.Bool: + if v.Bool() { + return 1, true + } + return 0, true + } + return 0, false +} + +// numLess returns whether a < b. +// a and b must necessarily have the same kind. +func numLess(a, b reflect.Value) bool { + switch a.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return a.Int() < b.Int() + case reflect.Float32, reflect.Float64: + return a.Float() < b.Float() + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return a.Uint() < b.Uint() + case reflect.Bool: + return !a.Bool() && b.Bool() + } + panic("not a number") +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/writerc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/writerc.go new file mode 100644 index 000000000..a2dde608c --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/writerc.go @@ -0,0 +1,26 @@ +package yaml + +// Set the writer error and return false. +func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_WRITER_ERROR + emitter.problem = problem + return false +} + +// Flush the output buffer. +func yaml_emitter_flush(emitter *yaml_emitter_t) bool { + if emitter.write_handler == nil { + panic("write handler not set") + } + + // Check if the buffer is empty. + if emitter.buffer_pos == 0 { + return true + } + + if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { + return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) + } + emitter.buffer_pos = 0 + return true +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go new file mode 100644 index 000000000..30813884c --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go @@ -0,0 +1,478 @@ +// Package yaml implements YAML support for the Go language. +// +// Source code and other details for the project are available at GitHub: +// +// https://github.com/go-yaml/yaml +// +package yaml + +import ( + "errors" + "fmt" + "io" + "reflect" + "strings" + "sync" +) + +// MapSlice encodes and decodes as a YAML map. +// The order of keys is preserved when encoding and decoding. +type MapSlice []MapItem + +// MapItem is an item in a MapSlice. +type MapItem struct { + Key, Value interface{} +} + +// The Unmarshaler interface may be implemented by types to customize their +// behavior when being unmarshaled from a YAML document. The UnmarshalYAML +// method receives a function that may be called to unmarshal the original +// YAML value into a field or variable. It is safe to call the unmarshal +// function parameter more than once if necessary. +type Unmarshaler interface { + UnmarshalYAML(unmarshal func(interface{}) error) error +} + +// The Marshaler interface may be implemented by types to customize their +// behavior when being marshaled into a YAML document. The returned value +// is marshaled in place of the original value implementing Marshaler. +// +// If an error is returned by MarshalYAML, the marshaling procedure stops +// and returns with the provided error. +type Marshaler interface { + MarshalYAML() (interface{}, error) +} + +// Unmarshal decodes the first document found within the in byte slice +// and assigns decoded values into the out value. +// +// Maps and pointers (to a struct, string, int, etc) are accepted as out +// values. If an internal pointer within a struct is not initialized, +// the yaml package will initialize it if necessary for unmarshalling +// the provided data. The out parameter must not be nil. +// +// The type of the decoded values should be compatible with the respective +// values in out. If one or more values cannot be decoded due to a type +// mismatches, decoding continues partially until the end of the YAML +// content, and a *yaml.TypeError is returned with details for all +// missed values. +// +// Struct fields are only unmarshalled if they are exported (have an +// upper case first letter), and are unmarshalled using the field name +// lowercased as the default key. Custom keys may be defined via the +// "yaml" name in the field tag: the content preceding the first comma +// is used as the key, and the following comma-separated options are +// used to tweak the marshalling process (see Marshal). +// Conflicting names result in a runtime error. +// +// For example: +// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// +// See the documentation of Marshal for the format of tags and a list of +// supported tag options. +// +func Unmarshal(in []byte, out interface{}) (err error) { + return unmarshal(in, out, false) +} + +// UnmarshalStrict is like Unmarshal except that any fields that are found +// in the data that do not have corresponding struct members, or mapping +// keys that are duplicates, will result in +// an error. +func UnmarshalStrict(in []byte, out interface{}) (err error) { + return unmarshal(in, out, true) +} + +// A Decoder reads and decodes YAML values from an input stream. +type Decoder struct { + strict bool + parser *parser +} + +// NewDecoder returns a new decoder that reads from r. +// +// The decoder introduces its own buffering and may read +// data from r beyond the YAML values requested. +func NewDecoder(r io.Reader) *Decoder { + return &Decoder{ + parser: newParserFromReader(r), + } +} + +// SetStrict sets whether strict decoding behaviour is enabled when +// decoding items in the data (see UnmarshalStrict). By default, decoding is not strict. +func (dec *Decoder) SetStrict(strict bool) { + dec.strict = strict +} + +// Decode reads the next YAML-encoded value from its input +// and stores it in the value pointed to by v. +// +// See the documentation for Unmarshal for details about the +// conversion of YAML into a Go value. +func (dec *Decoder) Decode(v interface{}) (err error) { + d := newDecoder(dec.strict) + defer handleErr(&err) + node := dec.parser.parse() + if node == nil { + return io.EOF + } + out := reflect.ValueOf(v) + if out.Kind() == reflect.Ptr && !out.IsNil() { + out = out.Elem() + } + d.unmarshal(node, out) + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + +func unmarshal(in []byte, out interface{}, strict bool) (err error) { + defer handleErr(&err) + d := newDecoder(strict) + p := newParser(in) + defer p.destroy() + node := p.parse() + if node != nil { + v := reflect.ValueOf(out) + if v.Kind() == reflect.Ptr && !v.IsNil() { + v = v.Elem() + } + d.unmarshal(node, v) + } + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + +// Marshal serializes the value provided into a YAML document. The structure +// of the generated document will reflect the structure of the value itself. +// Maps and pointers (to struct, string, int, etc) are accepted as the in value. +// +// Struct fields are only marshalled if they are exported (have an upper case +// first letter), and are marshalled using the field name lowercased as the +// default key. Custom keys may be defined via the "yaml" name in the field +// tag: the content preceding the first comma is used as the key, and the +// following comma-separated options are used to tweak the marshalling process. +// Conflicting names result in a runtime error. +// +// The field tag format accepted is: +// +// `(...) yaml:"[][,[,]]" (...)` +// +// The following flags are currently supported: +// +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. +// +// flow Marshal using a flow style (useful for structs, +// sequences and maps). +// +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. +// +// In addition, if the key is "-", the field is ignored. +// +// For example: +// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" +// +func Marshal(in interface{}) (out []byte, err error) { + defer handleErr(&err) + e := newEncoder() + defer e.destroy() + e.marshalDoc("", reflect.ValueOf(in)) + e.finish() + out = e.out + return +} + +// An Encoder writes YAML values to an output stream. +type Encoder struct { + encoder *encoder +} + +// NewEncoder returns a new encoder that writes to w. +// The Encoder should be closed after use to flush all data +// to w. +func NewEncoder(w io.Writer) *Encoder { + return &Encoder{ + encoder: newEncoderWithWriter(w), + } +} + +// Encode writes the YAML encoding of v to the stream. +// If multiple items are encoded to the stream, the +// second and subsequent document will be preceded +// with a "---" document separator, but the first will not. +// +// See the documentation for Marshal for details about the conversion of Go +// values to YAML. +func (e *Encoder) Encode(v interface{}) (err error) { + defer handleErr(&err) + e.encoder.marshalDoc("", reflect.ValueOf(v)) + return nil +} + +// Close closes the encoder by writing any remaining data. +// It does not write a stream terminating string "...". +func (e *Encoder) Close() (err error) { + defer handleErr(&err) + e.encoder.finish() + return nil +} + +func handleErr(err *error) { + if v := recover(); v != nil { + if e, ok := v.(yamlError); ok { + *err = e.err + } else { + panic(v) + } + } +} + +type yamlError struct { + err error +} + +func fail(err error) { + panic(yamlError{err}) +} + +func failf(format string, args ...interface{}) { + panic(yamlError{fmt.Errorf("yaml: "+format, args...)}) +} + +// A TypeError is returned by Unmarshal when one or more fields in +// the YAML document cannot be properly decoded into the requested +// types. When this error is returned, the value is still +// unmarshaled partially. +type TypeError struct { + Errors []string +} + +func (e *TypeError) Error() string { + return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n ")) +} + +// -------------------------------------------------------------------------- +// Maintain a mapping of keys to structure field indexes + +// The code in this section was copied from mgo/bson. + +// structInfo holds details for the serialization of fields of +// a given struct. +type structInfo struct { + FieldsMap map[string]fieldInfo + FieldsList []fieldInfo + + // InlineMap is the number of the field in the struct that + // contains an ,inline map, or -1 if there's none. + InlineMap int +} + +type fieldInfo struct { + Key string + Num int + OmitEmpty bool + Flow bool + // Id holds the unique field identifier, so we can cheaply + // check for field duplicates without maintaining an extra map. + Id int + + // Inline holds the field index if the field is part of an inlined struct. + Inline []int +} + +var structMap = make(map[reflect.Type]*structInfo) +var fieldMapMutex sync.RWMutex + +func getStructInfo(st reflect.Type) (*structInfo, error) { + fieldMapMutex.RLock() + sinfo, found := structMap[st] + fieldMapMutex.RUnlock() + if found { + return sinfo, nil + } + + n := st.NumField() + fieldsMap := make(map[string]fieldInfo) + fieldsList := make([]fieldInfo, 0, n) + inlineMap := -1 + for i := 0; i != n; i++ { + field := st.Field(i) + if field.PkgPath != "" && !field.Anonymous { + continue // Private field + } + + info := fieldInfo{Num: i} + + tag := field.Tag.Get("yaml") + if tag == "" && strings.Index(string(field.Tag), ":") < 0 { + tag = string(field.Tag) + } + if tag == "-" { + continue + } + + inline := false + fields := strings.Split(tag, ",") + if len(fields) > 1 { + for _, flag := range fields[1:] { + switch flag { + case "omitempty": + info.OmitEmpty = true + case "flow": + info.Flow = true + case "inline": + inline = true + default: + return nil, errors.New(fmt.Sprintf("Unsupported flag %q in tag %q of type %s", flag, tag, st)) + } + } + tag = fields[0] + } + + if inline { + switch field.Type.Kind() { + case reflect.Map: + if inlineMap >= 0 { + return nil, errors.New("Multiple ,inline maps in struct " + st.String()) + } + if field.Type.Key() != reflect.TypeOf("") { + return nil, errors.New("Option ,inline needs a map with string keys in struct " + st.String()) + } + inlineMap = info.Num + case reflect.Struct: + sinfo, err := getStructInfo(field.Type) + if err != nil { + return nil, err + } + for _, finfo := range sinfo.FieldsList { + if _, found := fieldsMap[finfo.Key]; found { + msg := "Duplicated key '" + finfo.Key + "' in struct " + st.String() + return nil, errors.New(msg) + } + if finfo.Inline == nil { + finfo.Inline = []int{i, finfo.Num} + } else { + finfo.Inline = append([]int{i}, finfo.Inline...) + } + finfo.Id = len(fieldsList) + fieldsMap[finfo.Key] = finfo + fieldsList = append(fieldsList, finfo) + } + default: + //return nil, errors.New("Option ,inline needs a struct value or map field") + return nil, errors.New("Option ,inline needs a struct value field") + } + continue + } + + if tag != "" { + info.Key = tag + } else { + info.Key = strings.ToLower(field.Name) + } + + if _, found = fieldsMap[info.Key]; found { + msg := "Duplicated key '" + info.Key + "' in struct " + st.String() + return nil, errors.New(msg) + } + + info.Id = len(fieldsList) + fieldsList = append(fieldsList, info) + fieldsMap[info.Key] = info + } + + sinfo = &structInfo{ + FieldsMap: fieldsMap, + FieldsList: fieldsList, + InlineMap: inlineMap, + } + + fieldMapMutex.Lock() + structMap[st] = sinfo + fieldMapMutex.Unlock() + return sinfo, nil +} + +// IsZeroer is used to check whether an object is zero to +// determine whether it should be omitted when marshaling +// with the omitempty flag. One notable implementation +// is time.Time. +type IsZeroer interface { + IsZero() bool +} + +func isZero(v reflect.Value) bool { + kind := v.Kind() + if z, ok := v.Interface().(IsZeroer); ok { + if (kind == reflect.Ptr || kind == reflect.Interface) && v.IsNil() { + return true + } + return z.IsZero() + } + switch kind { + case reflect.String: + return len(v.String()) == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + case reflect.Slice: + return v.Len() == 0 + case reflect.Map: + return v.Len() == 0 + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Struct: + vt := v.Type() + for i := v.NumField() - 1; i >= 0; i-- { + if vt.Field(i).PkgPath != "" { + continue // Private field + } + if !isZero(v.Field(i)) { + return false + } + } + return true + } + return false +} + +// FutureLineWrap globally disables line wrapping when encoding long strings. +// This is a temporary and thus deprecated method introduced to faciliate +// migration towards v3, which offers more control of line lengths on +// individual encodings, and has a default matching the behavior introduced +// by this function. +// +// The default formatting of v2 was erroneously changed in v2.3.0 and reverted +// in v2.4.0, at which point this function was introduced to help migration. +func FutureLineWrap() { + disableLineWrapping = true +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go new file mode 100644 index 000000000..f6a9c8e34 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go @@ -0,0 +1,739 @@ +package yaml + +import ( + "fmt" + "io" +) + +// The version directive data. +type yaml_version_directive_t struct { + major int8 // The major version number. + minor int8 // The minor version number. +} + +// The tag directive data. +type yaml_tag_directive_t struct { + handle []byte // The tag handle. + prefix []byte // The tag prefix. +} + +type yaml_encoding_t int + +// The stream encoding. +const ( + // Let the parser choose the encoding. + yaml_ANY_ENCODING yaml_encoding_t = iota + + yaml_UTF8_ENCODING // The default UTF-8 encoding. + yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM. + yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM. +) + +type yaml_break_t int + +// Line break types. +const ( + // Let the parser choose the break type. + yaml_ANY_BREAK yaml_break_t = iota + + yaml_CR_BREAK // Use CR for line breaks (Mac style). + yaml_LN_BREAK // Use LN for line breaks (Unix style). + yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style). +) + +type yaml_error_type_t int + +// Many bad things could happen with the parser and emitter. +const ( + // No error is produced. + yaml_NO_ERROR yaml_error_type_t = iota + + yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory. + yaml_READER_ERROR // Cannot read or decode the input stream. + yaml_SCANNER_ERROR // Cannot scan the input stream. + yaml_PARSER_ERROR // Cannot parse the input stream. + yaml_COMPOSER_ERROR // Cannot compose a YAML document. + yaml_WRITER_ERROR // Cannot write to the output stream. + yaml_EMITTER_ERROR // Cannot emit a YAML stream. +) + +// The pointer position. +type yaml_mark_t struct { + index int // The position index. + line int // The position line. + column int // The position column. +} + +// Node Styles + +type yaml_style_t int8 + +type yaml_scalar_style_t yaml_style_t + +// Scalar styles. +const ( + // Let the emitter choose the style. + yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = iota + + yaml_PLAIN_SCALAR_STYLE // The plain scalar style. + yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. + yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. + yaml_LITERAL_SCALAR_STYLE // The literal scalar style. + yaml_FOLDED_SCALAR_STYLE // The folded scalar style. +) + +type yaml_sequence_style_t yaml_style_t + +// Sequence styles. +const ( + // Let the emitter choose the style. + yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota + + yaml_BLOCK_SEQUENCE_STYLE // The block sequence style. + yaml_FLOW_SEQUENCE_STYLE // The flow sequence style. +) + +type yaml_mapping_style_t yaml_style_t + +// Mapping styles. +const ( + // Let the emitter choose the style. + yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota + + yaml_BLOCK_MAPPING_STYLE // The block mapping style. + yaml_FLOW_MAPPING_STYLE // The flow mapping style. +) + +// Tokens + +type yaml_token_type_t int + +// Token types. +const ( + // An empty token. + yaml_NO_TOKEN yaml_token_type_t = iota + + yaml_STREAM_START_TOKEN // A STREAM-START token. + yaml_STREAM_END_TOKEN // A STREAM-END token. + + yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token. + yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token. + yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token. + yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token. + + yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token. + yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token. + yaml_BLOCK_END_TOKEN // A BLOCK-END token. + + yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token. + yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token. + yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token. + yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token. + + yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token. + yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token. + yaml_KEY_TOKEN // A KEY token. + yaml_VALUE_TOKEN // A VALUE token. + + yaml_ALIAS_TOKEN // An ALIAS token. + yaml_ANCHOR_TOKEN // An ANCHOR token. + yaml_TAG_TOKEN // A TAG token. + yaml_SCALAR_TOKEN // A SCALAR token. +) + +func (tt yaml_token_type_t) String() string { + switch tt { + case yaml_NO_TOKEN: + return "yaml_NO_TOKEN" + case yaml_STREAM_START_TOKEN: + return "yaml_STREAM_START_TOKEN" + case yaml_STREAM_END_TOKEN: + return "yaml_STREAM_END_TOKEN" + case yaml_VERSION_DIRECTIVE_TOKEN: + return "yaml_VERSION_DIRECTIVE_TOKEN" + case yaml_TAG_DIRECTIVE_TOKEN: + return "yaml_TAG_DIRECTIVE_TOKEN" + case yaml_DOCUMENT_START_TOKEN: + return "yaml_DOCUMENT_START_TOKEN" + case yaml_DOCUMENT_END_TOKEN: + return "yaml_DOCUMENT_END_TOKEN" + case yaml_BLOCK_SEQUENCE_START_TOKEN: + return "yaml_BLOCK_SEQUENCE_START_TOKEN" + case yaml_BLOCK_MAPPING_START_TOKEN: + return "yaml_BLOCK_MAPPING_START_TOKEN" + case yaml_BLOCK_END_TOKEN: + return "yaml_BLOCK_END_TOKEN" + case yaml_FLOW_SEQUENCE_START_TOKEN: + return "yaml_FLOW_SEQUENCE_START_TOKEN" + case yaml_FLOW_SEQUENCE_END_TOKEN: + return "yaml_FLOW_SEQUENCE_END_TOKEN" + case yaml_FLOW_MAPPING_START_TOKEN: + return "yaml_FLOW_MAPPING_START_TOKEN" + case yaml_FLOW_MAPPING_END_TOKEN: + return "yaml_FLOW_MAPPING_END_TOKEN" + case yaml_BLOCK_ENTRY_TOKEN: + return "yaml_BLOCK_ENTRY_TOKEN" + case yaml_FLOW_ENTRY_TOKEN: + return "yaml_FLOW_ENTRY_TOKEN" + case yaml_KEY_TOKEN: + return "yaml_KEY_TOKEN" + case yaml_VALUE_TOKEN: + return "yaml_VALUE_TOKEN" + case yaml_ALIAS_TOKEN: + return "yaml_ALIAS_TOKEN" + case yaml_ANCHOR_TOKEN: + return "yaml_ANCHOR_TOKEN" + case yaml_TAG_TOKEN: + return "yaml_TAG_TOKEN" + case yaml_SCALAR_TOKEN: + return "yaml_SCALAR_TOKEN" + } + return "" +} + +// The token structure. +type yaml_token_t struct { + // The token type. + typ yaml_token_type_t + + // The start/end of the token. + start_mark, end_mark yaml_mark_t + + // The stream encoding (for yaml_STREAM_START_TOKEN). + encoding yaml_encoding_t + + // The alias/anchor/scalar value or tag/tag directive handle + // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN). + value []byte + + // The tag suffix (for yaml_TAG_TOKEN). + suffix []byte + + // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN). + prefix []byte + + // The scalar style (for yaml_SCALAR_TOKEN). + style yaml_scalar_style_t + + // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN). + major, minor int8 +} + +// Events + +type yaml_event_type_t int8 + +// Event types. +const ( + // An empty event. + yaml_NO_EVENT yaml_event_type_t = iota + + yaml_STREAM_START_EVENT // A STREAM-START event. + yaml_STREAM_END_EVENT // A STREAM-END event. + yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event. + yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event. + yaml_ALIAS_EVENT // An ALIAS event. + yaml_SCALAR_EVENT // A SCALAR event. + yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event. + yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event. + yaml_MAPPING_START_EVENT // A MAPPING-START event. + yaml_MAPPING_END_EVENT // A MAPPING-END event. +) + +var eventStrings = []string{ + yaml_NO_EVENT: "none", + yaml_STREAM_START_EVENT: "stream start", + yaml_STREAM_END_EVENT: "stream end", + yaml_DOCUMENT_START_EVENT: "document start", + yaml_DOCUMENT_END_EVENT: "document end", + yaml_ALIAS_EVENT: "alias", + yaml_SCALAR_EVENT: "scalar", + yaml_SEQUENCE_START_EVENT: "sequence start", + yaml_SEQUENCE_END_EVENT: "sequence end", + yaml_MAPPING_START_EVENT: "mapping start", + yaml_MAPPING_END_EVENT: "mapping end", +} + +func (e yaml_event_type_t) String() string { + if e < 0 || int(e) >= len(eventStrings) { + return fmt.Sprintf("unknown event %d", e) + } + return eventStrings[e] +} + +// The event structure. +type yaml_event_t struct { + + // The event type. + typ yaml_event_type_t + + // The start and end of the event. + start_mark, end_mark yaml_mark_t + + // The document encoding (for yaml_STREAM_START_EVENT). + encoding yaml_encoding_t + + // The version directive (for yaml_DOCUMENT_START_EVENT). + version_directive *yaml_version_directive_t + + // The list of tag directives (for yaml_DOCUMENT_START_EVENT). + tag_directives []yaml_tag_directive_t + + // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT). + anchor []byte + + // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). + tag []byte + + // The scalar value (for yaml_SCALAR_EVENT). + value []byte + + // Is the document start/end indicator implicit, or the tag optional? + // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT). + implicit bool + + // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT). + quoted_implicit bool + + // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). + style yaml_style_t +} + +func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) } +func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) } +func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) } + +// Nodes + +const ( + yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null. + yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false. + yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values. + yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values. + yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values. + yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values. + + yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences. + yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping. + + // Not in original libyaml. + yaml_BINARY_TAG = "tag:yaml.org,2002:binary" + yaml_MERGE_TAG = "tag:yaml.org,2002:merge" + + yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str. + yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq. + yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map. +) + +type yaml_node_type_t int + +// Node types. +const ( + // An empty node. + yaml_NO_NODE yaml_node_type_t = iota + + yaml_SCALAR_NODE // A scalar node. + yaml_SEQUENCE_NODE // A sequence node. + yaml_MAPPING_NODE // A mapping node. +) + +// An element of a sequence node. +type yaml_node_item_t int + +// An element of a mapping node. +type yaml_node_pair_t struct { + key int // The key of the element. + value int // The value of the element. +} + +// The node structure. +type yaml_node_t struct { + typ yaml_node_type_t // The node type. + tag []byte // The node tag. + + // The node data. + + // The scalar parameters (for yaml_SCALAR_NODE). + scalar struct { + value []byte // The scalar value. + length int // The length of the scalar value. + style yaml_scalar_style_t // The scalar style. + } + + // The sequence parameters (for YAML_SEQUENCE_NODE). + sequence struct { + items_data []yaml_node_item_t // The stack of sequence items. + style yaml_sequence_style_t // The sequence style. + } + + // The mapping parameters (for yaml_MAPPING_NODE). + mapping struct { + pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value). + pairs_start *yaml_node_pair_t // The beginning of the stack. + pairs_end *yaml_node_pair_t // The end of the stack. + pairs_top *yaml_node_pair_t // The top of the stack. + style yaml_mapping_style_t // The mapping style. + } + + start_mark yaml_mark_t // The beginning of the node. + end_mark yaml_mark_t // The end of the node. + +} + +// The document structure. +type yaml_document_t struct { + + // The document nodes. + nodes []yaml_node_t + + // The version directive. + version_directive *yaml_version_directive_t + + // The list of tag directives. + tag_directives_data []yaml_tag_directive_t + tag_directives_start int // The beginning of the tag directives list. + tag_directives_end int // The end of the tag directives list. + + start_implicit int // Is the document start indicator implicit? + end_implicit int // Is the document end indicator implicit? + + // The start/end of the document. + start_mark, end_mark yaml_mark_t +} + +// The prototype of a read handler. +// +// The read handler is called when the parser needs to read more bytes from the +// source. The handler should write not more than size bytes to the buffer. +// The number of written bytes should be set to the size_read variable. +// +// [in,out] data A pointer to an application data specified by +// yaml_parser_set_input(). +// [out] buffer The buffer to write the data from the source. +// [in] size The size of the buffer. +// [out] size_read The actual number of bytes read from the source. +// +// On success, the handler should return 1. If the handler failed, +// the returned value should be 0. On EOF, the handler should set the +// size_read to 0 and return 1. +type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) + +// This structure holds information about a potential simple key. +type yaml_simple_key_t struct { + possible bool // Is a simple key possible? + required bool // Is a simple key required? + token_number int // The number of the token. + mark yaml_mark_t // The position mark. +} + +// The states of the parser. +type yaml_parser_state_t int + +const ( + yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota + + yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document. + yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START. + yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document. + yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END. + yaml_PARSE_BLOCK_NODE_STATE // Expect a block node. + yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence. + yaml_PARSE_FLOW_NODE_STATE // Expect a flow node. + yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence. + yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence. + yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence. + yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. + yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key. + yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value. + yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry. + yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. + yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. + yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. + yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping. + yaml_PARSE_END_STATE // Expect nothing. +) + +func (ps yaml_parser_state_t) String() string { + switch ps { + case yaml_PARSE_STREAM_START_STATE: + return "yaml_PARSE_STREAM_START_STATE" + case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: + return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE" + case yaml_PARSE_DOCUMENT_START_STATE: + return "yaml_PARSE_DOCUMENT_START_STATE" + case yaml_PARSE_DOCUMENT_CONTENT_STATE: + return "yaml_PARSE_DOCUMENT_CONTENT_STATE" + case yaml_PARSE_DOCUMENT_END_STATE: + return "yaml_PARSE_DOCUMENT_END_STATE" + case yaml_PARSE_BLOCK_NODE_STATE: + return "yaml_PARSE_BLOCK_NODE_STATE" + case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: + return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE" + case yaml_PARSE_FLOW_NODE_STATE: + return "yaml_PARSE_FLOW_NODE_STATE" + case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: + return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE" + case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: + return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE" + case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: + return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE" + case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: + return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE" + case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: + return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE" + case yaml_PARSE_FLOW_MAPPING_KEY_STATE: + return "yaml_PARSE_FLOW_MAPPING_KEY_STATE" + case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: + return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: + return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE" + case yaml_PARSE_END_STATE: + return "yaml_PARSE_END_STATE" + } + return "" +} + +// This structure holds aliases data. +type yaml_alias_data_t struct { + anchor []byte // The anchor. + index int // The node id. + mark yaml_mark_t // The anchor mark. +} + +// The parser structure. +// +// All members are internal. Manage the structure using the +// yaml_parser_ family of functions. +type yaml_parser_t struct { + + // Error handling + + error yaml_error_type_t // Error type. + + problem string // Error description. + + // The byte about which the problem occurred. + problem_offset int + problem_value int + problem_mark yaml_mark_t + + // The error context. + context string + context_mark yaml_mark_t + + // Reader stuff + + read_handler yaml_read_handler_t // Read handler. + + input_reader io.Reader // File input data. + input []byte // String input data. + input_pos int + + eof bool // EOF flag + + buffer []byte // The working buffer. + buffer_pos int // The current position of the buffer. + + unread int // The number of unread characters in the buffer. + + raw_buffer []byte // The raw buffer. + raw_buffer_pos int // The current position of the buffer. + + encoding yaml_encoding_t // The input encoding. + + offset int // The offset of the current position (in bytes). + mark yaml_mark_t // The mark of the current position. + + // Scanner stuff + + stream_start_produced bool // Have we started to scan the input stream? + stream_end_produced bool // Have we reached the end of the input stream? + + flow_level int // The number of unclosed '[' and '{' indicators. + + tokens []yaml_token_t // The tokens queue. + tokens_head int // The head of the tokens queue. + tokens_parsed int // The number of tokens fetched from the queue. + token_available bool // Does the tokens queue contain a token ready for dequeueing. + + indent int // The current indentation level. + indents []int // The indentation levels stack. + + simple_key_allowed bool // May a simple key occur at the current position? + simple_keys []yaml_simple_key_t // The stack of simple keys. + simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number + + // Parser stuff + + state yaml_parser_state_t // The current parser state. + states []yaml_parser_state_t // The parser states stack. + marks []yaml_mark_t // The stack of marks. + tag_directives []yaml_tag_directive_t // The list of TAG directives. + + // Dumper stuff + + aliases []yaml_alias_data_t // The alias data. + + document *yaml_document_t // The currently parsed document. +} + +// Emitter Definitions + +// The prototype of a write handler. +// +// The write handler is called when the emitter needs to flush the accumulated +// characters to the output. The handler should write @a size bytes of the +// @a buffer to the output. +// +// @param[in,out] data A pointer to an application data specified by +// yaml_emitter_set_output(). +// @param[in] buffer The buffer with bytes to be written. +// @param[in] size The size of the buffer. +// +// @returns On success, the handler should return @c 1. If the handler failed, +// the returned value should be @c 0. +// +type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error + +type yaml_emitter_state_t int + +// The emitter states. +const ( + // Expect STREAM-START. + yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota + + yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END. + yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END. + yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document. + yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END. + yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence. + yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence. + yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. + yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence. + yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence. + yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping. + yaml_EMIT_END_STATE // Expect nothing. +) + +// The emitter structure. +// +// All members are internal. Manage the structure using the @c yaml_emitter_ +// family of functions. +type yaml_emitter_t struct { + + // Error handling + + error yaml_error_type_t // Error type. + problem string // Error description. + + // Writer stuff + + write_handler yaml_write_handler_t // Write handler. + + output_buffer *[]byte // String output data. + output_writer io.Writer // File output data. + + buffer []byte // The working buffer. + buffer_pos int // The current position of the buffer. + + raw_buffer []byte // The raw buffer. + raw_buffer_pos int // The current position of the buffer. + + encoding yaml_encoding_t // The stream encoding. + + // Emitter stuff + + canonical bool // If the output is in the canonical style? + best_indent int // The number of indentation spaces. + best_width int // The preferred width of the output lines. + unicode bool // Allow unescaped non-ASCII characters? + line_break yaml_break_t // The preferred line break. + + state yaml_emitter_state_t // The current emitter state. + states []yaml_emitter_state_t // The stack of states. + + events []yaml_event_t // The event queue. + events_head int // The head of the event queue. + + indents []int // The stack of indentation levels. + + tag_directives []yaml_tag_directive_t // The list of tag directives. + + indent int // The current indentation level. + + flow_level int // The current flow level. + + root_context bool // Is it the document root context? + sequence_context bool // Is it a sequence context? + mapping_context bool // Is it a mapping context? + simple_key_context bool // Is it a simple mapping key context? + + line int // The current line. + column int // The current column. + whitespace bool // If the last character was a whitespace? + indention bool // If the last character was an indentation character (' ', '-', '?', ':')? + open_ended bool // If an explicit document end is required? + + // Anchor analysis. + anchor_data struct { + anchor []byte // The anchor value. + alias bool // Is it an alias? + } + + // Tag analysis. + tag_data struct { + handle []byte // The tag handle. + suffix []byte // The tag suffix. + } + + // Scalar analysis. + scalar_data struct { + value []byte // The scalar value. + multiline bool // Does the scalar contain line breaks? + flow_plain_allowed bool // Can the scalar be expessed in the flow plain style? + block_plain_allowed bool // Can the scalar be expressed in the block plain style? + single_quoted_allowed bool // Can the scalar be expressed in the single quoted style? + block_allowed bool // Can the scalar be expressed in the literal or folded styles? + style yaml_scalar_style_t // The output style. + } + + // Dumper stuff + + opened bool // If the stream was already opened? + closed bool // If the stream was already closed? + + // The information associated with the document nodes. + anchors *struct { + references int // The number of references. + anchor int // The anchor id. + serialized bool // If the node has been emitted? + } + + last_anchor_id int // The last assigned anchor id. + + document *yaml_document_t // The currently emitted document. +} diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlprivateh.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlprivateh.go new file mode 100644 index 000000000..8110ce3c3 --- /dev/null +++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlprivateh.go @@ -0,0 +1,173 @@ +package yaml + +const ( + // The size of the input raw buffer. + input_raw_buffer_size = 512 + + // The size of the input buffer. + // It should be possible to decode the whole raw buffer. + input_buffer_size = input_raw_buffer_size * 3 + + // The size of the output buffer. + output_buffer_size = 128 + + // The size of the output raw buffer. + // It should be possible to encode the whole output buffer. + output_raw_buffer_size = (output_buffer_size*2 + 2) + + // The size of other stacks and queues. + initial_stack_size = 16 + initial_queue_size = 16 + initial_string_size = 16 +) + +// Check if the character at the specified position is an alphabetical +// character, a digit, '_', or '-'. +func is_alpha(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' +} + +// Check if the character at the specified position is a digit. +func is_digit(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' +} + +// Get the value of a digit. +func as_digit(b []byte, i int) int { + return int(b[i]) - '0' +} + +// Check if the character at the specified position is a hex-digit. +func is_hex(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' +} + +// Get the value of a hex-digit. +func as_hex(b []byte, i int) int { + bi := b[i] + if bi >= 'A' && bi <= 'F' { + return int(bi) - 'A' + 10 + } + if bi >= 'a' && bi <= 'f' { + return int(bi) - 'a' + 10 + } + return int(bi) - '0' +} + +// Check if the character is ASCII. +func is_ascii(b []byte, i int) bool { + return b[i] <= 0x7F +} + +// Check if the character at the start of the buffer can be printed unescaped. +func is_printable(b []byte, i int) bool { + return ((b[i] == 0x0A) || // . == #x0A + (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E + (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF + (b[i] > 0xC2 && b[i] < 0xED) || + (b[i] == 0xED && b[i+1] < 0xA0) || + (b[i] == 0xEE) || + (b[i] == 0xEF && // #xE000 <= . <= #xFFFD + !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF + !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) +} + +// Check if the character at the specified position is NUL. +func is_z(b []byte, i int) bool { + return b[i] == 0x00 +} + +// Check if the beginning of the buffer is a BOM. +func is_bom(b []byte, i int) bool { + return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF +} + +// Check if the character at the specified position is space. +func is_space(b []byte, i int) bool { + return b[i] == ' ' +} + +// Check if the character at the specified position is tab. +func is_tab(b []byte, i int) bool { + return b[i] == '\t' +} + +// Check if the character at the specified position is blank (space or tab). +func is_blank(b []byte, i int) bool { + //return is_space(b, i) || is_tab(b, i) + return b[i] == ' ' || b[i] == '\t' +} + +// Check if the character at the specified position is a line break. +func is_break(b []byte, i int) bool { + return (b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029) +} + +func is_crlf(b []byte, i int) bool { + return b[i] == '\r' && b[i+1] == '\n' +} + +// Check if the character is a line break or NUL. +func is_breakz(b []byte, i int) bool { + //return is_break(b, i) || is_z(b, i) + return ( // is_break: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + // is_z: + b[i] == 0) +} + +// Check if the character is a line break, space, or NUL. +func is_spacez(b []byte, i int) bool { + //return is_space(b, i) || is_breakz(b, i) + return ( // is_space: + b[i] == ' ' || + // is_breakz: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + b[i] == 0) +} + +// Check if the character is a line break, space, tab, or NUL. +func is_blankz(b []byte, i int) bool { + //return is_blank(b, i) || is_breakz(b, i) + return ( // is_blank: + b[i] == ' ' || b[i] == '\t' || + // is_breakz: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + b[i] == 0) +} + +// Determine the width of the character. +func width(b byte) int { + // Don't replace these by a switch without first + // confirming that it is being inlined. + if b&0x80 == 0x00 { + return 1 + } + if b&0xE0 == 0xC0 { + return 2 + } + if b&0xF0 == 0xE0 { + return 3 + } + if b&0xF8 == 0xF0 { + return 4 + } + return 0 + +} diff --git a/vendor/sigs.k8s.io/yaml/yaml.go b/vendor/sigs.k8s.io/yaml/yaml.go index efbc535d4..fc10246bd 100644 --- a/vendor/sigs.k8s.io/yaml/yaml.go +++ b/vendor/sigs.k8s.io/yaml/yaml.go @@ -1,3 +1,19 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package yaml import ( @@ -8,56 +24,59 @@ import ( "reflect" "strconv" - "gopkg.in/yaml.v2" + "sigs.k8s.io/yaml/goyaml.v2" ) -// Marshal marshals the object into JSON then converts JSON to YAML and returns the -// YAML. -func Marshal(o interface{}) ([]byte, error) { - j, err := json.Marshal(o) +// Marshal marshals obj into JSON using stdlib json.Marshal, and then converts JSON to YAML using JSONToYAML (see that method for more reference) +func Marshal(obj interface{}) ([]byte, error) { + jsonBytes, err := json.Marshal(obj) if err != nil { - return nil, fmt.Errorf("error marshaling into JSON: %v", err) + return nil, fmt.Errorf("error marshaling into JSON: %w", err) } - y, err := JSONToYAML(j) - if err != nil { - return nil, fmt.Errorf("error converting JSON to YAML: %v", err) - } - - return y, nil + return JSONToYAML(jsonBytes) } // JSONOpt is a decoding option for decoding from JSON format. type JSONOpt func(*json.Decoder) *json.Decoder -// Unmarshal converts YAML to JSON then uses JSON to unmarshal into an object, -// optionally configuring the behavior of the JSON unmarshal. -func Unmarshal(y []byte, o interface{}, opts ...JSONOpt) error { - return yamlUnmarshal(y, o, false, opts...) +// Unmarshal first converts the given YAML to JSON, and then unmarshals the JSON into obj. Options for the +// standard library json.Decoder can be optionally specified, e.g. to decode untyped numbers into json.Number instead of float64, or to disallow unknown fields (but for that purpose, see also UnmarshalStrict). obj must be a non-nil pointer. +// +// Important notes about the Unmarshal logic: +// +// - Decoding is case-insensitive, unlike the rest of Kubernetes API machinery, as this is using the stdlib json library. This might be confusing to users. +// - This decodes any number (although it is an integer) into a float64 if the type of obj is unknown, e.g. *map[string]interface{}, *interface{}, or *[]interface{}. This means integers above +/- 2^53 will lose precision when round-tripping. Make a JSONOpt that calls d.UseNumber() to avoid this. +// - Duplicate fields, including in-case-sensitive matches, are ignored in an undefined order. Note that the YAML specification forbids duplicate fields, so this logic is more permissive than it needs to. See UnmarshalStrict for an alternative. +// - Unknown fields, i.e. serialized data that do not map to a field in obj, are ignored. Use d.DisallowUnknownFields() or UnmarshalStrict to override. +// - As per the YAML 1.1 specification, which yaml.v2 used underneath implements, literal 'yes' and 'no' strings without quotation marks will be converted to true/false implicitly. +// - YAML non-string keys, e.g. ints, bools and floats, are converted to strings implicitly during the YAML to JSON conversion process. +// - There are no compatibility guarantees for returned error values. +func Unmarshal(yamlBytes []byte, obj interface{}, opts ...JSONOpt) error { + return unmarshal(yamlBytes, obj, yaml.Unmarshal, opts...) } -// UnmarshalStrict strictly converts YAML to JSON then uses JSON to unmarshal -// into an object, optionally configuring the behavior of the JSON unmarshal. -func UnmarshalStrict(y []byte, o interface{}, opts ...JSONOpt) error { - return yamlUnmarshal(y, o, true, append(opts, DisallowUnknownFields)...) +// UnmarshalStrict is similar to Unmarshal (please read its documentation for reference), with the following exceptions: +// +// - Duplicate fields in an object yield an error. This is according to the YAML specification. +// - If obj, or any of its recursive children, is a struct, presence of fields in the serialized data unknown to the struct will yield an error. +func UnmarshalStrict(yamlBytes []byte, obj interface{}, opts ...JSONOpt) error { + return unmarshal(yamlBytes, obj, yaml.UnmarshalStrict, append(opts, DisallowUnknownFields)...) } -// yamlUnmarshal unmarshals the given YAML byte stream into the given interface, +// unmarshal unmarshals the given YAML byte stream into the given interface, // optionally performing the unmarshalling strictly -func yamlUnmarshal(y []byte, o interface{}, strict bool, opts ...JSONOpt) error { - vo := reflect.ValueOf(o) - unmarshalFn := yaml.Unmarshal - if strict { - unmarshalFn = yaml.UnmarshalStrict - } - j, err := yamlToJSON(y, &vo, unmarshalFn) +func unmarshal(yamlBytes []byte, obj interface{}, unmarshalFn func([]byte, interface{}) error, opts ...JSONOpt) error { + jsonTarget := reflect.ValueOf(obj) + + jsonBytes, err := yamlToJSONTarget(yamlBytes, &jsonTarget, unmarshalFn) if err != nil { - return fmt.Errorf("error converting YAML to JSON: %v", err) + return fmt.Errorf("error converting YAML to JSON: %w", err) } - err = jsonUnmarshal(bytes.NewReader(j), o, opts...) + err = jsonUnmarshal(bytes.NewReader(jsonBytes), obj, opts...) if err != nil { - return fmt.Errorf("error unmarshaling JSON: %v", err) + return fmt.Errorf("error unmarshaling JSON: %w", err) } return nil @@ -67,21 +86,26 @@ func yamlUnmarshal(y []byte, o interface{}, strict bool, opts ...JSONOpt) error // object, optionally applying decoder options prior to decoding. We are not // using json.Unmarshal directly as we want the chance to pass in non-default // options. -func jsonUnmarshal(r io.Reader, o interface{}, opts ...JSONOpt) error { - d := json.NewDecoder(r) +func jsonUnmarshal(reader io.Reader, obj interface{}, opts ...JSONOpt) error { + d := json.NewDecoder(reader) for _, opt := range opts { d = opt(d) } - if err := d.Decode(&o); err != nil { + if err := d.Decode(&obj); err != nil { return fmt.Errorf("while decoding JSON: %v", err) } return nil } -// JSONToYAML Converts JSON to YAML. +// JSONToYAML converts JSON to YAML. Notable implementation details: +// +// - Duplicate fields, are case-sensitively ignored in an undefined order. +// - The sequence indentation style is compact, which means that the "- " marker for a YAML sequence will be on the same indentation level as the sequence field name. +// - Unlike Unmarshal, all integers, up to 64 bits, are preserved during this round-trip. func JSONToYAML(j []byte) ([]byte, error) { // Convert the JSON to an object. var jsonObj interface{} + // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the // Go JSON library doesn't try to pick the right number type (int, float, // etc.) when unmarshalling to interface{}, it just picks float64 @@ -93,35 +117,46 @@ func JSONToYAML(j []byte) ([]byte, error) { } // Marshal this object into YAML. - return yaml.Marshal(jsonObj) + yamlBytes, err := yaml.Marshal(jsonObj) + if err != nil { + return nil, err + } + + return yamlBytes, nil } // YAMLToJSON converts YAML to JSON. Since JSON is a subset of YAML, // passing JSON through this method should be a no-op. // -// Things YAML can do that are not supported by JSON: -// * In YAML you can have binary and null keys in your maps. These are invalid -// in JSON. (int and float keys are converted to strings.) -// * Binary data in YAML with the !!binary tag is not supported. If you want to -// use binary data with this library, encode the data as base64 as usual but do -// not use the !!binary tag in your YAML. This will ensure the original base64 -// encoded data makes it all the way through to the JSON. +// Some things YAML can do that are not supported by JSON: +// - In YAML you can have binary and null keys in your maps. These are invalid +// in JSON, and therefore int, bool and float keys are converted to strings implicitly. +// - Binary data in YAML with the !!binary tag is not supported. If you want to +// use binary data with this library, encode the data as base64 as usual but do +// not use the !!binary tag in your YAML. This will ensure the original base64 +// encoded data makes it all the way through to the JSON. +// - And more... read the YAML specification for more details. +// +// Notable about the implementation: // -// For strict decoding of YAML, use YAMLToJSONStrict. +// - Duplicate fields are case-sensitively ignored in an undefined order. Note that the YAML specification forbids duplicate fields, so this logic is more permissive than it needs to. See YAMLToJSONStrict for an alternative. +// - As per the YAML 1.1 specification, which yaml.v2 used underneath implements, literal 'yes' and 'no' strings without quotation marks will be converted to true/false implicitly. +// - Unlike Unmarshal, all integers, up to 64 bits, are preserved during this round-trip. +// - There are no compatibility guarantees for returned error values. func YAMLToJSON(y []byte) ([]byte, error) { - return yamlToJSON(y, nil, yaml.Unmarshal) + return yamlToJSONTarget(y, nil, yaml.Unmarshal) } // YAMLToJSONStrict is like YAMLToJSON but enables strict YAML decoding, // returning an error on any duplicate field names. func YAMLToJSONStrict(y []byte) ([]byte, error) { - return yamlToJSON(y, nil, yaml.UnmarshalStrict) + return yamlToJSONTarget(y, nil, yaml.UnmarshalStrict) } -func yamlToJSON(y []byte, jsonTarget *reflect.Value, yamlUnmarshal func([]byte, interface{}) error) ([]byte, error) { +func yamlToJSONTarget(yamlBytes []byte, jsonTarget *reflect.Value, unmarshalFn func([]byte, interface{}) error) ([]byte, error) { // Convert the YAML to an object. var yamlObj interface{} - err := yamlUnmarshal(y, &yamlObj) + err := unmarshalFn(yamlBytes, &yamlObj) if err != nil { return nil, err } @@ -136,7 +171,11 @@ func yamlToJSON(y []byte, jsonTarget *reflect.Value, yamlUnmarshal func([]byte, } // Convert this object to JSON and return the data. - return json.Marshal(jsonObj) + jsonBytes, err := json.Marshal(jsonObj) + if err != nil { + return nil, err + } + return jsonBytes, nil } func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) { @@ -147,13 +186,13 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in // decoding into the value, we're just checking if the ultimate target is a // string. if jsonTarget != nil { - ju, tu, pv := indirect(*jsonTarget, false) + jsonUnmarshaler, textUnmarshaler, pointerValue := indirect(*jsonTarget, false) // We have a JSON or Text Umarshaler at this level, so we can't be trying // to decode into a string. - if ju != nil || tu != nil { + if jsonUnmarshaler != nil || textUnmarshaler != nil { jsonTarget = nil } else { - jsonTarget = &pv + jsonTarget = &pointerValue } } @@ -205,7 +244,7 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in keyString = "false" } default: - return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v", + return nil, fmt.Errorf("unsupported map key of type: %s, key: %+#v, value: %+#v", reflect.TypeOf(k), k, v) } diff --git a/vendor/sigs.k8s.io/yaml/yaml_go110.go b/vendor/sigs.k8s.io/yaml/yaml_go110.go index ab3e06a22..94abc1719 100644 --- a/vendor/sigs.k8s.io/yaml/yaml_go110.go +++ b/vendor/sigs.k8s.io/yaml/yaml_go110.go @@ -1,7 +1,24 @@ // This file contains changes that are only compatible with go 1.10 and onwards. +//go:build go1.10 // +build go1.10 +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package yaml import "encoding/json"